[Spell] Cooldown after MULTIPLE CAST

Level 5
Joined
Feb 22, 2025
Messages
78
Is there a way to trigger this action:
When X ability being cast( which has 0 cooldown set in Object editor) 3 times in row it gets cooldown via triggers?

Another instance would be: Let's take teleport for example which has 5 sec cooldown set in OE, suppose that unit has a *talent which resets cooldown after first cast and sets the timer of 3 seconds to cast it again and after the 2nd cast it gets a cooldown or if the timer expiers for the 2nd cast it gets a cooldown. :goblin_boom:
 
Level 29
Joined
Sep 26, 2009
Messages
2,594
For both spells it makes more sense to set 0 second cooldown in OE. You would track number of casts via trigger variable and when it hits 3 casts, you run a trigger action that starts a cooldown for an ability.

Here is an example of Holy Light ability that goes on cooldown every 3 casts:
  • Holy Light
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Holy Light
    • Actions
      • Set VariableSet HolyLightCounter = ((HolyLightCounter + 1) mod 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HolyLightCounter Equal to 0
        • Then - Actions
          • Unit - For Unit (Triggering unit), start cooldown of ability (Ability being cast) " over "5.00 seconds.
        • Else - Actions
As for the second ability - you need to count number of casts similar to how it works for first ability, but also run a timer alongside it. If the timer expires first, you start cooldown and reset counter. If you cast the ability two times first, you pause timer and reset counter.
Here is example for Blink:
  • Blink
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink
    • Actions
      • Set VariableSet BlinkCounter = ((BlinkCounter + 1) mod 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BlinkCounter Equal to 0
        • Then - Actions
          • Trigger - Run Blink Start Cooldown <gen> (checking conditions)
        • Else - Actions
          • Set VariableSet BlinkCaster = (Triggering unit)
          • Countdown Timer - Start BlinkTimer as a One-shot timer that will expire in 3.00 seconds
  • Blink Start Cooldown
    • Events
      • Time - BlinkTimer expires
    • Conditions
    • Actions
      • Set VariableSet BlinkCounter = 0
      • Countdown Timer - Pause BlinkTimer
      • Unit - For Unit BlinkCaster, start cooldown of ability Blink " over "5.00 seconds.
Note that these examples are not MUI. If you want this to be MUI, you would need to use arrays instead of non-arrays like in my example and use something like unit indexer and track each unit's data under different index in the array.
 
Level 5
Joined
Feb 22, 2025
Messages
78
For both spells it makes more sense to set 0 second cooldown in OE. You would track number of casts via trigger variable and when it hits 3 casts, you run a trigger action that starts a cooldown for an ability.

Here is an example of Holy Light ability that goes on cooldown every 3 casts:
  • Holy Light
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Holy Light
    • Actions
      • Set VariableSet HolyLightCounter = ((HolyLightCounter + 1) mod 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HolyLightCounter Equal to 0
        • Then - Actions
          • Unit - For Unit (Triggering unit), start cooldown of ability (Ability being cast) " over "5.00 seconds.
        • Else - Actions
As for the second ability - you need to count number of casts similar to how it works for first ability, but also run a timer alongside it. If the timer expires first, you start cooldown and reset counter. If you cast the ability two times first, you pause timer and reset counter.
Here is example for Blink:
  • Blink
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink
    • Actions
      • Set VariableSet BlinkCounter = ((BlinkCounter + 1) mod 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BlinkCounter Equal to 0
        • Then - Actions
          • Trigger - Run Blink Start Cooldown <gen> (checking conditions)
        • Else - Actions
          • Set VariableSet BlinkCaster = (Triggering unit)
          • Countdown Timer - Start BlinkTimer as a One-shot timer that will expire in 3.00 seconds
  • Blink Start Cooldown
    • Events
      • Time - BlinkTimer expires
    • Conditions
    • Actions
      • Set VariableSet BlinkCounter = 0
      • Countdown Timer - Pause BlinkTimer
      • Unit - For Unit BlinkCaster, start cooldown of ability Blink " over "5.00 seconds.
Note that these examples are not MUI. If you want this to be MUI, you would need to use arrays instead of non-arrays like in my example and use something like unit indexer and track each unit's data under different index in the array.
Tnx, I have Unit INDEX in my map, I'll try to make this work, tnx again! :)
 
Top