Ability Cooldown Trigger Not Applying

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
I have a trigger which puts every spell for every "Music Box" out there on cooldown. See below:

  • Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set MusicBoxSongsCount = 1
      • Set MusicBoxSongs[MusicBoxSongsCount] = Pokemon Road
      • Set MusicBoxSongsCount = (MusicBoxSongsCount + 1)
      • Set MusicBoxSongs[MusicBoxSongsCount] = Snow Mountain
  • Unit Group - Pick every unit in MusicBoxGroup and do (Actions)
    • Loop - Actions
      • For each (Integer A) from 1 to MusicBoxSongsCount, do (Actions)
        • Loop - Actions
          • Game - Display to (All players) for 1.00 seconds the text: (Name of MusicBoxSongs[(Integer A)])
          • Unit - For Unit (Picked unit), Set cooldown of ability MusicBoxSongs[(Integer A)], Level: 1 to 5.00
During testing, I only have 1 Music Box. The display spits out the name of both abilities (as expected), but only the 1 ability, which was cast, goes on cooldown. Both abilities are level 1. Does anyone know why both abilities aren't going on cooldown?
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
2,010
This trigger seems incomplete...
but only the 1 ability, which was cast, goes on cooldown. Both abilities are level 1. Does anyone know why both abilities aren't going on cooldown?
I think your own statement answers your question...? Obviously if you cast a spell it will go on cooldown, not the other one you remained untouched.
Maybe I figured out what could have made you confused about "triggering the cooldown":
  • Unit - For Unit (Triggering unit), Set cooldown of ability AnyAbility, Level: 1 to 9.00
This doesn't trigger the cooldown, it just sets the cooldown of an ability to a value for the next cast.
The quickest way to trigger cooldowns is via spellbook, since it has an option to share all ability cooldowns
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
Oooohhh.....I thought that function would put the spell on cooldown, not simply change it's cooldown amount. Oops....Well if cooldowns won't stop people spamming music changes, I'll have to think of another way. I'm not sure I want to use spellbook in this case because it hides all songs under another layer of UI. I'm thinking I'll just add a "Wait5Seconds" timer and disallow music changes until it equals 0.

Thanks for your help.
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
If you give the unit 0 cast backswing and the spells no animation tags it can cast them all instantly. You'd just have to trigger animations for spells if you want them.

Another solution: use the passive with cooldown trick to temporarily 'replace' the other spells with shared cooldown with passive versions that instantly go on cooldown. Have a trigger that detects when these spells are cast and the next time disable/remove and enable/re-add the normal abilities again. Turn that second trigger off while the first one is working so it doesn't detect the first cast that starts the cooldown.

Edit: @Kyrbi0 -- here's a use for that trick, boom.
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
The spells already casts instantly upon casting and the Music system works fine except players could spam music changes. I originally thought the below line would put the specified spell on cooldown:

  • Unit - For Unit (Triggering unit), Set cooldown of ability AnyAbility, Level: 1 to 9.00
I wanted to use that to stop music change spamming. Don't worry, my timer solution seems to do the job.


  • Music Select
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Music Box (Hidden)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Remaining time for MusicChangeCooldown) Less than or equal to 0.00
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to Pokemon Road
            • Then - Actions
              • Set MusicSelectedPath = war3mapImported\Pokemon Road.mp3
              • Set MusicSelectedLength = 56.00
              • Set MusicSelectedName = Pokemon Road
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Ability being cast) Equal to Snow Mountain
                • Then - Actions
                  • Set MusicSelectedPath = war3mapImported\Snow Mountain (Cropped).mp3
                  • Set MusicSelectedLength = 90.00
                  • Set MusicSelectedName = Snow Mountain
                • Else - Actions
          • Countdown Timer - Start MusicChangeCooldown as a One-shot timer that will expire in 5.00 seconds
          • Game - Display to (All players) for 5.00 seconds the text: ((PlayerColours[(Player number of (Triggering player))] + (Name of (Triggering player))) + ( |rhas changed the song to + (MusicSelectedName + .)))
          • Trigger - Run Music Play <gen> (ignoring conditions)
        • Else - Actions
          • Game - Display to (All players) for 5.00 seconds the text: ((Please wait + (String((Integer((Remaining time for MusicChangeCooldown)))))) + second(s) before changing the song.)


Edit: I'll look into the above solution and consider implementing it. Thanks for sharing :)
 
Status
Not open for further replies.
Top