Difference between revisions of "Talk:RegisterForSingleUpdate - Form"

Jump to navigation Jump to search
no edit summary
imported>FR dZastrX
(Created page with "Using this function within several different states of the same script might be done very carefully : http://www.creationkit.com/Talk:State_Reference --~~~~")
 
Line 2: Line 2:
[[http://www.creationkit.com/Talk:State_Reference]]
[[http://www.creationkit.com/Talk:State_Reference]]
--[[User:FR dZastrX|FR dZastrX]] ([[User talk:FR dZastrX|talk]]) 2013-03-20T13:09:57 (EDT)
--[[User:FR dZastrX|FR dZastrX]] ([[User talk:FR dZastrX|talk]]) 2013-03-20T13:09:57 (EDT)
== Calling this function when the parent effect is no longer exist ==
Attempt to call this if an effect the script attached to is no longer exist or no longer active results in error, but it can be avoided.
<source lang="papyrus">
Event OnEffectStart(Actor akTarget, Actor akCaster)
RegisterForSingleUpdate(5)
EndEvent
; let's pretend that somewhere between RegisterForSingleUpdate() func call and OnUpdate() event the active magic effect has expired or stopped satisfying activity conditions
Event OnUpdate()
If (self as bool) ; this line checks if the active magic effect is still exist
RegisterForSingleUpdate(5)  ; attempt to call this without the check above will result in "unable to call" error in log, because the effect is no longer active
EndIf
EndEvent
</source>
This simple check '''reduces''' the chance of "unable to call RegisterForSingleUpdate()" error (it can still appear in fortunately rare cases). --[[User:Ingvion|Ingvion]] ([[User talk:Ingvion|talk]]) 12:07, 13 July 2023 (EDT)
71

edits

Navigation menu