magicEffectDeactivated⚓︎
This event triggers when an individual magic effect becomes inactive on its target.
For a magic source with multiple effects, this event triggers once for each effect as that effect becomes inactive on a target. If a source effect affected multiple references, this event can trigger for each reference before magicEffectRemoved triggers for the source effect.
--- @param e magicEffectDeactivatedEventData
local function magicEffectDeactivatedCallback(e)
end
event.register(tes3.event.magicEffectDeactivated, magicEffectDeactivatedCallback)
Tip
This event can be filtered based on the effectId event data.
Tip
An event can be claimed by setting e.claim to true, or by returning false from the callback. Claiming the event prevents any lower priority callbacks from being called.
Event Data⚓︎
caster(tes3reference): Read-only. The caster of the magic source. Can benil.effect(tes3effect): Read-only. The specific effect that triggered the event. This is equal toe.source.effects[e.effectIndex]. Can benil.effectId(tes3.effect, integer): Read-only. The magic effect ID ate.source.effects[e.effectIndex]. Maps to values intes3.effectnamespace.effectIndex(integer): Read-only. The index of the effect in the magic source's effects list.effectInstance(tes3magicEffectInstance): Read-only. The unique instance of the magic effect that became inactive.source(tes3alchemy, tes3enchantment, tes3spell): Read-only. The magic source that contains the effect.sourceInstance(tes3magicSourceInstance): Read-only. The unique instance of the magic source that contains the effect.state(tes3.spellState): Read-only. The state of the magic effect instance when the event fired.target(tes3reference): Read-only. The target of the magic effect instance that became inactive.
Examples⚓︎
Example: Show Deactivated Effect
Show the magic effect and source names when an effect becomes inactive on the player.
local function onMagicEffectDeactivated(e)
if e.target ~= tes3.player then return end
local effectName = tes3.getMagicEffect(e.effect.id).name
local sourceName = e.source.name
tes3.messageBox("Effect '%s' from '%s' became inactive.", effectName, sourceName)
end
event.register(tes3.event.magicEffectDeactivated, onMagicEffectDeactivated)
Related events⚓︎
magicEffectActivatedmagicEffectAddedmagicEffectRemovedspellTick