renogaz Posted September 26, 2012 Share Posted September 26, 2012 So basically my script its the next one Scriptname xxxxx extends ObjectReference {script xxxxxx} float daysfloat days1int count Event OnActivate(ObjectReference akActionRef)count = count+1if count ==1Debug.MessageBox("You found a xxxxxx")elseDebug.MessageBox("You pick up xxxxx")endifdays = Utility.GetCurrentGameTime()Debug.MessageBox("xxxxx" + days)RegisterForSingleUpdate(5) endEvent Event OnUpdate()days1 = Utility.GetCurrentGameTime()if days1 >= days + 3.000000Debug.MessageBox("xxxxx")UnregisterForUpdate()elseRegisterForSingleUpdate(5)endif endEvent What i want to do is when i pickup the x object, the days1 variable keeps running and the days variable stay static on the gametime when i picked it up, and after 3 ingame days display a message,my problem is that when i get to 3 or more days after pickup i keep recieving the message, is there a way to make it so after days1 >= days + 3.000000 the Event OnUpdate stops? Link to comment Share on other sites More sharing options...
steve40 Posted September 27, 2012 Share Posted September 27, 2012 (edited) Scriptname xxxxx extends ObjectReference {script xxxxxx} int count bool bActivated = False Event OnActivate(ObjectReference akActionRef) count += 1 if count == 1 Debug.MessageBox("You found a xxxxxx") else Debug.MessageBox("You pick up xxxxx") If !bActivated RegisterForSingleUpdateGameTimeUpdate(72) ; update in 72 hours (3 days) bActivated = True EndIf endif endEvent Event OnUpdateGameTime() Debug.MessageBox("xxxxx") bActivated = False endEvent Edited September 27, 2012 by steve40 Link to comment Share on other sites More sharing options...
renogaz Posted September 27, 2012 Author Share Posted September 27, 2012 Scriptname xxxxx extends ObjectReference {script xxxxxx} int count bool bActivated = False Event OnActivate(ObjectReference akActionRef) count += 1 if count == 1 Debug.MessageBox("You found a xxxxxx") else Debug.MessageBox("You pick up xxxxx") If !bActivated RegisterForSingleUpdateGameTimeUpdate(72) ; update in 72 hours (3 days) bActivated = True EndIf endif endEvent Event OnUpdateGameTime() Debug.MessageBox("xxxxx") bActivated = False endEvent i tried the script but it wont work, nothing shows up after 72 hrs, also the object is a MISC pickable object, not an activator or something like that, that has someething to do with that? Link to comment Share on other sites More sharing options...
steve40 Posted September 27, 2012 Share Posted September 27, 2012 Ug, I could swear I fixed that typo earlier... it should be: RegisterForSingleUpdateGameTime(72) not RegisterForSingleUpdateGameTimeUpdate(72) oops :facepalm: Link to comment Share on other sites More sharing options...
renogaz Posted September 27, 2012 Author Share Posted September 27, 2012 Ug, I could swear I fixed that typo earlier... it should be: RegisterForSingleUpdateGameTime(72) not RegisterForSingleUpdateGameTimeUpdate(72) oops :facepalm: yeah i noticed that and changed that, but still wont work for some reason, the var active its set to true when i showvars but wont show any box :( Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 27, 2012 Share Posted September 27, 2012 You need to register for updates inside of a function... taking steve40's example and adjusting it Scriptname xxxxx extends ObjectReference {script xxxxxx} int count bool bActivated = False Event OnActivate(ObjectReference akActionRef) count += 1 if count == 1 Debug.MessageBox("You found a xxxxxx") else Debug.MessageBox("You pick up xxxxx") If !bActivated DoMyUpdate() EndIf endif endEvent Function DoMyUpdate() RegisterForSingleUpdateGameTime(72) ; update in 72 hours (3 days) bActivated = True EndFunction Event OnUpdateGameTime() Debug.MessageBox("xxxxx") bActivated = False endEvent Link to comment Share on other sites More sharing options...
renogaz Posted September 27, 2012 Author Share Posted September 27, 2012 You need to register for updates inside of a function... taking steve40's example and adjusting it Scriptname xxxxx extends ObjectReference {script xxxxxx} int count bool bActivated = False Event OnActivate(ObjectReference akActionRef) count += 1 if count == 1 Debug.MessageBox("You found a xxxxxx") else Debug.MessageBox("You pick up xxxxx") If !bActivated DoMyUpdate() EndIf endif endEvent Function DoMyUpdate() RegisterForSingleUpdateGameTime(72) ; update in 72 hours (3 days) bActivated = True EndFunction Event OnUpdateGameTime() Debug.MessageBox("xxxxx") bActivated = False endEvent Thanks for reply, but its not working yet :/, what im doing its a pickable object, and i want to show the box after beign 3 days in my pocket, but it wont work yet, i dont know why, when i drrop the object and use "showvars" it tells me that bActivated its true, but after 3 days i dont get any message :/ Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 27, 2012 Share Posted September 27, 2012 Have you tried testing with a save that hasn't seen the object or script in question? Sometimes saves don't like to do new things with old objects Link to comment Share on other sites More sharing options...
renogaz Posted September 27, 2012 Author Share Posted September 27, 2012 Have you tried testing with a save that hasn't seen the object or script in question? Sometimes saves don't like to do new things with old objects Yes it dosnt want to work either, same as before, bActive its true but i dont get any message :/ Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 28, 2012 Share Posted September 28, 2012 without actually trying for myself, perhaps you need to use a global variable rather than a local variable in conjunction with updates? Link to comment Share on other sites More sharing options...
Recommended Posts