View Single Post
05-25-18, 07:19 AM   #4
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
http://www.wowinterface.com/forums/s...ad.php?t=56125

Also I should have told you earlier, but this kind of stuff should be going in General Authoring Discussion or Lua/XML Help.

This is the hack I use for this if you would ever be interested:

lua Code:
  1. hooksecurefunc("CompactUnitFrame_UpdateHealth", function(frame)
  2.     if frame.optionTable.colorNameBySelection and not frame:IsForbidden() then
  3.         local healthPercentage = ceil((UnitHealth(frame.displayedUnit) / UnitHealthMax(frame.displayedUnit) * 100))
  4.  
  5.         if not frame.health then
  6.             frame.health = CreateFrame("Frame", nil, frame)
  7.             frame.health:SetSize(170,16)
  8.             frame.health.text = frame.health.text or frame.health:CreateFontString(nil, "OVERLAY")
  9.             frame.health.text:SetAllPoints(true)
  10.             frame.health:SetFrameStrata("HIGH")
  11.             frame.health:SetPoint("CENTER", frame.healthBar)
  12.             frame.health.text:SetVertexColor(1, 1, 1)
  13.         end
  14.  
  15.         if InterfaceOptionsNamesPanelUnitNameplatesMakeLarger:GetValue() == "1" then
  16.             frame.health.text:SetFont("FONTS\\FRIZQT__.TTF", 11, "OUTLINE")
  17.         else
  18.             frame.health.text:SetFont("FONTS\\FRIZQT__.TTF", 8, "OUTLINE")
  19.         end
  20.  
  21.         frame.health.text:Show()
  22.         frame.health.text:SetText(healthPercentage .. "%")
  23.     end
  24. end)

Last edited by Ammako : 05-25-18 at 08:03 AM.
  Reply With Quote