magicEffectRemoved⚓︎
This event triggers when a magic source removes an active instance for one of its effects.
For a magic source with multiple effects, this event triggers once for each effect instance that is removed. If the same source effect is active on multiple references, magicEffectAdded, magicEffectActivated, magicEffectDeactivated, and magicEffectRemoved can each trigger once for each affected reference.
--- @param e magicEffectRemovedEventData
local function magicEffectRemovedCallback(e)
end
event.register(tes3.event.magicEffectRemoved, magicEffectRemovedCallback)
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 caused the source effect to be removed.mobile(tes3mobileActor): Read-only. The mobile actor the magic effect is removed from. Usetarget.mobileinstead.reference(tes3reference): Read-only. The reference of the mobile actor the magic effect is removed from. Usetargetinstead.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 caused the source effect to be removed.
Examples⚓︎
Example: Show Removed Effect
Show the magic effect and source names when an effect instance is removed on the player.
local function onMagicEffectRemoved(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' was removed.", effectName, sourceName)
end
event.register(tes3.event.magicEffectRemoved, onMagicEffectRemoved)
Related events⚓︎
magicEffectActivatedmagicEffectAddedmagicEffectDeactivatedspellTick