Quantcast Adding %HP to default nameplates; getting an error occasionally - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-25-18, 03:47 PM   #1
nKweo
A Deviate Faerie Dragon
 
nKweo's Avatar
Join Date: Oct 2012
Posts: 16
Adding %HP to default nameplates; getting an error occasionally

I've been looking into ways to add a simple %HP text to the default enemy nameplates. So far the best thing I've found is Gello's old addon Nameplate Percents.

It actually still works fine most of the times, but it sometimes throws an error (and doesn't display) in PvE instances. I'm still trying to nail down the exact situation; so far it seems that it only happens in boss fights (but not every time).

The error isn't very clear, but it does say something about taint. I suspect the problem is related to this function:
Code:
-- look for new nameplates that don't have a percent overlay and add one
function frame:ScanNameplates(...)
  for i=1,select("#",...) do
    local plate = select(i,...)
		local name = plate:GetName()
		if name and name:match("^NamePlate") then
			-- the statusBar is the first child of the first child of the nameplate
			local statusBar = plate:GetChildren():GetChildren()
			if not statusBar.percentOverlay then
				statusBar.percentOverlay = statusBar:CreateFontString(nil,"OVERLAY")
				statusBar.percentOverlay:SetFont(STANDARD_TEXT_FONT,12,"OUTLINE")
				local percent = statusBar.percentOverlay
				percent:SetPoint("LEFT",3,0)
				statusBar:HookScript("OnShow",ShowPercent)
				statusBar:HookScript("OnHide",HidePercent)
				overlays[statusBar.percentOverlay] = 1 -- add new child to next update batch
			end
    end
  end
end
As I said, it's pretty old code and Blizzard obviously has made big changes to the way nameplates are handled (e.g. C_NamePlate.GetNamePlates). Moreover, they protected some stuff in 7.2(?).

I've been messing around with it a little bit, but my knowledge is insufficient. I'm hoping for some ideas to get this working perfectly. I'm guessing that this shouldn't be too difficult for some of you code wizards. Any ideas are appreciated though!
  Reply With Quote
 

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Adding %HP to default nameplates; getting an error occasionally

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off