HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Resetting Ability Cooldowns

01-23-2009, 05:51 AM#1
Valdez
Hey, I was wondering if it was possible to reset the cooldowns of a units abilities via triggers (Yes I know it is possible via GUI using the "Reset ability cooldowns of <Unit>") but that way will not work for me because it resets all cooldowns, including those of items that the unit has in its inventories.

So essentially is it possible to reset a units abilities without reseting item cooldowns for that unit!

Thanks in advance!! :P
01-23-2009, 05:56 AM#2
akolyt0r
maybe removing and adding the ability again would do the job...
01-23-2009, 06:00 AM#3
ShadowWolf
Would removing the abilities then giving them back work? It'd be a hassle and more work than it's worth and I'm not even sure it works.

edit: damn ninja post before me
01-23-2009, 06:10 AM#4
fX_
Do not forget to note the level of the ability before removing it, if it is a leveled ability.

store level
remove
add
set level
01-23-2009, 07:01 AM#5
Valdez
Well if that is the only way I'm not going to bother trying.. would cause more problems then its worth IMO.

But I have a another question.. is their any way to activate the cooldown of an ability for a unit using triggers?
01-23-2009, 09:05 AM#6
Troll-Brain
And what it does if you put the items on the floor, reset cooldown, and then give back the items to the unit ?
01-23-2009, 10:39 AM#7
fX_
It is not so complicated. You need only one function that runs straight:

Collapse JASS:
function lalala takes...
local integer INT_Level = GetUnitAbilityLevel(theUnit, theAbility)
call UnitRemoveAbility(theUnit, theAbility)
call UnitAddAbility(theUnit, theAbility)
call SetUnitAbilityLevel(theUnit, theAbility, INT_Level)
endfunction

that's it
01-23-2009, 10:42 AM#8
Troll-Brain
Quote:
Originally Posted by fX_
It is not so complicated. You need only one function that runs straight:

Collapse JASS:
function lalala takes...
local integer INT_Level = GetUnitAbilityLevel(theUnit, theAbility)
call UnitRemoveAbility(theUnit, theAbility)
call UnitAddAbility(theUnit, theAbility)
call SetUnitAbilityLevel(theUnit, theAbility, INT_Level)
endfunction

that's it
no you must use the booleans of the functions Remove/AddAbility to be safe.
If UnitRemove... then UnitAdd...
Also i dunno if it works if an unit own an item which have an ability, but maybe it works.
01-23-2009, 10:44 AM#9
ShadowWolf
Quote:
Originally Posted by Troll-Brain
And what it does if you put the items on the floor, reset cooldown, and then give back the items to the unit ?
I like this idea. Now why the hell didn't I think of that?
01-23-2009, 11:19 AM#10
Valdez
Actually I found away around all of that. Now it still resets item cooldowns but not the item that gives the ability so it is essentially fixed as far as I'm concerned.

Trigger:
Refresher
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Refresher
Collapse Actions
Unit - Reset ability cooldowns for (Casting unit)

Will reset all the abilities before the actual "Refresher" ability fires so it doesn't reset its own cooldown.

I origionally used:

Trigger:
Refresher
Collapse Events
Unit - A unit uses an item
Collapse Conditions
(item-type of (item being manipulated)) Equal to Multi-Purpose Walker 4500
Collapse Actions
Unit - Reset ability cooldowns for (triggering unit)

in that one, the reset is applied after the ability goes on cooldown so essentially gives you an infinite CD reset witch is very bad..
01-23-2009, 09:01 PM#11
marshall
I believe with the event "begins casting an ability" that it is possible for the player to abort the cast before cooldown sets in (albeit quite difficult to do), so even with your method it may still be possible to have infinite Refresher... not sure - it might not be a problem for instant-cast abilities.
01-23-2009, 09:10 PM#12
Szythe
I don't believe that is an issue for abilities cast via items, which don't factor in the cast time of the hero.