• 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.

Cooldown Reset Help

Status
Not open for further replies.
Level 14
Joined
Oct 6, 2008
Messages
759
I'v done this in the past with the Add Ability/Remove Ability triggers. You make an integer which will detect at what lvl your spell is and if a cooldown reset activates you remove and then add back the spell and set it to its apropriate level via the options in the 'hero' triggers.

It's easier if it is not hero ability. Just remove it and add it again. Use timers and stuff if needed.
 
Level 7
Joined
Oct 16, 2010
Messages
194
You mean i remove the abilities which i do not want to reset cooldown and then use the reset cooldown trigger and add those skills which i removed back again?

Edit: i already tried it and it lagged the game everytime this trigger is used. Is there another way to do this or can you show me an example.
 
Level 11
Joined
Nov 15, 2007
Messages
800
You remove the ability you want to refresh, not the other abilities. Removing an ability from a unit refreshes its cooldown.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • Refresh Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Wait 0.00 seconds
      • Set Ability = (Ability being cast)
      • Set AbilityLevel = (Level of Ability for (Triggering unit))
      • Unit - Remove Ability from (Triggering unit)
      • Unit - Add Ability to (Triggering unit)
      • Unit - Set level of Ability for (Triggering unit) to AbilityLevel
AbilityLevel is Integer variable
Ability is Ability variable

But beware, this only works for single-cast spell such as Banish, Storm Bolt and others
You have to self-adjust the event to "A unit Finishes casting an ability" if the spell such as Flame Strike (requires a cast delay time)

Don't worry about the 0.00 second of wait there, it is still MUI and without it, the trigger will bug (the event occurs too fast), therefore putting a wait there is required.
 
Level 16
Joined
Aug 7, 2009
Messages
1,406
This works perfectly for me:

JASS:
function ResetCooldown takes unit whichUnit,integer whichAbility returns nothing
    local integer level=GetUnitAbilityLevel(whichUnit,whichAbility)

    if level>0 then
        call UnitRemoveAbility(whichUnit,whichAbility)
        call UnitAddAbility(whichUnit,whichAbility)
        call SetUnitAbilityLevel(whichUnit,whichAbility,level)
    endif
endfunction

It basically abuses a WC3 bug, where removing an ability from a unit/hero will remove the cooldown as well, so removing it and adding it back imediately will reset its cooldown.

Usage:
  • Custom script: call ResetCooldown(GetTriggerUnit(),GetSpellAbilityId())
  • Custom script: call ResetCooldown(udg_MyGlobalVariable,udg_MyAbility)
  • Custom script: call ResetCooldown(udg_MyGlobalUnit,'A000')
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
defskull, have you tested that? Removing the wait should not bug it, as removing an ability after casting it is common practice for dummy abilities.

I always test something before I post it, believe me.

You should test it, you should test it....

A Blood Mage cast Banish to himself (using my trigger, just remove the Wait), I wanna see did it work or not, try it.

Custom script: call ResetCooldown(GetTriggerUnit(),GetSpellAbilityId())
Custom script: call ResetCooldown(udg_MyGlobalVariable,udg_MyAbility)
Custom script: call ResetCooldown(udg_MyGlobalUnit,'A000')
You sure JASS has function like that ? 'ResetCooldown' ?
Why I kept getting errors "expected a function name", proves that this function does not exist ?

I have this and kept getting errors;

  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: set udg_AbilityID = GetSpellAbilityId()
      • Custom script: call ResetCooldown(GetTriggerUnit(), udg_AbilityID)
 
Last edited:
heh, I believe you man. Was just asking.

Perhaps it has something to do with the fact that dummy units are typically ordered "issue order targeting ___" and then the ability is removed to trigger that "instant" glitch/abusation.

Also, about this part:

You have to self-adjust the event to "A unit Finishes casting an ability" if the spell such as Flame Strike (requires a cast delay time)

You should be careful because not every ability behaves like flame strike (which is a rather strange one, actually)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Have you always remove the ability once your dummy has casted it ?
For what reason, actually ?

Hmmm, perhaps dummy unit settings are:
Art - Animation - Cast Backswing: 0
Art - Animation - Cast Point: 0

Making them almost instantly to cast the spell without animation delay

All units have animation delay, but if your dummy is none.mdx model, perhaps it does not have any animation to play, that's why almost instantly

This is just pure guess by the way
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Does a test map is required to make you believe ?

After you test the map, go to Trigger Editor and add Wait of 1.00 second above the Remove Ability function and see now that will work

But if it's instantly, the Footman unable to do anything since it requires him a cast animation.
 

Attachments

  • Cokemonkey.w3x
    16.6 KB · Views: 53
Status
Not open for further replies.
Top