gerg357 Posted August 20, 2016 Posted August 20, 2016 lets say i click activator to start it then i want it to do something else if 3 days has passed since it was activated/clicked
IsharaMeradin Posted August 21, 2016 Posted August 21, 2016 (edited) The following is an activate then 3 days later something else happens without activating again. Bare minimum code. Reveal hidden contents Scriptname SomeScript Extends ObjectReference Event OnActivate(ObjectReference akActionRef) Float TimeToAct = Utility.GetCurrentGameTime() + 3.0 RegisterForSingleUpdate(TimeToAct) EndEvent Event OnUpdate() ;do whatever after at least 3 days have passed EndEvent The next one changes behavior when the activator is clicked again at least 3 days later. Reveal hidden contents Scriptname SomeScript Extends ObjectReference Bool BeenClicked = false Float TimeToAct Event OnActivate(ObjectReference akActionRef) If BeenClicked == false BeenClicked = true TimeToAct = Utility.GetCurrentGameTime() + 3.0 Else If Utility.GetCurrentGameTime() < TimeToAct ;do action when less than 3 days Else BeenClicked = false ;do action when 3 days or greater EndIf EndIf EndEvent EDIT: There are other ways to do this as well. Those are just the easiest ones for me to write up. Edited August 21, 2016 by IsharaMeradin
Ghaunadaur Posted August 22, 2016 Posted August 22, 2016 If it's 3 days, I'd recommend to use RegisterForSingleUpdateGameTime and OnUpdateGameTime instead of RegisterForSingleUpdate.
IsharaMeradin Posted August 22, 2016 Posted August 22, 2016 I knew there were game time versions, just slipped my mind. Those would be better to use. Would shorten the first code option posted earlier. Reveal hidden contents Scriptname SomeScript Extends ObjectReference Event OnActivate(ObjectReference akActionRef) RegisterForSingleUpdateGameTime(3.0) EndEvent Event OnUpdateGameTime() ;do whatever after at least 3 days have passed EndEvent
lofgren Posted August 22, 2016 Posted August 22, 2016 I think gametime updates are on the scale of hours, so 3 game days would beRegisterForSingleUpdateGameTime(72.0)
Recommended Posts