EventSpellCastAt(object, int, int)
Creates an event which triggers a "spell cast at" reaction.
event EventSpellCastAt( object oCaster, int nSpell, int bHarmful = TRUE );
Parameters
oCaster
Caster of the spell.
nSpell
bHarmful
Determines if the spell is harmful to its target. (Default: TRUE)
Description
Returns an event which triggers the "SpellCastAt" script. nSpell is a constant of SPELL_* which specifies the type of spell that is cast.
In the OnSpellCastAt script, the parameter bHarmful is returned by GetLastSpellHarmful, oCaster is returned by GetLastSpellCaster, and nSpell is returned by GetLastSpell.
Remarks
This event must then be signaled using SignalEvent.
This doesn't actually cast the spell, it just makes the object that the event is signaled to behave as if it were.
If a spell script doesn't fire any event, then the AI will not even notice a spell was cast (and would only react to damage out of all the effects that could be applied).
Version
1.64
Example
// Makes us think that Magic Missile (a hostile spell) was cast // on ourselves, by ourselves. Not a very good example, but it is // one none the less. void main() { // Note: Ususally, this is all used on one line, because it is easier. SignalEvent(OBJECT_SELF, EventSpellCastAt(OBJECT_SELF, SPELL_MAGIC_MISSILE, TRUE)); }
See Also
categories: | Spell Casting Effects Functions | Spells Functions |
constants: | SPELL_* Constants |
events:  | OnSpellCastAt Event |
author: Charles Feduke, editors: Jasperre, Mistress, additional contributors: Jasperre, Lilac Soul, Christopher