-- Battle royale in squads of two, on up to 32 teams: Slayer with teams on -- and one life per round, so a player who dies stays out. Five seconds into -- the round everyone is dealt into numbered squads; the last squad with a -- player alive wins. --[=[ mode name = "Battle Royale" [options] "rounds.teams" = 1 "respawn.lives" = 1 ]=] declare team_count = 32 alias deal_timer = global.timer[0] alias dealt = global.number[0] alias standing = global.number[1] alias squad_number = global.number[2] alias in_squad = global.number[3] alias cursor = global.team[0] alias previous = global.team[1] alias winner = global.team[2] alias deaths = temporaries.number[0] -- Each squad's next squad, and whether it has a player alive. alias next = team.team[0] alias alive = team.number[0] declare deal_timer = 5 on init: do deal_timer.set_rate(-100%) end if dealt == 0 and deal_timer.is_zero() then -- 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 -- Two players a squad, in order; players past the last squad stay put. cursor = team[0] in_squad = 0 for each player do if cursor != no_team then current_player.team = cursor in_squad += 1 if in_squad == 2 then cursor = cursor.next in_squad = 0 end end end dealt = 1 end if dealt == 1 then for each team do current_team.alive = 0 end for each player do deaths = current_player.get_death_count() if deaths == 0 then current_player.team.alive = 1 end end standing = 0 for each team do if current_team.alive == 1 then standing += 1 winner = current_team end end if standing == 1 then winner.end_round() dealt = 2 end end