Maintain hero selection limits post team switch

I’m trying to build an attack/defend assault mode that’s juiced up and has offensive/defensive specific hero selection limits. At all times the defensive team should only be able to select Torbjorn, and at all times the offensive team should only be able to select anyone but Torbjorn.

My problem is that I enable competitive rules so that each team gets a chance on both O and D, and when the teams swap after the first round the now attacking team is still only able to select Torb while the now defending team has access to the rest of the roster.

I want the defending team to always only be able to select Torb.

I want the attacking team to always only be able to select everyone except for Torb.

I am juicing up all the heroes individually so those changes I’ve made need to also apply if that changes anything. Obviously I can reapply them.

My understanding is that at the beginning of the game, TEAM 1 is always on defense and TEAM 2 is always on offense.

Any ideas?

OK this worked except that when the game on competitive mode goes into a third and fourth round, the options switch. In both rounds 3 and 4 offense now can only select Torb. Is there a way to have this rule persist through both overtime rounds?

Forgot that the Teams don’t switch sides between Round 2 and 3…

rule("Rule 1")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Is Assembling Heroes == True;
	}

	actions
	{
		If(Is Team On Offense(Team 1));
			Set Player Allowed Heroes(All Players(Team 1), Remove From Array(All Heroes, Hero(Torbjörn)));
			Set Player Allowed Heroes(All Players(Team 2), Hero(Torbjörn));
		Else;
			Set Player Allowed Heroes(All Players(Team 1), Hero(Torbjörn));
			Set Player Allowed Heroes(All Players(Team 2), Remove From Array(All Heroes, Hero(Torbjörn)));
		End;
	}
}

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

	actions
	{
		If(Is Team On Offense(Team Of(Event Player)));
			Set Player Allowed Heroes(Event Player, Remove From Array(All Heroes, Hero(Torbjörn)));
		Else;
			Set Player Allowed Heroes(Event Player, Hero(Torbjörn));
		End;
	}
}

And yes; this is pretty much the same as before except that it doesn’t use a global variable to keep track of the current Round.

This worked. Thank you!

1 Like