Late post, but you might want to keep in mind that when you use functions such as CastSpell, CastSpellOnTarget, FullCastSpell, and FullCastSpellOTarget, they all cast the spells on the NPC using the spell, so you need to define what the target is before it starts casting. That's where this would come in to play.