Jump to content

LF HP % on Nameplates script / addon

script percent nameplate execute

  • Please log in to reply
9 replies to this topic

#1 BalanceRexxar

BalanceRexxar
  • Junkies
  • Posts: 409

Posted 09 June 2013 - 12:38 AM

I play WW monk and touch of death is only 10% so the majority of the time I only have one chance to use it before they either die from something else or go to 11% or higher, what I'm looking for is very simple.

I'm looking for a script / addon that keeps default blizzard nameplates and has a health % above on or below the nameplate itself.

If anyone has a script to do so or knows of an addon that shows % but deosn't change the look or castbar of the default nameplates I'd be very grateful.

Thanks yo.

#2 Frion

Frion
  • Junkies
  • Posts: 17

Posted 10 June 2013 - 04:13 PM

Sorry for no author of this but i just dont know (have alot scripts saved in txt file)
local fixvalue = function(val)
	if(val >= 1e6) then
		return ('%.2f'..SECOND_NUMBER_CAP):format(val / 1e6):gsub('%.?0+(['..FIRST_NUMBER_CAP..SECOND_NUMBER_CAP..'])$', '%1')
	elseif(val >= 1e4) then
		return ('%.1f'..FIRST_NUMBER_CAP):format(val / 1e3):gsub('%.?0+(['..FIRST_NUMBER_CAP..SECOND_NUMBER_CAP..'])$', '%1')
	else
		return val
	end
end
CreateFrame('frame'):SetScript('OnUpdate', function(self, elapsed)
	 for index = 1, select('#', WorldFrame:GetChildren()) do
		  local f = select(index, WorldFrame:GetChildren())
		  if f:GetName() and f:GetName():find('NamePlate%d') then
			   f.h = select(1, select(1, f:GetChildren()):GetChildren())
			   if f.h then
					if not f.h.v then
						 f.h.v = f.h:CreateFontString(nil, "ARTWORK")   
						 f.h.v:SetPoint("CENTER", f.h, 'CENTER')
						 f.h.v:SetFont(STANDARD_TEXT_FONT, 9, 'OUTLINE')
					else
						 local _, maxh = f.h:GetMinMaxValues()
						 local val = f.h:GetValue()
						 f.h.v:SetText(string.format("%s - %d%%", fixvalue(val), math.floor((val/maxh)*100)))
					end
			   end
		  end
	 end
end)


#3 BalanceRexxar

BalanceRexxar
  • Junkies
  • Posts: 409

Posted 11 June 2013 - 05:10 AM

thanks man

#4 Vernaz

Vernaz
  • Members
  • Posts: 10
  • LocationAustralia

Posted 20 June 2013 - 06:21 AM

If you don't want to use a script I suggest Healthbartext addon

#5 Thazable

Thazable
  • Premium Junkies
  • Posts: 232

Posted 17 July 2013 - 02:26 PM

That's actually pretty neat, but is there a way to only display the actual % on the plates w/o the hp value?

#6 Wildbreath

Wildbreath
  • Premium
  • Posts: 26

Posted 30 July 2013 - 06:20 AM

i'm author

#7 Syncrow

Syncrow
  • Premium
  • Posts: 183

Posted 01 August 2013 - 07:15 PM

View PostThazable, on 17 July 2013 - 02:26 PM, said:

That's actually pretty neat, but is there a way to only display the actual % on the plates w/o the hp value?

CreateFrame('frame'):SetScript('OnUpdate', function(self, elapsed)
  for index = 1, select('#', WorldFrame:GetChildren()) do
	local f = select(index, WorldFrame:GetChildren())
	if f:GetName() and f:GetName():find('NamePlate%d') then
	  f.h = select(1, select(1, f:GetChildren()):GetChildren())
	  if f.h then
	 if not f.h.v then
	   f.h.v = f.h:CreateFontString(nil, "ARTWORK")  
	   f.h.v:SetPoint("RIGHT")
	   f.h.v:SetFont(STANDARD_TEXT_FONT, 9, 'OUTLINE')
	 else
	   local _, maxh = f.h:GetMinMaxValues()
	   local val = f.h:GetValue()
	   f.h.v:SetText(string.format(math.floor((val/maxh)*100)).." %")
	 end
	  end
	end
  end
end)


#8 Thazable

