WoWInterface - View Single Post - target enemy arena/world
View Single Post
10-23-20, 10:28 AM   #4
An Onyxian Warder
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 397
As JDoubleU00 said you can use this in a macro:
/targetenemyplayer [@arena1, exists]
/targetenemy [@arena1, noexists]
If you don't want to waste a macro slot, you could make a small addon instead:
local header = CreateFrame('Frame', nil, nil, 'SecureHandlerStateTemplate')
header:SetAttribute('unit', 'arena1')
header:SetAttribute("_onstate-unitexists", "self:SetBinding(nil, 'TAB', newstate and 'TARGETNEARESTENEMYPLAYER' or 'TARGETNEARESTENEMY')")
RegisterUnitWatch(header, true)
And here is another option that can be much more versatile if needed (full macro conditionals, multiple binds):
local header = CreateFrame('Frame', nil, nil, 'SecureHandlerStateTemplate')
header:SetAttribute("_onstate-Bind-TAB", "self:SetBinding(nil, 'TAB', newstate)")
RegisterStateDriver(header, "Bind-TAB", "[@arena1, exists] TARGETNEARESTENEMYPLAYER; TARGETNEARESTENEMY")
  Reply With Quote