View Single Post
11-02-20, 08:03 PM   #6
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
Originally Posted by Vrul View Post
As JDoubleU00 said you can use this in a macro:
Code:
/targetenemyplayer [@arena1, exists]
/targetenemy [@arena1, noexists]
If you don't want to waste a macro slot, you could make a small addon instead:
Code:
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):
Code:
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")
Amazing work!

Originally Posted by danischior View Post
this looks awesome, thx guys !
Happy to helped with part of the solution. These forums are awesome.
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote