1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Participate in Blizzard's Public Test Realm to give them feedback on the upcoming patches. Info is here.
    Dismiss Notice
  3. Take part in forum poll and decide the winner of Icon Contest #16!
    Dismiss Notice
  4. Congratulate the winners of the first ATC contest!
    Dismiss Notice
  5. Zwiebelchen is hosting a special UI texturing contest. Whomever wins will get a $150 reward through paypal! Come along and draw your texturing tools for the Fantastic Adventurer UI contest.
    Dismiss Notice
  6. Sneak, pickpocket and assassinate! Create a stealth map in Mini-Mapping Contest #14!
    Dismiss Notice
  7. Music Contest #8 - Hive Soundtrack is up! Create the soundtrack for the upcoming videos of Hive Workshop's YouTube Channel.
    Dismiss Notice

[vJASS] Best Way to Get Armour?

Discussion in 'Triggers & Scripts' started by Mr_Bean, Apr 16, 2012.

  1. Mr_Bean

    Mr_Bean

    Joined:
    Feb 11, 2011
    Messages:
    1,823
    Resources:
    6
    Maps:
    2
    Spells:
    4
    Resources:
    6
  2. Arhowk

    Arhowk

    Joined:
    Aug 8, 2007
    Messages:
    2,751
    Resources:
    0
    Resources:
    0
    first, theres no snippet in that post as far as i can tell.

    anyway, idk, this might work
    Code (vJASS):
    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
     
  3. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,214
    Resources:
    5
    Icons:
    1
    Spells:
    4
    Resources:
    5
    You can study this script (or use it) to get accurate armor detection:
    http://www.wc3c.net/showthread.php?t=105849

    Make sure that your armor reduction multiplier constant isn't changed. (in game constants or whatever)
     
  4. Mr_Bean

    Mr_Bean

    Joined:
    Feb 11, 2011
    Messages:
    1,823
    Resources:
    6
    Maps:
    2
    Spells:
    4
    Resources:
    6
    Thanks guys! I will try them when I get back home.

    @Arhowk: I was referring to post #3 in that topic that I linked.
     
  5. Arhowk

    Arhowk

    Joined:
    Aug 8, 2007
    Messages:
    2,751
    Resources:
    0
    Resources:
    0
    Go to 11
     
  6. Magtheridon96

    Magtheridon96

    Joined:
    Dec 12, 2008
    Messages:
    6,017
    Resources:
    9
    Maps:
    1
    Spells:
    8
    Resources:
    9