Jump to content

how to get game days passed with activator


gerg357

Recommended Posts

The following is an activate then 3 days later something else happens without activating again. Bare minimum code.

 

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.

 

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 by IsharaMeradin
Link to comment
Share on other sites

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.

 

 

Scriptname SomeScript Extends ObjectReference

Event OnActivate(ObjectReference akActionRef)
  RegisterForSingleUpdateGameTime(3.0) 
EndEvent

Event OnUpdateGameTime()
  ;do whatever after at least 3 days have passed
EndEvent 

 

 

Link to comment
Share on other sites

  • 1 month later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...