magicEffectActivated⚓︎
This event triggers when an individual magic effect becomes active on its target.
For a magic source with multiple effects, this event triggers once for each effect as that effect becomes active on a target. If a source effect later affects another reference, or is restored as a reference is loaded, this event can trigger again for that reference.
--- @param e magicEffectActivatedEventData
local function magicEffectActivatedCallback(e)
end
event.register(tes3.event.magicEffectActivated, magicEffectActivatedCallback)
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 active.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 active.
Examples⚓︎
Example: Show Activated Effect
Show the magic effect and source names when an effect becomes active on the player.
local function onMagicEffectActivated(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 active.", effectName, sourceName)
end
event.register(tes3.event.magicEffectActivated, onMagicEffectActivated)
Related events⚓︎
magicEffectAddedmagicEffectDeactivatedmagicEffectRemovedspellTick