• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[vJASS] Best Way to Get Armour?

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
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
 
Status
Not open for further replies.
Top