OnUpdateGameTime - Form

From the CreationKit Wiki
Jump to navigation Jump to search

Member of: ActiveMagicEffect Script, Alias Script, and Form Script

Event called periodically in game time if the active magic effect/alias/form is registered for update events. This event will not be sent if the game is in menu mode.

Syntax[edit | edit source]

Event OnUpdateGameTime()

Parameters[edit | edit source]

None

Example[edit | edit source]

Function SomeFunction()                       
  RegisterForUpdateGameTime(0.5) ; Before we can use onUpdateGameTime() we must register.
endFunction

Event OnUpdateGameTime() ; because of how we registered, this event occurs every 30 minutes of game time		
  if myQuest.getStage() == 10
    UnregisterForUpdateGameTime() ; when we're done with it, make sure to unregister
    Debug.Trace("Got what we needed, so stop polling!")
  endIf
endEvent

Notes[edit | edit source]

  • Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.
  • This event is not relayed to any aliases or magic effects attached to the form.
  • This event is relayed to other scripts attached to the same object. eg. On a quest form with 2 main quest scripts and a fragment script, an update event registered by one will be received by all three.
  • OnUpdateGameTime may come in much later then you expect if the player is sleeping, waiting, fast traveling, or serving jail time. The event will only be sent once, after the sleep/wait/travel/serve period is over, so you should be prepared to handle hours passing between updates.

See Also[edit | edit source]