View Single Post
11-01-19, 04:52 AM   #1
Ayacoz
A Murloc Raider
Join Date: Nov 2019
Posts: 5
Help with an Addon Nameplate

Here is the deal.

I Like the blizzard nameplate by default, but i would like to see the values of hp and % and the Unitnameplate

i find an simple project, that i cant remember the owner's name but its not me.

This "addon" does what i want, BUT, it shows also at the Blizzard Raid Frame, and i dont want it, can someone help me on not showing it at Raid Frame.

here's the code

hooksecurefunc("CompactUnitFrame_UpdateHealth", function(frame)

if not frame:IsForbidden() then
local healthPercentage = ceil((UnitHealth(frame.displayedUnit) / UnitHealthMax(frame.displayedUnit) * 100)) -- Calculating a percentage value for health.

if not frame.health then
frame.health = CreateFrame("Frame", nil, frame) -- Setting up health display frames.
frame.health:SetSize(170,16)
frame.health.text = frame.health.text or frame.health:CreateFontString(nil, "OVERLAY")
frame.health.text:SetAllPoints(true)
frame.health:SetFrameStrata("HIGH")
frame.health:SetPoint("CENTER", frame.healthBar)
frame.health.text:SetVertexColor(1, 1, 1)
end

if InterfaceOptionsNamesPanelUnitNameplatesMakeLarger:GetValue() == "1" then -- If 'Larger Nameplates' option is enabled.
frame.health.text:SetFont("FONTS\\FRIZQT__.TTF", 11, "OUTLINE")
else
frame.health.text:SetFont("FONTS\\FRIZQT__.TTF", 8, "OUTLINE")
end


frame.health.text:SetText(UnitHealth(frame.unit).. "-" .. healthPercentage .. "%") -- Update health numbers + percentages (player.)
frame.health.text:Show() -- Thanks Blizzard...

end
end)
  Reply With Quote