View Single Post
09-12-15, 10:05 PM   #1
Lesteryoung
A Black Drake
Join Date: Aug 2015
Posts: 81
Trying to change font/color on unit frames for player targets only.

I have this code that adds class colors on the default unit frames

Code:
local frame = CreateFrame("FRAME")
frame:RegisterEvent("GROUP_ROSTER_UPDATE")
frame:RegisterEvent("PLAYER_TARGET_CHANGED")
frame:RegisterEvent("PLAYER_FOCUS_CHANGED")
frame:RegisterEvent("UNIT_FACTION")

local function eventHandler(self, event, ...)
        if UnitIsPlayer("target") then
                c = RAID_CLASS_COLORS[select(2, UnitClass("target"))]
                TargetFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
        end
        if UnitIsPlayer("focus") then
                c = RAID_CLASS_COLORS[select(2, UnitClass("focus"))]
                FocusFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
        end
end

frame:SetScript("OnEvent", eventHandler)

for _, BarTextures in pairs({TargetFrameNameBackground, FocusFrameNameBackground}) do
        BarTextures:SetTexture("Interface\\TargetingFrame\\UI-StatusBar")
end
And am trying to also adjust the font/color of the focus/target frame respectively. I added this but it changes for non-player targets aswell.

Code:
TargetFrameTextureFrameName:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
TargetFrameTextureFrameName:SetTextColor(1,.9,0)
FocusFrameTextureFrameName:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
FocusFrameTextureFrameName:SetTextColor(1,.9,0)
I thought if you just put that in the two blocks of code that add the color it would also just be another adjustment but it doesn't work like that I guess.
  Reply With Quote