Difference between revisions of "OnSpellCast - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Egocarib
(Undo revision 23219 by TwilightSky (talk))
Tag: Undo
 
(5 intermediate revisions by 4 users not shown)
Line 4: Line 4:
'''Member of:''' [[ObjectReference Script]]
'''Member of:''' [[ObjectReference Script]]


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


== Syntax ==
== Syntax ==
Line 28: Line 28:
== Notes ==
== Notes ==
*For concentration spells, this event only fires once, at the moment the reference begins casting.
*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. TempleBlessingScript casts its spell on the player from the player, but the event is not caught).
* This Event can also be used to detect shouts cast by the player, but unlike spells, akSpell must be assigned to a shout.


== See Also ==
== See Also ==
*[[ObjectReference Script]]
*[[ObjectReference Script]]

Latest revision as of 11:33, 13 July 2023

Member of: ObjectReference Script

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

Syntax[edit | edit source]

Event OnSpellCast(Form akSpell)

Parameters[edit | edit source]

Examples[edit | edit source]

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[edit | edit source]

  • 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. TempleBlessingScript casts its spell on the player from the player, but the event is not caught).
  • This Event can also be used to detect shouts cast by the player, but unlike spells, akSpell must be assigned to a shout.

See Also[edit | edit source]