(1, 0, 0, [],
[
(multiplayer_is_server),
(get_max_players, ":num_players"),
(try_for_range, ":player_no", 0, ":num_players"),
(player_is_active, ":player_no"),
(neg|player_is_busy_with_menus, ":player_no"),
(try_begin),
(player_slot_eq, ":player_no", slot_player_spawned_this_round, 0),
(player_get_team_no, ":player_team", ":player_no"), #if player is currently spectator do not spawn his agent
(lt, ":player_team", multi_team_spectator),
(player_get_troop_id, ":player_troop", ":player_no"), #if troop is not selected do not spawn his agent
(ge, ":player_troop", 0),
(assign, ":spawn_new", 0),
(assign, ":num_active_players_in_team_0", 0),
(assign, ":num_active_players_in_team_1", 0),
(try_begin),
(assign, ":num_active_players", 0),
(get_max_players, ":num_players"),
(try_for_range, ":player_no_2", 0, ":num_players"),
(player_is_active, ":player_no_2"),
(val_add, ":num_active_players", 1),
(player_get_team_no, ":player_team_2", ":player_no_2"),
(try_begin),
(eq, ":player_team_2", 0),
(val_add, ":num_active_players_in_team_0", 1),
(else_try),
(eq, ":player_team_2", 1),
(val_add, ":num_active_players_in_team_1", 1),
(try_end),
(try_end),
(store_mul, ":multipication_of_num_active_players_in_teams", ":num_active_players_in_team_0", ":num_active_players_in_team_1"),
(store_mission_timer_a, ":round_time"),
#Delay the first spawn
(ge, ":round_time", 16),
#
(val_sub, ":round_time", "$g_round_start_time"),
(this_or_next|lt, ":round_time", multiplayer_new_agents_finish_spawning_time),
(this_or_next|le, ":num_active_players", 2),
(eq, ":multipication_of_num_active_players_in_teams", 0),
(eq, "$g_round_ended", 0),
(assign, ":spawn_new", 1),
(try_end),
(eq, ":spawn_new", 1),
(try_begin),
(eq, ":player_team", 0),
(assign, ":entry_no", multi_initial_spawn_point_team_1),
(else_try),
(eq, ":player_team", 1),
(assign, ":entry_no", multi_initial_spawn_point_team_2),
(try_end),
(call_script, "script_multiplayer_buy_agent_equipment", ":player_no"),
(player_spawn_new_agent, ":player_no", ":entry_no"),
(player_set_slot, ":player_no", slot_player_spawned_this_round, 1),
(else_try), #spawning as a bot (if option ($g_multiplayer_player_respawn_as_bot) is 1)
(eq, "$g_multiplayer_player_respawn_as_bot", 1),
(player_get_agent_id, ":player_agent", ":player_no"),
(ge, ":player_agent", 0),
(neg|agent_is_alive, ":player_agent"),
(agent_get_time_elapsed_since_removed, ":elapsed_time", ":player_agent"),
(gt, ":elapsed_time", "$g_multiplayer_respawn_period"),
(player_get_team_no, ":player_team", ":player_no"),
(assign, ":is_found", 0),
(try_for_agents, ":cur_agent"),
(eq, ":is_found", 0),
(agent_is_alive, ":cur_agent"),
(agent_is_human, ":cur_agent"),
(agent_is_non_player, ":cur_agent"),
(agent_get_team ,":cur_team", ":cur_agent"),
(eq, ":cur_team", ":player_team"),
(assign, ":is_found", 1),
#(player_control_agent, ":player_no", ":cur_agent"),
(try_end),
(try_begin),
(eq, ":is_found", 1),
(call_script, "script_find_most_suitable_bot_to_control", ":player_no"),
(player_control_agent, ":player_no", reg0),
(player_get_slot, ":num_spawns", ":player_no", slot_player_spawned_this_round),
(val_add, ":num_spawns", 1),
(player_set_slot, ":player_no", slot_player_spawned_this_round, ":num_spawns"),
(try_end),
(try_end),
(try_end),
]),