1. #1

    kgpanel script to change a panels border color based on my targets class color

    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

  2. #2
    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())

  3. #3
    Quote Originally Posted by twin2 View Post
    Not tested, but give this a try
    I was able to kinda get this to work. I put it in the "onUpdate" not sure if it needs to be broken up into different sections.
    shows class colors just fine but does not do the red or green based on reaction (colors them based on the last "class" i had targeted.

  4. #4
    Creating multiple tables in OnUpdate? Are you trying to kill the poor guy's FPS? Use three locals instead. Please.
    UI & AddOns expert | Interface & Macros moderator - My work

  5. #5
    Quote Originally Posted by Treeston View Post
    Creating multiple tables in OnUpdate? Are you trying to kill the poor guy's FPS? Use three locals instead. Please.
    What and where should i be putting the scripts?

    thanks

  6. #6
    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.

  7. #7
    Yeah, registering in OnLoad and putting the script in OnEvent sounds good.

    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())
    Should also do what you want. Haven't tried it.
    UI & AddOns expert | Interface & Macros moderator - My work

  8. #8
    Excellent! works perfect

    Thanks to both of you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •