Initially Black Raid Frames, turn into class color when (buff) is applied.
Hey guys!
Trying to find the right logic and events to use for this specific action, I will continue to build onto the addon using the same logic and using colors to navigate through dispells buffs etc on raidframes. Im not interested in vuhdo or grid thats why im attempting this myself. Troubleshoot: The code below turns my raid frames black initially but wont respond and change to class color when I apply power word: shield. Im using chatgpt and scanning the code for mistakes but since as a newbie i just cant find my way around this <3 ------------ local frame = CreateFrame("Frame") frame:RegisterEvent("PLAYER_LOGIN") frame:RegisterEvent("UNIT_AURA") frame:SetScript("OnEvent", function(self, event, unit) if event == "PLAYER_LOGIN" then -- Set class colors to black initially for all raid and party members for _, colorTable in pairs(RAID_CLASS_COLORS) do colorTable.r, colorTable.g, colorTable.b = 0, 0, 0 colorTable.colorStr = "000000" end elseif event == "UNIT_AURA" and (unit == "player" or UnitInParty(unit) or UnitInRaid(unit)) then local hasPowerWordShield = false for i = 1, 40 do local _, _, _, _, _, _, _, _, _, spellID = UnitAura(unit, i, "HELPFUL") if spellID and spellID == 17 then -- Replace 17 with the actual spell ID of Power Word: Shield hasPowerWordShield = true break end end local _, class = UnitClass(unit) local colorTable = RAID_CLASS_COLORS[class] if colorTable then if hasPowerWordShield then -- Update the class color when Power Word: Shield is applied colorTable.r, colorTable.g, colorTable.b = RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b colorTable.colorStr = RAID_CLASS_COLORS[class].colorStr else -- Set class colors to black if Power Word: Shield is not applied colorTable.r, colorTable.g, colorTable.b = 0, 0, 0 colorTable.colorStr = "000000" end end end end) |
Both
Lua Code:
Lua Code:
All your actions in both PLAYER_LOGIN and UNIT_AURA just keep changing this global table's colours to black again and again.... Lua Code:
is exactly the same as: Lua Code:
and Lua Code:
is exactly the same as: Lua Code:
You need to work at the point you want to set the colour of a texture and decide what you want to do with colouring. eg: Lua Code:
And don't do anything at PLAYER_LOGIN |
i went down a similar path to you to for dark blizz frames, check out a project on curseforge called 'Blizzard Raid Frames - Debuff Highlight By slothpala' to get you started
using the above project as a base, heres my mod i did for dark frames Code:
local restoreColor = function() end you will have to make other changes like converting the background to light color etc |
Thank you! I will study a bit more and share my progress.
|
All times are GMT -6. The time now is 06:47 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI