View Single Post
05-18-13, 11:04 PM   #3
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
I'm making health text for a HUD addon I'm working on I got the bars updating I just gotta work on the text that I've honestly never dealth with before.

Then if I want the numbers to run and update with health changes I can just do this?
Lua Code:
  1. f.HealthText = f:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
  2. f.HealthText:SetPoint("BOTTOM",f.hp,0,0)
  3. local currentHealth, maxHealth = UnitHealth("player"), UnitHealthMax("player")
  4. local function update(self)
  5.   local unit = self.unit
  6.   f.PowerText:SetFormattedText("%d/%d", currentPower, maxPower)
  7. f:SetScript("OnEvent",update)
  8. f:RegisterUnitEvent("UNIT_HEALTH",f.unit)
  9.  
  10. update(f) --initial update
__________________
Tweets YouTube Website

Last edited by 10leej : 05-18-13 at 11:10 PM.
  Reply With Quote