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

attack speed system

Status
Not open for further replies.
Level 17
Joined
Jul 17, 2011
Messages
1,864
im making a system which is able to modify the attack speed of a unit with a smallest possible variation of only 1% so you can have 2% increased attack speed, 3%,.. 55%,56%,57% etc.. however i ran into a problem: i thought that the gloves of haste attack speed ability stacks but it appears that only works when a hero aquires multiple gloves of haste items and the effect does not work if you add multiple gloves of haste abilities.. so the only solution that i have so far is to make 100 attack speed abilities and just remove the old and add a new ability so if i wanted to make a hero gain 22% attack speed i would add ability# 22 assuming ability 1 gives 1% attack speed and ability 100 gives 100%
so is there another way to modify the attack speed maybe with upgrades or some other ability >.>
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
This is why we need more Math and Logic Classes in School.

You have to do something like Roman Numeric System

Have 1 ability with 5 levels: 0, 1, 2, 3, and 4% increase
Have 1 ability with 5 levels: 0, 5, 10, 15, and 20% increase
Have 1 ability with 5 levels: 0, 10, 20, 30, 40% increase.
Have 1 ability with 5 levels: 0, 20, 40, 60, 80% increase.

Add all the abilities to the unit and set them to lvl 1 (where they give no bonus)

Lets assume your unit starts increasing speed
- 1%, 2%, 3%, 4% (untill now it's just the 1% Ability level increase)
- Increases another to 5%, now you set 1%Abil to 0, and set 5%Abil to level 1. Then start with the 1%Abil again.
- Increases up to 10%, now set 1%Abil and 5%Abil to 0, and set 10%Abil to lvl 1, then start with the 1% abil again, and with the 5% abil again.
- Increases up to 20%, now set 1%Abil, 5%Abil, and 10%Abil to 0, and set 20%Abil to 1, then start with the others just as before.

I don't know the exact math in all this, but I know there is a formula that allows you to do this without having to use hundreds of ITE's statements, and without having to use a 100 levels ability.

With this system you can increase speed from 1% to 144% one by one with just those 4 abilities and some math formula (and an Ability array). In fact, this could work for critical strike and evasion as well, is not so heavy, seems pretty efficient, abilities can be hidden in a spellbook and many people could take advantage of this by simply using
  • t
  • Custom script: call SetSpeedBonus(someunit, 20) to Set Speed bonus to 20%
  • Custom script: call SetCriticalChance(someunit, 22) to set Critical Strike to 22%
  • Custom script: call SetEvasionChance(someunit, 68) to set Evasion to 68%
 
Level 17
Joined
Jul 17, 2011
Messages
1,864
Status
Not open for further replies.
Top