Check cooldown of a skill

lucifekit

New Member
Reaction score
2
Is there anyway to check an ability is cooldown or not ?

I need to make an auto-cast system that will do this thing :
Example i have an hero with 4 ability
-Ability A don't have cooldown.
-Ability B have 1 second cooldown.
-Ability C have 5 second cooldown.
-Ability D have 20 second cooldown.
Then when a hero attack,he will use ability which have the biggest cooldown that isn't in cooldown time instead of normal attack.

Example the hero have 0.5s cooldown between each attack(0,5s each attack)
0s : He use ability D
0.5s later : Ability D is in cooldown,He use ability C
1s later : Ability D + C is in cooldown,He use ability B
1.5s later : Ability D + C +B is in cooldown,He use ability A
2s later: Ability D+C is in cooldown,Ability B is finish cooldown,He use ability B
2.5s later : Ability D + C +B is in cooldown,He use ability A
...
5s later : He use ability B
5.5s later : Ability C is finish cooldown,He use ability C
...
20s later : Ability D is finish cooldown,he use ability D

Sorry if i don't describle my idea clearly,but i wish u could understand it.So are there anyway to do this?

(I can use 4 timer to set 4 field in hashtable of the hero for each skill,but i want to find an easier way)
 

Tamisrah

Active Member
Reaction score
16
Except for the hashtable part this won't get any easier I'm afraid.
Instead of a hashtable you should look into some kind of unit attachment system. (for example AutoIndex)
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
If it's for a single boss hero, you could just use arrays.

If it's for multiple heroes, a hashtable would work better.

You'll probably need a little bit of Custom Script/JASS to create the timers you need.

Anyway, you can make it a little easier by storing them in decreasing order of cooldown. Then, you can just say "if the first one is done cooling down, I know it has the longest cooldown since I saved them in that order. Otherwise, check the next one" and so on.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
What I would do, is use hashtables to save the duration when casted, and every 1 second minus 1.00 from it. And then another periodic trigger that checks if the longest cooldown skill is ready, use it if it's ready, check for the next longest cooldown skill and so on.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top