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) |
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.
Lua Code:
|
Thanks mate
i'll run some tests to see if its what i want, but it seems to be. I'll tell you the results Quote:
|
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.) Thanks ! Quote:
|
You can expand line 14 to be something like this.
Lua Code:
|
1 Attachment(s)
It worked perfectly!
Thanks you so much =D Quote:
|
All times are GMT -6. The time now is 02:22 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI