• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Way to keep cooldown on spell when removed

Status
Not open for further replies.
Level 7
Joined
Jun 14, 2009
Messages
235
Hello, I was wondering if there is a way to maintain the cooldown on a spell, when you remove and later add a spell. To be more specific, I am removing a spell based off of Channel, and then adding it again, however the cooldown refreshes. I was wondering if there is a way to prevent that, or a similar work-around.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
I think its possible with vJASS - JASS but with GUI its nearly impossible.

It definatly is not possible. JASS is the trigger scripting language WC3 uses so is not super powerful like many people think.

An idea occured to me. You could keep track of cooldown using timers. When the ability is used, you start a timer with a timeout of the abiliti's cooldown. You then make a system to keep track of ability removal and addition. If the ability is removed before the cooldown timer (the one started when cast) finishes, then it can not be added until the timer expires (which signifies the ability has cooled down). This could be done by abstracting the add and remove process where it can only give the unit the ability if and when the cooldown timer expires otherwise until then it only virtually has it (a custom function returns the unit has the ability even though it physically does not).

This can be viewed as a form of proxy with caching functionality. Because the remove and add ability are heavyweight due to cooldown (can not remove and add without messing it up), the proxy gets interacted with which inturn manages ability removal and addition in such a way cooldown is consistent.

Be aware though that this could cause the ability to go missing for a length of time. This however is the only MUI way to do what you want.
 
Level 7
Joined
Jun 14, 2009
Messages
235
It definatly is not possible. JASS is the trigger scripting language WC3 uses so is not super powerful like many people think.

An idea occured to me. You could keep track of cooldown using timers. When the ability is used, you start a timer with a timeout of the abiliti's cooldown. You then make a system to keep track of ability removal and addition. If the ability is removed before the cooldown timer (the one started when cast) finishes, then it can not be added until the timer expires (which signifies the ability has cooled down). This could be done by abstracting the add and remove process where it can only give the unit the ability if and when the cooldown timer expires otherwise until then it only virtually has it (a custom function returns the unit has the ability even though it physically does not).

This can be viewed as a form of proxy with caching functionality. Because the remove and add ability are heavyweight due to cooldown (can not remove and add without messing it up), the proxy gets interacted with which inturn manages ability removal and addition in such a way cooldown is consistent.

Be aware though that this could cause the ability to go missing for a length of time. This however is the only MUI way to do what you want.

Interesting. The hero I'm making will only be used by 1 player at a time, so it should work fine with the way you first posted. Thanks for the help.
 
Status
Not open for further replies.
Top