I need help with lua code
Hello there,
I need help with a lua script, I would like to add color into PlayerFrame aswell same as TargetFrame and FocusFrame. In the code below it already have class color in health bar and color behind name of target and focus, not player frame. (red marked text is the code I tried to implement without any success) local frame = CreateFrame("FRAME") frame:RegisterEvent("GROUP_ROSTER_UPDATE") frame:RegisterEvent("PLAYER_TARGET_CHANGED") frame:RegisterEvent("PLAYER_FOCUS_CHANGED") frame:RegisterEvent("PLAYER_FRAME_CHANGED")<- Not sure about this one, tried many different texts. 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 if UnitIsPlayer("player") then c = RAID_CLASS_COLORS[select(2, UnitClass("player"))] PlayerFrameNameBackground:SetVertexColor(c.r, c.g, c.b) end end frame:SetScript("OnEvent", eventHandler) for _, BarTextures in pairs({TargetFrameNameBackground, FocusFrameNameBackground, PlayerFrameNameBackground}) do BarTextures:SetTexture("Interface\\TargetingFrame\\UI-StatusBar") end |
What if you hooked PlayerFrame OnShow?
(Also pls dont use dark red text.) Also: http://www.wowinterface.com/download...ameFrames.html |
Here's the same overall code I posted in this thread but, with some modifications for you....
Code:
local function getPlayerColors(unit) btw, PLAYER_FRAME_CHANGED will not work as it's not a valid event. -> https://wow.gamepedia.com/Events I can't test this right now but, it should work. |
All times are GMT -6. The time now is 02:28 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI