Thread Tools Display Modes
08-08-12, 01:42 AM   #1
Sentacursa
A Deviate Faerie Dragon
 
Sentacursa's Avatar
Join Date: Aug 2012
Posts: 13
Question on Health

Hello: first time posting here. so kinda hard to explain
coding left top unit frames
all works nicely except the text over health bar.
complete stuck there and with my lack on english i can't really find good info
hope u guys can help me with it

Code:
			local health = CreateFrame("StatusBar",nil,self);
			health:SetFrameStrata("BACKGROUND");
			health:SetFrameLevel(2);
			health:SetWidth(150);
			health:SetHeight(30);
			health:SetPoint("TOPLEFT",self.Castbar,"BOTTOMLEFT",0,-2);

			
			
			health.value = health:CreateFontString(nil, "OVERLAY", "FontOutline10");
			health.value:SetWidth(135);
			health.value:SetHeight(11);
			health.value:SetJustifyH("RIGHT");
			health.value:SetJustifyV("MIDDLE");
			health.value:SetPoint("LEFT",health,"LEFT",4,0);
			

			
			self.Health = health;
			self.Health.frequentUpdates = true;
			self.Health.colorDisconnected = true;
			self.Health.colorHealth = true;

			healt.value:SetText("something%");
at the bottom is where i'm stuck

tryd the following, without luck

Code:
		    local min, max = UnitHealth(self.unit), UnitHealthMax(self.unit);
			local gHealth = (min/max)*100;
			health.value:SetText(gHealth);
also tryd including registerevents for unit health and maxhealth and with update and preupdate, finally considerd to post here.
thank you
  Reply With Quote
08-08-12, 03:02 PM   #2
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
Where is the "local min/max" code located, PostUpdateHealth? Also, have you looked at using Tags? I would suggest it for any basic handling of font strings.

Last edited by Freebaser : 08-08-12 at 03:04 PM.
  Reply With Quote
08-08-12, 03:07 PM   #3
Sentacursa
A Deviate Faerie Dragon
 
Sentacursa's Avatar
Join Date: Aug 2012
Posts: 13
Originally Posted by Freebaser View Post
Where is the "local min/max" code located, PostUpdateHealth? Also, have you looked at using Tags? I would suggest it for any basic handling of font strings.
found it there ty
that was just the info i needed ty
  Reply With Quote
08-09-12, 12:13 PM   #4
Sentacursa
A Deviate Faerie Dragon
 
Sentacursa's Avatar
Join Date: Aug 2012
Posts: 13
Ty Freebaser, with ur help i have my player frame done: wanted to give u a little peek for if u where interested..


  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Question on Health


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off