Loading...
Forum Rules:
You may only create a new thread here if you have created a guide on how to do something with ElvUI. Do not create a thread here if you just want to ask how to do something.

[Guide] ElvUI Custom Tag Guide

91
[mention]xenostrigger[/mention] you can create a custom text for one of the tags - eg mana and place it on the right side of the power bar.

[Guide] ElvUI Custom Tag Guide

93
does [distance] tag show the distance between you and the selected unit?
and if so how can i use it? just putting [distance] in the custom text doesn't work for me (actually trying with target unitframe>creating custom text>putting [distance] in the text format).

[Guide] ElvUI Custom Tag Guide

94
Made a Custom Tag to change the unit name color to correspond with threat (instead of just the bar). I don't play with an HP bar, so I wanted threat status to be reflected in the name color.

I'm not a coder whatosever, so this is ramshackled together using what I could research online. It seems to work as intended, but I would love any tips for improvement on it. For example, it would be great to reference the ElvUI threat colors instead of having them hardcoded in...I just have no idea how to do that. :oops:

Code: Select all

function(unit)
    local _, threat = UnitDetailedThreatSituation('player', unit);
    local _, focus = UnitDetailedThreatSituation('focus', unit);
    local tankColor = {
        [0] = "fe2d2d", --Bad Threat Color
        [1] = "ff8132", --Transition Color
        [2] = "ff8132", --Tranistion Color
        [3] = "32b400", --Good Color
        [4] = "bb32ff" --Offtank
    }
    local dpsColor = {
        [0] = "32b400", --Bad Threat Color
        [1] = "ff8132", --Transition Color
        [2] = "ff8132", --Tranistion Color
        [3] = "fe2d2d" --Good Color
    }
    local role = UnitGroupRolesAssigned('player');
    if role == 'TANK'  and focus == 3 then
        return '||cFF'..tankColor[4]
    elseif role == 'HEALER' or role == 'DAMAGER' then
        return '||cFF'..dpsColor[threat]
    else 
        return '||cFF'..tankColor[threat]
    end
end
Example:
Image

[Guide] ElvUI Custom Tag Guide

95
Heed help with party/raid frames customization. I want the frames to look like this:
Image
Like that I was able to do

Code: Select all

[namecolor][health:deficit-percent:name-veryshort]
adding "deficit:shortvalue" doesn't work
[health:deficit:shortvalue] and [deficit:name] looks fine, but I need veryshort names in frames

[Guide] ElvUI Custom Tag Guide

