Hello,
For the macro
/run if UnitIsUnit("player", "target") or UnitIsDeadOrGhost("target") then TargetUnit("") end
/run for i=1,10 do TargetNearestEnemy() if UnitIsPlayer("target") then break end end
/run if not UnitIsPlayer("target") then TargetUnit("") end
If I don't want it to target players that are already dead, or ghost players (which I'm assuming are players just as they rez out), how do I modify it?
Do I change the third line to
/run if not UnitIsPlayer("target") or UnitIsDeadOrGhost("target") then TargetUnit("") end
or just have a 4th line with
/run if not UnitIsDeadOrGhost("target") then TargetUnit("") end
Or are neither of these correct?Thanks.
You can always look at the health value of the target. If above 0 then it isn't dead. UnitHealth() will return the real health value for players (it returns a percentage for mobs and NPCs). So, you could modify the macro like this:
|
Source code
|
1
2
3
|
run if UnitIsUnit("player", "target") or UnitIsDeadOrGhost("target") then TargetUnit("") end
/run for i=1,10 do TargetNearestEnemy() if UnitIsPlayer("target") and UnitHealth("target") > 0 then break end end
/run if not UnitIsPlayer("target") then TargetUnit("") end
|
The
and UnitHealth("target") > 0 in the for loop's if statement will force it to keep looking if the target has no health. You could replace UnitHeath() with UnitIsDeadOrGhost(), but IIRC UnitHealth is more reliable.