WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   LUA Code help! (https://www.wowinterface.com/forums/showthread.php?t=56820)

vorrent 11-01-18 05:17 PM

LUA Code help!
 
1 Attachment(s)
As title states, having some brain lapse in lua coding as I've been updating/managing my personal addon since WoD.

That being said I'm trying to change the BACKGROUND behind player name in each frame to black or "nothing" setalpha() or whatever. But unsure which line to change.

EDIT: Would it be easier to just delete my current lua string and just have a simple hp class colour lua with no colour behind name...essentially what i'm looking for.

IMAGE
https://imgur.com/a/NaHCFOs

CURRENT CODE:
hooksecurefunc("UnitFrameHealthBar_Update", colour)
hooksecurefunc("HealthBar_OnValueChanged", function(self)
colour(self, self.unit)
end)

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
if PlayerFrame:IsShown() and not PlayerFrame.bg then
c = RAID_CLASS_COLORS[select(2, UnitClass("player"))]
bg=PlayerFrame:CreateTexture()
bg:SetPoint("TOPLEFT",PlayerFrameBackground)
bg:SetPoint("BOTTOMRIGHT",PlayerFrameBackground,0,22)
bg:SetTexture(TargetFrameNameBackground:GetTexture())
bg:SetVertexColor(c.r,c.g,c.b)
PlayerFrame.bg=true
end
end

frame:SetScript("OnEvent", eventHandler)

for _, BarTextures in pairs({TargetFrameNameBackground, FocusFrameNameBackground}) do
BarTextures:SetTexture("Interface\\TargetingFrame\\UI-StatusBar")
end

Terenna 11-01-18 07:39 PM

Vorrent from Deus Vox?

scrable 11-02-18 04:12 PM

If you want the background transparent add an alpha parameter to SetVertexColor. If you want to change the solid color to black change the c.r c.g c.b to black


All times are GMT -6. The time now is 03:21 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI