EventSpellCastAt

From NWN Lexicon

Contents

[edit] EventSpellCastAt(object, int, int)

Creates an event which triggers a "spell cast at" reaction.

event EventSpellCastAt(
    object oCaster,
    int nSpell,
    int bHarmful = TRUE
);

[edit] Parameters

oCaster

Caster of the spell.

nSpell

SPELL_*

bHarmful

Determines if the spell is harmful to its target. (Default: TRUE)


[edit] Description

Returns an event which triggers the "SpellCastAt" script. nSpell is a constant of OnSpellCastAt script, the parameter bHarmful is returned by GetLastSpell .



[edit] 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).


[edit] Version

1.64

[edit] 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));
}

[edit] See Also

constants: 

SPELL_* Constants

events: 

OnSpellCastAt Event



 author: Charles Feduke, editors: Jasperre, Mistress, additional contributors: Jasperre, Lilac Soul, Christopher
 

Personal tools
Categories