-- Combined Arms: two teams of classes, each with weapons, vehicles and -- abilities of its own, and four ways back into the fight. Classes are -- chosen in the class picker before each life; abilities are the game -- mode ability keys (Settings > Keyboard & Mouse or Controller > Game mode -- abilities: X, 2, 3 and H, or the D-pad's right, left and down). -- -- Medic (assault rifle): spawns with a regenerator (Use equipment), and -- Ability 1 deploys another (45 s). Hold Ability 3 over a fallen -- teammate's body (a cross over it shows to the team) for two seconds -- to revive them there, as the class they were. -- Support (battle rifle): Ability 1 drops an ammunition case that -- refills the weapons of teammates beside it (30 s); Ability 2 gives -- the teammates beside you, and you, an overshield (25 s). -- Anti-Armor (rocket launcher): spawns with a trip mine (Use -- equipment); Ability 1 deploys a power drain, which stops vehicles -- (45 s). -- Recon (sniper rifle): Ability 1 hides you for 8 seconds (25 s); -- Ability 2 marks the enemy in your sights for your team for 10 -- seconds. -- Pilot (SMG): the only class that flies aircraft with more than one -- seat (the Hornet). Hold Ability 3 in or beside an aircraft to -- repair it, while it still stands. -- Armor (shotgun): the only class that drives ground vehicles with more -- than one seat (Warthog, Mongoose, Scorpion, Wraith, Elephant). Hold -- Ability 3 in or beside a ground vehicle to repair it. -- Only Anti-Armor picks up rocket launchers, Spartan lasers, fuel rod -- guns and missile pods, and only Recon sniper and beam rifles. Anyone -- rides as a passenger or gunner. -- -- While you wait to respawn, Ability 4 chooses where: -- Base: Halo 3's own spawns. -- Squad: beside a random teammate who has been out of combat for 5 -- seconds and is near the objective (an object the map's Forge -- scripting labels "objective"; anywhere when there is none). -- Beacon: beside your team's spawn beacon. Objects labelled -- "spawn_beacon" are beacons: Ability 4 beside one picks it up, and -- Ability 4 again plants it at your feet. Ten hits from the enemy -- destroy a planted beacon: it goes back where Forge placed it. -- Vehicle: beside your team's spawn vehicle. Vehicles labelled -- "spawn_vehicle" belong to the team of their last driver and deploy -- after standing still for three seconds (a star over them shows -- their team); destroyed, they respawn as Forge's do. --[=[ mode name = "Combined Arms" mode = "Slayer" [rules] score_to_win = 50 kill_points = 1 death_points = 0 suicide_points = -1 betrayal_points = -1 [options] "respawn.seconds" = 8 "rounds.limit" = 1 "rounds.minutes" = 15 "rounds.teams" = 1 [[logic.megalo_traits]] camouflage = 4 [logic.deployment] title = "Combined Arms" teams = ["Red", "Blue"] [[logic.deployment.classes]] name = "Medic" description = "Revives fallen teammates and deploys regenerators." team = 0 cost = 0 biped = "spartan" primary = "assault_rifle" secondary = "magnum" grenades = [2, 0, 0, 0] max_active = 0 [[logic.deployment.classes]] name = "Support" description = "Drops ammunition and gives teammates overshields." team = 0 cost = 0 biped = "spartan" primary = "battle_rifle" secondary = "magnum" grenades = [2, 0, 0, 0] max_active = 0 [[logic.deployment.classes]] name = "Anti-Armor" description = "Rockets, lasers, trip mines and power drains." team = 0 cost = 0 biped = "spartan" primary = "rocket_launcher" secondary = "magnum" grenades = [1, 0, 0, 0] max_active = 2 [[logic.deployment.classes]] name = "Recon" description = "Sniper rifles, camouflage and marked targets." team = 0 cost = 0 biped = "spartan" primary = "sniper_rifle" secondary = "magnum" grenades = [1, 0, 0, 0] max_active = 2 [[logic.deployment.classes]] name = "Pilot" description = "Flies the aircraft that carry a crew, and repairs them." team = 0 cost = 0 biped = "spartan" primary = "smg" secondary = "magnum" grenades = [1, 0, 0, 0] max_active = 2 [[logic.deployment.classes]] name = "Armor" description = "Drives the ground vehicles that carry a crew, and repairs them." team = 0 cost = 0 biped = "spartan" primary = "shotgun" secondary = "magnum" grenades = [1, 0, 0, 0] max_active = 2 [[logic.deployment.classes]] name = "Medic" description = "Revives fallen teammates and deploys regenerators." team = 1 cost = 0 biped = "spartan" primary = "assault_rifle" secondary = "magnum" grenades = [2, 0, 0, 0] max_active = 0 [[logic.deployment.classes]] name = "Support" description = "Drops ammunition and gives teammates overshields." team = 1 cost = 0 biped = "spartan" primary = "battle_rifle" secondary = "magnum" grenades = [2, 0, 0, 0] max_active = 0 [[logic.deployment.classes]] name = "Anti-Armor" description = "Rockets, lasers, trip mines and power drains." team = 1 cost = 0 biped = "spartan" primary = "rocket_launcher" secondary = "magnum" grenades = [1, 0, 0, 0] max_active = 2 [[logic.deployment.classes]] name = "Recon" description = "Sniper rifles, camouflage and marked targets." team = 1 cost = 0 biped = "spartan" primary = "sniper_rifle" secondary = "magnum" grenades = [1, 0, 0, 0] max_active = 2 [[logic.deployment.classes]] name = "Pilot" description = "Flies the aircraft that carry a crew, and repairs them." team = 1 cost = 0 biped = "spartan" primary = "smg" secondary = "magnum" grenades = [1, 0, 0, 0] max_active = 2 [[logic.deployment.classes]] name = "Armor" description = "Drives the ground vehicles that carry a crew, and repairs them." team = 1 cost = 0 biped = "spartan" primary = "shotgun" secondary = "magnum" grenades = [1, 0, 0, 0] max_active = 2 ]=] enum Kind medic support anti_armor recon pilot armor end enum Spawn base squad beacon vehicle end enum Beacon lying carried planted end -- A player's class this life (its number among its team's six), where -- they chose to spawn, whether a medic revived them, whether this life's -- rules are set, and whether they hold a revive. alias kind = player.number[0] alias spawn_choice = player.number[1] alias seconds = player.number[2] alias holding = player.number[3] alias revived = player.number[4] alias living = player.number[5] -- Their body that fell, the enemy they marked, what they deployed and -- where they will spawn; the teammate they spawn beside, and whom they -- revive. alias body = player.object[0] alias marked = player.object[1] alias deployed = player.object[2] alias spawn_at = player.object[3] alias mate = player.player[0] alias reviving = player.player[1] -- Ability 1's cooldown; Ability 2's (Recon: the mark's time left); the -- camouflage left (Recon) or the next repair (Pilot, Armor); a revive. alias cooldown = player.timer[0] alias cooldown_2 = player.timer[1] alias effect = player.timer[2] alias hold = player.timer[3] -- A beacon: lying, carried or planted, the hits it took, where Forge -- placed it, its team and who carries it. alias state = object.number[0] alias hits = object.number[1] alias home_x = object.number[2] alias home_y = object.number[3] alias home_z = object.number[4] alias owner = object.team[0] alias carrier = object.player[0] -- A spawn vehicle: deployed, and how long it has still to stand. alias deployed_here = object.number[5] alias still = object.timer[0] alias distance = global.number[0] alias count = global.number[1] alias health = global.number[2] alias class = global.number[3] alias handled = global.number[4] alias fit = global.number[5] alias x = global.number[6] alias y = global.number[7] alias z = global.number[8] alias result = global.number[9] alias objective = global.object[0] alias spot = global.object[1] alias target = global.object[2] alias fallen = global.object[3] alias actor = global.player[0] alias other = global.player[1] alias ammo_pulse = global.timer[0] declare object.timer[0] = 3 -- Whether `other` is a teammate of `actor`'s to spawn beside: alive, out -- of combat for 5 seconds and near the objective, if there is one. function squad_fit() fit = 0 if other != no_player and other != actor and other.team == actor.team and other.is_not_respawning() then count = other.get_time_out_of_combat() if count >= 5 then fit = 1 if objective != no_object then distance = other.biped.get_distance_to(objective) if distance > 500 then fit = 0 end end end end end -- The weapons a new life may not pick up and the vehicles it may not -- drive: the other classes'. function class_rules() current_player.set_weapon_pickup(all, 1) current_player.set_driver_use(vehicle, 1) if current_player.kind != Kind.anti_armor then current_player.set_weapon_pickup(rocket_launcher, 0) current_player.set_weapon_pickup(spartan_laser, 0) current_player.set_weapon_pickup(fuel_rod_gun, 0) current_player.set_weapon_pickup(missile_pod, 0) end if current_player.kind != Kind.recon then current_player.set_weapon_pickup(sniper_rifle, 0) current_player.set_weapon_pickup(beam_rifle, 0) end if current_player.kind != Kind.pilot then current_player.set_driver_use(multi_seat_aircraft, 0) end if current_player.kind != Kind.armor then current_player.set_driver_use(multi_seat_ground_vehicle, 0) end if current_player.kind == Kind.medic then current_player.give_equipment(regenerator) end if current_player.kind == Kind.anti_armor then current_player.give_equipment(trip_mine) end end on init: do ammo_pulse.set_rate(-100%) for each object with label "spawn_beacon" do current_object.home_x = current_object.get_x() current_object.home_y = current_object.get_y() current_object.home_z = current_object.get_z() end -- The class and its abilities at the right, above Halo 3's score. script_widget[0].set_position(all_players, 1240, 500) script_widget[0].set_anchor(all_players, bottom_right) script_widget[0].set_alignment(all_players, right) script_widget[0].set_font_size(all_players, 18) script_widget[0].set_color(all_players, 255, 210, 90, 255) script_widget[1].set_position(all_players, 1240, 528) script_widget[1].set_anchor(all_players, bottom_right) script_widget[1].set_alignment(all_players, right) script_widget[2].set_position(all_players, 1240, 554) script_widget[2].set_anchor(all_players, bottom_right) script_widget[2].set_alignment(all_players, right) -- Where you will spawn, while you wait to. script_widget[3].set_position(all_players, 640, 470) script_widget[3].set_anchor(all_players, top) script_widget[3].set_font_size(all_players, 18) script_widget[3].set_background(all_players, 8, 16, 28, 170) end on object death: do current_player.living = 0 current_player.holding = 0 current_player.body = killed_object -- The team sees where its fallen lie. killed_object.set_waypoint_icon(dead_teammate) killed_object.set_waypoint_visibility(current_player.team) -- A beacon its carrier had falls where they did. for each object with label "spawn_beacon" do if current_object.carrier == current_player then current_object.detach() current_object.state = Beacon.lying current_object.carrier = no_player end end end on button press: do actor = current_player if not current_player.is_not_respawning() and pressed_button == button.ability_4 then current_player.spawn_choice += 1 if current_player.spawn_choice > Spawn.vehicle then current_player.spawn_choice = Spawn.base end current_player.mate = no_player end if current_player.is_not_respawning() then -- Ability 4: plant the beacon you carry, or pick one up. if pressed_button == button.ability_4 then handled = 0 for each object with label "spawn_beacon" do if handled == 0 and current_object.carrier == actor then x = actor.biped.get_x() y = actor.biped.get_y() z = actor.biped.get_z() z += 2 current_object.detach() current_object.set_position(x, y, z) current_object.state = Beacon.planted current_object.owner = actor.team current_object.carrier = no_player current_object.hits = 0 current_object.set_waypoint_icon(flag) current_object.set_waypoint_visibility(everyone) handled = 1 end end for each object with label "spawn_beacon" do if handled == 0 and current_object.state != Beacon.carried then distance = current_object.get_distance_to(actor.biped) if distance <= 20 then current_object.attach_to(actor.biped, -3, 0, 6, relative) current_object.state = Beacon.carried current_object.carrier = actor current_object.owner = no_team current_object.set_waypoint_visibility(no_one) handled = 1 end end end end if current_player.kind == Kind.medic and pressed_button == button.ability_1 and current_player.cooldown.is_zero() then current_player.deployed.delete() current_player.deployed = current_player.biped.place_at_me(regenerator, "regenerator", none, 10, 0, 2, none) current_player.cooldown = 45 current_player.cooldown.set_rate(-100%) end if current_player.kind == Kind.support and pressed_button == button.ability_1 and current_player.cooldown.is_zero() then current_player.deployed.delete() current_player.deployed = current_player.biped.place_at_me("objects/gear/human/military/case_ap_turret/case_ap_turret", "ammo_case", none, 10, 0, 2, none) current_player.cooldown = 30 current_player.cooldown.set_rate(-100%) end if current_player.kind == Kind.support and pressed_button == button.ability_2 and current_player.cooldown_2.is_zero() then for each player do if current_player.is_not_respawning() and current_player.team == actor.team then distance = current_player.biped.get_distance_to(actor.biped) if distance <= 25 then current_player.biped.shields = 200 end end end current_player.cooldown_2 = 25 current_player.cooldown_2.set_rate(-100%) end if current_player.kind == Kind.anti_armor and pressed_button == button.ability_1 and current_player.cooldown.is_zero() then current_player.deployed.delete() current_player.deployed = current_player.biped.place_at_me(power_drainer, "power_drain", none, 15, 0, 2, none) current_player.cooldown = 45 current_player.cooldown.set_rate(-100%) end if current_player.kind == Kind.recon and pressed_button == button.ability_1 and current_player.cooldown.is_zero() then current_player.effect = 8 current_player.effect.set_rate(-100%) current_player.cooldown = 33 current_player.cooldown.set_rate(-100%) end -- Recon marks the enemy in their sights: a body or a vehicle that -- is no teammate's. if current_player.kind == Kind.recon and pressed_button == button.ability_2 then target = current_player.get_crosshair_target() fit = 0 if target.is_of_type(biped) or target.is_of_type(vehicle) then fit = 1 end for each player do if current_player.team == actor.team and current_player.biped == target then fit = 0 end end if fit == 1 then current_player.marked.set_waypoint_visibility(no_one) current_player.marked = target target.set_waypoint_icon(bullseye) target.set_waypoint_priority(blink) target.set_waypoint_visibility(current_player.team) current_player.cooldown_2 = 10 current_player.cooldown_2.set_rate(-100%) end end end end -- Ten hits from the enemy destroy a planted beacon. on object damaged: do if current_object.has_forge_label("spawn_beacon") and current_object.state == Beacon.planted and current_player != no_player then if current_player.team != current_object.owner then current_object.hits += 1 if current_object.hits >= 10 then current_object.state = Beacon.lying current_object.hits = 0 current_object.owner = no_team current_object.set_waypoint_visibility(no_one) current_object.set_position(current_object.home_x, current_object.home_y, current_object.home_z) current_object.play_sound("sound/game_sfx/multiplayer/flag_capture_capture_vfx") end end end end objective = no_object for each object with label "objective" do objective = current_object end -- Spawn vehicles: the team of their last driver, deployed once still. for each object with label "spawn_vehicle" do for each player do target = current_player.get_vehicle() if target == current_object and current_player.is_driver() then current_object.owner = current_player.team end end distance = current_object.get_speed() health = current_object.health if distance > 2 or health <= 0 or current_object.owner == no_team then current_object.deployed_here = 0 current_object.still = 3 current_object.still.set_rate(0%) current_object.set_waypoint_visibility(no_one) alt current_object.still.set_rate(-100%) if current_object.still.is_zero() and current_object.deployed_here == 0 then current_object.deployed_here = 1 current_object.set_waypoint_icon(vip) current_object.set_waypoint_visibility(current_object.owner) end end end for each player do actor = current_player -- A new life: its class's rules and gear. Back from a revive, the body -- that fell goes. if current_player.is_not_respawning() and current_player.living == 0 then current_player.living = 1 current_player.kind = current_player.get_deployment_class() current_player.kind %= 6 class_rules() current_player.body.set_waypoint_visibility(no_one) if current_player.revived == 1 then current_player.body.delete() end current_player.body = no_object current_player.revived = 0 current_player.mate = no_player current_player.effect = 0 end if current_player.kind == Kind.recon and not current_player.effect.is_zero() then current_player.apply_traits(script_traits[0]) end if current_player.kind == Kind.recon and current_player.cooldown_2.is_zero() then current_player.marked.set_waypoint_visibility(no_one) current_player.marked = no_object end -- Medics revive the teammate whose body they hold Ability 3 over, for -- two seconds. other = no_player if current_player.kind == Kind.medic and current_player.is_not_respawning() and current_player.is_button_held(button.ability_3) then for each player do fallen = current_player.body if not current_player.is_not_respawning() and current_player.team == actor.team and current_player.revived == 0 and fallen != no_object then distance = fallen.get_distance_to(actor.biped) if distance <= 15 then other = current_player end end end end if other == no_player then current_player.holding = 0 alt if current_player.holding == 0 or current_player.reviving != other then current_player.holding = 1 current_player.reviving = other current_player.hold = 2 current_player.hold.set_rate(-100%) end if current_player.hold.is_zero() then current_player.holding = 0 class = other.get_last_deployment_class() result = other.deploy_class(class) other.revived = 1 other.set_primary_respawn_object(other.body) other.set_respawn_time(0) end end -- Pilots repair aircraft and Armor ground vehicles beside them while -- they hold Ability 3: 5% twice a second, while the vehicle stands. fit = 0 if current_player.kind == Kind.pilot or current_player.kind == Kind.armor then fit = 1 end if fit == 1 and current_player.is_not_respawning() and current_player.is_button_held(button.ability_3) and current_player.effect.is_zero() then current_player.effect = 1 current_player.effect.set_rate(-200%) for each object do fit = 0 if actor.kind == Kind.pilot and current_object.is_of_type(aircraft) then fit = 1 end if actor.kind == Kind.armor and current_object.is_of_type(ground_vehicle) then fit = 1 end if fit == 1 then distance = current_object.get_distance_to(actor.biped) health = current_object.health if distance <= 30 and health > 0 and health < 100 then health += 5 if health > 100 then health = 100 end current_object.health = health end end end end -- Where the dead will spawn. if not current_player.is_not_respawning() and current_player.revived == 0 then spot = no_object if current_player.spawn_choice == Spawn.squad then other = current_player.mate squad_fit() if fit == 0 then current_player.mate = no_player for each player randomly do if actor.mate == no_player then other = current_player squad_fit() if fit == 1 then actor.mate = current_player end end end end other = current_player.mate spot = other.biped end if current_player.spawn_choice == Spawn.beacon then for each object with label "spawn_beacon" do if current_object.state == Beacon.planted and current_object.owner == actor.team then spot = current_object end end end if current_player.spawn_choice == Spawn.vehicle then for each object with label "spawn_vehicle" do if current_object.deployed_here == 1 and current_object.owner == actor.team then spot = current_object end end end current_player.spawn_at = spot current_player.set_primary_respawn_object(spot) end end -- Ammunition cases refill the weapons of the teammates beside them. if ammo_pulse.is_zero() then for each player do actor = current_player target = current_player.deployed if current_player.kind == Kind.support and target != no_object then for each player do if current_player.is_not_respawning() and current_player.team == actor.team then distance = current_player.biped.get_distance_to(target) if distance <= 25 then current_player.refill_ammo() end end end end end ammo_pulse = 3 ammo_pulse.set_rate(-100%) end for each player do current_player.seconds = current_player.cooldown script_widget[0].set_value_text_for(current_player, "") if current_player.kind == Kind.medic then script_widget[0].set_text_for(current_player, "Medic") script_widget[1].set_text_for(current_player, "Regenerator: ready") if not current_player.cooldown.is_zero() then script_widget[1].set_text_for(current_player, "Regenerator: %n s", current_player.seconds) end script_widget[2].set_text_for(current_player, "Hold Ability 3 over the fallen to revive") if current_player.holding == 1 then script_widget[2].set_text_for(current_player, "Reviving...") end end if current_player.kind == Kind.support then script_widget[0].set_text_for(current_player, "Support") script_widget[1].set_text_for(current_player, "Ammunition case: ready") if not current_player.cooldown.is_zero() then script_widget[1].set_text_for(current_player, "Ammunition case: %n s", current_player.seconds) end current_player.seconds = current_player.cooldown_2 script_widget[2].set_text_for(current_player, "Overshield: ready") if not current_player.cooldown_2.is_zero() then script_widget[2].set_text_for(current_player, "Overshield: %n s", current_player.seconds) end end if current_player.kind == Kind.anti_armor then script_widget[0].set_text_for(current_player, "Anti-Armor") script_widget[1].set_text_for(current_player, "Power drain: ready") if not current_player.cooldown.is_zero() then script_widget[1].set_text_for(current_player, "Power drain: %n s", current_player.seconds) end script_widget[2].set_text_for(current_player, "Trip mine: Use equipment") end if current_player.kind == Kind.recon then script_widget[0].set_text_for(current_player, "Recon") script_widget[1].set_text_for(current_player, "Camouflage: ready") if not current_player.cooldown.is_zero() then script_widget[1].set_text_for(current_player, "Camouflage: %n s", current_player.seconds) end current_player.seconds = current_player.cooldown_2 script_widget[2].set_text_for(current_player, "Ability 2 marks your target") if not current_player.cooldown_2.is_zero() then script_widget[2].set_text_for(current_player, "Target marked: %n s", current_player.seconds) end end if current_player.kind == Kind.pilot then script_widget[0].set_text_for(current_player, "Pilot") script_widget[1].set_text_for(current_player, "You fly crewed aircraft") script_widget[2].set_text_for(current_player, "Hold Ability 3 to repair aircraft") end if current_player.kind == Kind.armor then script_widget[0].set_text_for(current_player, "Armor") script_widget[1].set_text_for(current_player, "You drive crewed ground vehicles") script_widget[2].set_text_for(current_player, "Hold Ability 3 to repair ground vehicles") end script_widget[3].set_text_for(current_player, "Spawn: base (Ability 4 to change)") if current_player.spawn_choice == Spawn.squad then script_widget[3].set_text_for(current_player, "Spawn: squad, none out of combat (Ability 4)") if current_player.spawn_at != no_object then script_widget[3].set_text_for(current_player, "Spawn: squad (Ability 4 to change)") end end if current_player.spawn_choice == Spawn.beacon then script_widget[3].set_text_for(current_player, "Spawn: beacon, none planted (Ability 4)") if current_player.spawn_at != no_object then script_widget[3].set_text_for(current_player, "Spawn: beacon (Ability 4 to change)") end end if current_player.spawn_choice == Spawn.vehicle then script_widget[3].set_text_for(current_player, "Spawn: vehicle, none deployed (Ability 4)") if current_player.spawn_at != no_object then script_widget[3].set_text_for(current_player, "Spawn: vehicle (Ability 4 to change)") end end if current_player.revived == 1 then script_widget[3].set_text_for(current_player, "A medic is reviving you") end -- The abilities while alive, the spawn choice while waiting. script_widget[0].set_visibility(current_player, true) if current_player.is_not_respawning() then script_widget[1].set_visibility(current_player, true) script_widget[2].set_visibility(current_player, true) script_widget[3].set_visibility(current_player, false) alt script_widget[1].set_visibility(current_player, false) script_widget[2].set_visibility(current_player, false) script_widget[3].set_visibility(current_player, true) end end