Plz help me. Trying to create gamemode

trying to create a gamemode that, for every kill that the player gets, decreases the cool down timer for all abilities by 2%.
How can I create this? I’d really appreciate any help. I’ve tried for over 3hrs and I’m just frustrated now.

rule("Rule 1")
{
	event
	{
		Player Dealt Final Blow;
		All;
		All;
	}

	actions
	{
		Set Ability Cooldown(Event Player, Button(Primary Fire), Ability Cooldown(Event Player, Button(Primary Fire)) * 0.980);
		Set Ability Cooldown(Event Player, Button(Secondary Fire), Ability Cooldown(Event Player, Button(Secondary Fire)) * 0.980);
		Set Ability Cooldown(Event Player, Button(Ability 1), Ability Cooldown(Event Player, Button(Ability 1)) * 0.980);
		Set Ability Cooldown(Event Player, Button(Ability 2), Ability Cooldown(Event Player, Button(Ability 2)) * 0.980);
		Set Ability Cooldown(Event Player, Button(Crouch), Ability Cooldown(Event Player, Button(Crouch)) * 0.980);
	}
}

I have tried this and something else that’s similar to this and it still has no effect on the cool downs. I have been trying to do this in the workshop the standard way. Should I be just copying this text file into a folder somewhere instead?

When your game uses english localization, you should just need to copy the provided code above by Teawy, to your clipboard, then you go into your workshop editor menu and press the button that says paste rules, it should paste the textual code and transpile the code into workshop syntax in time and is ready for testing. If your localization is different you need to paste it into a text file first, then change and translate some instrincts key words like rule; action and condition into your language in which you are working for the workshop, copy/paste the change into the workshop as explained above. Second method is to ask for a share code, translation and transpiling into the right target format is done automatically.

1 Like

Gotcha. I really appreciate the help guys.

But I can’t seem to get it to work the way I had intended. I am trying to get the length of the abilities’ normal cool down time to decrease by 2% every time a player gets a kill. (Example: for an ability that has a normal cool down of 10seconds, then after 10 kills it would permanently be 20% less cool down time every time that ability is used) What I believe this code is doing instead is taking the remaining cool down time at the time of each kill and reducing it by 2%. Which feel like little to no effect.

Well that requires a bit more and different setup, and the goal as i forseen it that each ability should end up with 0s of cooldown? Tell us a bit more of what you trying to do, does it involve a reset of decreasing so that it won’t up ending to become 0?

1 Like

Yes exactly. After around 50 kills there would be no cool down at all. (I understand that due to compounding that it won’t be exactly 50, that’s okay.) Getting a kill would decrease the cool down rate of each ability by 2%. And it would remain 2% less for each use, until the next kill is gotten. Then after the next kill, the cool down timers would be 2% less than before. And so on and so forth. Until the cool downs are 0. If a player has 1 kill the cool down timers would be 98% of their usual time. If they have 5 kills then their cool down timers will be 90% of what they would normally be. Etc etc. I hope that is a good explaination.

So you want the maximum cooldown to become 2% shorter for every kill, not the current ability cooldown.

rule("Rule 1")
{
	event
	{
		Player Joined Match;
		All;
		All;
	}

	actions
	{
		Event Player.A = 1;
	}
}

rule("Rule 2")
{
	event
	{
		Player Dealt Final Blow;
		All;
		All;
	}

	conditions
	{
		Event Player.A > Null;
	}

	actions
	{
		Event Player.A -= 0.020;
	}
}

rule("Rule 3")
{
	event
	{
		Player Died;
		All;
		All;
	}

	conditions
	{
		Attacker == Victim;
	}

	actions
	{
		Event Player.A += 0.020;
	}
}

rule("Rule 4")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Ability Cooldown(Event Player, Button(Primary Fire)) != Null;
	}

	actions
	{
		Set Ability Cooldown(Event Player, Button(Primary Fire), Ability Cooldown(Event Player, Button(Primary Fire)) * Event Player.A);
	}
}

rule("Rule 5")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Ability Cooldown(Event Player, Button(Secondary Fire)) != Null;
	}

	actions
	{
		Set Ability Cooldown(Event Player, Button(Secondary Fire), Ability Cooldown(Event Player, Button(Secondary Fire))
			* Event Player.A);
	}
}

rule("Rule 6")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Ability Cooldown(Event Player, Button(Ability 1)) != Null;
	}

	actions
	{
		Set Ability Cooldown(Event Player, Button(Ability 1), Ability Cooldown(Event Player, Button(Ability 1)) * Event Player.A);
	}
}

