Returns the class that the spellcaster cast the spell as.
Returns the class that the spellcaster (OBJECT_SELF in a called spell script) cast the spell as.
It will return CLASS_TYPE_INVALID for:
- Creature spells and special abilities
- Any ActionCastSpellXXX() with the bCheat parameter TRUE (which will always be the case for placeables), even if they have the spell already.
- Any "spell" script fired by a feat (Epic spells, barbarian rage ETC).
- Items cast from spells the first time they are used. See Known Bugs.
Very useful new function as there didn't use to be any reliable way of telling which class an object used to cast a spell.
It is only to be used in a spell script for spells which are castable by PC's, or at least, that is the only useful place. Also, by definition, the class level will be adequate to cast this spell.
The result of this function doesn't change (remain previous value of last spell cast) in case the spell is cast from an item. It is recommended to use GetSpellCastItem to check for this before assuming this works.
// As OBJECT_SELF is the caster, the caster will speak it.
// Get caster class
if(GetLastSpellCastClass() == CLASS_TYPE_CLERIC)
// Speak the string
SpeakString("I do this for " + GetDeity(OBJECT_SELF) + "!");
author: Lilac Soul, editor: Jasperre, additional contributor(s): arQon