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

[Request] Making LoL's Olaf Berserker Rage

Status
Not open for further replies.
Level 3
Joined
Jun 17, 2015
Messages
53
I tried to make the spell, here's the tooltips:
Berserker Rage
Olaf's gains 1% attack speed for every 1% of his missing health.

I tried to create a-100 levels spell but it cause lag a lot, i watched some sample spells that uses two spell, First is 1-9, second is 10-90 but i dont know how it works... :goblin_cry:

Please, i need somebody help me that can make a sample spell that working like the tooltips, and for the future ill save the sample spell for another spell that works same like it.
 
Level 25
Joined
Sep 26, 2009
Messages
2,373
well, that's really simple. You have those two abilities, although they should start both from 0 (0-9 and 0-90). To calculate the levels you have to do this:
(100.00 - current_percent_hp) = X
Y = (X / 10) + 1
Z = (X % 10) + 1
Y is level of the ability which uses multiples of 10 (10, 20, etc.)
Z is the level of the second ability.

For example let's say your unit has 27% hp. That means the increase should be 73%.
100.00 - current_percent_hp = 100.00 - 27.00 = 73.00. Convert that number into integer (if it ain't already).
Y = (73 / 10) + 1 = 7 + 1 = 8
Z = (73 % 10) + 1 (% means modulo) = 3 (the remainder after dividing 73 by 10) + 1 = 4.

So now you know that you have to set one ability to level 8 and second ability to level 4.
Setting the ability which uses multiples of 10 to level 8 will cause it to give 70% bonus (remember, you start with 0% at level 1, so the number 70 is at level 8).
The second ability gives you 3% bonus (again, you start at 0% for level 1, so level 4 gives you 3% bonus).

The total is 73% which is the desired amount.

This is how it should look in actual trigger:
  • Actions
    • Set X = (Integer((100.00 - (Percentage life of *your unit*))))
    • Set Y = ((X / 10) + 1)
    • Set Z = ((X mod 10) + 1)
    • Unit - Set level of *stronger boost ability* for *your unit* to Y
    • Unit - Set level of *weaker boost ability* for *your unit* to Z
Of course you should choose batter names than X, Y and Z. I just put them inside the trigger so you can easily refer to what I wrote.
 
Level 3
Joined
Jun 17, 2015
Messages
53
about the mod, can you do an example of it? (calculate in GUI)

  • Set Z = ((X mod 10) + 1)
anyway here's the trigger i've made by follow your steps

  • Viking Blood
    • Events
      • Time - Every 0.10 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_10 = ((Viking_HP / 10) + 1)
      • Set Viking_1 = ((Viking_HP / 10) + 1)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Percentage life of Viking_User) Greater than (>) ((100.00 - 10.00) - (20.00 x (Real((Level of Viking Speed for Viking_User)))))
          • Then - Actions
            • Unit - Set level of Viking AS (+10) for Viking_User to (2 + (2 x (Level of Viking Speed for Viking_User)))
            • Unit - Set level of Viking AS (+1) for Viking_User to 1
          • Else - Actions
            • Unit - Set level of Viking AS (+10) for Viking_User to Viking_10
            • Unit - Set level of Viking AS (+1) for Viking_User to Viking_1


here i add the limit that his Attack Speed bonus stop at 30/50/70/90% HP, but here's the result when i tested:

-At level 1, it doesnt increases any AS bonus while im losing HP
-At Speed Limit, it doesnt decreases when im gained HP (ex: im in 50%HP = 50AS, when im regen to 100%HP it still give 50AS)
-And how can i make it gain 1AS every 2%HP missing?
 
Last edited:
Level 25
Joined
Sep 26, 2009
Messages
2,373
the mod option can be found under "Math - Modulo".

The reason why it doesn't increase any attack speed is because you immediately give your unit the maximum attack speed.
This is basically your If/Then/Else (ITE) structure:
Code:
If (Conditions)
    %Hp is greater than 70/50/30/10%
Then (Actions)
    Set level of (+10) ability to max allowed
    Set level of (+1) ability to 1
Else
    Set level of (+10) ability to calculated amount
    Set level of (+1) ability to calculated amount
Example situation: Your hero has 80% hp and level 1 of the ability. 80% is greater than the 70% limit, so he goes to the "Then" block which sets the bonus AS to the max allowed amount. I think you just need to set the condition from "Greater than" to "Less than".

There is a way to make this work without ITE however. That's by using the "Math - Min" function. This function takes two parameters (two numbers) and returns to you the lesser one of the two. So you could do for example this:
  • Set X = (Integer((100.00 - (Percentage life of Viking_User))))
  • Set X = (Min(X, (10 + (20 x (Level of Viking Speed for Viking_User)))))
  • ... now here is the Y and Z calculation, etc.
So what this does is that it gets two numbers and returns you the lesser one of the two. At level 1 the limit is 30% AS, so if your hero has 80% Hp, then the bonus should be 20%. Min(20,30) returns 20 so it's all OK.
But if your hero had for example 45% Hp, then the bonus should be 55%. Min(55,30) is 30, so he's stuck at getting 30% attack speed.
That way you need no ITE.

As for the 1% AS per 2% lost Hp, I guess you could first divide the X amount by 2 before checking it via the Min function?
For example your hero has 30% Hp and level 2 of the ability, meaning the check should be max 50% AS. Now because hero has 30%, that means 70% is lost. If you divide 70/2, you get 35% increased attack speed. Then check via Min(35, 50), which returns 35% (I guess the limit is losing its purpose here, but it matters not ATM).
 
Level 3
Joined
Jun 17, 2015
Messages
53
here's the sample map, if you are free please edit and test cuz i changed and it wont works (changed a little)
 

Attachments

  • Berserker Blood.w3x
    18.5 KB · Views: 45
Level 25
Joined
Sep 26, 2009
Messages
2,373
It won't work in the sample map you posted because:
- Mountain King does not have Berserker Blood and AC abilities
- You did not change the other calculation from ((Hp/10)+1) to ((Hp mod 10)+1)
- While you did change the condition, you also swapped the actions from Then block to Else block and vice-versa, which basically nulled the fix.

The fixed map is attached below. I add another trigger there for test purpose only: When you press ESC key, the game will display message with how much Hp is Viking_User missing and the values of Viking_1 and Viking_10 variables.

As far as I tested it via those messages, it showed correct values.
 

Attachments

  • Berserker Blood.w3x
    18.7 KB · Views: 92
Level 3
Joined
Jun 17, 2015
Messages
53
First is i appologize with the sample map, 'cause i copy n paste so fast then i forget to add the Berserker Blood and AC Abilities

- About the triggers,i wasnt understand then i need u to fix and yeah i understand it now.
- And 1 question: i changed the "Attack Speed bonus" to "Item Life Regen Bonus" but the regen wont work. Is "Item Life Regen" is an unlevelable ability?
 
Level 3
Joined
Jun 17, 2015
Messages
53
ty for infomations and your helps, added rep4u

anyway, i saw DotA's necrolyte have this skill

Sadist
Reveling in death and pain, the Necrolyte gains 1/2/3/4hp and 1/2/3/4mana regeneration for killing units. Lasts 6 seconds. Hero Kills give 10 times the bonus

then i thought they were used the Item Life Regen
 
Last edited:
Status
Not open for further replies.
Top