Custom conditional examples

Health threshold, <50%

function(unitID)
    local hp = UnitHealth(unitID)
    local maxHP = UnitHealthMax(unitID)
    if hp and maxHP then
        if hp/maxHP <= 0.5 then
            return true
        end
    end
end

Health threshold, <20% & <35%

function(unitID) 
    local hp = UnitHealth(unitID)
    local maxHP = UnitHealthMax(unitID)
    if hp and maxHP then
        value = hp/maxHP
        if value <= 0.2 then
            return true, {1,1,1,1}
        elseif value <= 0.35 then
            return true
        end
    end
end

Magic buff

function(unitID)
    for i = 1, 40 do
        if UnitBuff(unitID, i) then
            local _,_,_,_,buffType = UnitBuff(unitID, i)
            if buffType and buffType == 'Magic' then
                return true
            end
        else
            return
        end
    end
end

Comments

Posts Quoted:
Reply
Clear All Quotes