I don’t want to move my unit frames but wants to show my health under my player. Like just a bar. No portrait or anything. Just HP. I have something like this for energy and wanted just HP so better see if I’m going to die.
Enable the Personal Resource Display
I don’t see that. I’m playing SoD btw.
Or if you want something small to play around with, you can post the following to the website addon.bool.no
to create/down a simple player health bar.
local function CreateBar(name, previous) -- Create StatusBar with a text overlay
local f = CreateFrame("StatusBar", "PersonalBar"..name, UIParent)
f:SetSize(100, 10)
f:SetPoint("CENTER", 0, -100)
f:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar")
f.BG = f:CreateTexture()
f.BG:SetAllPoints()
f.BG:SetDrawLayer("BACKGROUND", -1)
f.BG:SetColorTexture(1, 1, 1, 0.4)
f.Text = f:CreateFontString()
f.Text:SetFontObject(GameFontNormalSmall)
f.Text:SetPoint("CENTER")
f.Text:SetJustifyH("CENTER")
f.Text:SetJustifyV("CENTER")
return f
end
local function UpdateHealth(self) -- Update the health bar
local health = UnitHealth("player")
self:SetValue(health)
self.Text:SetText(FormatLargeNumber(health) .. '/' .. FormatLargeNumber(self.healthMax))
end
local function UpdateHealthMax(self) -- Update min./max. health values
self.healthMax = UnitHealthMax("player")
self:SetMinMaxValues(0, self.healthMax)
UpdateHealth(self)
end
local Health = CreateBar('Health') -- Create the health bar
Health:SetStatusBarColor(0, 1, 0) -- make it green
Health.BG:SetVertexColor(0, 0.7, 0.3)
Health:SetScript("OnEvent", function(self, event, ...)
if event == "UNIT_HEALTH_FREQUENT" then
UpdateHealth(self)
elseif event == "UNIT_MAXHEALTH" then
UpdateHealthMax(self)
else -- PLAYER_LOGIN
UpdateHealthMax(self)
end
end)
Health:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", "player") -- register the events to be used
Health:RegisterUnitEvent("UNIT_MAXHEALTH", "player")
Health:RegisterEvent("PLAYER_LOGIN") -- Initialise bar on login
1 Like