blackandwhite14593 Posted July 7, 2016 Posted July 7, 2016 Hi! I wonder how utility wait command actually works. If I use it inside a function, to wait for say a long period of time, will it just a pause the end of that function and go on running other commands, or will it stop all the script run altogether for that time? I want to make a cooldown function, and using registerforsingleupdate() doesn't really work for me. Thank you for your help!
darkconsole Posted July 7, 2016 Posted July 7, 2016 it pauses that thread at that exact spot until the time expires. other scripts in other threads will continue as normal.
blackandwhite14593 Posted July 7, 2016 Author Posted July 7, 2016 it pauses that thread at that exact spot until the time expires. other scripts in other threads will continue as normal. Got it! Thank you! So say if have utility.wait implemented inside a function and i put in a very long time, say an hour. Would a frequent periodical call for this function, cause overload on papyrus? I also wonder if you know if onupdate event is configured to essentially just call utility wait command inside it?
darkconsole Posted July 7, 2016 Posted July 7, 2016 yes. you will throw excess threads into excess wait offsets until the thread count gets too high and the papyrus vm tells you to gtfo.
blackandwhite14593 Posted July 7, 2016 Author Posted July 7, 2016 yes. you will throw excess threads into excess wait offsets until the thread count gets too high and the papyrus vm tells you to gtfo. Hahah, got it! Thanks!
darkconsole Posted July 7, 2016 Posted July 7, 2016 the timer method would be the proper way to do it to avoid stacking entire threads. if its not working then you probably just need to rethink how you are doing or getting caught by something you don't know yet. like if its a spell magic effect on an npc you're going to have a bad time no matter which way you do it after crossing a load door.
blackandwhite14593 Posted July 7, 2016 Author Posted July 7, 2016 the timer method would be the proper way to do it to avoid stacking entire threads. if its not working then you probably just need to rethink how you are doing or getting caught by something you don't know yet. like if its a spell magic effect on an npc you're going to have a bad time no matter which way you do it after crossing a load door. I understand, thanks! Didn't know about the timer, very useful. Unfortunately can't use it either in my case. I need something that I could pass an object to. Like if there was a timer with an additional variable to pass an object to, an actor in my case. I wonder if it's possible to create custom timers to take more variables.
darkconsole Posted July 7, 2016 Posted July 7, 2016 in the very least you could try to lock a potentially smaller dedicated thread. knowing nothing about what you are doing or how you are doing it... ScriptName SomeGlobalScript extends Quest Function InOneHourDoWhatevs(Form Something) self.RegisterForModEvent("MyTriggerEvent","MyTriggerHandler") Int EventID = ModEvent.Create("MyTriggerEvent") ModEvent.PushForm(EventID,Something) ModEvent.Send(EventID) Return EndFunction Function MyTriggerHandler(Form Something) Utility.Wait(3600) ;; whatevs. If(Something as Actor != None) (Something as Actor).Kill() EndIf Return EndFunction elsewhere ScriptName SomeEffectScript extends ActiveMagicEffect SomeGlobalScript Property Main Auto Event OnEffectStart(Actor Target, Actor Caster) Main.InOneHourDoWhatevs(Target as Form) Return EndEvent
blackandwhite14593 Posted July 7, 2016 Author Posted July 7, 2016 in the very least you could try to lock a potentially smaller dedicated thread. knowing nothing about what you are doing or how you are doing it... ScriptName SomeGlobalScript extends Quest Function InOneHourDoWhatevs(Form Something) self.RegisterForModEvent("MyTriggerEvent","MyTriggerHandler") Int EventID = ModEvent.Create("MyTriggerEvent") ModEvent.PushForm(EventID,Something) ModEvent.Send(EventID) Return EndFunction Function MyTriggerHandler(Form Something) Utility.Wait(3600) ;; whatevs. If(Something as Actor != None) (Something as Actor).Kill() EndIf Return EndFunction elsewhere ScriptName SomeEffectScript extends ActiveMagicEffect SomeGlobalScript Property Main Auto Event OnEffectStart(Actor Target, Actor Caster) Main.InOneHourDoWhatevs(Target as Form) Return EndEvent Thank you, mate! Really useful stuff. I think I'll try to implement a workaround with timer, if it doesn't work I'll give this a try. Really appreciate your help! Edit: I wonder how setting many timers would effect the papyrus. Edit 2: just tried to compile my script, it complains it can't find startTimer function for some reason... Edit 3: wait a second...are timers only available for fallout 4 and it's creation kit? well i'm coding for skyrim
darkconsole Posted July 8, 2016 Posted July 8, 2016 timers in skyrim are the RegisterForUpdate things. timers in fallout 4 are completely different.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.