Hello! I have some coding experience, but none whatsoever with Lua, which has made this extremely difficult. I've spent the last two days researching to try and build a weakaura that will either display an icon when a bosses hp is between two percents (i.e. between 88% and 85% and then again when the boss is between 73% and 70%). I would even settle for a weakaura that would display the bosses percent and then change colors when the boss is between the two target percents.

Here's what I have so far:

Display Bar Texture
Left text %n
right text %c%

Code:
Code:
function()
    if UnitExists("boss1") then
        local percent = (UnitHealth("boss1")/UnitHealthMax("boss1"))*100
        return ("%i"):format(percent)
    else
        return "0"
    end
end

Trigger: Status Health - Specific Unit - boss1

Animations

Code:
Code:
function(p, r1, g1, b1, a1, r2, g2, b2, a2)
    local percentage = (UnitHealth("boss1")/UnitHealthMax("boss1"))*100
    local red, green, blue = 0,0,0
    if (percentage <= 88 and percentage >= 85) then
        red, green, blue = 1,0,0
    elseif (percentage <=73 and percentage <= 70) then
        red, green, blue = 1,0,0
    elseif (percentage <=58 and percentage <= 55) then
        red, green, blue = 1,0,0
    elseif (percentage <=43 and percentage <= 40) then
        red, green, blue = 1,0,0
    elseif (percentage <=28 and percentage <= 25) then
        red, green, blue = 1,0,0
    elseif (percentage <=13 and percentage <= 10) then
        red, green, blue = 1,0,0
    --elseif percentage <= 0 then
        --red, green, blue = 1,1,1
    else red, green, blue = 0,1,0
    end
    return red, green, blue, 1
end


For this code I'm trying to get the boss percent or the bar to be red when the boss is between these target percent points, and for the bar to be green otherwise.

I could use help either making this work or to have an icon pop up on my screen (i.e. the star icon marker) when the boss is between these percents, and to otherwise disappear.

Hopefully someone out there can help. Thank you so much!