I'm in the midst of making a WoW addon for RP'ers and I have come across a bit of a difficult problem. I've written up this addon to have a Health indicator, and a Barrier indicator. The Barrier takes any damage before damage is applied to health, and even carries over if there is a remainder
Bob has 3 Barrier and 10 HP, he takes 4 damage so he now has 9 HP.
I've decided to add another layer of protection, which is Armor. This armor would act as another static healthbar that protect the players HP value.
So Bob has 3 Barrier, 5 Armor and 10 HP. He then takes 4 damage, and now has 0 Barrier, 4 Armor and 10 HP. Then he takes 5 Damage, and now has 0 Barrier, 0 Armor and 9 HP.
All of this would be typed out into the chat of whatever group was appropriate, like this
I'm having issues implimenting this armor bar, this is what I have so far.
apdmg = 0
hpdmg = 0
bdmg = 0
if TempHP >=0 then hpdmg = tdmg - TempHP
else hpdmg = tdmg - apdmg end
if hpdmg < 0 then hpdmg = 0 end
if apdmg < 0 then hpdmg = 0 end
bdmg = tdmg - hpdmg
tdmg - ArmorPoints = apdmg
TempHP = TempHP - bdmg
HealthPoints = HealthPoints - hpdmg
ArmorPoints = ArmorPoints - apdmg
if ArmorPoints < 0 then ArmorPoints = 0 end
if HealthPoints < 0 then HealthPoints = 0 end
if TempHP < 0 then TempHP = 0 end
if statsop == "True" then
hpinput:SetText(HealthPoints)
armorinput:SetText(ArmorPoints)
thpinput:SetText(TempHP) end
--apdmg = Armor point Damage
--hpdmg = Health Point damage
--bdmg = Barrier Damage
--TempHP is also a version of barrier damage.
However when i add this to the addon, and try to activate the function I get the following error message.
Note: Line 1666 is the following
block:SetScript("OnClick", function()
C_Timer.After(1, function()
--d20 = tonumber(roll)
d20t = d20 + Block + DefMod
if d20t >= DifficultyCheckDef then
OutC = "Pass" else
OutC = "Fail"
end
and line 1634 is simply this
apinput:SetText(ArmorPoints)