rule("Rule 7")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Ability Cooldown(Event Player, Button(Ability 2)) != Null;
	}

	actions
	{
		Set Ability Cooldown(Event Player, Button(Ability 2), Ability Cooldown(Event Player, Button(Ability 2)) * Event Player.A);
	}
}

rule("Rule 8")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Ability Cooldown(Event Player, Button(Crouch)) != Null;
	}

	actions
	{
		Set Ability Cooldown(Event Player, Button(Crouch), Ability Cooldown(Event Player, Button(Crouch)) * Event Player.A);
	}
}

The new ability cooldown would trigger the next time the ability goes on cooldown.

If you don’t want it to work like in FFA that suicide increases the cooldown by 2% again, remove “Rule 3”.

1 Like

Alternatively here is my attempt currently only for Ana, the end result is identically to Teawy’s way, but requires more effort, my thought was to obtain the initial cooldowns of every ability a heroe has, store them into an Array, on obtained kill these cooldowns change and will be applied later on when triggering an ability with cooldown and when the kill counter is greater than 0, but it turns out to be redundant the way i attemtping it as it is, cause the cooldown registry would look different for each hero so it adds to much complexity, Teawy’s is more straightforward, the difference is the ability’s cooldown in Teawy’s example will be applied twice, after an elimination and outside of the elimination, it can be seen as a guard operation, in my example they are applied once outside the elimination rule as you will notice below:

variables
{
	player:
		0: Cooldowns
		1: Eliminations
		2: UpdatedCooldowns
}

rule("Register cooldowns")
{
	event
	{
		Ongoing - Each Player;
		All;
		Ana;
	}

	conditions
	{
		Is In Setup == True;
		Is Alive(Event Player) == True;
		Has Spawned(Event Player) == True;
	}

	actions
	{
		Wait(1, Ignore Condition);
		"Primary Fire"
		Event Player.Cooldowns[0] = 0;
		"Secondary Fire"
		Event Player.Cooldowns[1] = 0;
		Press Button(Event Player, Button(Ability 1));
		Wait(1, Ignore Condition);
		"Ability 1"
		Event Player.Cooldowns[2] = Round To Integer(Ability Cooldown(Event Player, Button(Ability 1)), Up);
		Wait(1, Ignore Condition);
		Press Button(Event Player, Button(Ability 2));
		Wait(1, Ignore Condition);
		"Ability 2"
		Event Player.Cooldowns[3] = Round To Integer(Ability Cooldown(Event Player, Button(Ability 2)), Up);
		"Crouch Ability"
		Event Player.Cooldowns[4] = 0;
	}
}

rule("Decrease Cooldowns by 2% per kill")
{
	event
	{
		Player Earned Elimination;
		All;
		All;
	}

	conditions
	{
		Count Of(Event Player.Cooldowns) == 5;
	}

	actions
	{
		Event Player.Eliminations += 1;
		Event Player.UpdatedCooldowns = Mapped Array(Event Player.Cooldowns, Round To Integer(
			Current Array Element - Current Array Element * (1 - 0.980) * Event Player.Eliminations, Down));
	}
}

rule("Apply new cooldown Primary Fire")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Event Player.Eliminations > Null;
		Ability Cooldown(Event Player, Button(Primary Fire)) > Null;
	}

	actions
	{
		Set Ability Cooldown(Event Player, Button(Primary Fire), Event Player.UpdatedCooldowns[0]);
	}
}

rule("Apply new cooldown Secondary Fire")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Event Player.Eliminations > Null;
		Ability Cooldown(Event Player, Button(Secondary Fire)) > Null;
	}

	actions
	{
		Set Ability Cooldown(Event Player, Button(Secondary Fire), Event Player.UpdatedCooldowns[1]);
	}
}

rule("Apply new cooldown Ability 1")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Event Player.Eliminations > Null;
		Ability Cooldown(Event Player, Button(Ability 1)) > Null;
	}

	actions
	{
		Set Ability Cooldown(Event Player, Button(Ability 1), Event Player.UpdatedCooldowns[2]);
	}
}

rule("Apply new cooldown Ability 2")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Event Player.Eliminations > Null;
		Ability Cooldown(Event Player, Button(Ability 2)) > Null;
	}

	actions
	{
		Set Ability Cooldown(Event Player, Button(Ability 2), Event Player.UpdatedCooldowns[3]);
	}
}

rule("Apply new cooldown Crouch")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Event Player.Eliminations > Null;
		Ability Cooldown(Event Player, Button(Crouch)) > Null;
	}

	actions
	{
		Set Ability Cooldown(Event Player, Button(Crouch), Event Player.UpdatedCooldowns[4]);
	}
}
1 Like

They both work perfectly. I really appreciate it guys. u guys are so nice

2 Likes