View Single Post
11-15-12, 11:24 PM   #2
Ekaterina
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 65
Hi,
Try this - which is modified code from the forum post you linked.

In your onload script:
Lua Code:
  1. self:RegisterEvent("PLAYER_ENTERING_WORLD")
  2. self:RegisterEvent("PLAYER_TARGET_CHANGED")
  3.  
  4. self:Hide()

In your onevent script:
Lua Code:
  1. local FFA_PVP_TEXTURE = "Interface\\TargetingFrame\\UI-PVP-FFA" -- The paths to the textures to be used when the player is flagged for FFA/regular PvP.
  2. local REG_PVP_TEXTURE = "Interface\\TargetingFrame\\UI-PVP-%f"  -- %f in both paths will be replaced with either Horde or Alliance, depending on the player's faction.
  3.  
  4.  self:Hide()
  5. local faction = UnitFactionGroup("target")    
  6.  
  7. if UnitIsPVPFreeForAll("target") then        
  8.     self.bg:SetTexture(FFA_PVP_TEXTURE)        
  9.     self:Show()
  10. elseif UnitIsPVP("target") then        
  11.     self.bg:SetTexture(REG_PVP_TEXTURE:gsub("%%f", faction))        
  12.     self:Show
  13. end

Ekat

Last edited by Ekaterina : 11-15-12 at 11:26 PM. Reason: to correct FFA fail.
  Reply With Quote