-- Flood Infection. -- Roles: 0 = new arrival, 1 = survivor, 2 = Flood. Teams mirror roles. -- Player-controlled combat forms keep their native bodies and melee attacks. --[=[ mode name = "Flood Infection" mode = "Slayer" [rules] score_to_win = 0 kill_points = 1 death_points = 0 suicide_points = 0 betrayal_points = -1 [options] "rounds.teams" = 1 "rounds.limit" = 3 "rounds.minutes" = 0 "player.primary_weapon" = 11 "player.secondary_weapon" = 7 "player.grenades" = 2 [logic.options] initial_infected = { value = 1, min = 1, max = 8 } round_seconds = { value = 180, min = 30, max = 900 } warmup_seconds = { value = 10, min = 0, max = 60 } [[logic.megalo_traits]] resistance = 4 shields = 1 speed = 5 gravity = 3 damage = 6 pickup = 1 vehicles = 1 radar = 2 [[logic.megalo_traits]] resistance = 4 shields = 1 speed = 9 gravity = 3 damage = 6 pickup = 2 vehicles = 1 radar = 3 headshots = 2 [[logic.megalo_traits]] resistance = 6 shields = 1 speed = 9 gravity = 3 damage = 6 pickup = 2 vehicles = 1 radar = 3 headshots = 2 [[logic.megalo_traits]] resistance = 7 shields = 1 speed = 8 gravity = 3 damage = 6 pickup = 2 vehicles = 1 radar = 3 headshots = 2 [[logic.megalo_traits]] resistance = 6 speed = 7 [[logic.megalo_traits]] resistance = 4 shields = 1 speed = 8 gravity = 3 damage = 6 pickup = 2 vehicles = 1 radar = 3 headshots = 2 ]=] alias phase = global.number[0] alias players = global.number[1] alias living = global.number[2] alias survivors = global.number[3] alias infected = global.number[4] alias picks = global.number[5] alias scratch = global.number[6] alias seconds = global.number[7] alias warmup = global.timer[0] alias remaining = global.timer[1] alias role = player.number[0] alias deaths = player.number[1] alias form = player.number[2] alias flood_body = player.object[0] alias old_body = global.object[0] alias new_body = global.object[1] on init: do warmup = script_option[2] end function transform() -- Remove this player's previous Flood corpse before creating another life. current_player.flood_body.delete() old_body = current_player.biped current_player.form = rand(4) if current_player.form == 0 then new_body = old_body.place_at_me(flood_human, "flood_body", none, 0, 0, 0, none) end if current_player.form == 1 then new_body = old_body.place_at_me(flood_elite, "flood_body", none, 0, 0, 0, none) end if current_player.form == 2 then new_body = old_body.place_at_me(flood_brute, "flood_body", none, 0, 0, 0, none) end if current_player.form == 3 then new_body = old_body.place_at_me(flood_carrier, "flood_body", none, 0, 0, 0, none) end current_player.set_biped(new_body) old_body.delete() current_player.flood_body = current_player.biped end if phase != 2 then players = 0 living = 0 for each player do players += 1 if current_player.is_not_respawning() then living += 1 end if current_player.role == 0 then current_player.role = 1 if phase == 1 then current_player.role = 2 end current_player.deaths = current_player.get_infection_death_count() end end if phase == 0 then -- Advance randomness during waiting; join/start timing varies the draw. scratch = rand(32767) warmup.set_rate(0%) if living < 2 then warmup = script_option[2] script_widget[0].set_text("Flood Infection: waiting for two living players") end if living >= 2 then warmup.set_rate(-100%) seconds = warmup script_widget[0].set_text("Flood outbreak in %n seconds", seconds) if warmup.is_zero() then picks = script_option[0] if picks >= living then picks = living picks -= 1 end for each player randomly do if picks > 0 and current_player.is_not_respawning() then current_player.role = 2 picks -= 1 end current_player.deaths = current_player.get_infection_death_count() end remaining = script_option[1] remaining.set_rate(-100%) phase = 1 end end end survivors = 0 infected = 0 for each player do if phase == 1 then -- Only lethal Infection Form bites convert; melee and explosions do not. scratch = current_player.get_infection_death_count() if scratch != current_player.deaths then current_player.role = 2 end current_player.deaths = scratch end if current_player.role == 1 then survivors += 1 end if current_player.role == 2 then infected += 1 end end -- Replace a disconnected last zombie while two or more players remain. if phase == 1 and infected == 0 and players >= 2 then for each player randomly do if infected == 0 then current_player.role = 2 infected += 1 survivors -= 1 end end end for each player do script_widget[1].set_visibility(current_player, false) script_widget[2].set_visibility(current_player, false) script_widget[3].set_visibility(current_player, false) if current_player.role == 1 then if current_player.team != team[0] then current_player.team = team[0] end current_player.apply_traits(script_traits[0]) script_widget[1].set_visibility(current_player, true) if phase == 1 and survivors == 1 then current_player.apply_traits(script_traits[4]) script_widget[3].set_visibility(current_player, true) end end if current_player.role == 2 then if current_player.team != team[1] then current_player.team = team[1] end if current_player.is_not_respawning() and current_player.biped != no_object then if current_player.flood_body != current_player.biped then transform() end end if current_player.form == 0 then current_player.apply_traits(script_traits[1]) end if current_player.form == 1 then current_player.apply_traits(script_traits[2]) end if current_player.form == 2 then current_player.apply_traits(script_traits[3]) end if current_player.form == 3 then current_player.apply_traits(script_traits[5]) end script_widget[2].set_visibility(current_player, true) end end script_widget[0].set_visibility(all_players, true) script_widget[1].set_text("SURVIVOR: hold out. Lethal Infection Form bites infect.") script_widget[2].set_text("FLOOD: melee to attack; carriers explode. New form each life.") script_widget[3].set_text("LAST SURVIVOR: increased resistance and speed") if phase == 1 then seconds = remaining script_widget[0].set_text("Survivors: %n | Flood: %n | Time: %n", survivors, infected, seconds) -- Elimination takes priority over the timer expiring on the same tick. if survivors == 0 and players > 0 then script_widget[0].set_text("The Flood have consumed every survivor") team[1].end_round() phase = 2 end if phase == 1 and survivors > 0 then if remaining.is_zero() or infected == 0 then script_widget[0].set_text("Survivors win") team[0].end_round() phase = 2 end end end end