GetLastSpell

From NWN Lexicon
Revision as of 21:39, 21 June 2020 by Jasperre (talk | contribs) (→‎See Also)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search



GetLastSpell()

Determines the spell that was last cast.

Description

This is for use in a OnSpellCastAt script, it gets the ID (SPELL_*) of the spell that was cast.

It will not return the true spell value, but whatever value is put into the EventSpellCastAt() - therefore, sub-dial spells like Polymorph will merely return SPELL_POLYMORPH not the sub spell number.



Remarks

You should not use this function in actual spell scripts. In spell scripts, use GetSpellId instead.


Version

1.61

Example

// If the last spell was SPELL_VIRTUE say something
void main()
{
    if(GetLastSpell() == SPELL_VIRTUE)
    {
        SpeakString("I feel so alive! I feel...virtuous!");
    }
}

See Also

functions: 

GetLastSpellHarmful GetLastSpellCaster

constants: 

SPELL_* Constants

events: 

OnSpellCastAt Event



 author: Jody Fletcher, editor: Jasperre