Hi. So I was looking for a script to run to show the percentage health of the enemy on the default nameplates. After some looking around I found one (Credits to: Idomár, posted 05 oct -18), which I have modified some to my liking.
The only problem with this script is that it also put the percentage health on the blizzard raidframes, which I would prefer if it would not. Only want it on enemy nameplates and selfNameplate. Is there anyone that can help me figure out the coding?
Is the issue in that the raid frames also use frame.health? If so, is there a workaround?
Any help is much appreciated.
hooksecurefunc("CompactUnitFrame_UpdateHealth", function(frame)
if not frame:IsForbidden() then
local healthPercentage = ceil((UnitHealth(frame.displayedUnit) / UnitHealthMax(frame.displayedUnit) * 100))
if not frame.health then
frame.health = CreateFrame("Frame", nil, frame)
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
frame.health.text:SetFont("FONTS\\FRIZQT__.TTF", 10, "OUTLINE")
else
frame.health.text:SetFont("FONTS\\FRIZQT__.TTF", 8, "OUTLINE")
end
frame.health.text:SetText(healthPercentage .. "%")
frame.health.text:Show()
end
end)