Quantcast LUA Code help! - WoWInterface
Thread Tools Display Modes
11-01-18, 05:17 PM   #1
vorrent
A Kobold Labourer
Join Date: Nov 2018
Posts: 1
LUA Code help!

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
Attached Thumbnails
Click image for larger version

Name:	UI.jpg
Views:	17
Size:	190.1 KB
ID:	9170  

Last edited by vorrent : 11-01-18 at 05:30 PM. Reason: Added image
  Reply With Quote
11-01-18, 07:39 PM   #2
Terenna
A Cyclonian
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 40
Vorrent from Deus Vox?
  Reply With Quote
11-02-18, 04:12 PM   #3
scrable
A Murloc Raider
 
scrable's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 9
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
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » LUA Code help!

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