Targeting Macros
Auto-targeting
Put these lines ahead of your existing macro for auto-targeting
/run if UnitHealth("target")==0 and UnitExists("target") then ClearTarget(); end
/run if GetUnitName("target")==nil then TargetNearestEnemy() end
Spammable Wand Shoot w/ Auto Targeting
/run --CastSpellByName("Shoot") end
/run if GetUnitName("target")==nil or UnitExists("target") and UnitReaction("target","player")>4 then TargetNearestEnemy() end
/run if not IsAutoRepeatAction(#) then CastSpellByName("Shoot"); end
Auto Shot and melee Attack w/ Auto Targeting
/run if GetUnitName("target")==nil then TargetNearestEnemy() end
/run if CheckInteractDistance("target", 3) and (not PlayerFrame.inCombat) then AttackTarget() elseif not IsAutoRepeatAction(#) then CastSpellByName("Auto Shot") end
Target By Name
Cast spell on enemy that matches name below EXACTLY. Useful when leveling to tag mobs first.
/run TargetByName("REPLACE THIS TO NPC NAME", true) CastSpellByName("REPLACE THIS WITH INSTANT CAST SPELL")
Target last enemy
/run TargetLastEnemy()
Target last target
/run TargetLastTarget()
Target Nearest Enemy
/run TargetNearestEnemy();
No Unit Exists
If no target, friendly target, or dead target, then target nearest enemy
/script if UnitExists("target") == nil or not UnitIsEnemy("target", "player") or UnitIsDead("target") ~= nil then TargetNearestEnemy() end
Unit Reaction
if no target, no hostile target, then targets nearest enemy
/run if GetUnitName("target")==nil or UnitExists("target") and UnitReaction("target","player")>4 then TargetNearestEnemy() end
Target Nearest Friend
/run TargetNearestFriend()
Targettarget
Target your target's target, then cast the spell
/run TargetUnit("targettarget") CastSpellByName("spell")
Target your target's target, then cast the spell, then target the previous target
/run TargetUnit("targettarget") CastSpellByName("spell") TargetLastTarget()