#Anchoring to nameplate

3 messages · Page 1 of 1 (latest)

pale vale
#

Im struggling to get the nameplate anchors to work, im using display>position settings > anchored to: nameplates. in the tsu custom code i got this: 'function(allstates, event, ...)
if event == 'UNIT_TARGET' then
local unitp = ...
local unitf = nil
local targeted = UnitName(unitp .. "target")

    if unitp == "player" then           
        unitf = "playertarget"       
    elseif unitp == "party1" then
        unitf = "party1target"
    elseif unitp == "party2" then
        unitf = "party2target"
    elseif unitp == "party3" then
        unitf = "party3target"
    elseif unitp == "party4" then
        unitf = "party4target"
    elseif unitp == "party5" then
        unitf = "party5target"
    end
    
    if targeted then           
        allstates[unitf] = {
            show = true,
            changed = true,
            progressType = "static", 
            unit = unitf,
            name = GetUnitName(unitp)
        }
    else
        allstates[unitf] = {
            show = false,
            changed = true, 
            progressType = nil,
            unit = nil,
            name = nil
        }
    end       
    return true
else
    
    return true
end

end'

i wasnt exactly sure how do use nameplateX as unitID so im using party1target and so on. now what happens is that the text appears centered and not anchored to anything

loud thunder
#
local targeted = UnitName(unitp .. "target")

        if unitp == "player" then
            unitf = "playertarget"
        elseif unitp == "party1" then
            unitf = "party1target"
        elseif unitp == "party2" then
            unitf = "party2target"
        elseif unitp == "party3" then
            unitf = "party3target"
        elseif unitp == "party4" then
            unitf = "party4target"
        elseif unitp == "party5" then
            unitf = "party5target"
        end

you concatenate target to the end of unitp then compare unitp 5 different times to set unitf instead of just also concatenating in the exact same way?

#

also if youre trying to anchor to nameplates then you need a your allstates[state].unit to be set to a valid nameplate unit name. ie- nameplate1, nameplate15