1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-23 13:40:22 -05:00

Encounter: add better team randomization between games

This commit is contained in:
Jbleezy
2023-04-22 20:12:46 -07:00
parent 480bde9619
commit 11e33d7ec3
2 changed files with 49 additions and 31 deletions

View File

@ -58,31 +58,28 @@ menuautoassign( comingfrommenu )
{ {
if ( sessionmodeiszombiesgame() ) if ( sessionmodeiszombiesgame() )
{ {
if (level.allow_teamchange) if (assignment == "")
{ {
if (assignment == "") guids = strTok(getDvar("team_axis"), " ");
foreach (guid in guids)
{ {
guids = strTok(getDvar("team_axis"), " "); if (self getguid() == int(guid))
foreach (guid in guids)
{ {
if (self getguid() == int(guid)) assignment = "axis";
{ break;
assignment = "axis";
break;
}
} }
} }
}
if (assignment == "") if (assignment == "")
{
guids = strTok(getDvar("team_allies"), " ");
foreach (guid in guids)
{ {
guids = strTok(getDvar("team_allies"), " "); if (self getguid() == int(guid))
foreach (guid in guids)
{ {
if (self getguid() == int(guid)) assignment = "allies";
{ break;
assignment = "allies";
break;
}
} }
} }
} }

View File

@ -1144,6 +1144,9 @@ round_start_wait(time, initial)
level thread freeze_hotjoin_players(); level thread freeze_hotjoin_players();
flag_wait("initial_blackscreen_passed"); flag_wait("initial_blackscreen_passed");
setDvar("team_axis", "");
setDvar("team_allies", "");
} }
else else
{ {
@ -2552,23 +2555,41 @@ save_teams_on_intermission()
{ {
level waittill("intermission"); level waittill("intermission");
text = ""; axis_guids = "";
players = get_players("axis"); allies_guids = "";
foreach (player in players)
if (level.allow_teamchange)
{ {
text += player getguid() + " "; players = get_players("axis");
foreach (player in players)
{
axis_guids += player getguid() + " ";
}
players = get_players("allies");
foreach (player in players)
{
allies_guids += player getguid() + " ";
}
}
else
{
players = array_randomize(get_players());
for (i = 0; i < players.size; i++)
{
if (i % 2 == 0)
{
axis_guids += player getguid() + " ";
}
else
{
allies_guids += player getguid() + " ";
}
}
} }
setDvar("team_axis", text); setDvar("team_axis", axis_guids);
setDvar("team_allies", allies_guids);
text = "";
players = get_players("allies");
foreach (player in players)
{
text += player getguid() + " ";
}
setDvar("team_allies", text);
} }
all_voice_on_intermission() all_voice_on_intermission()