View Single Post
01-13-14, 07:04 AM   #13
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
What you are looking for can be done very easily nowadays. First you need a texture in the shape that you are looking for. You can shape a texture by adjusting the alpha layer of the TGA file.

Next you write an addon that integrates that graphic. A working health bar is this one:
Lua Code:
  1. local function OnUnitHealthFrequent(bar)
  2.   local hcur, hmax = UnitHealth(bar.unit), UnitHealthMax(bar.unit)
  3.   local hper = 0
  4.   if hmax > 0 then hper = hcur/hmax end
  5.   bar:SetValue(hper)
  6. end
  7.  
  8. local bar = CreateFrame("StatusBar","MyAddonMyHealthBar", UIParent)
  9. bar.unit = "player"
  10. bar:SetSize(100,100)
  11. bar:SetPoint("CENTER",0,0)
  12. bar:SetMinMaxValues(0, 1)
  13. bar:SetStatusBarTexture(PATH_TO_YOUR_SHAPED_TEXTURE)
  14. bar:SetStatusBarColor(1,0,0)
  15. bar:SetOrientation("VERTICAL")
  16. bar:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", bar.unit)
  17. bar:RegisterEvent("PLAYER_LOGIN")
  18. bar:SetScript("OnEvent", OnUnitHealthFrequent)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote