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:
-- look for new nameplates that don't have a percent overlay and add one
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")
local percent = statusBar.percentOverlay
overlays[statusBar.percentOverlay] = 1 -- add new child to next update batch
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!