OnSpellCast - ObjectReference

From the CreationKit Wiki
Revision as of 15:01, 15 January 2020 by imported>Pickysaurus (→‎Notes: Papyrus casts aren't detected.)
Jump to navigation Jump to search

Member of: ObjectReference Script

Event called when a spell is cast by this object reference.

Syntax

Event OnSpellCast(Form akSpell)

Parameters

Examples

Event OnSpellCast(Form akSpell)
  Spell spellCast = akSpell as Spell
  if spellCast && spellCast == FireballSpell
    Debug.Trace("We just cast a fireball!")
  else
    Debug.Trace("We cast something, but we don't know what it is")
  endIf
endEvent

Notes

  • For concentration spells, this event only fires once, at the moment the reference begins casting.
  • This function does not appear to detect spells cast via Papyrus (e.g. TemplateBlessingScript casts its spell on the player from the player, but the event is not caught).

See Also