Thread Tools Display Modes
05-04-06, 02:21 AM   #1
romkatv
A Deviate Faerie Dragon
Join Date: May 2006
Posts: 15
How to check whether spell can be cast on target?

Hello, WoW Interface experts.

I need to determine whether I can cast heling spell (e.g. Renew) on party (or raid) member. I need function like the CanCastHelingOnUnit("unit") which returns true if supplied "unit" is within cast range (30 yards for Renew) and is in the line of sight.

I need it to create macro which will allow me to select party (or raid) member with the lowest health who can be healed.

Thank you for any help.
  Reply With Quote
05-04-06, 10:04 AM   #2
jrhodes98
A Murloc Raider
Join Date: Aug 2005
Posts: 6
Group Buttons is your answer!

Group Buttons has all of this, and MUCH more in it. I use it to easily cross heal 40 man raids as a priest. You can have active target based heal bars, RAID windows based heal bars (meaning EACH person in raid has own heal bar), and LOWEST HEALTH based hea bars (auto casts on lowest health in GROUP or RAID, depending on your setup). I use all of the above in my GB priest setup.

WoW Int GB page

Author's website
  Reply With Quote
05-12-06, 04:05 AM   #3
romkatv
A Deviate Faerie Dragon
Join Date: May 2006
Posts: 15
This is not what I actually need. I want to select (and heal) only targets which *can* be healed. I don't want to select targets which are not in a line of sight.

After searchig through forums and other resources I've found it's not possible to check whether the target is in a line of sight or not. Anyway thanks for your reply.
  Reply With Quote
05-12-06, 06:48 AM   #4
Maia
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 15
There is no way to check if someone is out of LOS. You can check the range with SpellCanTargetUnit(unit). As for LOS, the event you'd have to watch is UI_ERROR_MESSAGE with arg1==SPELL_FAILED_LINE_OF_SIGHT.

Hope that helps.
  Reply With Quote
05-15-06, 08:31 AM   #5
romkatv
A Deviate Faerie Dragon
Join Date: May 2006
Posts: 15
Originally Posted by Maia
There is no way to check if someone is out of LOS. You can check the range with SpellCanTargetUnit(unit). As for LOS, the event you'd have to watch is UI_ERROR_MESSAGE with arg1==SPELL_FAILED_LINE_OF_SIGHT.

Hope that helps.
Thank you for your reply. The best stuff I can do with my macro is something like the following:
1. remove selection.
2. pick up healing spell (to be able to call SpellCanTargetUnit(unit)).
3. find all raid members for which SpellCanTargetUnit(unit) is true.
4. find raid member with the lowest health.
5. cast spell on the found member.
6. if SPELL_FAILED_LINE_OF_SIGHT received then mark raid member as a LOS member. This will force addon to skip this member for some time (5-10 sec) on the step 3.
  Reply With Quote
05-15-06, 06:56 PM   #6
Esamynn
Featured Artist
Premium Member
Featured
Join Date: Jan 2005
Posts: 395
I seem to remember some tests in the distant past showing that SpellCanTargetUnit(unit) does a LoS check as well as a distance check. This may or may not be the case anymore, but it would be worth re-testing if you are going to use this method.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » How to check whether spell can be cast on target?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off