Difference between revisions of "RegisterForUpdateGameTime - Form"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Fg109
imported>IsharaMeradin
m (→‎Notes: Added a note about not being able to register for game time updates until player recieves full controls)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Scripting]]
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Papyrus]]
[[Category:Non-delayed Native Function]]
'''Member of:''' [[ActiveMagicEffect Script]], [[Alias Script]], and [[Form Script]]
'''Member of:''' [[ActiveMagicEffect Script]], [[Alias Script]], and [[Form Script]]


Line 19: Line 20:
<source lang="papyrus">
<source lang="papyrus">
; Register to be notified every in-game day
; Register to be notified every in-game day
RegisterForUpdateGameTime(24)
RegisterForUpdateGameTime(24.0)
</source>
</source>


== Notes ==
== Notes ==
*Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.
*Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.
*Registering for game time updates is only possible after the player has received full player controls. For the default game the earliest a game time update can be registered is when the player gets their hands freed just inside Helgen Keep (MQ101 stage 240).
* See the notes for [[OnUpdateGameTime - Form|OnUpdateGameTime]] for details on how often the event will be sent as sleeping, fast traveling, and serving jail time will affect it - as well as any additional notes.
* See the notes for [[OnUpdateGameTime - Form|OnUpdateGameTime]] for details on how often the event will be sent as sleeping, fast traveling, and serving jail time will affect it - as well as any additional notes.
* If you find yourself doing this:
* If you find yourself doing this:
Line 33: Line 35:
</source>
</source>
Then you should use [[RegisterForSingleUpdateGameTime - Form|RegisterForSingleUpdateGameTime]] instead
Then you should use [[RegisterForSingleUpdateGameTime - Form|RegisterForSingleUpdateGameTime]] instead
*Using this function could cause your game to freeze under any of the following conditions:
**afInterval is less than some number between 0.0244 and 0.0238. (1.0 / 41.0 and 1.0 / 42.0)
**afInterval is expressed as X / Y where X and Y are both integers (no decimal points) and evaluate to less than 1.


== See Also ==
== See Also ==

Latest revision as of 12:22, 24 November 2012

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

Registers this active magic effect/alias/form for periodic update events in game time. Only the specific form, alias, or magic effect that registered will get the event - it will not be relayed to attached aliases or magic effects.

Syntax[edit | edit source]

Function RegisterForUpdateGameTime(float afInterval) native

Parameters[edit | edit source]

  • afInterval: How often, in game hours, the update event should be sent

Return Value[edit | edit source]

None

Examples[edit | edit source]

; Register to be notified every in-game day
RegisterForUpdateGameTime(24.0)

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.
  • Registering for game time updates is only possible after the player has received full player controls. For the default game the earliest a game time update can be registered is when the player gets their hands freed just inside Helgen Keep (MQ101 stage 240).
  • See the notes for OnUpdateGameTime for details on how often the event will be sent as sleeping, fast traveling, and serving jail time will affect it - as well as any additional notes.
  • If you find yourself doing this:
Event OnUpdateGameTime()
    UnregisterForUpdateGameTime()
    ; Do some stuff
endEvent

Then you should use RegisterForSingleUpdateGameTime instead

  • Using this function could cause your game to freeze under any of the following conditions:
    • afInterval is less than some number between 0.0244 and 0.0238. (1.0 / 41.0 and 1.0 / 42.0)
    • afInterval is expressed as X / Y where X and Y are both integers (no decimal points) and evaluate to less than 1.

See Also[edit | edit source]