I'm doing something wrong, I can't even get the name to show
this is the code I use in my units/target file
Lua Code:
local name = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
name:SetPoint("BOTTOM", Portrait, "TOP", 0, 4)
Portrait:Tag(name, "[name]")
and this is all my code in modules/tags file. copied directly from oUF_SquarePortrait, all I have edited is change the name, and made all core instances into tags
Lua Code:
local addon, ns = ...
local cfg = ns.cfg
--container
local tags = CreateFrame("Frame")
ns.tags = tags
---------------------------------------------
-- FUNCTIONS
---------------------------------------------
function tags:CreateDropShadow(parent,edgeFile,edgeSize,padding)
if parent.dropShadow then return end
edgeFile = edgeFile or ""
edgeSize = edgeSize or 8
padding = padding or 8
parent.dropShadow = CreateFrame("Frame", nil, parent)
parent.dropShadow:SetPoint("TOPLEFT",-padding,padding)
parent.dropShadow:SetPoint("BOTTOMRIGHT",padding,-padding)
parent.dropShadow:SetBackdrop({ bgFile = nil, edgeFile = edgeFile, tile = false, tileSize = 16, edgeSize = edgeSize, insets = { left = 0, right = 0, top = 0, bottom = 0, }, })
local mt = getmetatable(parent).__index
mt.SetDropShadowColor = function(self,r,g,b,a) self.dropShadow:SetBackdropBorderColor(r or 1, g or 1, b or 1, a or 1) end
end
--fontstring func
function tags:NewFontString(parent,family,size,outline,layer)
local fs = parent:CreateFontString(nil, layer or "OVERLAY")
fs:SetFont(family,size,outline)
fs:SetShadowOffset(0, -2)
fs:SetShadowColor(0,0,0,1)
return fs
end
---------------------------------------------
-- TAGS
---------------------------------------------
--unit name tag
oUF.Tags.Events["sxui:name"] = "UNIT_NAME_UPDATE UNIT_CONNECTION"
oUF.Tags.Methods["sxui:name"] = function(unit)
local name = oUF.Tags.Methods["name"](unit)
return "|cffffffff"..name.."|r"
end
--unit health tag
oUF.Tags.Events["sxui:health"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH"
oUF.Tags.Methods["sxui:health"] = function(unit)
local perhp = oUF.Tags.Methods["perhp"](unit)
return "|cffffffff"..perhp.."|r"
end
But I still don't get it to work :/