Workshop rule for 1 Barrier tank per team

I want to make a 6v6 game mode where Barrier tanks are limited to one per team. Say you choose Winston, now the other person cannot pick Rein, Sigma, Ramattra, etc (excluding mauga and maybe Sara). I am unsure on how I could have it so thought I’d ask for help here.

Man… over a week and no help for such a simple thing.

here ya go, not sure if hero limits work (since bots never restrict hero’s and I have nobody to test it with) but it’ll work if the tank leaves and if you join after the tank is chosen

variables
{
	global:
		0: Barrier_Tanks

	player:
		0: Is_Barrier_Tank
}

rule("Barrier Tanks")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Global.Barrier_Tanks = Array(Hero(Ramattra), Hero(Reinhardt), Hero(Sigma), Hero(Winston));
	}
}

rule("Is Barrier Tank")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is True For Any(Global.Barrier_Tanks, Hero Of(Event Player) == Current Array Element) == True;
		Event Player.Is_Barrier_Tank != True;
	}

	actions
	{
		Set Player Allowed Heroes(Remove From Array(All Players(Team Of(Event Player)), Event Player), Remove From Array(All Heroes,
			Global.Barrier_Tanks));
		Event Player.Is_Barrier_Tank = True;
		Wait Until(Is True For All(Global.Barrier_Tanks, Hero Of(Event Player) != Current Array Element), 99999);
		Reset Player Hero Availability(All Players(Team Of(Event Player)));
		Event Player.Is_Barrier_Tank = False;
		Wait(0.500, Ignore Condition);
		Loop If Condition Is True;
	}
}

rule("Barrier Tank Left")
{
	event
	{
		Player Left Match;
		All;
		All;
	}

	conditions
	{
		Is True For All(All Players(Team Of(Event Player)), !Current Array Element.Is_Barrier_Tank) == True;
	}

	actions
	{
		Reset Player Hero Availability(All Players(Team Of(Event Player)));
	}
}

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

	conditions
	{
		Is True For Any(All Players(Team Of(Event Player)), Current Array Element.Is_Barrier_Tank) == True;
	}

	actions
	{
		Set Player Allowed Heroes(Event Player, Remove From Array(All Heroes, Global.Barrier_Tanks));
	}
}

So I managed to hop on with a friend and it appears to be working perfectly. Thankyou for the help.

1 Like