View Single Post
03-03-18, 06:07 PM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Pass a function as the second parameter to oUF:SpawnNamePlates, it will be called whenever a new nameplate unit is used or when the player changes targets.
Then use UnitIsUnit('target', unit) in that function to check if they match (unit being the 3rd argument passed to the function), and proceed to show/hide your border.

Drycoded example:
Lua Code:
  1. oUF:SpawnNamePlate(nil, function(self, _, unit)
  2.     if(UnitExists('target') and UnitIsUnit('target', unit)) then
  3.         self.border:Show()
  4.     else
  5.         self.border:Hide()
  6.     end
  7. end)

Shorter version
Lua Code:
  1. oUF:SpawnNamePlate(nil, function(self, _, unit)
  2.     self.border:SetShown(UnitExists('target') and UnitIsUnit('target', unit))
  3. end)

Last edited by p3lim : 03-03-18 at 06:12 PM.
  Reply With Quote