I have a question for lua boffins! I'm struggling with my health on player characters.
I currently use this for my health tag to show the percentage and nothing else.
Code:oUF.Tags.Methods['hp'] = function(u) if UnitIsDead(u) or UnitIsGhost(u) or not UnitIsConnected(u) then return oUF.Tags.Methods['DDG'](u) else local per = oUF.Tags.Methods['perhp'](u).."" or 0 local min, max = UnitHealth(u), UnitHealthMax(u) return per end end oUF.Tags.Events['hp'] = 'UNIT_HEALTH'
Having done a little bit of casual arena I have noticed a flaw! I need to see health values on player characters. Could anybody help me achieve this? I don't know what is used to question if the target is a player or an NPC. Just to add I'd like to see values in simple K format. So 324k for 324000 health.
Code:local numFormat = function(v) if v > 1E10 then return (floor(v/1E9)).."b" elseif v > 1E9 then return (floor((v/1E9)*10)/10).."b" elseif v > 1E7 then return (floor(v/1E6)).."m" elseif v > 1E6 then return (floor((v/1E6)*10)/10).."m" elseif v > 1E4 then return (floor(v/1E3)).."k" elseif v > 1E3 then return (floor((v/1E3)*10)/10).."k" else return v end end oUF.Tags.Methods['hp'] = function(u) if UnitIsDead(u) or UnitIsGhost(u) or not UnitIsConnected(u) then return oUF.Tags.Methods['DDG'](u) else local per = oUF.Tags.Methods['perhp'](u) or 0 local cur = oUF.Tags.Methods['curhp'](u) or 0 if UnitIsPlayer(u) then return numFormat(cur).." - "..per else return per end end end oUF.Tags.Events['hp'] = 'UNIT_HEALTH'
Last edited by mmoc48efa32b91; 2013-03-03 at 10:26 PM.
Oh wow those are some really small partyframes.
I dig the look but I doubt I could effectively heal with unitframes that small.
Edit: how come the boss frame on the right is not skinned?
Thanks man.
You should fix up your minimap so it's square, not just square border with a round map.
I like your feel otherwise, bringing reworked default UIs to the tables. ;D
---------- Post added 2013-03-05 at 01:26 PM ----------
Yeah, I agree.
I've changed it since then and made everything fit a little bit better together.
I will be uploading a video with the links and ect to my channel a day or so after US 5.2 goes live.
You can check it out there, or here as I will be posting another video of it.
Thanks! Talk soon. :3