96
Re-did my custom tag so I could use brackets to designate my target (they're a 'protected' character if you try and add them in tags normally). Essentially it's an all-in-one code that handles names, colors, target designation without having to mess around with Style Filters. Basically just use Style Filters for Alpha levels.

Colors grey when tap denied. Uses a special color for when your Focus (Offtank) has aggro on a mob.

Appreciate any and all feedback. I really suck at coding.

Image

Code: Select all

function(unit, target, player)
    local _, threat = UnitDetailedThreatSituation('player', unit);
    local _, focus = UnitDetailedThreatSituation('focus', unit);
    local isTank = UnitGroupRolesAssigned('player') == "TANK";
    local isDPS = UnitGroupRolesAssigned('player') == "DAMAGER";
    local isHealer = UnitGroupRolesAssigned('player') == "HEALER";
    local isNone = UnitGroupRolesAssigned('player') == "NONE";
    local unitName = _TAGS['name'](unit);
    local unitNameTarget = '['.._TAGS['name'](unit)..']';
    local nameColor = _TAGS['namecolor'](unit);
    local perHp = '||cFFFFFFFF '.._TAGS['perhp'](unit);
    local isTarget = UnitIsUnit('playertarget', unit);
    local isUnitCombat = UnitAffectingCombat(unit);
    local isPlayerCombat = UnitAffectingCombat('player');
    local isTapped = UnitIsTapDenied(unit);
    --
    local tankColor = {
        [0] = "||cFFfe2d2d", --Bad Threat Color
        [1] = "||cFFff8132", --Transition Color
        [2] = "||cFFff8132", --Transition Color
        [3] = "||cFF32b400", --Good Color
        [4] = "||cFFbb32ff" --Offtank
    }
    local dpsColor = {
        [0] = "||cFF32b400", --Bad Threat Color
        [1] = "||cFFff8132", --Transition Color
        [2] = "||cFFff8132", --Transition Color
        [3] = "||cFFfe2d2d" --Good Color
    }
    local tappedColor = "||cFF999999"; --Tapped Color
    --
    if (isTarget and isTapped) then
        return tappedColor..unitNameTarget..perHp;
    elseif isTapped then
        return tappedColor..unitName..perHp;
    elseif (isTarget and isUnitCombat and isPlayerCombat and isTank and focus == 3) then
        return tankColor[4]..unitNameTarget..perHp;
    elseif (isTarget and isUnitCombat and isPlayerCombat and isTank) then
        return tankColor[threat]..unitNameTarget..perHp;
    elseif (isTarget and isUnitCombat and isPlayerCombat) and (isDPS or isHealer) then
        return dpsColor[threat]..unitNameTarget..perHp;
    elseif (isTarget and isUnitCombat and isPlayerCombat and isNone) then
        return tankColor[threat]..unitNameTarget..perHp;
    elseif (isUnitCombat and isPlayerCombat and isTank and focus == 3) then
        return tankColor[4]..unitName..perHp;
    elseif (isUnitCombat and isPlayerCombat and isTank) then
        return tankColor[threat]..unitName..perHp;
    elseif (isUnitCombat and isPlayerCombat) and (isDPS or isHealer) then
        return dpsColor[threat]..unitName..perHp;
    elseif (isUnitCombat and isPlayerCombat and isNone) then
        return tankColor[threat]..unitName..perHp;
    elseif isTarget then
        return nameColor..'['..unitName..']'..perHp;
    else
        return nameColor .. unitName .. perHp;
    end
end
And here is for Friendly targets. Only shows HP if they're below 100%.

Code: Select all

function(unit, target, player)
    local unitName = _TAGS['name'](unit);
    local unitNameTarget = '['.._TAGS['name'](unit)..']';
    local nameColor = _TAGS['namecolor'](unit);
    local perHp = '||cFFFFFFFF '.._TAGS['perhp'](unit);
    local min, max = UnitHealth(unit), UnitHealthMax(unit)
    local deficit = max - min
    
    if UnitIsUnit("playertarget", unit) and not ((deficit <= 0) or (min == 0) or (UnitIsGhost(unit))) then
        return nameColor..unitNameTarget..perHp;
    elseif UnitIsUnit("playertarget", unit) and ((deficit <= 0) or (min == 0) or (UnitIsGhost(unit))) then
        return nameColor..unitNameTarget;
    end
    --
    if not UnitIsUnit("playertarget", unit) and not ((deficit <= 0) or (min == 0) or (UnitIsGhost(unit))) then
        return nameColor..unitName..perHp;
    elseif not UnitIsUnit("playertarget", unit) and ((deficit <= 0) or (min == 0) or (UnitIsGhost(unit))) then
        return nameColor..unitName;
    end
end

[Guide] ElvUI Custom Tag Guide

99
I'm using custom tags in my target unitframe. I have [name:title] which displays players' names with their titles, but doesn't display anything for NPCs... supposedly because they don't have titles. Any way to make that tag turn into just a [name] tag when targeting NPCs?

[Guide] ElvUI Custom Tag Guide

100
Was searching how to show player power on the target nameplates - no dice - but thanks to your great API/examples + CustomTags was able to do what I wanted:
Image
The custom tag shows '@' character for each 20 focus I have on the target unit nameplate and '*' character if I have more than 10 but less than 20

Code: Select all

UNIT_DISPLAYPOWER UNIT_POWER_FREQUENT

Code: Select all

function(unit)
    local pType = UnitPowerType("player")
    local min, max = UnitPower("player", pType), UnitPowerMax("player", pType)
    --local deficit = max - min
    --deficit = 1
    local String
    
    --if not (deficit <= 0) then
    local playerClass, englishClass,classIndex = UnitClass("player")
    local classcolor =Hex( _COLORS.class[englishClass])
    if not(classIndex ==3) then
        String = _VARS.E:GetFormattedText('CURRENT', min, max, true)
    else
        local halfshots=min/ 10
        local s = string.rep("@", math.floor(halfshots/2))
        if (halfshots/2-math.floor(halfshots/2) >= 0.5) then
            s = s .. "*"
        end
        String = format("%s%s||r", classcolor, s)            
    end
    --end
    
    return String
end
Since I am only 2 hours in wow lua and stuff the code is apparently not perfect.
Also it would have been nice to show some icon instead of the text characters (I know it is possible because of faction:icon tag) but could not find example. Anyway it is much better for me now even in this state.
Thank you for the great addon/API/example!