• 🏆 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!

[Trigger] Set unit +1%AS per 2%HP lost

Status
Not open for further replies.
Level 3
Joined
Jun 17, 2015
Messages
53
I got the trigger of Nichilus that helped me with this

+1AS per 1%HP lost
http://www.hiveworkshop.com/forums/...quest-making-lols-olaf-berserker-rage-267325/

Now i want to change to +1AS per 2%HP lost (max 20/40/60/80%), but i tried everything / 2 it didnt work, here is my trigger

  • Viking Spirit
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
      • (Viking_User is alive) Equal to (==) True
    • Actions
      • Set Viking_HP = (100 - (Integer((Percentage life of Viking_User))))
      • Set Viking_HP = (Min(Viking_HP, (0 + (20 x (Level of Viking Spirit for Viking_User)))))
      • Set Viking_1 = ((Viking_HP mod 10) + 1)
      • Set Viking_10 = ((Viking_HP / 10) + 1)
      • Unit - Set level of Viking AS (1) for Viking_User to Viking_1
      • Unit - Set level of Viking AS (10) for Viking_User to Viking_10


i tried
  • Set Viking_HP = (100 - (Integer((Percentage life of Viking_User) / 2)))
  • or
  • Unit - Set level of Viking AS (1) for Viking_User to (Viking_1 / 2)
  • Unit - Set level of Viking AS (10) for Viking_User to (Viking_10 / 2)
but seem like it didnt work
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
I will add a second line after first, so it is easier to see what to change.
  • Viking Spirit
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
      • (Viking_User is alive) Equal to (==) True
    • Actions
      • Set Viking_HP = (100 - (Integer((Percentage life of Viking_User))))
      • Set Viking_HP = (Viking_HP / 2)
      • Set Viking_HP = (Min(Viking_HP, (0 + (20 x (Level of Viking Spirit for Viking_User)))))
      • Set Viking_1 = ((Viking_HP mod 10) + 1)
      • Set Viking_10 = ((Viking_HP / 10) + 1)
      • Unit - Set level of Viking AS (1) for Viking_User to Viking_1
      • Unit - Set level of Viking AS (10) for Viking_User to Viking_10
 
Level 3
Joined
Jun 17, 2015
Messages
53
is it different than?
  • Set Viking_HP = (100 - (Integer((Percentage life of Viking_User) / 2)))
anyway 1 error
  • Set Viking_HP = (Min(Viking_HP, (0 + (20 x (Level of Viking Spirit for Viking_User)))))
i dont know why but it feels something wrong
At lv1, max at 20%HP
My hero got 710HP, 80% of HP=568. But my hero's HP are 480 it only gives 17%AS

i dont know what's wrong with Viking_HP min max @_@?
 
Last edited:

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
What's up with all these calculations? Surely you can make it easier.

set level of ability to (100 - percentage hp) / 2.

More specifically:
set variable = (100 - percentage hp) / 2
if(variable is greater than or equal to 20/40/60/80) then
set variable to 20/40/60/80
endif
set level of ability to variable

Just gonna point out that reaching 80% is impossible. Max physically possible is 50 since if you have 1% hp (99 missing) you will have 49/40 stacks, depending on how wc3 rounds numbers.

edit: I assumed you had an ability which increase attack speed by 1% for each level.
 
Status
Not open for further replies.
Top