Thazable
  • Premium Junkies
  • Posts: 232

Posted 06 August 2013 - 11:03 AM

View PostSyncrow, on 01 August 2013 - 07:15 PM, said:

CreateFrame('frame'):SetScript('OnUpdate', function(self, elapsed)
for index = 1, select('#', WorldFrame:GetChildren()) do
local f = select(index, WorldFrame:GetChildren())
if f:GetName() and f:GetName():find('NamePlate%d') then
	 f.h = select(1, select(1, f:GetChildren()):GetChildren())
	 if f.h then
	 if not f.h.v then
	 f.h.v = f.h:CreateFontString(nil, "ARTWORK")
	 f.h.v:SetPoint("RIGHT")
	 f.h.v:SetFont(STANDARD_TEXT_FONT, 9, 'OUTLINE')
	 else
	 local _, maxh = f.h:GetMinMaxValues()
	 local val = f.h:GetValue()
	 f.h.v:SetText(string.format(math.floor((val/maxh)*100)).." %")
	 end
	 end
end
end
end)
Wow, big thanks buddy. :)

#9 rufse

rufse
  • Members
  • Posts: 9

Posted 05 September 2015 - 04:16 PM

So ive been loving and using the below script for a while now, but with the latest patch its been acting up. It will now show a really long string of numbers for percentage. So a nameplate will now show something like:

(0.98826968543855 - 98%)

Any code savvy lifesavers got an idea whats gone wrong since 6.2.2 ?



View PostFrion, on 10 June 2013 - 04:13 PM, said:

Sorry for no author of this but i just dont know (have alot scripts saved in txt file)
local fixvalue = function(val)
if(val >= 1e6) then
return ('%.2f'..SECOND_NUMBER_CAP):format(val / 1e6):gsub('%.?0+(['..FIRST_NUMBER_CAP..SECOND_NUMBER_CAP..'])$', '%1')
elseif(val >= 1e4) then
return ('%.1f'..FIRST_NUMBER_CAP):format(val / 1e3):gsub('%.?0+(['..FIRST_NUMBER_CAP..SECOND_NUMBER_CAP..'])$', '%1')
else
return val
end
end
CreateFrame('frame'):SetScript('OnUpdate', function(self, elapsed)
for index = 1, select('#', WorldFrame:GetChildren()) do
local f = select(index, WorldFrame:GetChildren())
if f:GetName() and f:GetName():find('NamePlate%d') then
f.h = select(1, select(1, f:GetChildren()):GetChildren())
if f.h then
if not f.h.v then
f.h.v = f.h:CreateFontString(nil, "ARTWORK")
f.h.v:SetPoint("CENTER", f.h, 'CENTER')
f.h.v:SetFont(STANDARD_TEXT_FONT, 9, 'OUTLINE')
else
local _, maxh = f.h:GetMinMaxValues()
local val = f.h:GetValue()
f.h.v:SetText(string.format("%s - %d%%", fixvalue(val), math.floor((val/maxh)*100)))
end
end
end
end
end)


#10 DrGogo

DrGogo
  • Members
  • Posts: 1

Posted 06 May 2016 - 07:10 PM

View PostSyncrow, on 01 August 2013 - 07:15 PM, said:

CreateFrame('frame'):SetScript('OnUpdate', function(self, elapsed)
for index = 1, select('#', WorldFrame:GetChildren()) do
local f = select(index, WorldFrame:GetChildren())
if f:GetName() and f:GetName():find('NamePlate%d') then
	 f.h = select(1, select(1, f:GetChildren()):GetChildren())
	 if f.h then
	 if not f.h.v then
	 f.h.v = f.h:CreateFontString(nil, "ARTWORK")
	 f.h.v:SetPoint("RIGHT")
	 f.h.v:SetFont(STANDARD_TEXT_FONT, 9, 'OUTLINE')
	 else
	 local _, maxh = f.h:GetMinMaxValues()
	 local val = f.h:GetValue()
	 f.h.v:SetText(string.format(math.floor((val/maxh)*100)).." %")
	 end
	 end
end
end
end)

Hello.. I use your nameplate percent code. Very great. I need health value and healt percent code. For example: 497k - 100%

Could you please do this for me ?

Thank You





Also tagged with one or more of these keywords: script, percent, nameplate, execute

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

<