As the title says, I'm looking for a kgpanel script that will change the panel border color to my targets class color. (npc reaction as well if i target a quest npc or others)
Everything I've found in my searches didn't work at all.
Thanks
As the title says, I'm looking for a kgpanel script that will change the panel border color to my targets class color. (npc reaction as well if i target a quest npc or others)
Everything I've found in my searches didn't work at all.
Thanks
Not tested, but give this a try
local Color = {r = 1, g = 1, b = 1};
if UnitExists("target") then
if ( UnitExists("pet") and UnitIsUnit("target", "pet") ) then
Color = {r = 1, g = 1, b = 1}
elseif UnitIsPlayer("target") then
local _, class = UnitClass("target");
Color = RAID_CLASS_COLORS[class];
else
if UnitIsEnemy("player", "target") then
Color = {r = 1, g = 0, b = 0}
elseif UnitCanAttack("player", UFD.unitname) then
Color = {r = 1, g = 1, b = 0}
else
Color = {r = 0, g = 1, b = 0}
end
end
end
self:SetBackdropBorderColor(Color.r, Color.g, Color.b, self.bg:GetAlpha())
Creating multiple tables in OnUpdate? Are you trying to kill the poor guy's FPS? Use three locals instead. Please.
Probably should have mentioned this is something i found on wowinterface, i shared it because he said he did not find any info and i knew a similar post existed on that forum regarding this question so i shared it here.
If it's good or bad i don't know..
EDIT:
Not familiar with KGpanels, but im guessing you should add this onload self:RegisterEvent("PLAYER_TARGET_CHANGED") and the rest onevent(not sure if you even need to check for the event), i'll let the experienced ones answer that
Im curious what UFD.unitname is, never seen that before.. but that's offtopic :P
Last edited by twin2; 2013-01-08 at 06:57 PM.
Yeah, registering in OnLoad and putting the script in OnEvent sounds good.
Should also do what you want. Haven't tried it.Code:local r,g,b if UnitIsPlayer("target") then local c = RAID_CLASS_COLORS[(select(2,UnitClass("target")))] r,g,b = c.r, c.g, c.b else r,g,b = UnitSelectionColor("target") end self:SetBackdropBorderColor(r,g,b,self.bg:GetAlpha())