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

[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:
Level 18
Joined
Nov 21, 2012
Messages
835
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