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
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.text = frame.health.text or frame.health:CreateFontString(nil, "OVERLAY")
frame.health.text:SetVertexColor(1, 1, 1)
if InterfaceOptionsNamesPanelUnitNameplatesMakeLarger:GetValue() == "1" then -- If 'Larger Nameplates' option is enabled.
frame.health.text:SetFont("FONTS\\FRIZQT__.TTF", 11, "OUTLINE")
frame.health.text:SetFont("FONTS\\FRIZQT__.TTF", 8, "OUTLINE")
frame.health.text:SetText(UnitHealth(frame.unit).. "-" .. healthPercentage .. "%") -- Update health numbers + percentages (player.)
frame.health.text:Show() -- Thanks Blizzard...
Here's what I do on mine. It hooks NameplateDriverFrame:OnNamePlateCreated() when it creates nameplates and CompactUnitFrame_UpdateHealth() to update. I also store a mapping between the unitframe and the text to prevent collisions with other addons or future additions from Blizzard.
i'll run some tests to see if its what i want, but it seems to be.
I'll tell you the results
It worked at some way, i liked it, but if there's an option to add the percent like mine, i'll be glad, i tried so hard here and realized that i suck at it, can you take a look ?
**frame.health.text:SetText(UnitHealth(frame.unit).. "-" .. healthPercentage .. "%") -- Update health numbers + percentages (player.)
You can expand line 14 to be something like this.
It worked perfectly!
Thanks you so much =D
|All times are GMT -6. The time now is 03:46 PM.|
vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI