Multiple "Set Ability Cooldown" - bug?

Hi all! I’m fairly new to the Workshop. I’ve encountered something that does look like a bug, though.

The following code does not work as expected. Only the cooldown of Ability 2 is reset, not both. The Inspector says both are executed.

actions
{
	Set Ability Cooldown(All Players(All Teams), Button(Ability 1), 0);
	Set Ability Cooldown(All Players(All Teams), Button(Ability 2), 0);
}

If I have any number of Set Ability Cooldown() in sequence, only the last one seems to be executed, e.g. if I reorder the last two commands, Ability 1 will get reset instead.

However, if there is a Wait() inserted in between, everything works as expected.

actions
{
	Set Ability Cooldown(All Players(All Teams), Button(Ability 1), 0);
	"Wait seems to be necessary for both cooldown commands to be executed"
	Wait(0.016, Ignore Condition);
	Set Ability Cooldown(All Players(All Teams), Button(Ability 2), 0);
}

Is this a bug, or, am I missing something?

Appreciate the help, thank you!

Interestingly, this works fine for me, but in these instances it’s only done to a single player.

Perhaps this bug only occurs when an array of players are being affected?

1 Like

This is apparently fixed on ptr:

Fixed a bug where setting multiple Ability Cooldowns within the same frame could fail

4 Likes

Ah, I should have checked the PTR notes. Thanks for your help!

This is rule number 1 for workshop coding: Whenever some actions don’t get executed as expected, put a wait action and see if this fixes it :slight_smile:

1 Like