Hey all 
Working on a custom combat system. The goal at this point is to make 1 armor reduce 1 damage. This is how it works in Gaia's Retaliation, for example, a unit deals 20 damage, the attacked unit has 5 armor, thus taking 15 damage.
I am using systems for damage detection and to determine armor. I have my trigger at the point where each time a unit is attacked, it displays the attacker, attacker's armor, defender, defenders armor, full damage (before armor), and reduced damage (after armor). Using these variables, I figured I could make this system first by reducing the effects of the normal wc3 system.
Next step would be to apply the new damage. I changed that line to:
My test:
I set up a little area with a hero and a footmen.
The results:
The first time a unit with full health is hit, they take the normal wc3 combat system determined damage (the reduced damage). At that point, they both seem to be in perpetual combat. Their life seems to be set to their max life minus the damage dealt. Each hit. I am not sure why. I thought it might be the GetWidgetLife returning the units max life, but I tested that too and it returns the current life.
I am sure someone sees a simple logical error that I have made, or better yet, I will figure it out as soon as I finally hit submit. Either way, help/advice/suggestions always appreciated
Thanks!
Working on a custom combat system. The goal at this point is to make 1 armor reduce 1 damage. This is how it works in Gaia's Retaliation, for example, a unit deals 20 damage, the attacked unit has 5 armor, thus taking 15 damage.
I am using systems for damage detection and to determine armor. I have my trigger at the point where each time a unit is attacked, it displays the attacker, attacker's armor, defender, defenders armor, full damage (before armor), and reduced damage (after armor). Using these variables, I figured I could make this system first by reducing the effects of the normal wc3 system.
JASS:
call SetWidgetLife(defender, GetWidgetLife(defender) + reducDamage)
Next step would be to apply the new damage. I changed that line to:
JASS:
call SetWidgetLife(defender, (GetWidgetLife(defender) + reducDamage) + (fullDamage - defenderArmor))
My test:
I set up a little area with a hero and a footmen.
The results:
The first time a unit with full health is hit, they take the normal wc3 combat system determined damage (the reduced damage). At that point, they both seem to be in perpetual combat. Their life seems to be set to their max life minus the damage dealt. Each hit. I am not sure why. I thought it might be the GetWidgetLife returning the units max life, but I tested that too and it returns the current life.
I am sure someone sees a simple logical error that I have made, or better yet, I will figure it out as soon as I finally hit submit. Either way, help/advice/suggestions always appreciated