View Single Post
04-16-19, 05:06 AM   #12
SilverDragony
A Murloc Raider
Join Date: Apr 2019
Posts: 6
Hi,

I work on this code but I have another probleme. I realy liked your help on this post so I continue here.

I sursh to display a border for each classification, but I don't understand why my code doesn't work. Is there a problem is local function ?

Lua Code:
  1. --Target Classification
  2.     local default = "Interface/AddOns/ClassicPortrait/media/default"
  3.     local unitClassTextures = {
  4.         worldboss = "Interface/AddOns/ClassicPortrait/media/worldboss",
  5.         boss = "Interface/AddOns/ClassicPortrait/media/boss",
  6.         elite = "Interface/AddOns/ClassicPortrait/media/elite",
  7.         rare = "Interface/AddOns/ClassicPortrait/media/rare",
  8.         rareelite = "Interface/AddOns/ClassicPortrait/media/rareelite",
  9.     }
  10.      
  11.     local function OnEvent(self, event, ...)
  12.         if event == "PLAYER_TARGET_CHANGED" and UnitExists("target") then
  13.             self.Border:SetTexture( unitClassTextures[UnitClassification("target")] or default )
  14.         end
  15.     end
  16.      
  17.     local function CreateBorder(self)
  18.         local t = self.Border or self:CreateTexture(nil, "BACKGROUND", nil, -8)
  19.         self.Border = t
  20.      
  21.         ft:SetPoint("CENTER", 110, -350)
  22.         ft.Border = ft:CreateTexture("$parent_Border", "BORDER")
  23.         ft.Border:SetPoint("TOPLEFT", -6, 4)
  24.         ft.Border:SetPoint("BOTTOMRIGHT", 6, -10)
  25.         ft.Border:SetVertexColor(1, 1, 0, 1)
  26.      
  27.         self:RegisterEvent("PLAYER_TARGET_CHANGED")
  28.         self:HookScript("OnEvent", OnEvent)
  29.     end

I verify in game on an elite unit but the addons display nothing.

Thank again for your help and have a good day
  Reply With Quote