if maxHealth > smaxHealth3 and health > smaxHealth3 then -- set shield
local lmaxHealth = maxHealth
s3 = health - smaxHealth3
ms3 = maxHealth - smaxHealth3
maxHealth = 0 -- maxhealth = 0
health = health - s3 -- health - shield
print(s3)
maxHealth = lmaxHealth -- maxhealth = lastmaxhealth
end
if maxHealth > smaxHealth2 and health > smaxHealth2 then -- set shield
local lmaxHealth = maxHealth
s2 = health - smaxHealth2
ms2 = maxHealth - smaxHealth2
maxHealth = 0 -- maxhealth = 0
health = health - s2 -- health - shield
maxHealth = lmaxHealth -- maxhealth = lastmaxhealth
end
if maxHealth > smaxHealth and health > smaxHealth then -- set shield
local lmaxHealth = maxHealth
shield = health - smaxHealth -- health - setmaxhealth(100)
maxHealth = 0 -- maxhealth = 0
health = health - shield -- health - shield
maxHealth = lmaxHealth -- maxhealth = lastmaxhealth
end
These are my if statements for each stage of my shield system shown here:
https://www.youtube.com/watch?v=vUUeM1YQoFs&user=badfitz66
bottom one being the yellow bar, green being the middle. I added the top just now.
Is there any way I can condense this?
What's Wolfgang McHairyback gonna do? |