#WA nameplates with Class-reaction color

17 messages · Page 1 of 1 (latest)

keen basin
#

Hello! I was looking to make a rather simplistic nameplate replacement with WA by using my current target bar coloring code by replacing "target" to "nameplate":


function(_, r, g, b)
if (UnitIsPlayer("target")) then
local c = RAID_CLASS_COLORS[select(2, UnitClass("target"))]
return c.r, c.g, c.b
elseif UnitExists("target") then
if UnitIsTapDenied("target") and not UnitCanAttack("player", "target") then
return 0.5, 0.5, 0.5
end

    local reaction = UnitReaction("target", "player")
    local colors = aura_env.colors
    
    if reaction < 4 or UnitThreatSituation("player", "target") then
        reaction = "HOSTILE"
    elseif reaction == 4 then
        reaction = "NEUTRAL"
    else
        reaction = "FRIENDLY"            
    end
    
    return colors[reaction].r, colors[reaction].g, colors[reaction].b
end
return r, g, b

end


However, it doesn't work and just returns my Foreground Color... is this possible with WA or am I reaching too far and should just settle for single color nameplates? Any help appreciated and thank you!

abstract frost
#

which nameplate

#

it's nameplate1 to nameplate40 you need a valid unit

keen basin
#

Ohhh... so it needs to be specific... didn't know it went from 1 to 40... thought it would replicate the rules on each nameplate automatically... then, how do I make each nameplates obey the coloring rules independently?

abstract frost
#

and what do you mean by "namepalte replacement"? Do you anchor progressbars to enemy units?

keen basin
#

Exactly

abstract frost
#

what is the trigger?

keen basin
#

just health > nameplate

#

Also I put that code on the first post on the Animations > Color > Custom

abstract frost
#

how do you select units by clicking these WA bars?

keen basin
#

no, is just a progress bar anchored to the nameplates of the game..

abstract frost
#

I'd use conditions, but

function(_, r, g, b)
    local unit = aura_env.state.unit
    if unit then
        if UnitIsPlayer(unit) then
            local c = RAID_CLASS_COLORS[select(2, UnitClass(unit))]
            return c.r, c.g, c.b
        elseif UnitIsTapDenied(unit) and not UnitCanAttack("player", unit) then --why not UnitCanAttack??? What if you can attack tap denied unit
            return 0.5, 0.5, 0.5
        end

        local reaction = UnitReaction(unit, "player")
        local colors = aura_env.colors

        if reaction < 4 or UnitThreatSituation("player", unit) then
            reaction = "HOSTILE"
        elseif reaction == 4 then
            reaction = "NEUTRAL"
        else
            reaction = "FRIENDLY"
        end

        return colors[reaction].r, colors[reaction].g, colors[reaction].b
    end
    return r, g, b
end
keen basin
#

thank you ! I'll try that later!

keen basin
#

It seems it worked!!! Genius!! Thank you!

keen basin
#

Me again 😅 I was wondering if there could be a way to add in that code a way to make the opacity of my target nameplate a 100% and the rest let's say 50%... is it possible?

violet sun
#

I am a noob. But maybe make a 2nd trigger "target" and then use a condition