Post by Wildhorn
Is 'unit' defined in blizzard's base code or am I overlooking it somewhere?
It is neither. "unit" has to be replaced by
something.
So your first code box is correct, your 2nd box code cant works.
Post by Wanderingfox
Is 'unit' defined in blizzard's base code or am I overlooking it somewhere?
It is neither. "unit" has to be replaced by
something.
So your first code box is correct, your 2nd box code cant works.
Not true.
function CreateHealthBar(unit)
local currentHP = UnitHealth(unit)
local maxHP = UnitHealthMax(unit)
local createManyHealthBars = CreateFrame("Statusbar", "healthBars", UIParent)
createManyHealthBars:SetMinMaxValues(0, maxHP)
createManyHealthBars:SetValue(currentHP)
end
Called like this:
CreateHealthBar("SomeValidUnitID")
Combining the above with some frame recycling/creating code, and you can dynamically create frames without too much trouble.