More teams, names and colors
A team game's script can have up to 64 teams, where Halo 3 stops at eight. Declare how many once, at the top level of the script, from 2 to 64:
declare team_count = 32
team[0] to team[31] then exist, for each team visits all 32 and the neutral team, and current_player.team can be set to any of them. They work like Halo 3's teams: teammates can't hurt each other, the scoreboard, game-over screen and carnage report group and score them, and team chat and team voice follow them. Without a declaration the map and game type decide, with at most eight. A mode with classes has as many teams as its teams, and a team_count must match them. Game types says which can have more than eight.
- Play it with teams: set
"rounds.teams" = 1in the header. - VIP: every team has its own VIP. A one-VIP game gives the VIP to one of the first eight teams.
- Territories: any team captures and holds territories. One-sided Territories defends with one of the first eight teams.
- The declaration replaces the map's own team count in the game types that can have more than eight, so a map made for four Territories teams can play eight or more. In the others it can only lower it.
- Rotating sides in one-sided and attack/defend variants keep rotating among the first eight teams.
- In the lobby players are put on two teams as usual. The script deals them into the others, for example at the start of the round.
Team names and colors
The first eight teams keep Halo 3's names and colors, Red, Blue and so on to Pink. Teams 9 to 64 are “Team 9” to “Team 64”, each with a color of its own. A script renames and recolors any of them:
declare team_count = 16
on init: do
for each team do
if current_team != neutral_team then
current_team.set_name("Squad")
end
end
team[0].set_name("Alpha")
team[0].set_color(255, 140, 0)
end
team[3].set_name("Squad %n", 4)- The team's name everywhere players see it: the score display, scoreboard, game-over screen, carnage report, team chat, HUD messages and the team picker. As in widget text,
%nputs in a number, up to three, and%%is a percent sign. 1 to 24 bytes, with no control characters. The neutral team has no name to set. team[3].set_color(255, 140, 0)- The team's color, red, green and blue from 0 to 255 each: the armor its players wear, the score display and every menu that colors the team. Players already alive change color at once.
Names and colors set to constants, such as team[3].set_name("Bravo"), show in the lobby before the game starts; others appear once the script runs.
Forge and AI
In Forge, every object's Team row lists all 64 teams: starting and respawn points, team barriers and AI spawners can belong to Team 9 and later as they can to Red or Blue. A team past the first eight with no spawn points of its own starts at any start point, as in free for all.
game.set_ai_team(label, team) puts the AI of every Forge AI spawner with that Forge label on a team for the rest of the game: team[5] or any other, neutral_team (enemy of all), all_players (ally of all players) or no_team (the spawner's own Team again). AI already alive changes to its new team. A game holds up to 1,024 AI alongside its players.
declare team_count = 16
on init: do
game.set_ai_team("wardens", team[12])
end
Battle royale example
megalo-battle-royale.rmeg plays battle royale in squads of two on 32 teams. Its header turns teams on and gives everyone one life, so a player who dies stays out. Five seconds into the round it names the teams Squad 1 to Squad 32 and deals the players into them two at a time, in order. From then on it counts the squads with a player who hasn't died, and when one is left, that squad wins the round.
--[=[ mode
name = "Battle Royale"
[options]
"rounds.teams" = 1
"respawn.lives" = 1
]=]
declare team_count = 32
-- Each squad's next squad, and whether it has a player alive.
alias next = team.team[0]
alias alive = team.number[0]
-- Number the squads and chain each to the next.
previous = no_team
squad_number = 0
for each team do
if current_team != neutral_team then
squad_number += 1
current_team.set_name("Squad %n", squad_number)
if previous != no_team then
previous.next = current_team
end
previous = current_team
end
end
Each team's own variables, team.team[0] and team.number[0], chain the squads in order and mark the ones still standing. For squads of three or more, change the 2 in if in_squad == 2 then; for fewer teams, lower team_count.
