first, theres no snippet in that post as far as i can tell.
anyway, idk, this might work
Jass:
function GetUnitArmor takes unit u returns real
local real hp = GetUnitState(u, UNIT_STATE_LIFE)
local real damage
call UnitDamageTarget( u, u, 10.0, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
set damage = hp - GetUnitState(u, UNIT_STATE_LIFE)
call SetUnitState(u, UNIT_STATE_LIFE, hp)
if damage > 10.0 then
set damage = 20.0 - damage
return (damage-10.0)/(damage*0.06)
endif
return (10.0-damage)/(damage*0.06)
endfunction
just remmeber the constants are correct