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

[Solved] Reset a single ability cooldown inside a spellbook

Status
Not open for further replies.
So, I have been encountering this roadblock for one of my ability ideas in which I wanted to create an ability that resets its cooldown whenever the unit evades an attack.

Detecting when the evasion happens is not a problem, as all attacks are scripted anyway.


However, actually resetting the cooldown seems to be a huge issue.

So far, I tried the following:

  • Using UnitResetCooldown and temporarily hiding all other abilities via SetPlayerAbilityAvailable --> Result: All cooldowns will be resetted, regardless of if an ability is hidden or not
  • Removing the ability inside the spellbook and re-adding it via the adder book again --> Result: The ability resets properly, but as soon as I remove the original spellbook containing the ability (which is required to add the ability again), the spellbook closes itself as if the player pressed ESC
  • Defining a second level of the ability with a zero cooldown, then setting/incrementing ability levels to the no-cooldown level and resetting it back, --> Result: no effect. The original cooldown will still be used until the timer has expired. Adding a wait or timer interval inbetween the level changes doesn't change anything.

... I'm out of ideas at this point. Anything? Please?
 
Last edited by a moderator:
Removing the ability inside the spellbook and re-adding it via the adder book again --> Result: The ability resets properly, but as soon as I remove the original spellbook containing the ability (which is required to add the ability again), the spellbook closes itself as if the player pressed ESC

yes, that works
to reopen spellbook you can use force to press key
  • resetSpellbookRoar
    • Events
      • Player - Player 1 (Red) types a chat message containing roar as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Spell BookRoar1 for Antonidas 0000 <gen>) Greater than 0
        • Then - Actions
          • Unit - Remove Spell BookRoar1 from Antonidas 0000 <gen>
          • Unit - Add Spell BookRoar2 to Antonidas 0000 <gen>
          • Player - Disable Spell BookRoar2 for Player 1 (Red)
          • Game - Force Player 1 (Red) to press the key d
        • Else - Actions
          • Unit - Remove Spell BookRoar2 from Antonidas 0000 <gen>
          • Unit - Add Spell BookRoar1 to Antonidas 0000 <gen>
          • Player - Disable Spell BookRoar1 for Player 1 (Red)
          • Game - Force Player 1 (Red) to press the key d
d=hot key
however I dont know how to detect *if* player has currectly spell book opened or closed..
 
yes, that works
to reopen spellbook you can use force to press key

d=hot key
however I dont know how to detect *if* player has currectly spell book opened or closed..
... what basicly kills the idea already.

In that case, I would rather make the adder book have multiple levels and have identical copies of the spell I can switch back and forth between by adjusting the adder book level.
This would always work, but it's kind of a convoluted workaround I would rather try to avoid.
 
I found a super simple solution to my problem:
Just increment/decrement the level of the spellbook used to add the ability whenever you want to reset the cooldown. This basicly does the same as removing/adding the ability, but without the UI closing the spellbook in the process.

The book used to add the ability doesn't even need to be set to two levels. Inc/Dec ability level works despite the book only having one ability level.


Problem solved.
 
Status
Not open for further replies.
Top