1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-23 05:30:41 -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 (level.allow_teamchange)
if (assignment == "")
{
if (assignment == "")
guids = strTok(getDvar("team_axis"), " ");
foreach (guid in guids)
{
guids = strTok(getDvar("team_axis"), " ");
foreach (guid in guids)
if (self getguid() == int(guid))
{
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"), " ");
foreach (guid in guids)
if (self getguid() == int(guid))
{
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();
flag_wait("initial_blackscreen_passed");
setDvar("team_axis", "");
setDvar("team_allies", "");
}
else
{
@ -2552,23 +2555,41 @@ save_teams_on_intermission()
{
level waittill("intermission");
text = "";
players = get_players("axis");
foreach (player in players)
axis_guids = "";
allies_guids = "";
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);
text = "";
players = get_players("allies");
foreach (player in players)
{
text += player getguid() + " ";
}
setDvar("team_allies", text);
setDvar("team_axis", axis_guids);
setDvar("team_allies", allies_guids);
}
all_voice_on_intermission()