Hello,
put this code instead of spell name, and use option spell option 'Not spell, is lua...':
local SpellName = GetSpellInfo(109259)
for i = 1, 4, 1 do
local UnitIdString = "party" .. i .. "target"
if UnitExists(UnitIdString) then
if GetRaidTargetIndex(UnitIdString) == 8 and IsSpellInRange(SpellName,UnitIdString) then
CastSpellByName(SpellName, UnitIdString)
return
end
end
end
(I have added IsSpellInRange)
And add "lua script" condition:
Lua script:
needToCast=false;
local SpellName = GetSpellInfo(109259)
for i = 1, 4, 1 do
local UnitIdString = "party" .. i .. "target"
if UnitExists(UnitIdString) then
if GetRaidTargetIndex(UnitIdString) == 8 and IsSpellInRange(SpellName,UnitIdString) then
needToCast=true;
return
end
end
end
Return value research:
true
Return value var:
needToCast
To use this code in party chat command just use "Action command type" > "Lua" with the first code of this post.
of course, replace 109259 by your spell in in all codes.