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

pause cooldown ability

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,555
@Ender Wiggins
That's an old post :p The cooldown functions didn't exist back then.

This should help:

But it's not that simple. In order to reference each ability that a unit has you'll need to keep track of them in a Hashtable. You do this by saving the ability id to the unit at an index. So the unit's first ability would be stored at index 1, second ability at index 2, etc... You would also want to store the number of abilities a unit has as well, which could be saved at index 0.

Then when the time comes to pause the cooldowns for a unit you would first load index 0 to get the unit's total number of abilities, and then from there use a For Loop going from 1 to Total number of abilities (the loaded value). Finally you'd load the abilities one at a time using the For Loop's provided integer, adjusting their cooldown with the the Get Cooldown/Set Cooldown functions. Something like this:

  • For each Integer A from 1 to (Load 0 of Key(Triggering unit) from CooldownHashtable do...
  • Set Variable Integer = Load (Integer A) of Key(Triggering Unit) from CooldownHashtable
  • Custom script: set udg_AbilityCode = udg_Integer
  • Set Variable Real = (Cooldown remaining of AbilityCode + 5.00)
  • Unit - For Unit (Triggering unit), start cooldown of ability AbilityCode " over " Real seconds.
The variables used in the trigger are named after their variable types.

Note that you MIGHT be able to do this without a Hashtable by getting the abilities by their index, I know you can do this with Item related abilities but I think that's exclusive to them.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,555
If you're on patch 1.31+ then you can use the method found in that link I posted. There's an Action that lets you Start the Cooldown of an ability. So you Start the cooldown of the ability and set it to it's current cooldown + X seconds.

If you wanted to do something like Void's Time Dilation ability, you would want to check if the abilities current cooldown is > 0.00 seconds before adjusting it, since it should only affect abilities that are currently on cooldown.

Disabling an ability will not pause it's cooldown. What I described before is your best option as far as I know.
 
Last edited:
Level 7
Joined
Sep 19, 2020
Messages
190
Status
Not open for further replies.
Top