Something more like this might work better for you then:
//Place in the OnSpellCastAt event of an NPC.
void main()
{
object oHealer = GetLastSpellCaster();
int iSpell = GetLastSpell();
if (iSpell == SPELL_HEAL ||
iSpell == SPELL_CURE_CRITICAL_WOUNDS ||
iSpell == SPELL_CURE_LIGHT_WOUNDS ||
iSpell == SPELL_CURE_MINOR_WOUNDS ||
iSpell == SPELL_CURE_MODERATE_WOUNDS ||
iSpell == SPELL_CURE_SERIOUS_WOUNDS ||
iSpell == SPELL_GREATER_RESTORATION)
{
SetFacingPoint(GetPosition(oHealer));
ActionPlayAnimation(ANIMATION_FIREFORGET_BOW);
ActionSpeakString("Thank you.");
ExecuteScript("nw_c2_defaultb", OBJECT_SELF);
}
else ExecuteScript("nw_c2_defaultb", OBJECT_SELF);
}
I've never been a good spell caster/healer so i'm sure there are a couple spells I may have fogotten. You can add to the list of spells to check in the same fashion as above.
GetLastSpellCaster does not return a valid object if the spell is an Area Of Effect type spell. So if you add an AOE healing spell to the list, the NPC will probably still bow and speak their line but wont face the healer. Might look weird.
Hope that helps you. Good Luck.
Modifié par GhostOfGod, 22 juillet 2010 - 07:17 .