I have an ability on my siege tank with cooldowns and I want the cooldown to be active and therefore to decrease over time even after the unit is sieged into another form.
For example, if the unit is in Tank mode and I use the ability, when I morph to Siege mode the cooldown would just stop elapsing. The cooldown remains the same as it was the last moment this unit was in tank mode.
The text shown on chat is the remaining cooldown of the ability. You can see that even after a lot of time has passed in Siege mode, the cooldown was halted. How can I resume the cooldown? Tried using triggers but couldn't find an action modifying the cooldown. They just wouldn't work
Figured out myself. There's an easy way and the hard way.
The easy way: Just add the ability you want to share cooldown to both interchangeable units. Ex) Siege Tank Tank Mode and Siege Tank Siege Mode
And then just hide the ability in the command card for units you don't want to have the ability. I'm not sure if other methods to hide such as validator would work. But if it doesn't, then this method would be troublesome for abilities with auto cast since it can be casted whether or not it's hidden
The hard way: Use triggers. Create three variables. Two real varibles and a timer. One real variable would represent the real time cooldown and the other the displayed incorrect cooldown. There's unit A and unit B. The ability you want to sync cooldown to game time is in Unit A.
Trigger 1:
Event = TriggerAddEventUnitAbility(Ability you want to sync)
Action = Timer Start(The timer you created)
Trigger 2:
Event = TriggerAddEventUnitAbility(Morphing from unit A to unit B)
Action = Set Variable(Var: Incorrect cooldown variable, Val: UnitGetCooldown{Ability you want to sync} )
Trigger 3:
Event = TriggerAddEventTimePeriodic(dur: 0.1)
TriggerAddEvenUnitAbility(Morphing from unit B to unit A)
Action = Set Variable(Var: Real time cooldown variable, Val: TimerGetRemaining{t: The timer you created} )
UnitAbilityAddCooldown(inVal: ArithmeticReal{val1: Real time cooldown variable, op: minus, val2: Incorrect cooldown variable } )
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I have an ability on my siege tank with cooldowns and I want the cooldown to be active and therefore to decrease over time even after the unit is sieged into another form.
For example, if the unit is in Tank mode and I use the ability, when I morph to Siege mode the cooldown would just stop elapsing. The cooldown remains the same as it was the last moment this unit was in tank mode.
Here's an representation. https://vimeo.com/562643111
The text shown on chat is the remaining cooldown of the ability. You can see that even after a lot of time has passed in Siege mode, the cooldown was halted. How can I resume the cooldown? Tried using triggers but couldn't find an action modifying the cooldown. They just wouldn't work
Figured out myself. There's an easy way and the hard way.
The easy way: Just add the ability you want to share cooldown to both interchangeable units. Ex) Siege Tank Tank Mode and Siege Tank Siege Mode
And then just hide the ability in the command card for units you don't want to have the ability. I'm not sure if other methods to hide such as validator would work. But if it doesn't, then this method would be troublesome for abilities with auto cast since it can be casted whether or not it's hidden
The hard way: Use triggers. Create three variables. Two real varibles and a timer. One real variable would represent the real time cooldown and the other the displayed incorrect cooldown. There's unit A and unit B. The ability you want to sync cooldown to game time is in Unit A.
Trigger 1:
Event = TriggerAddEventUnitAbility(Ability you want to sync)
Action = Timer Start(The timer you created)
Trigger 2:
Event = TriggerAddEventUnitAbility(Morphing from unit A to unit B)
Action = Set Variable(Var: Incorrect cooldown variable, Val: UnitGetCooldown{Ability you want to sync} )
Trigger 3:
Event = TriggerAddEventTimePeriodic(dur: 0.1)
TriggerAddEvenUnitAbility(Morphing from unit B to unit A)
Action = Set Variable(Var: Real time cooldown variable, Val: TimerGetRemaining{t: The timer you created} )
UnitAbilityAddCooldown(inVal: ArithmeticReal{val1: Real time cooldown variable, op: minus, val2: Incorrect cooldown variable } )