Difference between revisions of "OnEffectFinish - ActiveMagicEffect"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Egocarib
m (Restored note (I think it's good to keep both the old and the new note on the page -- the original one is probably much less confusing for newer modders.))
imported>DavidJCobb
(→‎Notes: merged and clarified two of the notes; added another one based on testing.)
Line 23: Line 23:


== Notes ==
== Notes ==
*By the time this event is called, the active magic effect may have already been deleted by the game. Any native calls to this active magic effect may fail.
* By the time this event is called, the underlying active magic effect may have already been deleted by the game. Attempts to call native functions may fail and throw errors.
*None of the ActiveMagicEffect script native function may run in this event even though the internal ActiveEffect object is not deleted if the effect is simply disabled, not dispelled. The papyrus script object itself is detached after oneffectfinish completes, resetting all properties and script object variables.
** Even if the effect is simply disabled (due to spell-side conditions not being met) rather than disabled, calls to native functions may fail, because the Papyrus script object itself is detached after OnEffectFinish completes, resetting all properties and script object variables.
*This event is also called when the owning spell is removed from the target or when its conditions become invalid.
* This event is also called when the owning spell is removed from the target or when its conditions become invalid.
* If a magic effect is applied to a [[LeveledCharacter]] and the actor respawns (e.g. because their parent cell has been reset) before the effect runs out, then OnEffectFinish will not run. The effect will simply cease to exist.


== See Also ==
== See Also ==
*[[ActiveMagicEffect Script]]
*[[ActiveMagicEffect Script]]
*[[OnEffectStart - ActiveMagicEffect]]
*[[OnEffectStart - ActiveMagicEffect]]

Revision as of 18:14, 12 November 2018

Member of: ActiveMagicEffect Script

Event called when the active magic effect has just finished on the specified target.

Syntax

Event OnEffectFinish(Actor akTarget, Actor akCaster)

Parameters

  • akTarget: The Actor this effect just finished on.
  • akCaster: The Actor that cast the spell this effect is from.

Examples

Event OnEffectFinish(Actor akTarget, Actor akCaster)
  Debug.Trace("Magic effect fades from " + akTarget)
endEvent

Notes

  • By the time this event is called, the underlying active magic effect may have already been deleted by the game. Attempts to call native functions may fail and throw errors.
    • Even if the effect is simply disabled (due to spell-side conditions not being met) rather than disabled, calls to native functions may fail, because the Papyrus script object itself is detached after OnEffectFinish completes, resetting all properties and script object variables.
  • This event is also called when the owning spell is removed from the target or when its conditions become invalid.
  • If a magic effect is applied to a LeveledCharacter and the actor respawns (e.g. because their parent cell has been reset) before the effect runs out, then OnEffectFinish will not run. The effect will simply cease to exist.

See Also