Assigning Teams in Lyra

I’m trying to create a lobby based system where you can manually assign teams to the ShooterCore Experience inside Lyra, however I can’t seem to see anywhere how the teams are assigned. Currently they just assign the host to team 1, with every player joining after that switching between team 1 and 2.

Where are the teams assigned in the Lyra game logic?

Cheers

You are assigned a team via this C++ function of the ULyraTeamCreationComponent:

void ULyraTeamCreationComponent::ServerChooseTeamForPlayer(ALyraPlayerState* PS)
{
	if (PS->IsOnlyASpectator())
	{
		PS->SetGenericTeamId(FGenericTeamId::NoTeam);
	}
	else
	{
		const FGenericTeamId TeamID = IntegerToGenericTeamId(GetLeastPopulatedTeamID());
		PS->SetGenericTeamId(TeamID);
	}
}

You can of course change that however you want using C++.

1 Like