Talk:RegisterForSingleUpdate - Form

Revision as of 11:07, 13 July 2023 by Ingvion (talk | contribs)

Using this function within several different states of the same script might be done very carefully : [[1]] --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.

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

This simple check reduces the chance of "unable to call RegisterForSingleUpdate()" error (it can still appear in fortunately rare cases). --Ingvion (talk) 12:07, 13 July 2023 (EDT)

Return to "RegisterForSingleUpdate - Form" page.