PDA

View Full Version : Scripting question: target of a spell when SpellIsTargetting


Sophisse
03-05-2005, 04:00 AM
Hi guys, I'm having a problem with my add on. I want to be able to determine the spell target in order to be able to announce to group, and some other processing.

This is easy to determine in the ordinary spellcast scenario, where the caster targets then casts - you just say targetname=UnitName("target");

But if the caster does not have a target some spells (like healing spells) will sit in a SpellIsTargeting state until a target is selected by the caster - by clicking a party member hotkey, or clicking on the target.

In that case, the spell target never actually shows up as a target for the user, and UnitName("target") returns the user's target which will be something else (or nil).

So I am looking for a way to determine the true target of a spell when processing the SPELLCAST_START event. Anybody know?

And, is there a better spot to discuss issues like this?

Thanks,
Sophisse <Noctis> 44 priest on Whisperwind

Sophisse
03-07-2005, 01:06 AM
Update: I am able to catch one case by hooking (using Sea.util.hook) the SpellTargetUnit function. This is called when a spell is targeting and the player targets by clicking on a player frame (not sure if it is called if you click on a player).

However, my usual method is to cast the spell, then spell-target using the keyboard keys for players. This does not invoke the SpellTargetUnit function, so my hook doesn't work for that case. Any suggestions on how to intercept or detect key targeting events?

Thanks,
Sophisse