Quantcast I need help with lua code - WoWInterface
Thread Tools Display Modes
Prev Previous Post   Next Post Next
02-26-18, 02:00 AM   #1
A Kobold Labourer
Join Date: Feb 2018
Posts: 1
Exclamation 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("PLAYER_FRAME_CHANGED")<- Not sure about this one, tried many different texts.

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)
if UnitIsPlayer("focus") then
c = RAID_CLASS_COLORS[select(2, UnitClass("focus"))]
FocusFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
if UnitIsPlayer("player") then
c = RAID_CLASS_COLORS[select(2, UnitClass("player"))]
PlayerFrameNameBackground:SetVertexColor(c.r, c.g, c.b)


frame:SetScript("OnEvent", eventHandler)

for _, BarTextures in pairs({TargetFrameNameBackground, FocusFrameNameBackground, PlayerFrameNameBackground}) do

Last edited by rbkz : 02-26-18 at 04:47 AM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » I need help with lua code

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off