View Single Post
11-02-22, 10:54 PM   #1
realitysucks
A Defias Bandit
Join Date: Nov 2022
Posts: 2
target health percentage

i used to have an addon back in retail wrath and on private servers which showed status text in a neat way, i have the code here but it doesnt work with the classic client, does anyone know how to make it behave like intended?

i know theres an option to show percentage and status text in game but i dont like how its displayed

Code:
hooksecurefunc("TextStatusBar_UpdateTextString", function(textStatusBar)
	if textStatusBar == TargetFrameHealthBar and not GetCVarBool("statusTextPercentage") and not textStatusBar.showPercentage then
		local s = TargetFrameTextureFrameHealthBarText:GetText()
		if s then
			s = string.match(s, "[^%/%(]+")
			if s then
				TargetFrameTextureFrameHealthBarText:SetText(s.."("..tostring(math.ceil((UnitHealth("target") / UnitHealthMax("target")) * 100)).."%)")
			end
		end
	end
end)
this is how it looks like:
  Reply With Quote