dredd3110 Posted March 19, 2016 Share Posted March 19, 2016 Hi, I'm searching a way to enable the activation of an item based on how much time have past since the last activation.this is for a food resource (bee hive) that I just want to be able to harvest once a day. from what I've seen, there is a lot of options, whose functions like: OnUpdateGameTime, RegisterForSingleUpdateGameTime I'm not sure to set it up safely, I've create my script and I just need to know how you attach it to an OnActivate event that start a timer and lock harvesting again until 24hours has passed. Thanks in advance.Here's the script I would use. Just attach it to your hive then fill the RewardList property with LItemIngredientHoneycomb and the TimeoutHours property with 24.0. By default if the player clicks again in that same day nothing will happen, but you can create a custom message to show (or even let the default container activation happen). ScriptName RewardWithTimeoutScript extends ObjectReference {Activating this object gives a reward only once per time period.} LeveledItem Property RewardList Auto {Required: A list of one or more items the player receives when activating this object.} float Property TimeoutHours Auto {Required: The amount of time, in game hours, before the player can get the reward again.} Message Property TimeoutMsg Auto {Optional: Message shown if player activates this object again during the timeout period.} bool Property AllowNormalActivationDuringTimeout Auto {Optional: Allow normal activation for furniture, containers, etc. during the timeout period.} Event OnInit() BlockActivation() EndEvent Event OnActivate(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() ; do not allow other characters to get the reward! GoToState("TimeoutActive") if TimeoutHours > 0 RegisterForSingleUpdateGameTime(TimeoutHours) endif if RewardList akActionRef.AddItem(RewardList) endif endif EndEvent Event OnUpdateGameTime() GoToState("") EndEvent State TimeoutActive Event OnActivate(ObjectReference akActionRef) if TimeoutMsg TimeoutMsg.Show() endif if AllowNormalActivationDuringTimeout Activate(akActionRef, true) endif EndEvent EndState Thank you cdcooley for the reply :thumbsup:Now I'm gonna learn a bit on what you've wrote and how it works. That's really nice thanks! Link to comment Share on other sites More sharing options...
Darkxenoth Posted March 20, 2016 Share Posted March 20, 2016 How would one go about making it so when you get a skill up it alters your magicka, health, or stamina values? Like, how would you make it so increasing your smithing would also increase your health and/or stamina? Was thinking about changing the way you gain attribute points to encourage leveling of specific skills for different play-styles. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 20, 2016 Share Posted March 20, 2016 How would one go about making it so when you get a skill up it alters your magicka, health, or stamina values? Like, how would you make it so increasing your smithing would also increase your health and/or stamina? Was thinking about changing the way you gain attribute points to encourage leveling of specific skills for different play-styles.Is that something that can be done with Community Uncapper? Sounds like it but I'm not sure... Link to comment Share on other sites More sharing options...
BrogetaSon Posted March 20, 2016 Share Posted March 20, 2016 I want to set a pet assigned to one of my followers. If I open CK, create a pet and then set a relationship to Parent:(Pet) and Child:(follower), will this work? Link to comment Share on other sites More sharing options...
nitramka Posted March 20, 2016 Share Posted March 20, 2016 When I crate a mod which changes the loot table, and modify it or remove it even from active plugins.It shouldn´t be affecting savegames ? Link to comment Share on other sites More sharing options...
dredd3110 Posted March 20, 2016 Share Posted March 20, 2016 (edited) Hello again, So I've finished and tested my script concerning a daily harvestable beehive, it work as intended, but due to the use of OnUpdateGameTime stuff, I would be grateful if someone can confirm that it's ok and should not break with time. Thanks in advance. Scriptname aaf_BeeHiveActiTimerScript extends ObjectReference Potion Property FoodHoney AutoIngredient Property BeeHiveHusk AutoIngredient Property BeeHoneyComb AutoActor Property PlayerREF AutoSound Property aaf_BeeHiveSound01 AutoSound Property aaf_BeeHiveSound02 AutoSound Property aaf_BeeHiveSound03 Autofloat Property TimeoutHours Auto int Counter Event OnUpdateGameTime()Counter = 0endEvent Event OnActivate(ObjectReference akActionRef) If akActionRef == PlayerREF EndIf Counter = Counter + 1if Counter == 1 debug.Notification("Récolte de rayon(s) de miel:") aaf_BeeHiveSound01.PlayAndWait(self) Utility.Wait(0.5) int random = Utility.RandomInt(1,2) PlayerRef.addItem(BeeHoneyComb, Random , false) self.RegisterForSingleUpdateGameTime(TimeoutHours) elseif Counter == 2 debug.Notification("Récolte de miel:") aaf_BeeHiveSound02.PlayAndWait(self) Utility.Wait(0.5) int random = Utility.RandomInt(1,2) PlayerRef.addItem(FoodHoney, Random , false) elseif Counter == 3 debug.Notification("Nettoyage de la ruche:") aaf_BeeHiveSound03.PlayAndWait(self) Utility.Wait(0.5) int random = Utility.RandomInt(1,2) PlayerRef.addItem(BeeHiveHusk, Random , false) elseif Counter > 3 debug.Notification("Il est encore trop tôt.") endif endEvent Edited March 20, 2016 by dredd3110 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 20, 2016 Share Posted March 20, 2016 @dredd3110If the intent is to allow the player to get 1-2 honey comb on the first activation then 1-2 honey on the second and 1-2 husks on the third with nothing to be obtained again until the counter resets when the time runs out... then it looks good. Link to comment Share on other sites More sharing options...
dredd3110 Posted March 20, 2016 Share Posted March 20, 2016 @dredd3110If the intent is to allow the player to get 1-2 honey comb on the first activation then 1-2 honey on the second and 1-2 husks on the third with nothing to be obtained again until the counter resets when the time runs out... then it looks good.that's a good thing! It's not always nice to simply ask for an answer, when it may be easy to find it, but I'm starting to use scripts so, good advices are really appreciated when they come from experienced persons! Thanks for your reply and for your support IsharaMeradin :thumbsup: Link to comment Share on other sites More sharing options...
ScarletPox Posted March 20, 2016 Share Posted March 20, 2016 I have a question. I created a custom interior cell and gave it a custom ambient sound. I converted the file properly, named it correctly, created a sound descriptor, set it to loop blah blah blah... When I first enter a cell in my custom interior the sound plays fine, loops fine, and doesn't go wrong. When I reload a save made in that cell however, the sound doesn't play. If I leave that cell and enter another, then re-enter that cell, then the sound starts playing again. Why is this happening, and how can I fix it? I asked before but didn't get a decent answer. Link to comment Share on other sites More sharing options...
Darkxenoth Posted March 20, 2016 Share Posted March 20, 2016 (edited) How would one go about making it so when you get a skill up it alters your magicka, health, or stamina values? Like, how would you make it so increasing your smithing would also increase your health and/or stamina? Was thinking about changing the way you gain attribute points to encourage leveling of specific skills for different play-styles. Is that something that can be done with Community Uncapper? Sounds like it but I'm not sure... From what I understand from messing with, and reading the mod page description for, the Uncapper - I should be able to use the Uncapper to change the attribute (magicka/health/stamina) increase you get on level to be zero instead of the default ten. However, I don't see anything in the Uncapper that would allow me to make leveling a skill increase an attribute. That's the thing I'm wondering how to do...Was thinking I would probably need a script that runs each time you get a skill gain, checking which skill went up to determine what attribute to increase. Not sure how exactly I would do that though. Edit: So, I was looking into how I might keep track of when the player increases a skill and how to get a script to fire each time that happens. From what I've found, it seems like I could probably accomplish this using the Story Manager to run a quest each time a skill increases, and have my script attached to that quest.This brings more questions to mind though... Would I need to make multiple quests, each corresponding to a different skill? Or could I have the one quest run each time a skill gain happens, and just run a check to see which skill it was that went up? Is there an easy way to check which skill went up? Edited March 20, 2016 by Darkxenoth Link to comment Share on other sites More sharing options...
Recommended Posts