--[[
dlc2_m02.lua
SR3 Mission Script
DATE: 9/27/2011
AUTHOR: Sean Rose
]]--
-- Characters --
Dlc2_m02_characters = {
alien_homie = "npc_alien_homie",
brutina = "npc_brutina",
}
-- Groups --
Dlc2_m02_groups = {
homies = {
name = "grp_homies",
npcs = { Dlc2_m02_characters.alien_homie },
},
machines = {
name = "grp_machines",
},
amazon_01 = { name = "grp_amazon_01", sleep = true, amazon = true, } ,
amazon_02 = { name = "grp_amazon_02", sleep = true, amazon = true, } ,
amazon_03 = { name = "grp_amazon_03", sleep = true , amazon = true,} ,
amazon_04 = { name = "grp_amazon_04", sleep = true, amazon = true, } ,
amazon_05 = { name = "grp_amazon_05", amazon = true, } ,
amazon_06 = { name = "grp_amazon_06", sleep = true, amazon = true, } ,
amazon_07 = { name = "grp_amazon_07", sleep = true, amazon = true, } ,
amazon_08 = { name = "grp_amazon_08", sleep = true, amazon = true, } ,
amazon_09 = { name = "grp_amazon_09", sleep = true, amazon = true, } ,
amazon_10 = { name = "grp_amazon_10", sleep = true, amazon = true, } ,
amazon_11 = { name = "grp_amazon_11", amazon = true, } ,
amazon_12 = { name = "grp_amazon_12", amazon = true, } ,
amazon_13 = { name = "grp_amazon_13", amazon = true, } ,
amazon_14 = { name = "grp_amazon_14", amazon = true, } ,
amazon_15 = { name = "grp_amazon_15", amazon = true, } ,
amazon_16 = { name = "grp_amazon_16", amazon = true, } ,
brutina = { name = "grp_brutina" },
saucer = { name = "grp_saucer" },
loadout1 = { name = "grp_loadout_01" },
loadout2 = { name = "grp_loadout_02" },
loadout3 = { name = "grp_loadout_03" },
clapboards = { name = "grp_clapboards" },
kiwiposters = { name = "grp_kiwiposters" },
}
-- Navpoints --
Dlc2_m02_navpoints = {
local_mission_start = "nav_local_mission_start",
remote_mission_start = "nav_remote_mission_start",
local_mission_end = "nav_local_mission_end",
remote_mission_end = "nav_remote_mission_end",
hanger_camera = "nav_hanger_camera",
}
-- Triggers --
Dlc2_m02_triggers = {
machine_2 = "trg_machine_2",
saucer = "trg_saucer",
machine_4a = "trg_machine4a_local",
machine_4b = "trg_machine4b_local",
machine_4c = "trg_machine4c_local",
-- door triggers
room1_enter_door = "trg_room1_enter_door",
hall2_enter_door = "trg_hall2_enter_door",
room2_enter_door = "trg_room2_enter_door",
room3_enter_door = "trg_room3_enter_door",
hall3_enter_door = "trg_hall3_enter_door",
room4_enter_door = "trg_room4_enter_door",
room4_exit_door = "trg_room4_exit_door",
hall4_enter_door = "trg_hall4_enter_door",
hanger_enter_door = "trg_hanger_enter_door",
-- backstage areas
backstage1 = "trg_backstage_enter_1",
backstage2 = "trg_backstage_enter_2",
backstage3 = "trg_backstage_enter_3",
-- clapboards
clapboard_01 = "trg_clapboard_01",
clapboard_02 = "trg_clapboard_02",
clapboard_03 = "trg_clapboard_03",
clapboard_04 = "trg_clapboard_04",
clapboard_05 = "trg_clapboard_05",
clapboard_06 = "trg_clapboard_06",
-- npc activation triggers
activate_hall_1 = "trg_activate_hall1",
activate_hall_2 = "trg_activate_hall2",
activate_hall_3 = "trg_activate_hall3",
activate_room_2 = "trg_activate_room2",
-- convo triggers
backstage_01_roof = "trg_backstage_01_roof",
backstage_02_borc = "trg_backstage_02_borc",
hall_01_first_action_2 = "trg_convo_first_action_2",
hall_03_find_key_area = "trg_convo_find_key_area",
backstage_03_mars = "trg_convo_mars",
backstage_03_walker = "trg_convo_walker",
backstage_03_exit = "trg_convo_bs3_exit",
action_02 = "trg_convo_action_02",
-- traps
electric_trap_1 = "trg_electric_1",
electric_trap_2 = "trg_electric_2",
fire_trap = "trg_fire_trap",
}
-- Vehicles --
Dlc2_m02_vehicles = {
saucer = "veh_saucer",
}
-- Mesh Movers --
Dlc2_m02_movers = {
}
-- Text --
Dlc2_m02_text = {
-- backstage_01 --
get_pistol = "DLC2_M02_GET_PISTOL",
go_to_set = "DLC2_M02_GO_TO_SET",
-- hallway_01 --
approach_machine_local = "DLC2_M02_APPROACH_MACHINE_LOCAL",
approach_machine_coop = "DLC2_M02_APPROACH_MACHINE_COOP",
-- room_01 --
protect_homie = "DLC2_M02_PROTECT_HOMIE",
return_to_homie = "DLC2_M02_RETURN_TO_HOMIE",
progress_01 = "DLC2_M02_PROGRESS_01", -- replaces text below
progress = "DLC2_M02_PROGRESS_LABEL",
explosion_warning = "DLC2_M02_EXPLOSION_WARNING",
approach_machine_local = "DLC2_M02_APPROACH_MACHINE_LOCAL",
approach_machine_coop = "DLC2_M02_APPROACH_MACHINE_COOP",
-- room_02 --
rewire_explosives = "DLC2_M02_REWIRE_EXPLOSIVES",
use_rewire = "DLC2_M02_USE_REWIRE",
progress_02 = "DLC2_M02_PROGRESS_02", -- replaces text below
progress = "DLC2_M02_PROGRESS_LABEL",
go_to_backstage = "DLC2_M02_GO_TO_BACKSTAGE",
-- backstage_02 --
get_smg = "DLC2_M02_GET_SMG",
go_to_set = "DLC2_M02_GO_TO_SET",
-- room_03 --
progress_02 = "DLC2_M02_PROGRESS_02", -- replaces text below
progress = "DLC2_M02_PROGRESS_LABEL",
explosion_warning = "DLC2_M02_EXPLOSION_WARNING",
go_to_servers = "DLC2_M02_GO_TO_SERVER_ROOM",
-- go_to_servers = "DLC2_MO2_GO_TO_SERVERS", replaces text below
approach_machine_local = "DLC2_M02_APPROACH_MACHINE_LOCAL",
-- room_04 --
go_to_server = "DLC2_M02_GO_TO_SERVER",
wait_for_homie = "DLC2_M02_WAIT_FOR_HOMIE",
search_code = "DLC2_M02_SEARCH_CODE",
progress = "DLC2_M02_PROGRESS_LABEL",
self_destruct = "DLC2_M02_SELF_DESTRUCT", -- replaces text below
security_activating = "DLC2_M02_SECURITY_ACTIVATING",
-- backstage_03 --
get_final_weapon = "DLC2_M02_GET_FINAL_WEAPON",
go_to_set = "DLC2_M02_GO_TO_SET",
-- hangar --
go_to_hangar = "DLC2_M02_GO_TO_HANGAR",
approach_saucer = "DLC2_M02_APPROACH_SAUCER",
kill_brutina = "DLC2_M02_KILL_BRUTINA",
go_to_control_room = "DLC2_M02_GO_TO_CONTROL_ROOM",
destroy_console = "DLC2_M02_DESTROY_CONSOLE", -- replaces text below
generator_destroy = "DLC2_M02_DESTORY_GENERATOR",
board_saucer = "DLC2_M02_BOARD_SAUCER",
}
-- Threads --
Dlc2_m02_threads = {
}
-- Checkpoints --
Dlc2_m02_checkpoints = {
MISSION_START_CHECKPOINT,
"1",
"2",
"3",
"4",
}
-- Continuous Spawn Groups --
Dlc2_m02_spawn_groups = {
elites = {
"grp_cspawn_elite_01",
"grp_cspawn_elite_02",
"grp_cspawn_elite_03",
"grp_cspawn_elite_04",
},
pistols = {
"grp_cspawn_pistol_01",
"grp_cspawn_pistol_02",
"grp_cspawn_pistol_03",
"grp_cspawn_pistol_04",
},
smgs = {
"grp_cspawn_smg_01",
"grp_cspawn_smg_02",
"grp_cspawn_smg_03",
"grp_cspawn_smg_04",
},
-- not really spawn groups but put here so they shut down
-- when entering backstage
others = {
"grp_amazon_01",
"grp_amazon_02",
"grp_amazon_03",
"grp_amazon_04",
"grp_amazon_05",
"grp_amazon_06",
"grp_amazon_07",
"grp_amazon_08",
"grp_amazon_09",
"grp_amazon_10",
"grp_amazon_11",
"grp_amazon_12",
"grp_amazon_13",
"grp_amazon_14",
"grp_amazon_15",
"grp_amazon_16",
}
}
-- Spawn Regions --
Dlc2_m02_spawn_regions = {
hall_1 = {
},
machine_1 = {
{ name = "srgn_machine_1_1" },
{ name = "srgn_machine_1_3" },
},
hall_2 = {
},
machine_2 = {
},
machine_3 = {
{ name = "srgn_machine_1_9", filter = 2 },
{ name = "srgn_machine_1_10", filter = 4 },
},
hall_3 = {
},
machine_4a = {
{ name = "srgn_machine_1_15", filter = 2 },
{ name = "srgn_machine_1_17", filter = 4 },
},
machine_4b = {
{ name = "srgn_machine_1_16", filter = 2 },
{ name = "srgn_machine_1_17", filter = 4 },
},
machine_4 = {
{ name = "srgn_machine_1_13", filter = 2 },
{ name = "srgn_machine_1_14", filter = 4 },
},
hanger_1 = {
{ name = "srgn_machine_1_19" },
{ name = "srgn_machine_1_20" },
},
}
-- Cutscenes --
Dlc2_m02_cutscenes = {
}
-- Conversations --
Dlc2_m02_convos = {
-- example_convo = { convo_name = "m14_drive_01", player_speaks = true },
-- example_cell = { cell_name = "m14_reach_helicopter", speakers_2d = { "Kinzie" }, player_speaks = true, recieving = false },
-- example_2d = { persona_2d_params = { "M14_Too_Far_Away_From_Van" }, speakers_2d = { "Kinzie" } },
-- example_3d = { persona_3d_params = { LOCAL_PLAYER, "M20_Start_Running_Down_People" }, },
mission_start = { convo_name = "DLC2_M02_Mission_Start", player_speaks = true },
bs_1_first_convo = { convo_name = "DLC2_M02_BS_1_First_Convo", player_speaks = true },
bs_1_walk_on_roof = { convo_name = "DLC2_M02_BS_1_Walk_On_Roof", player_speaks = true },
first_action_1 = { convo_name = "DLC2_M02_1st_Action_1_Convo", player_speaks = true },
first_action_see_mib = { convo_name = "DLC2_M02_1st_Action_See_MiB", player_speaks = true },
find_1st_device = { convo_name = "DLC2_M02_Find_1st_Device", player_speaks = true },
first_device_end = { convo_name = "DLC2_M02_1st_Device_End", player_speaks = true },
first_action_2 = { convo_name = "DLC2_M02_1st_Action_2_Convo", player_speaks = true },
arrive_locked_door = { convo_name = "DLC2_M02_Arrive_Locked_Door", player_speaks = true },
blow_up_locked_door = { convo_name = "DLC2_M02_Blowup_Locked_Door", player_speaks = true },
find_2nd_device = { convo_name = "DLC2_M02_Find_2nd_Device", player_speaks = true },
second_device_end = { convo_name = "DLC2_M02_2nd_Device_End", player_speaks = true },
bs_2_first = { convo_name = "DLC2_M02_BS_2_First_Convo", player_speaks = true },
see_borc_set = { convo_name = "DLC2_M02_See_BorC_Set", player_speaks = true },
see_rm_trap = { convo_name = "DLC2_M02_See_RM_Trap", player_speaks = true },
see_genki_pyro = { convo_name = "DLC2_M02_See_Genki_Pyro", player_speaks = true },
exit_bs_2 = { convo_name = "DLC2_M02_Exit_BS_2_Convo", player_speaks = true },
second_action_1 = { convo_name = "DLC2_M02_2nd_Action_1_Convo", player_speaks = true },
find_third_device = { convo_name = "DLC2_M02_Find_3rd_Device", player_speaks = true },
third_device_end = { convo_name = "DLC2_M02_3rd_Device_End", player_speaks = true },
find_key_area = { convo_name = "DLC2_M02_Find_Key_Area", player_speaks = true },
after_first_tier = { convo_name = "DLC2_M02_After_First_Tier", player_speaks = true },
trigger_destruct = { convo_name = "DLC2_M02_Trigger_Destruct", player_speaks = true },
control_room = { convo_name = "DLC2_M02_Control_Room", player_speaks = true },
unlock_door = { convo_name = "DLC2_M02_Unlock_Door", player_speaks = true },
bs3_first_convo = { convo_name = "DLC2_M02_BS_3_First_Convo", player_speaks = true },
after_massacre = { convo_name = "DLC2_M02_After_Massacre", player_speaks = true },
see_zimos_crib = { convo_name = "DLC2_M02_See_Zimos_Crib", player_speaks = true },
see_rfg_walker = { convo_name = "DLC2_M02_See_RFG_Walker", player_speaks = true },
see_mars_set = { convo_name = "DLC2_M02_See_Mars_Set", player_speaks = true },
exit_bs3 = { convo_name = "DLC2_M02_Exit_BS_3_Convo", player_speaks = true },
third_action_1 = { convo_name = "DLC2_M02_3rd_Action_1_Convo", player_speaks = true },
see_ship = { convo_name = "DLC2_M02_See_Ship", player_speaks = true },
rambo_moment = { convo_name = "DLC2_M02_Rambo_Moment", player_speaks = true },
see_brutina = { convo_name = "DLC2_M02_See_Brutina", player_speaks = true },
force_field_start = { convo_name = "DLC2_M02_Force_Field_Start", player_speaks = true },
disable_generator = { convo_name = "DLC2_M02_Disable_Generator", player_speaks = true },
generator_blows_up = { convo_name = "DLC2_M02_Generator_Blows_Up", player_speaks = false },
jumping_to_end = { convo_name = "DLC2_M02_Jumping_to_End", player_speaks = true },
mission_end = { convo_name = "DLC2_M02_Mission_End", player_speaks = false },
backstage_talking1 = { convo_name = "DLC2_M02_Backstage_Talking1", player_speaks = false },
backstage_talking2 = { convo_name = "DLC2_M02_Backstage_Talking2", player_speaks = true },
backstage_talking3 = { convo_name = "DLC2_M02_Backstage_Talking3", player_speaks = true },
-- lines, not convos
first_device_finished_01 = { persona_2d_params = { "DLC2_m02_1st_device_finished_01" }, },
work_on_trap_01 = { persona_2d_params = { "DLC2_m02_work_on_trap_01" }, },
new_weapons_01 = { persona_2d_params = { "pak2_m02_new_weapons_01" }, speakers_2d = { "PAK2_Director" }, },
new_weapons_02 = { persona_2d_params = { "pak2_m02_new_weapons_02" }, speakers_2d = { "PAK2_Director" }, },
new_weapons_03 = { persona_2d_params = { "pak2_m02_new_weapons_03" }, speakers_2d = { "PAK2_Director" }, },
action_01 = { persona_2d_params = { "pak2_m02_1st_action_start_01" }, speakers_2d = { "PAK2_Director" }, },
action_02 = { persona_2d_params = { "pak2_m02_2nd_action_start_01" }, speakers_2d = { "PAK2_Director" }, },
action_03 = { persona_2d_params = { "pak2_m02_3rd_action_start_01" }, speakers_2d = { "PAK2_Director" }, },
approval_01 = { persona_2d_params = { "pak2_m02_2nd_device_approval_01" }, speakers_2d = { "PAK2_Director" }, },
second_device_finished_01 = { persona_3d_params = { LOCAL_PLAYER, "pak2_m02_2nd_device_finished_01" }, },
third_device_finished_01 = { persona_3d_params = { Dlc2_m02_characters.alien_homie, "pak2_m02_3rd_device_finished_01" }, },
ready_4a = { persona_3d_params = { Dlc2_m02_characters.alien_homie, "PAK2_M02_Ready_Comp1_01" }, },
berating_4a = { persona_3d_params = { Dlc2_m02_characters.alien_homie, "pak2_m02_first_tier_berating_01" }, },
after_4b = { persona_3d_params = { LOCAL_PLAYER, "pak2_m02_after_bottom_tier_01" }, },
ready_4b = { persona_3d_params = { Dlc2_m02_characters.alien_homie, "PAK2_M02_Ready_Comp2_01" }, },
ready_4c = { persona_3d_params = { Dlc2_m02_characters.alien_homie, "PAK2_M02_Ready_Comp3_01" }, },
fiding_key_01 = { persona_3d_params = { Dlc2_m02_characters.alien_homie, "pak2_m02_finding_key_01" }, },
key_area_explodes_01 = { persona_3d_params = { LOCAL_PLAYER, "pak2_m02_key_area_explodes_01" }, },
brutina_defeated_01 = { persona_3d_params = { LOCAL_PLAYER, "pak2_m02_brutina_defeated_01" }, },
disable_generator_01 = { persona_3d_params = { Dlc2_m02_characters.alien_homie, "pak2_m02_disable_generator_01" }, },
disable_generator_02 = { persona_3d_params = { Dlc2_m02_characters.alien_homie, "pak2_m02_disable_generator_02" }, },
disable_generator_03 = { persona_3d_params = { LOCAL_PLAYER, "pak2_m02_disable_generator_03" }, },
saving_player_01 = { persona_3d_params = { Dlc2_m02_characters.alien_homie, "pak2_m02_saving_player_01" }, },
generic_actions = { persona_2d_params = { "pak2_generic_actions" }, speakers_2d = { "PAK2_Director" }, },
}
Dlc2_m02_loadouts = {
player = {
{
weapons = {
[ WEAPON_SLOT_PISTOL ] = "DLC_LaserPistol",
},
equip = WEAPON_SLOT_PISTOL,
trigger = "trg_loadout_1",
objective_text = Dlc2_m02_text.get_pistol,
convo = Dlc2_m02_convos.new_weapons_01,
},
{
weapons = {
[ WEAPON_SLOT_SMG ] = "DLC_LaserSMG",
[ WEAPON_SLOT_PISTOL ] = "DLC_LaserPistol",
},
equip = WEAPON_SLOT_SMG,
trigger = "trg_loadout_2",
objective_text = Dlc2_m02_text.get_smg,
convo = Dlc2_m02_convos.new_weapons_02,
},
{
weapons = {
[ WEAPON_SLOT_EXPLOSIVE ] = "DLC_GrenadeLauncher",
[ WEAPON_SLOT_SMG ] = "DLC_LaserSMG",
[ WEAPON_SLOT_PISTOL ] = "DLC_LaserPistol",
},
equip = WEAPON_SLOT_EXPLOSIVE,
trigger = "trg_loadout_3",
objective_text = Dlc2_m02_text.get_final_weapon,
convo = Dlc2_m02_convos.new_weapons_03,
},
},
homie = {
"DLC_LaserPistol",
"DLC_LaserSMG",
"DLC_GrenadeLauncher",
}
}
Dlc2_m02_backstage_doors = {
{
exit = { "mov_door_backstage_exit_1a", "mov_door_backstage_exit_1b" },
},
{
enter = { "mov_door_backstage_enter_2a", },
exit = { "mov_door_backstage_exit_2a", },
},
{
enter = { "mov_door_backstage_enter_3a", },
exit = { "mov_door_backstage_exit_3a", },
},
}
Dlc2_m02_trails = {
backstage1 = {
"nav_trail_backstage_1_1",
"nav_trail_backstage_1_2",
"nav_trail_backstage_1_3",
"nav_trail_backstage_1_4",
},
room1 = {
"nav_trail_room_1_1",
"nav_machine_1",
},
room2 = {
"nav_trail_room_2_1",
"nav_trail_room_2_2",
"nav_machine_2",
},
backstage2 = {
"nav_trail_room_2_2",
"nav_trail_backstage_2_1",
"nav_trail_backstage_2_2",
},
room3 = {
"nav_trail_room_3_1",
"nav_trail_room_3_2",
"nav_machine_3",
},
room4a = {
"nav_trail_room_4_1",
"nav_trail_room_4_2",
"nav_trail_room_4_3",
"nav_trail_room_4_4",
"nav_machine4a_local",
},
room4a_checkpoint = {
"nav_trail_room_4_3",
"nav_trail_room_4_4",
"nav_machine4a_local",
},
room4b = {
"nav_trail_room_4_5",
"nav_trail_room_4_6",
"nav_machine4b_local",
},
room4c = {
"nav_trail_room_4_7",
"nav_trail_room_4_8",
"nav_machine4c_local",
},
room4 = {
"nav_trail_room_4_9",
"nav_machine_4",
},
backstage3 = {
"nav_trail_backstage_3_1",
"nav_trail_backstage_3_2",
},
hanger1 = {
"nav_trail_hanger_1",
"nav_trail_hanger_2",
},
hanger2 = {
"nav_trail_hanger_3",
"nav_trail_hanger_4",
"nav_trail_hanger_5",
"nav_generator"
},
}
Dlc2_m02_convo_queue = { }
Dlc2_m02_status = { }
Dlc2_m02_gspawn_data = {
room_1 = { -- both hall1 and room1
create_groups = { Dlc2_m02_groups.amazon_01, Dlc2_m02_groups.amazon_02 },
},
hall_2 = {
create_groups = { Dlc2_m02_groups.amazon_03 },
},
room_2 = {
create_groups = { Dlc2_m02_groups.amazon_04 },
},
room_3 = {
delete_groups = { Dlc2_m02_groups.amazon_01, Dlc2_m02_groups.amazon_02, Dlc2_m02_groups.amazon_03, Dlc2_m02_groups.amazon_04 },
create_groups = { Dlc2_m02_groups.amazon_05 },
},
room_4 = { -- hall3 and room4
create_groups = { Dlc2_m02_groups.amazon_06, Dlc2_m02_groups.amazon_07, Dlc2_m02_groups.amazon_08, Dlc2_m02_groups.amazon_09, Dlc2_m02_groups.amazon_10 },
},
hanger_1 = { -- on arrival at hanger - before mini cutscene
delete_groups = { Dlc2_m02_groups.amazon_05, Dlc2_m02_groups.amazon_06, Dlc2_m02_groups.amazon_07, Dlc2_m02_groups.amazon_08, Dlc2_m02_groups.amazon_09, Dlc2_m02_groups.amazon_10 },
},
hanger_2 = { -- after mini cutscene
create_groups = { Dlc2_m02_groups.amazon_15, Dlc2_m02_groups.amazon_14, Dlc2_m02_groups.amazon_16 },
},
brutina = { -- brutina trigger
create_groups = { Dlc2_m02_groups.brutina },
},
kiwiposters = {
create_groups = { Dlc2_m02_groups.kiwiposters },
}
}
Dlc2_m02_cspawn_data = {
hall_1 = {
num_elites = 0,
num_pistols = 1,
num_smgs = 1,
cspawn_regions = Dlc2_m02_spawn_regions.hall_1,
},
machine_1 = {
num_elites = 0,
num_pistols = 2,
num_smgs = 1,
cspawn_regions = Dlc2_m02_spawn_regions.machine_1,
},
hall_2 = {
num_elites = 0,
num_pistols = 2,
num_smgs = 1,
cspawn_regions = Dlc2_m02_spawn_regions.hall_2,
},
machine_2 = {
num_elites = 0,
num_pistols = 1,
num_smgs = 1,
cspawn_regions = Dlc2_m02_spawn_regions.machine_2,
},
machine_3 = {
num_elites = 2,
num_pistols = 1,
num_smgs = 1,
cspawn_regions = Dlc2_m02_spawn_regions.machine_3,
respawn_delay = 1,
filters = { elites = { 2, 4 }, pistols = { 2 }, smgs = { 4 }, },
tethers = {
[ Dlc2_m02_spawn_groups.elites[ 1 ] ] = { { nav = "nav_room_3_attack_from_l3", d = 1 } },
[ Dlc2_m02_spawn_groups.elites[ 2 ] ] = { { nav = "nav_room_3_attack_from_r3", d = 1 } },
[ Dlc2_m02_spawn_groups.pistols[ 1 ] ] = { { nav = "nav_room_3_attack_from_l2", d = 1 }, { nav = "nav_room_3_attack_from_r2", d = 1 }, },
[ Dlc2_m02_spawn_groups.smgs[ 1 ] ] = { { nav = "nav_room_3_attack_from_l1", d = 1 }, { nav = "nav_room_3_attack_from_r1", d = 1 }, },
},
},
hall_3 = {
num_elites = 1,
num_pistols = 2,
num_smgs = 2,
cspawn_regions = Dlc2_m02_spawn_regions.hall_3,
},
machine_4a = {
num_elites = 0,
num_pistols = 1,
num_smgs = 1,
cspawn_regions = Dlc2_m02_spawn_regions.machine_4a,
filters = { elites = { }, pistols = { 2 }, smgs = { 4 }, },
tethers = {
[ Dlc2_m02_spawn_groups.pistols[ 1 ] ] = { { nav = "nav_room_4_attack_from_l1", d = 1 }, { nav = "nav_room_4_attack_from_l2", d = 1 }, },
[ Dlc2_m02_spawn_groups.smgs[ 1 ] ] = { { nav = "nav_room_4_attack_from_l3", d = 1 }, { nav = "nav_room_4_attack_from_l4", d = 1 }, },
},
},
machine_4b = {
num_elites = 0,
num_pistols = 2,
num_smgs = 2,
cspawn_regions = Dlc2_m02_spawn_regions.machine_4b,
filters = { elites = { }, pistols = { 4 }, smgs = { 2 }, },
tethers = {
[ Dlc2_m02_spawn_groups.smgs[ 1 ] ] = { { nav = "nav_room_4_attack_from_r1", d = 1 }, { nav = "nav_room_4_attack_from_r2", d = 1 }, },
[ Dlc2_m02_spawn_groups.pistols[ 1 ] ] = { { nav = "nav_room_4_attack_from_r3", d = 1 }, { nav = "nav_room_4_attack_from_r4", d = 1 }, },
},
},
machine_4 = {
num_elites = 2,
num_pistols = 2,
num_smgs = 0,
cspawn_regions = Dlc2_m02_spawn_regions.machine_4,
filters = { elites = { 4, 2 }, pistols = { 4, 2 }, smgs = { }, },
tethers = {
[ Dlc2_m02_spawn_groups.elites[ 1 ] ] = { { nav = "nav_room_4_attack_from_m1", d = 1 } },
[ Dlc2_m02_spawn_groups.elites[ 2 ] ] = { { nav = "nav_room_4_attack_from_m8", d = 1 } },
[ Dlc2_m02_spawn_groups.pistols[ 1 ] ] = { { nav = "nav_room_4_attack_from_m3", d = 1 }, { nav = "nav_room_4_attack_from_m4", d = 1 }, },
[ Dlc2_m02_spawn_groups.pistols[ 2 ] ] = { { nav = "nav_room_4_attack_from_m5", d = 1 }, { nav = "nav_room_4_attack_from_m6", d = 1 }, },
},
},
brutina = { -- brutina trigger
num_elites = 2,
num_pistols = 3,
num_smgs = 3,
cspawn_regions = Dlc2_m02_spawn_regions.hanger_1,
},
}
Dlc2_m02_trigger_doors = {
room1_entry = {
trigger = Dlc2_m02_triggers.room1_enter_door,
doors = { "mov_door_room1_enter_1a" },
audio_event = "M02_Part1_Machine_Room_1",
},
hall2_entry = {
trigger = Dlc2_m02_triggers.hall2_enter_door,
doors = { "mov_door_hall2_enter_1a", },
},
room2_entry = {
trigger = Dlc2_m02_triggers.room2_enter_door,
doors = { "mov_door_room2_enter_1a" },
audio_event = "M02_Part1_Machine_Room_2",
},
room3_entry = {
trigger = Dlc2_m02_triggers.room3_enter_door,
doors = { "mov_door_room3_enter_1a", "mov_door_room3_enter_1b", },
},
hall3_entry = {
trigger = Dlc2_m02_triggers.hall3_enter_door,
doors = { "mov_door_hall3_enter_1a" },
audio_event = "M02_Part2_Corridor_2",
},
room4_entry = {
trigger = Dlc2_m02_triggers.room4_enter_door,
doors = { "mov_door_room4_enter_1a", },
},
room4_exit = {
trigger = Dlc2_m02_triggers.room4_exit_door,
doors = { "mov_door_room4_exit_1a" },
},
hall4_entry = {
trigger = Dlc2_m02_triggers.hall4_enter_door,
doors = { "mov_door_hall4_entry_1a" },
},
hanger_entry = {
trigger = Dlc2_m02_triggers.hanger_enter_door,
doors = { "mov_door_hanger_entry_1a" },
},
}
Dlc2_m02_backstage_data = {
{
exit_trigger = "trg_backstage_exit_1",
doors = Dlc2_m02_backstage_doors[ 1 ],
player_loadout = Dlc2_m02_loadouts.player[ 1 ],
homie_loadout = Dlc2_m02_loadouts.homie[ 1 ],
homie_personality = "gang defensive",
create_groups = { Dlc2_m02_groups.loadout1 },
loadout_trail = Dlc2_m02_trails.backstage1,
convo_enter = Dlc2_m02_convos.bs_1_first_convo,
action_line = Dlc2_m02_convos.action_01,
convo_exit = Dlc2_m02_convos.first_action_1,
},
{
enter_trigger = "trg_backstage_enter_2",
exit_trigger = "trg_backstage_exit_2",
doors = Dlc2_m02_backstage_doors[ 2 ],
player_loadout = Dlc2_m02_loadouts.player[ 2 ],
homie_loadout = Dlc2_m02_loadouts.homie[ 2 ],
homie_personality = "gang normal",
trigger_doors_at_end = { Dlc2_m02_trigger_doors.room3_entry },
create_groups = { Dlc2_m02_groups.loadout2 },
trail = Dlc2_m02_trails.backstage2,
convo_enter = Dlc2_m02_convos.bs_2_first,
action_line = Dlc2_m02_convos.generic_actions,
convo_exit = Dlc2_m02_convos.second_action_1,
on_enter_backstage_audio_event = "M02_Part1_Music_Stop",
},
{
enter_trigger = "trg_backstage_enter_3",
exit_trigger = "trg_backstage_exit_3",
doors = Dlc2_m02_backstage_doors[ 3 ],
player_loadout = Dlc2_m02_loadouts.player[ 3 ],
homie_loadout = Dlc2_m02_loadouts.homie[ 3 ],
homie_personality = "gang offensive",
trigger_doors_at_end = { Dlc2_m02_trigger_doors.hall4_entry },
create_groups = { Dlc2_m02_groups.loadout3 },
action_line = Dlc2_m02_convos.action_03,
on_enter_backstage_audio_event = "M02_Part2_Music_Stop",
no_trail = true,
},
}
Dlc2_m02_machine_data = {
machine_1 = {
mover = "mov_machine_1",
navpoint = "nav_machine_1",
approach_trigger = "trg_machine_approach_1",
activation_time = 30,
homie_activates = true,
safe_nav = "nav_machine_safe_1",
gspawn_data = Dlc2_m02_gspawn_data.room_1,
cspawn_data = Dlc2_m02_cspawn_data.machine_1,
explosion_type = "alien_mindcontrol",
trigger_doors = { Dlc2_m02_trigger_doors.room1_entry },
trail = Dlc2_m02_trails.room1,
convo_approach = Dlc2_m02_convos.find_1st_device,
convo_complete = Dlc2_m02_convos.first_device_end,
machine_mover = "mov_machine_1",
countdown_audio_event = "M02_Part1_Countdown_1",
homie_port = "nav_room1_homie_port",
},
machine_2 = {
mover = "mov_machine_2",
trigger = Dlc2_m02_triggers.machine_2,
navpoint = "nav_machine_2",
approach_trigger = "trg_machine_approach_2",
safe_nav = "nav_machine_safe_2",
activation_time = 30,
player_activates = true,
gspawn_data = Dlc2_m02_gspawn_data.hall_2,
cspawn_data = Dlc2_m02_cspawn_data.machine_2,
explosion_type = "alien_mindcontrol",
trigger_doors = { Dlc2_m02_trigger_doors.room2_entry, Dlc2_m02_trigger_doors.hall2_entry },
trail = Dlc2_m02_trails.room2,
convo_approach = { Dlc2_m02_convos.find_2nd_device, Dlc2_m02_convos.approval_01 },
convo_finish = Dlc2_m02_convos.second_device_finished_01,
convo_complete = Dlc2_m02_convos.second_device_end,
machine_mover = "mov_machine_2",
start_disable_audio_event = "M02_Part1_Countdown_2",
homie_port = "nav_room2_homie_port",
},
machine_3 = {
mover = "mov_machine_3",
navpoint = "nav_machine_3",
safe_nav = "nav_machine_safe_3",
approach_trigger = "trg_machine_approach_3",
activation_time = 30,
homie_activates = true,
gspawn_data = Dlc2_m02_gspawn_data.room_3,
cspawn_data = Dlc2_m02_cspawn_data.machine_3,
explosion_type = "alien_mindcontrol",
trail = Dlc2_m02_trails.room3,
convo_approach = Dlc2_m02_convos.find_third_device,
convo_finish = Dlc2_m02_convos.third_device_finished_01,
convo_complete = Dlc2_m02_convos.third_device_end,
machine_mover = "mov_machine_3",
start_disable_audio_event = "M02_Part2_Kwilanna_1",
countdown_audio_event = "M02_Part2_Countdown_1",
homie_port = "nav_room3_homie_port",
explosions = { "nav_machine_3_explode_1", "nav_machine_3_explode_2", "nav_machine_3_explode_3", },
explosions_mov = {
{ "mov_barrell_01", "mov_barrell_02", "mov_barrell_03", "mov_barrell_09", "mov_barrell_10", "mov_barrell_11", },
{ "mov_barrell_04", "mov_barrell_05", "mov_barrell_06", "mov_barrell_12", "mov_barrell_13", "mov_barrell_14", },
{ "mov_barrell_07", "mov_barrell_08", "mov_barrell_15", "mov_barrell_16", },
}
},
machine_4a = {
navpoint = "nav_machine4a_local",
navpoint_homie = "nav_machine4a_homie",
trigger = Dlc2_m02_triggers.machine_4a,
approach_trigger = "trg_machine4a_approach",
activation_time = 30,
both_disable = true,
gspawn_data = Dlc2_m02_gspawn_data.room_4,
cspawn_data = Dlc2_m02_cspawn_data.machine_4a,
trigger_doors = { Dlc2_m02_trigger_doors.hall3_entry, Dlc2_m02_trigger_doors.room4_entry },
trail = Dlc2_m02_trails.room4a,
convo_homie_ready = { Dlc2_m02_convos.ready_4a, Dlc2_m02_convos.berating_4a },
convo_complete = Dlc2_m02_convos.after_first_tier,
alt_approach_msg = Dlc2_m02_text.go_to_server,
start_disable_audio_event = "M02_Part2_Code_Search",
homie_port = "nav_room4_homie_port",
},
machine_4b = {
navpoint = "nav_machine4b_local",
navpoint_homie = "nav_machine4b_homie",
trigger = Dlc2_m02_triggers.machine_4b,
approach_trigger = "trg_machine4b_approach",
activation_time = 30,
both_disable = true,
cspawn_data = Dlc2_m02_cspawn_data.machine_4b,
alt_approach_msg = Dlc2_m02_text.go_to_server,
trail = Dlc2_m02_trails.room4b,
convo_homie_ready = Dlc2_m02_convos.ready_4c,
convo_complete = Dlc2_m02_convos.after_4b,
},
machine_4c = {
navpoint = "nav_machine4c_local",
navpoint_homie = "nav_machine4c_homie",
trigger = Dlc2_m02_triggers.machine_4c,
approach_trigger = "trg_machine4c_approach",
activation_time = 30,
both_disable = true,
convo_homie_ready = Dlc2_m02_convos.ready_4c,
convo_complete = { Dlc2_m02_convos.finding_key_01, Dlc2_m02_convos.trigger_destruct, },
alt_approach_msg = Dlc2_m02_text.go_to_server,
trail = Dlc2_m02_trails.room4c,
},
machine_4 = {
mover = "mov_machine_4",
navpoint = "nav_machine_4",
approach_trigger = "trg_machine_approach_4",
activation_time = 30,
homie_activates = true,
trail = Dlc2_m02_trails.room4b,
cspawn_data = Dlc2_m02_cspawn_data.machine_4,
convo_homie_ready = Dlc2_m02_convos.control_room,
convo_complete = Dlc2_m02_convos.unlock_door,
trail = Dlc2_m02_trails.room4,
start_disable_audio_event = "M02_Part2_Kwilanna_2",
proximity_check_waived = true,
},
}
Dlc2_m02_checkpoint_data = {
[ Dlc2_m02_checkpoints[ 1 ] ] = { -- mission start
local_start_nav = "nav_local_mission_start",
remote_start_nav = "nav_remote_mission_start",
homie_start_nav = "nav_homie_mission_start",
},
[ Dlc2_m02_checkpoints[ 2 ] ] = { -- room 1
local_start_nav = "nav_local_start_cp_m1",
remote_start_nav = "nav_remote_start_cp_m1",
homie_start_nav = "nav_homie_start_cp_m1",
backstage_data = Dlc2_m02_backstage_data[ 1 ]
},
[ Dlc2_m02_checkpoints[ 3 ] ] = { -- room 2
local_start_nav = "nav_local_start_cp_m2",
remote_start_nav = "nav_remote_start_cp_m2",
homie_start_nav = "nav_homie_start_cp_m2",
backstage_data = Dlc2_m02_backstage_data[ 2 ]
},
[ Dlc2_m02_checkpoints[ 4 ] ] = { -- room 3
local_start_nav = "nav_local_start_cp_m3",
remote_start_nav = "nav_remote_start_cp_m3",
homie_start_nav = "nav_homie_start_cp_m3",
backstage_data = Dlc2_m02_backstage_data[ 2 ]
},
[ Dlc2_m02_checkpoints[ 5 ] ] = { -- room 4
local_start_nav = "nav_local_start_cp_m4",
remote_start_nav = "nav_remote_start_cp_m4",
homie_start_nav = "nav_homie_start_cp_m4",
backstage_data = Dlc2_m02_backstage_data[ 3 ]
},
}
Dlc2_m02_clapboards = {
{ trigger = Dlc2_m02_triggers.clapboard_01, item = "item_clapboard_01", effect = "Vfx_clapboard_01", collected = false, },
{ trigger = Dlc2_m02_triggers.clapboard_02, item = "item_clapboard_02", effect = "Vfx_clapboard_02", collected = false, },
{ trigger = Dlc2_m02_triggers.clapboard_03, item = "item_clapboard_03", effect = "Vfx_clapboard_03", collected = false, },
{ trigger = Dlc2_m02_triggers.clapboard_04, item = "item_clapboard_04", effect = "Vfx_clapboard_04", collected = false, },
{ trigger = Dlc2_m02_triggers.clapboard_05, item = "item_clapboard_05", effect = "Vfx_clapboard_05", collected = false, },
{ trigger = Dlc2_m02_triggers.clapboard_06, item = "item_clapboard_06", effect = "Vfx_clapboard_06", collected = false, },
}
-- Achievement data
Dlc2_m02_achievements = {
pew_pew_pew = {
name = "Pew Pew Pew!",
slot_idx = 0,
current_count = 0,
target_goal = 35,
},
man_power = {
name = "Man Power!",
slot_idx = 1,
current_count = 0,
target_goal = 7,
},
lights_camera_action = {
name = "Lights! Camera! Action!",
slot_idx = 1,
current_count = 0,
target_goal = #Dlc2_m02_clapboards,
},
}
-- *************************
--
-- Standard functions
--
-- *************************
-- This is the primary entry point for the mission, and is responsible for starting up the mission
-- at the specified checkpoint.
-- CALLED FROM CODE
--
-- dlc2_m02_checkpoint: The checkpoint the mission should begin at
-- is_restart: TRUE if the mission is restarting, FALSE otherwise
--
function dlc2_m02_start( checkpoint, is_restart )
-- Disable the ability to add crib weapons for this mission. There wasn't room on consoles to store the meshes outside of the mission.
-- This fixes bug XXX where when the player did a brute kill with the pistol, the laser pistol weapon info was added to the crib
crib_weapon_add_disable()
-- Make sure the screen is completly faded out
mission_start_fade_out( 0.0 )
if checkpoint == Dlc2_m02_checkpoints[ 1 ] then
-- Clear all of the acievement counters
for i, achievement in pairs(Dlc2_m02_achievements) do
dlc2_m02_helper_achievement_reset( achievement )
end
dlc2_m02_clapboards_reset( #Dlc2_m02_clapboards )
teleport_coop( Dlc2_m02_navpoints.local_mission_start, Dlc2_m02_navpoints.remote_mission_start, true )
end
dlc2_m02_clapboard_setup()
dlc2_m02_initialize_common()
dlc2_m02_initialize_checkpoint( checkpoint )
-- Start fading in
mission_start_fade_in()
-- Run the mission from the current checkpoint
dlc2_m02_run( checkpoint, is_restart )
end
-- This is the primary function responsible for running the entire mission from start to finish.
--
-- first_checkpoint: The first checkpoint to begin running the mission at
--
function dlc2_m02_run( first_checkpoint, is_restart )
local current_checkpoint = first_checkpoint
local homie = Dlc2_m02_characters.alien_homie
-- make sure player personas are set to dlc2
persona_set_dlc_bundle(2)
group_create( Dlc2_m02_groups.clapboards )
if current_checkpoint == Dlc2_m02_checkpoints[ 1 ] then
character_ragdoll_set_last_resort_position( Dlc2_m02_checkpoint_data[ current_checkpoint ].local_start_nav )
dlc2_m02_set_up_spawn_phase( Dlc2_m02_cspawn_data.hall_1 )
on_trigger( "dlc2_m02_backstage_01_roof", Dlc2_m02_triggers.backstage_01_roof )
trigger_enable( Dlc2_m02_triggers.backstage_01_roof )
dlc2_m02_handle_backstage( Dlc2_m02_backstage_data[ 1 ], is_restart )
audio_object_post_event( "M02_Part1_Music_Start", nil, nil, LOCAL_PLAYER )
dlc2_m02_film_grain_load()
-- destroy each machine in turn
dlc2_m02_handle_machine( Dlc2_m02_machine_data.machine_1 )
dlc2_m02_setup_convo_trigger( Dlc2_m02_triggers.hall_01_first_action_2, Dlc2_m02_convos.first_action_2 )
dlc2_m02_helper_achievements_write_checkpoint()
current_checkpoint = Dlc2_m02_checkpoints[ 2 ]
mission_set_checkpoint( current_checkpoint )
end
if current_checkpoint == Dlc2_m02_checkpoints[ 2 ] then
dlc2_m02_film_grain_load()
dlc2_m02_set_up_spawn_phase( Dlc2_m02_cspawn_data.hall_2 )
Dlc2_m02_status.spawn_on_wake = Dlc2_m02_gspawn_data.room_2
dlc2_m02_handle_machine( Dlc2_m02_machine_data.machine_2 )
dlc2_m02_setup_convo_trigger( Dlc2_m02_triggers.backstage_02_borc, Dlc2_m02_convos.see_borc_set )
dlc2_m02_setup_convo_trigger( Dlc2_m02_triggers.action_02, Dlc2_m02_convos.exit_bs_2 )
dlc2_m02_handle_backstage( Dlc2_m02_backstage_data[ 2 ] )
dlc2_m02_helper_achievements_write_checkpoint()
current_checkpoint = Dlc2_m02_checkpoints[ 3 ]
mission_set_checkpoint( current_checkpoint )
end
if current_checkpoint == Dlc2_m02_checkpoints[ 3 ] then
if first_checkpoint == Dlc2_m02_checkpoints[ 3 ] then
-- since this checkpoint is starting us in the backstage we have to simulate that bit here
-- objective
objective_text( 0, Dlc2_m02_text.go_to_set, nil, nil, SYNC_ALL, OI_ASSET_LOCATION )
marker_add_trigger( "trg_backstage_exit_2", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_FULL, SYNC_ALL )
dlc2_m02_convo_play( Dlc2_m02_convos.exit_bs_2, false, true)
dlc2_m02_wait_for_player_to_enter_trigger( "trg_backstage_exit_2", true )
objective_text_clear( 0 )
marker_remove( "trg_backstage_exit_2" )
dlc2_m02_convo_play( Dlc2_m02_convos.generic_actions, false, true )
dlc2_m02_convo_play( Dlc2_m02_convos.second_action_1, false, false)
end
dlc2_m02_film_grain_load()
character_ragdoll_set_last_resort_position( Dlc2_m02_checkpoint_data[ current_checkpoint ].local_start_nav )
on_trigger( "dlc2_m02_room3_cue_music", "trg_room3_cue_music" )
trigger_enable( "trg_room3_cue_music", true )
dlc2_m02_handle_machine( Dlc2_m02_machine_data.machine_3 )
dlc2_m02_helper_achievements_write_checkpoint()
current_checkpoint = Dlc2_m02_checkpoints[ 4 ]
mission_set_checkpoint( current_checkpoint )
end
if current_checkpoint == Dlc2_m02_checkpoints[ 4 ] then
dlc2_m02_film_grain_load()
dlc2_m02_set_up_spawn_phase( Dlc2_m02_cspawn_data.hall_3 )
-- use altered crumb trail on chekpoint
if first_checkpoint == Dlc2_m02_checkpoints[ 4 ] then
Dlc2_m02_machine_data.machine_4a.trail = Dlc2_m02_trails.room4a_checkpoint
end
dlc2_m02_setup_convo_trigger( Dlc2_m02_triggers.hall_03_find_key_area, Dlc2_m02_convos.find_key_area )
dlc2_m02_handle_machine( Dlc2_m02_machine_data.machine_4a )
dlc2_m02_handle_machine( Dlc2_m02_machine_data.machine_4b )
dlc2_m02_end_cspawning()
dlc2_m02_handle_machine( Dlc2_m02_machine_data.machine_4c )
audio_object_post_event( "M02_Part2_Countdown_2", nil, nil, LOCAL_PLAYER )
audio_object_post_event( "M02_Security", nil, nil, LOCAL_PLAYER )
hud_critical_timer_set( 60 * 1000, Dlc2_m02_text.security_activating, "dlc2_m02_activate_security", SYNC_ALL )
dlc2_m02_handle_machine( Dlc2_m02_machine_data.machine_4 )
Dlc2_m02_threads.homie_kill_thread = thread_new( "dlc2_m02_homie_kills" )
dlc2_m02_setup_convo_trigger( Dlc2_m02_triggers.backstage_03_mars, Dlc2_m02_convos.see_mars_set )
dlc2_m02_setup_convo_trigger( Dlc2_m02_triggers.backstage_03_walker, Dlc2_m02_convos.see_rfg_walker )
dlc2_m02_setup_convo_trigger( Dlc2_m02_triggers.backstage_03_exit, Dlc2_m02_convos.exit_bs3 )
dlc2_m02_setup_door_trigger( Dlc2_m02_trigger_doors.room4_exit )
-- wait to detonate room
dlc2_m02_trail_start( Dlc2_m02_trails.backstage3 )
objective_text( 0, Dlc2_m02_text.go_to_backstage, nil, nil, SYNC_ALL, OI_ASSET_LOCATION )
dlc2_m02_wait_for_player_to_enter_trigger( "trg_room4_escape" )
hud_critical_timer_stop()
audio_object_post_event( "M02_Security_Stop", nil, nil, LOCAL_PLAYER )
local nav_explosions = {
"self_destruct_explosion<001>",
"self_destruct_explosion<002>",
"self_destruct_explosion<003>",
"self_destruct_explosion<004>",
"self_destruct_explosion<005>",
"self_destruct_explosion<006>",
"self_destruct_explosion<007>",
}
for i, nav in pairs( nav_explosions ) do
explosion_create( "alien_mindcontrol", nav, nil, nil, "vfx_mindcontrol_exp" )
camera_shake_play( "m24_marsquake", 6 )
delay( 1.0 )
end
dlc2_m02_convo_play( Dlc2_m02_convos.key_area_explodes_01, false, true )
dlc2_m02_handle_backstage( Dlc2_m02_backstage_data[ 3 ] )
dlc2_m02_helper_achievements_write_checkpoint()
current_checkpoint = Dlc2_m02_checkpoints[ 5 ]
mission_set_checkpoint( current_checkpoint )
end
character_ragdoll_set_last_resort_position( Dlc2_m02_checkpoint_data[ current_checkpoint ].local_start_nav )
-- audio: ACTION!
-- TODO
dlc2_m02_film_grain_load()
dlc2_m02_saucer_camera_sequence()
dlc2_m02_go_to_saucer()
dlc2_m02_brutina()
dlc2_m02_obj_shut_down_forcefield()
dlc2_m02_escape_in_saucer()
mission_end_success( "dlc2_m02" )
Dlc2_m02_status.mission_success = true
end
-- This is the primary function responsible for cleaning up the entire mission
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function dlc2_m02_cleanup()
dlc2_m02_trail_stop()
hud_critical_timer_stop()
cleanup_callbacks( Dlc2_m02_characters )
dlc2_m02_cleanup_group_members( Dlc2_m02_groups )
cleanup_groups( Dlc2_m02_groups )
dlc2_m02_cleanup_convos( Dlc2_m02_convos )
dlc2_m02_cleanup_triggers( Dlc2_m02_triggers )
dlc2_m02_cleanup_threads( Dlc2_m02_threads )
dlc2_m02_cleanup_movers( Dlc2_m02_movers )
dlc2_m02_cleanup_continuous_spawn_groups( Dlc2_m02_spawn_groups )
dlc2_m02_cleanup_continuous_spawn_regions( Dlc2_m02_spawn_regions )
qte_cleanup()
character_ragdoll_clear_last_resort_position()
spawning_vehicles( true )
spawning_pedestrians( true )
player_grenades_enable()
team_make_hostile( "Neutral Gang", "Playas" )
character_fake_revival_end( LOCAL_PLAYER )
customization_item_revert()
player_force_vehicle_seat( LOCAL_PLAYER, -1 )
player_parachute_wear_backpack( LOCAL_PLAYER, false )
player_movement_enable( LOCAL_PLAYER )
player_can_sprint( true )
radio_global_block( false )
audio_object_post_event( "M02_Music_Kill", nil, nil, LOCAL_PLAYER )
dlc2_m02_enable_traps( false )
on_trigger( "", "trg_room3_cue_music" )
if coop_is_active() then
player_force_vehicle_seat( REMOTE_PLAYER, -1 )
end
notoriety_set_min_and_max( "police", 0, 5 )
notoriety_set_min_and_max( "stag", 0, 5 )
notoriety_set_min_and_max( "luchadores", 0, 5 )
notoriety_set_min_and_max( "deckers", 0, 5 )
notoriety_set_min_and_max( "morningstar", 0, 5 )
notoriety_force_no_spawn( "police", false )
notoriety_force_no_spawn( "stag", false )
notoriety_force_no_spawn( "luchadores", false )
notoriety_force_no_spawn( "deckers", false )
notoriety_force_no_spawn( "morningstar", false )
dlc2_m02_film_grain_unload( false )
dlc2_m02_remove_loadout()
inv_weapon_disable_all_slots( false )
camera_end_look_through( true )
audio_persona_remove_2d( Dlc2_m02_status.personas[ "PAK2_Kwilanna" ] )
audio_persona_remove_2d( Dlc2_m02_status.personas[ "PAK2_Director" ] )
Dlc2_m02_status.personas = { }
action_nodes_shouldnt_flee( false )
if Dlc2_m02_status.mission_success == true then
teleport( LOCAL_PLAYER, Dlc2_m02_navpoints.local_mission_end )
if coop_is_active() == true then
teleport( REMOTE_PLAYER, Dlc2_m02_navpoints.remote_mission_end )
end
end
for i, d in pairs( Dlc2_m02_clapboards ) do
if d.effect_handle ~= nil then
effect_stop( d.effect_handle )
end
end
-- Clear the global persona override
persona_clear_global_situation_override()
-- Enable the addition of crib weapons
crib_weapon_add_enable()
end
function dlc2_m02_cleanup_group_members( groups )
for i, grp in pairs( groups ) do
local members = dlc2_m02_group_get_members( grp.name )
for j, member in pairs( members ) do
if character_exists( member ) == true then
clear_callbacks_for_obj( member )
end
end
end
end
-- Called when the mission has ended with success
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function dlc2_m02_success()
end
-- *************************
--
-- Local functions
--
-- *************************
-- Initialize the mission for the specified checkpoint
--
-- checkpoint: Checkpoint to initialize the mission to
--
function dlc2_m02_initialize_checkpoint(checkpoint)
local cp_data = Dlc2_m02_checkpoint_data[ checkpoint ]
local homie = Dlc2_m02_characters.alien_homie
dlc2_m02_helper_achievement_read_checkpoint( Dlc2_m02_achievements )
if checkpoint ~= MISSION_START_CHECKPOINT then
teleport_coop( cp_data.local_start_nav, cp_data.remote_start_nav, true )
end
-- move homie into position
teleport( Dlc2_m02_characters.alien_homie, cp_data.homie_start_nav )
-- backstage adjustments
local backstage_data = cp_data.backstage_data
if backstage_data ~= nil then
if backstage_data.player_loadout ~= nil then
dlc2_m02_switch_loadout( backstage_data.player_loadout )
end
if backstage_data.homie_loadout ~= nil then
inv_item_remove_all( homie )
inv_item_add( backstage_data.homie_loadout, 1, homie, true )
end
if backstage_data.homie_personality ~= nil then
ai_set_personality( homie, backstage_data.homie_personality )
end
end
if checkpoint == Dlc2_m02_checkpoints[ 2 ] then
audio_object_post_event( "M02_Music_Checkpoint_1", nil, nil, LOCAL_PLAYER )
elseif checkpoint == Dlc2_m02_checkpoints[ 4 ] then
audio_object_post_event( "M02_Music_Checkpoint_3", nil, nil, LOCAL_PLAYER )
end
end
-- ***************************************************
-- dlc2_m02_run Helper Functions
-- ***************************************************
function dlc2_m02_handle_machine( machine_data )
local nav = machine_data.navpoint
local homie = Dlc2_m02_characters.alien_homie
if machine_data.gspawn_data ~= nil then
dlc2_m02_create_groups( machine_data.gspawn_data )
end
-- objective, local: approach machine
local msg
if machine_data.alt_approach_msg == nil then
msg = Dlc2_m02_text.approach_machine_local
else
msg = machine_data.alt_approach_msg
end
objective_text( 0, msg, nil, nil, SYNC_LOCAL, OI_ASSET_LOCATION )
objective_text( 1, msg, nil, nil, SYNC_REMOTE, OI_ASSET_LOCATION )
if machine_data.trail ~= nil then
dlc2_m02_trail_start( machine_data.trail )
else
-- mark machine
marker_add( nav, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_FULL, SYNC_ALL )
end
-- set up any triggered doors
if machine_data.trigger_doors ~= nil then
for i, door_data in pairs( machine_data.trigger_doors ) do
dlc2_m02_setup_door_trigger( door_data )
end
end
-- wait for approach
if machine_data.approach_trigger ~= nil then
local coop_msg_displayed = coop_is_active() == false
while object_is_in_trigger( machine_data.approach_trigger, LOCAL_PLAYER ) == false do
if coop_msg_displayed == false and object_is_in_trigger( machine_data.approach_trigger, REMOTE_PLAYER ) == true then
objective_text( 1, Dlc2_m02_text.wait_for_homie, nil, nil, SYNC_REMOTE, OI_ASSET_LOCATION )
coop_msg_displayed = true
end
thread_yield()
end
else
while get_dist( LOCAL_PLAYER, nav ) > 15 do
thread_yield()
end
end
objective_text_clear( 0 )
objective_text_clear( 1 )
dlc2_m02_trail_stop()
-- port homie to known good spot if she is too far
local homie_port_nav = machine_data.homie_port
if homie_port_nav ~= nil and get_dist( LOCAL_PLAYER, homie_port_nav ) < get_dist( LOCAL_PLAYER, homie ) then
teleport( homie, homie_port_nav )
end
-- approach convo
if machine_data.convo_approach ~= nil then
dlc2_m02_convo_play( machine_data.convo_approach, false, true )
end
if machine_data.homie_activates == true then
dlc2_m02_homie_disable_machine( machine_data )
elseif machine_data.player_activates == true then
dlc2_m02_player_disable_machine( machine_data )
elseif machine_data.homie_destroys == true then
dlc2_m02_homie_destroy_machine( machine_data )
elseif machine_data.both_disable == true then
dlc2_m02_both_disable_machine( machine_data )
else -- assume player_destroys == true
dlc2_m02_player_destroy_machine( machine_data )
end
if machine_data.convo_finish ~= nil then
dlc2_m02_convo_play( machine_data.convo_finish, false, true )
end
if machine_data.explosion_type ~= nil then
audio_object_post_event( "M02_Self_Destruct", nil, nil, LOCAL_PLAYER )
if machine_data.countdown_audio_event ~= nil then
audio_object_post_event( machine_data.countdown_audio_event, nil, nil, LOCAL_PLAYER )
end
-- mark the unsafe area
minimap_icon_add_radius( nav, 15, SYNC_ALL )
if machine_data.explosions ~= nil then
for i, n in pairs( machine_data.explosions ) do
minimap_icon_add_radius( n, 15, SYNC_ALL )
end
end
-- countdown to explosion
Dlc2_m02_status.explosion_timer_complete = false
hud_critical_timer_set( 10 * 1000, Dlc2_m02_text.explosion_warning, "dlc2_m02_machine_exploding_countdown", SYNC_ALL )
local homie_being_safe = false
while true do
local should_be_safe = Dlc2_m02_status.explosion_timer_complete == false and get_dist( nav, LOCAL_PLAYER ) < 10
if homie_being_safe ~= should_be_safe then
if should_be_safe then
follower_make_independent( homie, true )
npc_leash_to_nav( homie, machine_data.safe_nav, 5 )
else
follower_make_independent( homie, false )
npc_leash_remove( homie )
end
homie_being_safe = should_be_safe
end
if Dlc2_m02_status.explosion_timer_complete then
break
end
thread_yield()
end
hud_critical_timer_stop()
-- explode with camera shake
mesh_mover_set_invulnerable( machine_data.machine_mover, false )
mesh_mover_kill( machine_data.machine_mover )
minimap_icon_remove_radius( nav )
camera_shake_play( "m24_marsquake", 6 )
explosion_create( "alien_mindcontrol", nav, LOCAL_PLAYER, nil, "vfx_mindcontrol_exp" )
if machine_data.explosions ~= nil then
for i, n in pairs( machine_data.explosions ) do
delay( 1 )
minimap_icon_remove_radius( n )
for j, mov in pairs( machine_data.explosions_mov[ i ] ) do
mesh_mover_set_invulnerable( mov, false )
mesh_mover_kill( mov )
camera_shake_play( "m24_marsquake", 6 )
end
end
end
end
if machine_data.convo_complete ~= nil then
dlc2_m02_convo_play( machine_data.convo_complete, false, true )
end
-- clear objective
objective_text_clear( 0 )
end
function dlc2_m02_go_to_saucer()
-- objective
objective_text( 0, Dlc2_m02_text.approach_saucer, nil, nil, SYNC_ALL, OI_ASSET_LOCATION )
dlc2_m02_create_groups( Dlc2_m02_gspawn_data.hanger_2 )
-- approach saucer
Dlc2_m02_status.saucer_approached = false
trigger_enable( Dlc2_m02_triggers.saucer, true )
on_trigger( "dlc2_m02_saucer_approach", Dlc2_m02_triggers.saucer )
dlc2_m02_trail_start( Dlc2_m02_trails.hanger1 )
while Dlc2_m02_status.saucer_approached == false do
thread_yield()
end
dlc2_m02_trail_stop()
mesh_mover_reset( "mov_forcefield" )
mesh_mover_show( "mov_forcefield" )
on_trigger( "", Dlc2_m02_triggers.saucer )
trigger_enable( Dlc2_m02_triggers.saucer, false )
dlc2_m02_convo_play( Dlc2_m02_convos.force_field_start, false, true )
-- clear objective
objective_text_clear( 0 )
end
function dlc2_m02_escape_in_saucer()
local homie = Dlc2_m02_characters.alien_homie
-- objective: get to saucer
objective_text( 0, Dlc2_m02_text.approach_saucer, nil, nil, SYNC_ALL, OI_ASSET_LOCATION )
-- approach saucer
Dlc2_m02_status.saucer_approached = false
marker_add( Dlc2_m02_vehicles.saucer, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_FULL, SYNC_ALL )
trigger_enable( Dlc2_m02_triggers.saucer, true )
on_trigger( "dlc2_m02_saucer_approach", Dlc2_m02_triggers.saucer )
while Dlc2_m02_status.saucer_approached == false do
thread_yield()
end
on_trigger( "", Dlc2_m02_triggers.saucer )
marker_remove( Dlc2_m02_vehicles.saucer )
trigger_enable( Dlc2_m02_triggers.saucer, false )
-- objective: get in saucer
objective_text( 0, Dlc2_m02_text.board_saucer, nil, nil, SYNC_ALL, OI_ASSET_USE )
marker_add( Dlc2_m02_vehicles.saucer, MINIMAP_ICON_USE, OI_ASSET_USE, OI_FLAGS_FULL, SYNC_ALL )
follower_make_independent( Dlc2_m02_characters.alien_homie, true )
vehicle_enter( homie, Dlc2_m02_vehicles.saucer, 0, true )
-- wait for players to get in saucer
while true do
if character_is_in_vehicle( homie, Dlc2_m02_vehicles.saucer ) then
turn_invulnerable( homie )
if character_is_in_vehicle( LOCAL_PLAYER, Dlc2_m02_vehicles.saucer ) then
if coop_is_active() then
if character_is_in_vehicle( REMOTE_PLAYER, Dlc2_m02_vehicles.saucer ) then
break
end
else
break
end
end
end
thread_yield()
end
-- clear objective
objective_text_clear( 0 )
marker_remove( Dlc2_m02_vehicles.saucer )
player_controls_disable( LOCAL_PLAYER )
if coop_is_active() == true then
player_controls_disable( REMOTE_PLAYER )
end
camera_look_through( Dlc2_m02_navpoints.hanger_camera, 2 )
Dlc2_m02_threads.saucer_away = thread_new( "dlc2_m02_saucer_away" )
delay( 5 )
audio_object_post_event( "M02_Part3_Music_Stop", nil, nil, LOCAL_PLAYER )
dlc2_m02_convo_play( Dlc2_m02_convos.mission_end, true, true )
delay( 3 )
end
function dlc2_m02_saucer_away()
helicopter_fly_to_direct( Dlc2_m02_vehicles.saucer, 2, "sp_saucer_away" )
end
-- ***************************************************
-- dlc2_m02_initialize_checkpoint Helper Functions
-- ***************************************************
-- Handle any common initialization
--
function dlc2_m02_initialize_common()
set_mission_author( "Sean Rose" )
notoriety_set_min_and_max( "police", 0, 0 )
notoriety_set_min_and_max( "stag", 0, 0 )
notoriety_set_min_and_max( "luchadores", 0, 0 )
notoriety_set_min_and_max( "deckers", 0, 0 )
notoriety_set_min_and_max( "morningstar", 0, 0 )
notoriety_force_no_spawn( "police", true )
notoriety_force_no_spawn( "stag", true )
notoriety_force_no_spawn( "luchadores", true )
notoriety_force_no_spawn( "deckers", true )
notoriety_force_no_spawn( "morningstar", true )
customization_outfit_wear("Lets Pretend Male A")
radio_global_block( true )
action_nodes_shouldnt_flee( true )
mission_set_cancel_warp_location( Dlc2_m02_navpoints.local_mission_end, Dlc2_m02_navpoints.remote_mission_end )
spawning_vehicles( false )
spawning_pedestrians( false )
-- disable weapons, they get enabled based on the mission stage
inv_weapon_disable_all_but_this_slot( WEAPON_SLOT_UNARMED )
-- create machines
group_create( Dlc2_m02_groups.machines.name )
-- spawn homie
group_create( Dlc2_m02_groups.homies.name )
party_add_ignore_limits( Dlc2_m02_groups.homies.npcs[ 1 ], LOCAL_PLAYER )
on_death( "dlc2_m02_on_death_alien_homie_fail", Dlc2_m02_groups.homies.npcs[ 1 ] )
Dlc2_m02_status.personas = {}
Dlc2_m02_status.personas[ "PAK2_Kwilanna" ] = audio_persona_load_2d( "PAK2_Kwilanna" )
Dlc2_m02_status.personas[ "PAK2_Director" ] = audio_persona_load_2d( "PAK2_Director" )
-- set up activation triggers
on_trigger( "dlc2_m02_wake_up_npcs", Dlc2_m02_triggers.activate_hall_1 )
trigger_enable( Dlc2_m02_triggers.activate_hall_1 )
on_trigger( "dlc2_m02_wake_up_npcs", Dlc2_m02_triggers.activate_hall_2 )
trigger_enable( Dlc2_m02_triggers.activate_hall_2 )
on_trigger( "dlc2_m02_wake_up_npcs", Dlc2_m02_triggers.activate_hall_3 )
trigger_enable( Dlc2_m02_triggers.activate_hall_3 )
on_trigger( "dlc2_m02_wake_up_npcs", Dlc2_m02_triggers.activate_room_2 )
trigger_enable( Dlc2_m02_triggers.activate_room_2 )
player_grenades_disable()
dlc2_m02_enable_traps( true )
-- Setup a global persona situation override to disable some of Kwilanna's ambient persona lines
persona_set_global_situation_override(9)
end
-- ***************************************************
-- Miscellaneous m24 Helper Funcrtions
-- ***************************************************
-- Cleans up a table of trigger regions by reseting their on_trigger callback and disabling them
--
-- trigger_group: (string) table of trigger names
function dlc2_m02_cleanup_triggers( trigger_group )
for i, trigger in pairs( trigger_group ) do
if type( trigger ) == "table" then
dlc2_m02_cleanup_triggers( trigger )
elseif trigger ~= "" then
on_trigger( "", trigger )
on_trigger_exit( "", trigger )
trigger_enable( trigger, false )
end
end
end
-- Cleans up a table of thread handles by killing them and resetting their thread handle
--
-- thread_group: (string) table of thread names
function dlc2_m02_cleanup_threads( thread_group )
for i, thread in pairs( thread_group ) do
if type( thread ) == "table" then
dlc2_m02_cleanup_threads( thread )
else
if thread ~= INVALID_THREAD_HANDLE then
thread_kill(thread)
thread = INVALID_THREAD_HANDLE
end
end
end
end
-- Cleans up a table of mover names by resetting their on_mover_destroyed callback and removing any HUD markers
--
-- mover_group: (string) table of mover names
function dlc2_m02_cleanup_movers( mover_group )
for i, mover in pairs( mover_group ) do
if type( mover ) == "table" then
dlc2_m02_cleanup_movers( mover )
else
on_mover_destroyed( "", mover )
marker_remove( mover )
end
end
end
-- Cleans up any active continuous spawn groups
--
-- cs_group: (string) table of spawn groups
function dlc2_m02_cleanup_continuous_spawn_groups( cs_group )
for i, spawn_group in pairs( cs_group ) do
if type( spawn_group ) == "table" then
dlc2_m02_cleanup_continuous_spawn_groups( spawn_group )
else
continuous_spawn_stop( spawn_group, true )
end
end
end
-- Disables any active spawn regions
--
-- cs_region: (string) table of spawn regions
function dlc2_m02_cleanup_continuous_spawn_regions( cs_region )
for i, region in pairs( cs_region ) do
if region.name == nil then
dlc2_m02_cleanup_continuous_spawn_regions( region )
else
spawn_region_enable( region.name, false )
end
end
end
-- *************************
--
-- Conversations
--
-- *************************
-- Play an audio conversation
--
-- convo: (table) the conversation to play - contains a name, handle, and table of non-player speakers
-- wait: (bool) don't return until convo has played
-- clear: (bool) clear any pending convos
--
function dlc2_m02_convo_play( convo, wait, clear )
if convo == nil or type( convo ) ~= "table" then
return
end
if convo.persona_3d_params == nil and convo.persona_2d_params == nil and convo.convo_name == nil then
for i, c in pairs( convo ) do
if i == 1 then
dlc2_m02_convo_play( c, false, clear )
else
dlc2_m02_convo_play( c, false, false )
end
end
if wait == true then
while dlc2_m02_convo_is_playing( convo[ #convo ] ) == true do
thread_yield()
end
end
return
end
if clear == true then
dlc2_m02_cleanup_convos( Dlc2_m02_convos )
end
-- add to end of queue
Dlc2_m02_convo_queue[ #Dlc2_m02_convo_queue + 1 ] = convo
-- start a manager thread if needed
if Dlc2_m02_threads.convo_manager == nil then
Dlc2_m02_threads.convo_manager = thread_new( "dlc2_m02_convo_manager" )
end
-- wait for convo to finish playing if requested
if wait == true then
while dlc2_m02_convo_is_playing( convo ) == true do
thread_yield()
end
end
end
function dlc2_m02_convo_is_playing( convo )
if convo == nil then
return sizeof_table( Dlc2_m02_convo_queue ) > 0
end
for i, c in pairs( Dlc2_m02_convo_queue ) do
if c == convo then
return true
end
end
return false
end
function dlc2_m02_convo_manager()
local convo
while #Dlc2_m02_convo_queue > 0 do
convo = Dlc2_m02_convo_queue[ 1 ]
convo.persona_handles = { }
-- Load 2D personas when necessary
if convo.speakers_2d ~= nil then
for i, persona in pairs( convo.speakers_2d ) do
if Dlc2_m02_status.personas[ persona ] ~= nil then
convo.persona_handles[ i ] = Dlc2_m02_status.personas[ persona ]
else
convo.persona_handles[ i ] = audio_persona_load_2d( persona )
end
end
end
-- Load the conversation
if convo.persona_3d_params ~= nil then
audio_play_persona_line( unpack( convo.persona_3d_params ) )
debug_print( "MAD", "playing 3d line " .. convo.persona_3d_params[ 2 ] .. "\n" )
while audio_persona_line_playing( convo.persona_3d_params[ 1 ] ) == true do
thread_yield()
end
elseif convo.persona_2d_params ~= nil then
-- a speakers_2d must have been specified
if true or convo.persona_handles[ 1 ] ~= nil then
convo.audio_id = audio_play_persona_line_2d( convo.persona_handles[ 1 ], convo.persona_2d_params[ 1 ] )
debug_print( "MAD", "playing 2d line " .. convo.persona_2d_params[ 1 ] .. "\n" )
while audio_is_playing( convo.audio_id ) == true do
thread_yield()
end
convo.audio_id = nil
end
elseif convo.cell_name ~= nil then
dlc2_m02_cellphone_call_wait( convo.cell_name, convo.recieving, convo.persona_handles[ 1 ] )
elseif convo.convo_name ~= nil then
-- load convo
if convo.coop_player ~= nil then
convo.convo_handle = audio_conversation_load_player( convo.convo_name, convo.coop_player )
elseif convo.player_speaks then
convo.convo_handle = audio_conversation_load( convo.convo_name )
else
convo.convo_handle = audio_conversation_load_direct( convo.convo_name )
end
-- play the conversation
debug_print( "MAD", "Playing convo: " .. convo.convo_name .. "\n" )
audio_conversation_play( convo.convo_handle )
thread_yield()
-- wait for the conversation to end
audio_conversation_wait_for_end( convo.convo_handle )
convo.convo_handle = nil
end
-- clean up personas
for i, handle in pairs( convo.persona_handles ) do
if Dlc2_m02_status.personas[ convo.speakers_2d[ i ] ] == nil then
audio_persona_remove_2d( handle )
end
end
convo.persona_handles = nil
-- delay if needed
if convo.delay_after ~= nil then
delay( convo.delay_after )
end
-- roll up the queue
if #Dlc2_m02_convo_queue > 1 then
for i = 2, #Dlc2_m02_convo_queue do
Dlc2_m02_convo_queue[ i - 1 ] = Dlc2_m02_convo_queue[ i ]
end
end
Dlc2_m02_convo_queue[ #Dlc2_m02_convo_queue ] = nil
end
-- if there's no convos to play just exit the thread
Dlc2_m02_threads.convo_manager = nil
end
function dlc2_m02_cleanup_convos( convos )
-- kill manager thread
if Dlc2_m02_threads.convo_manager ~= nil then
thread_kill( Dlc2_m02_threads.convo_manager )
Dlc2_m02_threads.convo_manager = nil
end
-- clear pending events
Dlc2_m02_convo_queue = { }
-- sweep all convo data and clean it up
for i, convo in pairs( convos ) do
dlc2_m02_cleanup_audio_item( convo )
end
end
function dlc2_m02_cleanup_audio_item( convo )
if convo.convo_handle ~= nil then
audio_conversation_end( convo.convo_handle )
convo.convo_handle = nil
end
if convo.audio_id ~= nil then
audio_stop( convo.audio_id )
convo.audio_id = nil
end
-- clean up loaded personas
if convo.persona_handles ~= nil then
for i, handle in pairs( convo.persona_handles ) do
if Dlc2_m02_status.personas[ convo.speakers_2d[ i ] ] == nil then
audio_persona_remove_2d( handle )
end
end
convo.persona_handles = nil
end
end
function dlc2_m02_player_disable_machine( machine_data )
local nav = machine_data.navpoint
local trigger = machine_data.trigger
local mover = machine_data.mover
local homie = Dlc2_m02_characters.alien_homie
-- objective: disable machine
marker_remove( nav )
marker_add_trigger( trigger, MINIMAP_ICON_USE, INGAME_EFFECT_LOCATION, OI_ASSET_USE, OI_FLAGS_FULL, SYNC_ALL )
objective_text( 0, Dlc2_m02_text.rewire_explosives, nil, nil, SYNC_ALL, OI_ASSET_USE )
-- set up trigger
Dlc2_m02_status.activation_time = machine_data.activation_time
Dlc2_m02_status.machine_disabled = false
Dlc2_m02_status.activation_progress = 0
Dlc2_m02_status.activation_nav = nav
Dlc2_m02_status.trigger_audio_event = machine_data.start_disable_audio_event
Dlc2_m02_status.trigger_cspawn_data = machine_data.cspawn_data
trigger_enable( trigger )
trigger_set_hold_to_repeat( trigger, true )
on_trigger( "dlc2_m02_on_trigger_machine", trigger )
while Dlc2_m02_status.machine_disabled ~= true do
thread_yield()
end
dlc2_m02_end_cspawning()
-- remove marker from machine
Dlc2_m02_status.trigger_cspawn_data = nil
hud_bar_off( 1 )
marker_remove( trigger )
on_trigger( "", trigger )
objective_text_clear( 0 )
end
-- homie moves to navpoint, plays animation for specified time
-- if local player moves out of range then homie will cower and countdown will stop
-- with appropriate messaging
function dlc2_m02_homie_disable_machine( machine_data )
local nav = machine_data.navpoint
local homie = Dlc2_m02_characters.alien_homie
local mover = machine_data.mover
if machine_data.cspawn_data ~= nil then
dlc2_m02_set_up_spawn_phase( machine_data.cspawn_data )
end
dlc2_m02_homie_disable( nav, machine_data.activation_time, machine_data.approach_trigger, machine_data.start_disable_audio_event, machine_data.convo_homie_ready, machine_data.proximity_check_waived )
dlc2_m02_end_cspawning()
marker_remove( homie )
marker_remove( nav )
objective_text_clear( 0 )
end
function dlc2_m02_homie_disable( nav, target_time, approach_trigger, start_disable_audio_event, start_disable_convo, proximity_check_waived )
local homie = Dlc2_m02_characters.alien_homie
-- objective: protect homie
marker_remove( nav )
marker_add( homie, MINIMAP_ICON_PROTECT_ACQUIRE, OI_ASSET_DEFEND, OI_FLAGS_FULL, SYNC_ALL )
objective_text( 0, Dlc2_m02_text.protect_homie, nil, nil, SYNC_ALL, OI_ASSET_DEFEND )
if start_disable_audio_event ~= nil then
audio_object_post_event( start_disable_audio_event, nil, nil, LOCAL_PLAYER )
end
-- set up progress bar
hud_bar_on( 1, "health", Dlc2_m02_text.progress, target_time )
hud_bar_set_value(1, 0 )
-- move homie into place
follower_make_independent( homie, true )
set_ignore_ai_flag( homie, true )
character_release_human_shield( homie )
-- now start timing the homie disabling the machine
local accum_time = 0
local disabling = false
local min_dist = 20
local msg_id = 0
local started = false
local critical_timer = false
local start_disable_convo_played = false
while accum_time < target_time do
thread_yield()
local protecting = true
if object_is_in_trigger( approach_trigger, LOCAL_PLAYER ) == false then
protecting = false
elseif coop_is_active() == true and object_is_in_trigger( approach_trigger, REMOTE_PLAYER ) == false then
protecting = false
end
if proximity_check_waived ~= true and critical_timer == false and started == true and protecting == false and disabling == true then
minimap_icon_add_radius( nav, min_dist - 5, SYNC_ALL )
hud_critical_timer_set( 10 * 1000, Dlc2_m02_text.return_to_homie, "dlc2_m02_failed_to_protect" )
critical_timer = true
elseif protecting == true and critical_timer == true then
minimap_icon_remove_radius( nav )
hud_critical_timer_stop()
critical_timer = false
end
if disabling == false then
if human_is_downed( homie ) == false and character_is_ragdolled( homie ) == false then
clear_animation_state( homie )
-- move into position
if get_dist( homie, nav ) > 3 then
ai_do_scripted_move( homie, nav, true, false )
while get_dist( homie, nav ) > 3 do
thread_yield()
end
end
-- animate disabling
local anim_name = "m14 transmitter in"
local force_play = false
local percentage = 1.0
local stand_still = true
local zero_movement = true
set_animation_set( homie, "PLYM" )
set_animation_state( homie, "m14 transmitter idle", nav )
action_play( homie, anim_name, anim_name, force_play, percentage, stand_still, zero_movement, nav )
if start_disable_convo ~= nil and start_disable_convo_played == false then
dlc2_m02_convo_play( start_disable_convo, false, true )
end
disabling = true
started = true
end
elseif human_is_downed( homie ) == true or get_dist( homie, nav ) > 1 then
clear_animation_state( homie )
set_animation_set( homie, "COP" )
disabling = false
end
-- if we are not cowering then increment the timer
if disabling == true and human_is_downed( homie ) == false then
accum_time = accum_time + get_frame_time()
hud_bar_set_value(1, accum_time )
end
end
marker_remove( homie )
set_ignore_ai_flag( homie, false )
set_animation_set( homie, "COP" )
clear_animation_state( homie )
if critical_timer == true then
hud_critical_timer_stop()
end
-- clear the progress bar
minimap_icon_remove_radius( nav )
hud_bar_off( 1 )
follower_make_independent( homie, false )
end
function dlc2_m02_player_destroy_machine( machine_data )
local nav = machine_data.navpoint
local mover = machine_data.mover
local homie = Dlc2_m02_characters.alien_homie
-- objective: destroy device
marker_remove( nav )
marker_add( nav, MINIMAP_ICON_KILL, OI_ASSET_KILL, OI_FLAGS_FULL, SYNC_ALL )
local msg
if machine_data.alt_destroy_msg == nil then
msg = Dlc2_m02_text.player_destroy_machine
else
msg = machine_data.alt_destroy_msg
end
objective_text( 0, msg, nil, nil, SYNC_ALL, OI_ASSET_KILL )
turn_vulnerable( mover )
-- set up progress bar
local prev_hit_points = get_current_hit_points( mover )
local max_hit_points = get_max_hit_points( mover )
local current_hit_points = prev_hit_points
hud_bar_on( 1, "health", Dlc2_m02_text.progress, max_hit_points )
hud_bar_set_value( 1, 0 )
repeat
thread_yield()
current_hit_points = get_current_hit_points( mover )
if prev_hit_points ~= current_hit_points then
hud_bar_set_value( 1, max_hit_points - current_hit_points )
end
until current_hit_points <= 0
-- clear the progress bar
hud_bar_off( 1 )
marker_remove( nav )
objective_text_clear( 0 )
end
function dlc2_m02_homie_destroy_machine( machine_data )
local nav = machine_data.navpoint
local mover = machine_data.mover
local homie = Dlc2_m02_characters.alien_homie
-- objective: destroy device
marker_remove( nav )
marker_add( homie, MINIMAP_ICON_PROTECT_ACQUIRE, OI_ASSET_DEFEND, OI_FLAGS_FULL, SYNC_ALL )
objective_text( 0, Dlc2_m02_text.protect_homie, nil, nil, SYNC_ALL, OI_ASSET_DEFEND )
-- set up progress bar
local prev_hit_points = get_current_hit_points( mover )
local max_hit_points = get_max_hit_points( mover )
local current_hit_points = prev_hit_points
local dmg_per_hit = max_hit_points / 10
local target_hp = max_hit_points * 0.4
hud_bar_on( 1, "health", Dlc2_m02_text.progress, max_hit_points )
hud_bar_set_value( 1, 0 )
-- move homie into firing position
follower_make_independent( homie, true )
set_ignore_ai_flag( homie, true )
character_release_human_shield( homie )
repeat
delay( rand_float( 0.5, 1.5 ) )
if get_dist( homie, machine_data.homie_fire_from ) > 1 then
character_release_human_shield( homie )
ai_do_scripted_move( homie, machine_data.homie_fire_from, true, false )
elseif human_is_downed( homie ) == false then
force_fire( homie, nav, true )
set_current_hit_points( mover, get_current_hit_points( mover ) - dmg_per_hit )
current_hit_points = get_current_hit_points( mover )
if prev_hit_points ~= current_hit_points then
hud_bar_set_value( 1, max_hit_points - current_hit_points )
end
end
until current_hit_points <= target_hp
set_ignore_ai_flag( homie, false )
-- clear the progress bar
hud_bar_off( 1 )
marker_remove( homie )
follower_make_independent( homie, false )
objective_text_clear( 0 )
end
function dlc2_m02_end_cspawning()
-- deactivate all spawn regions
if Dlc2_m02_status.active_spawn_regions ~= nil then
for i, v in pairs( Dlc2_m02_status.active_spawn_regions ) do
spawn_region_enable( v.name, false )
end
Dlc2_m02_status.active_spawn_regions = nil
end
Dlc2_m02_status.cspawn_tethers = nil
end
function dlc2_m02_create_groups( group_data )
if group_data.delete_groups ~= nil then
for i, v in pairs( group_data.delete_groups ) do
-- set up the take dmg callback for achievements
if v.amazon == true then
local npcs = dlc2_m02_group_get_members( v.name )
for j, npc in pairs( npcs ) do
on_take_damage( "", npc )
end
end
if group_is_loaded( v.name ) == true then
group_destroy( v.name )
end
end
-- give the system a bit to clean up
delay( 1 )
end
-- create specified groups
if Dlc2_m02_status.sleeping_npcs == nil then
Dlc2_m02_status.sleeping_npcs = { }
end
if group_data.create_groups ~= nil then
for i, grp in pairs( group_data.create_groups ) do
if group_is_loaded( grp.name ) == false then
group_create( grp.name, true )
local npcs = dlc2_m02_group_get_members( grp.name )
for j, npc in pairs( npcs ) do
npc_dont_drop_weapon_on_death( npc, true )
if grp.sleep == true then
set_ignore_ai_flag( npc, true )
Dlc2_m02_status.sleeping_npcs[ npc ] = true
end
if grp.amazon == true then
on_take_damage( "dlc2_m02_amazon_damaged_cb", npc )
end
end
end
end
end
end
function dlc2_m02_wake_up_npcs( activator, trigger )
trigger_enable( trigger, false )
on_trigger( "", trigger )
if Dlc2_m02_status.sleeping_npcs == nil then
return
end
for npc, d in pairs( Dlc2_m02_status.sleeping_npcs ) do
if character_exists( npc ) == true and character_is_dead( npc ) == false then
set_ignore_ai_flag( npc, false )
end
end
Dlc2_m02_status.sleeping_npcs = { }
-- if anything needs spawning now, do it
if Dlc2_m02_status.spawn_on_wake ~= nil then
dlc2_m02_create_groups( Dlc2_m02_status.spawn_on_wake )
Dlc2_m02_status.spawn_on_wake = nil
end
end
function dlc2_m02_set_up_spawn_groups( groups, count, filters, respawn_delay )
for i, group in pairs( groups ) do
if i <= count then
continuous_spawn_start( group, 0, respawn_delay, nil, filters[ i ], nil, nil, nil, "dlc2_m02_cspawn_group_created", "dlc2_m02_cspawn_group_released" )
else
continuous_spawn_stop( group, false )
end
end
end
function dlc2_m02_set_up_spawn_phase( spawn_data )
dlc2_m02_end_cspawning()
Dlc2_m02_status.cspawn_tethers = spawn_data.tethers
local f = spawn_data.filters
if f == nil then
f = { elites = {}, pistols = {}, smgs = {} }
end
local respawn_delay = spawn_data.respawn_delay
if respawn_delay == nil then
respawn_delay = 5
end
dlc2_m02_set_up_spawn_groups( Dlc2_m02_spawn_groups.elites, spawn_data.num_elites, f.elites, respawn_delay )
dlc2_m02_set_up_spawn_groups( Dlc2_m02_spawn_groups.pistols, spawn_data.num_pistols, f.pistols, respawn_delay )
dlc2_m02_set_up_spawn_groups( Dlc2_m02_spawn_groups.smgs, spawn_data.num_smgs, f.smgs, respawn_delay )
-- activate new spawn regions
if spawn_data.cspawn_regions ~= nil then
Dlc2_m02_status.active_spawn_regions = spawn_data.cspawn_regions
for i, v in pairs( Dlc2_m02_status.active_spawn_regions ) do
spawn_region_enable( v.name, true )
if v.filter ~= nil then
spawn_region_toggle_filter( v.name, v.filter )
end
end
end
end
function dlc2_m02_handle_backstage( backstage_data, skip_dialog )
local homie = Dlc2_m02_characters.alien_homie
-- init
-- init start trigger doors
if backstage_data.trigger_doors_at_start ~= nil then
for i, door_data in pairs( backstage_data.trigger_doors_at_start ) do
dlc2_m02_setup_door_trigger( door_data )
end
end
-- open entry door
if backstage_data.doors.enter ~= nil then
for i, door in pairs( backstage_data.doors.enter ) do
door_lock( door, false )
end
end
if backstage_data.create_groups ~= nil then
for i, group in pairs( backstage_data.create_groups ) do
if group_is_loaded( group.name ) == false then
group_create( group.name )
end
end
end
if backstage_data.no_trail ~= true then
if backstage_data.trail ~= nil then
dlc2_m02_trail_start( backstage_data.trail )
elseif backstage_data.enter_trigger ~= nil then
marker_add_trigger( backstage_data.enter_trigger, MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL )
end
end
-- wait for player to enter
if skip_dialog ~= true and backstage_data.enter_trigger ~= nil then
-- objective
objective_text( 0, Dlc2_m02_text.go_to_backstage, nil, nil, SYNC_ALL, OI_ASSET_LOCATION )
dlc2_m02_wait_for_player_to_enter_trigger( backstage_data.enter_trigger )
end
marker_remove( backstage_data.enter_trigger )
dlc2_m02_trail_stop()
if backstage_data.on_enter_backstage_audio_event ~= nil then
audio_object_post_event( backstage_data.on_enter_backstage_audio_event, nil, nil, LOCAL_PLAYER )
end
inv_weapon_disable_all_but_this_slot( WEAPON_SLOT_UNARMED )
player_can_sprint( false )
-- actors stop attacking players
for i, grp_set in pairs( Dlc2_m02_spawn_groups ) do
for j, group in pairs( grp_set ) do
local npcs = dlc2_m02_group_get_members( group )
for k, npc in pairs( npcs ) do
if character_exists( npc ) == true and character_is_dead( npc ) == false then
set_attack_player_flag( npc, false )
end
end
end
end
ai_force_team_idle( "None" )
team_make_allies( "Neutral Gang", "Playas" )
for i, grp_set in pairs( Dlc2_m02_spawn_groups ) do
for j, group in pairs( grp_set ) do
local npcs = dlc2_m02_group_get_members( group )
for k, npc in pairs( npcs ) do
if character_exists( npc ) == true and character_is_dead( npc ) == false then
character_set_combat_ready( npc, false )
human_set_force_holster( npc, true )
-- TODO: move to action node
end
end
end
end
-- stop film grain
dlc2_m02_film_grain_unload()
objective_text_clear( 0 )
delay( 3 )
-- dialog
if skip_dialog ~= true and backstage_data.convo_enter ~= nil then
dlc2_m02_convo_play( backstage_data.convo_enter , false, true )
end
-- switch loadout
if backstage_data.player_loadout ~= nil then
dlc2_m02_loadout_sequence( backstage_data.player_loadout, backstage_data.loadout_trail )
end
if backstage_data.homie_loadout ~= nil then
inv_item_remove_all( homie )
inv_item_add( backstage_data.homie_loadout, 1, homie, true )
end
if backstage_data.homie_personality ~= nil then
ai_set_personality( homie, backstage_data.homie_personality )
end
-- open exit door
if backstage_data.doors.exit ~= nil then
for i, door in pairs( backstage_data.doors.exit ) do
door_lock( door, false )
-- door_open( door, true )
end
end
-- objective
objective_text( 0, Dlc2_m02_text.go_to_set, nil, nil, SYNC_ALL, OI_ASSET_LOCATION )
if backstage_data.trigger_doors_at_end ~= nil then
for i, door_data in pairs( backstage_data.trigger_doors_at_end ) do
dlc2_m02_setup_door_trigger( door_data )
end
end
-- wait for player to exit
if backstage_data.exit_trigger ~= nil then
marker_add_trigger( backstage_data.exit_trigger, MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_FULL, SYNC_ALL )
dlc2_m02_wait_for_player_to_enter_trigger( backstage_data.exit_trigger, true )
marker_remove( backstage_data.exit_trigger )
end
if backstage_data.action_line ~= nil then
dlc2_m02_convo_play( backstage_data.action_line , false, true )
end
if backstage_data.convo_exit ~= nil then
local clear = backstage_data.action_line == nil
dlc2_m02_convo_play( backstage_data.convo_exit , false, clear)
end
if backstage_data.on_leave_backstage_audio_event ~= nil then
audio_object_post_event( backstage_data.on_leave_backstage_audio_event, nil, nil, LOCAL_PLAYER )
end
-- despawn current
dlc2_m02_cleanup_continuous_spawn_groups( Dlc2_m02_spawn_groups )
team_make_hostile( "Neutral Gang", "Playas" )
player_can_sprint( true )
objective_text_clear( 0 )
-- new enemies will be spawned by the objective code
end
function dlc2_m02_dialog_placeholder_timer()
Dlc2_m02_status.dialog_timer_elapsed = true
hud_critical_timer_stop()
end
function dlc2_m02_wait_for_player_to_enter_trigger( trigger_name, coop )
trigger_enable( trigger_name, true )
while true do
if object_is_in_trigger( trigger_name, LOCAL_PLAYER ) == true then
break
end
if coop == true and coop_is_active() == true then
if object_is_in_trigger( trigger_name, REMOTE_PLAYER ) == true then
break
end
end
thread_yield()
end
trigger_enable( trigger_name, false )
end
-- *************************
--
-- Callback functions
--
-- *************************
function dlc2_m02_on_death_alien_homie_fail()
mission_end_failure( "dlc2_m02", "dlc2_m02_mission_fail_homie_died" )
end
function dlc2_m02_on_trigger_machine( activator, trigger )
-- only one at a time please
if Dlc2_m02_status.trigger_activator ~= nil and Dlc2_m02_status.trigger_activator ~= activator then
return
end
player_movement_disable( activator )
local progress = Dlc2_m02_status.activation_progress
if progress == 0 then
hud_bar_on( 1, "health", Dlc2_m02_text.progress, Dlc2_m02_status.activation_time )
end
if Dlc2_m02_status.trigger_activator == nil then
Dlc2_m02_status.trigger_activator = activator
-- wait until player is ready to play an animation
while character_is_ready( activator ) == false do
thread_yield()
end
set_animation_state( activator, "m14 transmitter idle", Dlc2_m02_status.placement_nav )
human_set_force_holster( activator, true )
if Dlc2_m02_status.trigger_audio_event ~= nil then
audio_object_post_event( Dlc2_m02_status.trigger_audio_event, nil, nil, LOCAL_PLAYER )
Dlc2_m02_status.trigger_audio_event = nil
end
-- Play the intro animation
action_play( activator, "m14 transmitter in", "m14 transmitter in", false, 0.8, true, true, Dlc2_m02_status.activation_nav )
if Dlc2_m02_status.trigger_cspawn_data ~= nil then
dlc2_m02_set_up_spawn_phase( Dlc2_m02_status.trigger_cspawn_data )
end
end
if Dlc2_m02_threads.activation_monitor == nil then
Dlc2_m02_threads.activation_monitor = thread_new( "dlc2_m02_maybe_cancel_activation_thread" )
end
if Dlc2_m02_status.homie_disabling ~= false then
progress = progress + 0.1
end
if progress >= Dlc2_m02_status.activation_time then
player_movement_enable( activator )
human_set_force_holster( activator, false )
trigger_enable( trigger, false )
-- kill the monitor thread, not needed any more
if Dlc2_m02_threads.transmitter_monitor ~= nil then
thread_kill( Dlc2_m02_threads.activation_monitor )
Dlc2_m02_threads.transmitter_monitor = nil
end
-- Play the outro animation.
clear_animation_state( activator )
action_play( activator, "m14 transmitter out", "m14 transmitter out", false, 1, true, true )
Dlc2_m02_status.machine_disabled = true
else
Dlc2_m02_status.activation_progress = progress
hud_bar_set_value( 1, progress )
end
end
function dlc2_m02_maybe_cancel_activation_thread()
local prev_progress = Dlc2_m02_status.activation_progress
while true do
delay( 1 )
if Dlc2_m02_status.activation_progress <= prev_progress then
-- no progress so break out and kill it
break
end
prev_progress = Dlc2_m02_status.activation_progress
end
if Dlc2_m02_status.trigger_activator ~= nil then
player_movement_enable( Dlc2_m02_status.trigger_activator )
-- remove the triangulator left behind by the anim
character_remove_child_item_by_name( Dlc2_m02_status.trigger_activator, "Triangulator" )
-- Play the outro animation.
clear_animation_state( Dlc2_m02_status.trigger_activator )
human_set_force_holster( Dlc2_m02_status.trigger_activator, false )
end
if Dlc2_m02_status.trigger_cspawn_data ~= nil then
dlc2_m02_end_cspawning()
end
Dlc2_m02_status.trigger_activator = nil
Dlc2_m02_threads.activation_monitor = nil
end
function dlc2_m02_machine_exploding_countdown()
Dlc2_m02_status.explosion_timer_complete = true
end
function dlc2_m02_saucer_approach()
Dlc2_m02_status.saucer_approached = true
end
function dlc2_m02_group_get_members( group )
if type( group ) == "table" and type( group.name ) == "string" then
group = group.name
end
local r = { }
local npc = group_get_first_npc( group )
while npc do
r[ #r + 1 ] = npc
npc = group_get_next_npc( group, npc )
end
return r
end
function dlc2_m02_cspawn_group_created( group )
local npcs = dlc2_m02_group_get_members( group )
for i, npc in pairs( npcs ) do
npc_dont_drop_weapon_on_death( npc, true )
on_take_damage( "dlc2_m02_amazon_damaged_cb", npc )
end
if Dlc2_m02_status.cspawn_tethers ~= nil then
if Dlc2_m02_status.cspawn_tethers[ group ] ~= nil then
local tethers = Dlc2_m02_status.cspawn_tethers[ group ]
for i, npc in pairs( npcs ) do
if tethers[ i ] ~= nil then
ai_attack_region( npc, tethers[ i ].nav, tethers[ i ].d )
ai_do_scripted_move( npc, tethers[ i ].nav, true, false )
end
end
end
end
end
function dlc2_m02_cspawn_group_released( group )
local npcs = dlc2_m02_group_get_members( group )
for i, npc in pairs( npcs ) do
if character_exists( npc ) == true then
on_take_damage( "", npc )
end
end
end
function dlc2_m02_switch_loadout( loadout_data )
dlc2_m02_remove_loadout()
Dlc2_m02_status.current_loadout = loadout_data
for slot, weapon in pairs( loadout_data.weapons ) do
inv_weapon_disable_slot( slot, false, SYNC_ALL )
inv_weapon_add_temporary( LOCAL_PLAYER, weapon, 1, true, loadout_data.equip == slot, true, true )
if coop_is_active() then
inv_weapon_add_temporary( REMOTE_PLAYER, weapon, 1, true, loadout_data.equip == slot, true, true )
end
end
end
-- adds temp weapons and disables other slots
function dlc2_m02_loadout_sequence( loadout_data, trail )
trigger_enable( loadout_data.trigger, true )
objective_text( 0, loadout_data.objective_text, nil, nil, SYNC_ALL, OI_ASSET_USE )
if trail == nil then
marker_add_trigger( loadout_data.trigger, MINIMAP_ICON_USE, INGAME_EFFECT_LOCATION, OI_ASSET_USE, OI_FLAGS_FULL, SYNC_ALL )
else
dlc2_m02_trail_start( trail, "use" )
end
dlc2_m02_wait_for_player_to_enter_trigger( loadout_data.trigger, true )
trigger_enable( loadout_data.trigger, false )
dlc2_m02_switch_loadout( loadout_data )
audio_object_post_event( "M02_Give_Player_Weapon", nil, nil, LOCAL_PLAYER )
dlc2_m02_convo_play( loadout_data.convo, false, true )
marker_remove( loadout_data.trigger )
dlc2_m02_trail_stop()
end
-- reverses dlc2_m02_loadout_sequence()
function dlc2_m02_remove_loadout()
if Dlc2_m02_status.current_loadout ~= nil then
for slot, weapon in pairs( Dlc2_m02_status.current_loadout.weapons ) do
inv_weapon_remove_temporary( LOCAL_PLAYER, weapon )
if coop_is_active() then
inv_weapon_remove_temporary( REMOTE_PLAYER, weapon )
end
end
Dlc2_m02_status.current_loadout = nil
end
end
function dlc2_m02_trigger_door_cb( char, trigger )
trigger_enable( trigger, false )
on_trigger( "", trigger )
local door_data = Dlc2_m02_status.trigger_doors[ trigger ]
for i, door in pairs( door_data.doors ) do
if i ~= "convo" then
door_open( door )
end
end
if door_data.convo ~= nil then
dlc2_m02_convo_play( door_data.convo, false, true )
end
if door_data.gspawn_data ~= nil then
dlc2_m02_create_groups( door_data.gspawn_data )
end
if door_data.audio_event ~= nil then
audio_object_post_event( door_data.audio_event, nil, nil, LOCAL_PLAYER )
end
Dlc2_m02_status.trigger_doors[ trigger ] = nil
end
function dlc2_m02_setup_door_trigger( trigger_door )
if Dlc2_m02_status.trigger_doors == nil then
Dlc2_m02_status.trigger_doors = { }
end
for j, door in pairs( trigger_door.doors ) do
door_lock( door, false )
end
Dlc2_m02_status.trigger_doors[ trigger_door.trigger ] = trigger_door
trigger_enable( trigger_door.trigger, true )
on_trigger( "dlc2_m02_trigger_door_cb", trigger_door.trigger )
end
function dlc2_m02_both_disable_machine( machine_data )
local local_nav = machine_data.navpoint
local homie_nav = machine_data.navpoint_homie
local trigger = machine_data.trigger
local mover = machine_data.mover
local homie = Dlc2_m02_characters.alien_homie
local objective_switched = false
Dlc2_m02_status.trigger_cspawn_data = machine_data.cspawn_data
marker_remove( local_nav )
marker_add( local_nav, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_FULL, SYNC_ALL )
objective_text( 0, Dlc2_m02_text.wait_for_homie, nil, nil, SYNC_ALL, OI_ASSET_LOCATION )
-- move homie into place
follower_make_independent( homie, true )
set_ignore_ai_flag( homie, true )
character_release_human_shield( homie )
Dlc2_m02_status.homie_disabling = false
Dlc2_m02_status.machine_disabled = false
while Dlc2_m02_status.machine_disabled ~= true do
if Dlc2_m02_status.homie_disabling == false then
if human_is_downed( homie ) == false then
clear_animation_state( homie )
-- move into position
if get_dist( homie, homie_nav ) > 3 then
ai_do_scripted_move( homie, homie_nav, true, false )
while get_dist( homie, homie_nav ) > 3 do
thread_yield()
end
end
-- animate disabling
local anim_name = "m14 transmitter in"
local force_play = false
local percentage = 1.0
local stand_still = true
local zero_movement = true
set_animation_set( homie, "PLYM" )
set_animation_state( homie, "m14 transmitter idle", homie_nav )
action_play( homie, anim_name, anim_name, force_play, percentage, stand_still, zero_movement, homie_nav )
if objective_switched == false then
-- objective: disable machine
marker_remove( local_nav )
marker_add_trigger( trigger, MINIMAP_ICON_USE, INGAME_EFFECT_LOCATION, OI_ASSET_USE, OI_FLAGS_FULL, SYNC_ALL )
objective_text( 0, Dlc2_m02_text.search_code, nil, nil, SYNC_ALL, OI_ASSET_USE )
if machine_data.start_disable_audio_event ~= nil then
audio_object_post_event( machine_data.start_disable_audio_event, nil, nil, LOCAL_PLAYER )
end
-- set up trigger
Dlc2_m02_status.activation_time = machine_data.activation_time
Dlc2_m02_status.machine_disabled = false
Dlc2_m02_status.activation_progress = 0
Dlc2_m02_status.activation_nav = local_nav
trigger_enable( trigger )
trigger_set_hold_to_repeat( trigger, true )
on_trigger( "dlc2_m02_on_trigger_machine", trigger )
if machine_data.convo_homie_ready ~= nil then
dlc2_m02_convo_play( machine_data.convo_homie_ready, false, true )
end
objective_switched = true
end
Dlc2_m02_status.homie_disabling = true
end
elseif human_is_downed( homie ) == true or get_dist( homie, homie_nav ) > 3 then
set_animation_set( homie, "COP" )
clear_animation_state( homie )
Dlc2_m02_status.homie_disabling = false
end
thread_yield()
end
set_ignore_ai_flag( homie, false )
set_animation_set( homie, "COP" )
clear_animation_state( homie )
follower_make_independent( homie, false )
Dlc2_m02_status.homie_disabling = nil
dlc2_m02_end_cspawning()
-- remove marker from machine
hud_bar_off( 1 )
marker_remove( trigger )
on_trigger( "", trigger )
objective_text_clear( 0 )
end
function dlc2_m02_activate_security()
mission_end_failure( "dlc2_m02", "DLC2_M02_MISSION_FAIL_OUT_OF_TIME" )
end
function dlc2_m02_saucer_camera_sequence()
local obj_nav = "nav_hanger_camera_objective"
local trg_start = "trg_hanger_start_saucer_camera"
local homie = Dlc2_m02_characters.alien_homie
mesh_mover_reset( "mov_hanger_wall" )
mesh_mover_set_invulnerable( "mov_hanger_wall", true )
marker_add( obj_nav, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_FULL, SYNC_ALL )
objective_text( 0, "DLC2_M02_GO_TO_HANGER", nil, nil, SYNC_ALL, OI_ASSET_LOCATION )
dlc2_m02_setup_door_trigger( Dlc2_m02_trigger_doors.hall4_entry )
-- dlc2_m02_setup_door_trigger( Dlc2_m02_trigger_doors.hanger_entry )
dlc2_m02_wait_for_trigger_hit( trg_start )
marker_remove( obj_nav )
objective_text_clear( 0 )
set_ignore_ai_flag( homie, true )
follower_make_independent( homie, true )
mission_start_fade_out()
-- this just cleans up
dlc2_m02_create_groups( Dlc2_m02_gspawn_data.hanger_1 )
group_create_hidden( Dlc2_m02_groups.saucer.name, true )
vehicle_allow_ownership_transfer( Dlc2_m02_vehicles.saucer, false )
vehicle_set_keyframed_physics( Dlc2_m02_vehicles.saucer, true )
player_force_vehicle_seat( LOCAL_PLAYER, 1, Dlc2_m02_vehicles.saucer )
if coop_is_active() then
player_force_vehicle_seat( REMOTE_PLAYER, 2, Dlc2_m02_vehicles.saucer )
end
teleport_coop( "nav_hanger_camera_local_start", "nav_hanger_camera_remote_start" )
teleport( homie, "nav_hanger_camera_homie_start" )
group_show( Dlc2_m02_groups.saucer.name )
mission_start_fade_in()
audio_object_post_event( "M02_Part3_Music_Start", nil, nil, LOCAL_PLAYER )
audio_object_post_event( "M02_Spaceship_CTE", nil, nil, LOCAL_PLAYER )
fade_in_block()
player_controls_disable( LOCAL_PLAYER )
player_movement_disable( LOCAL_PLAYER )
if coop_is_active() == true then
player_controls_disable( REMOTE_PLAYER )
player_movement_disable( REMOTE_PLAYER )
end
dlc2_m02_convo_play( Dlc2_m02_convos.see_ship, false, true )
ai_do_scripted_move( homie, "nav_hanger_camera_homie_end", true, false )
camera_look_through( "nav_hanger_camera_2", 7, true )
camera_look_through( "nav_hanger_camera_3", 1, true )
camera_look_through( "nav_hanger_camera_4", 3, true )
camera_look_through( "nav_hanger_camera_5", 1, true )
delay( 3 )
camera_end_look_through( true )
set_ignore_ai_flag( homie, false )
follower_make_independent( homie, false )
player_controls_enable( LOCAL_PLAYER )
player_movement_enable( LOCAL_PLAYER )
if coop_is_active() == true then
player_controls_enable( REMOTE_PLAYER )
player_movement_enable( REMOTE_PLAYER )
end
dlc2_m02_convo_play( Dlc2_m02_convos.third_action_1, false, true )
end
function dlc2_m02_homie_kills()
local homie = Dlc2_m02_characters.alien_homie
local members = dlc2_m02_group_get_members( Dlc2_m02_groups.kiwiposters.name )
local flee_navs = { "nav_homie_kill_flee_1", "nav_homie_kill_flee_2", }
dlc2_m02_create_groups( Dlc2_m02_gspawn_data.kiwiposters )
local members = dlc2_m02_group_get_members( Dlc2_m02_groups.kiwiposters.name )
for i, member in pairs( members ) do
set_ignore_ai_flag( member, true )
end
dlc2_m02_wait_for_trigger_hit( "trg_homie_kill_begin" )
set_ignore_ai_flag( homie, true )
turn_invulnerable( homie )
character_prevent_flinching( homie, true )
follower_make_independent( homie, true )
ai_do_scripted_move( homie, "nav_homie_kill_mark", true, false )
while get_dist( homie, "nav_homie_kill_mark" ) > 2 do
thread_yield()
end
dlc2_m02_convo_play( Dlc2_m02_convos.bs3_first_convo, false, true )
ai_suggest_action( homie, "reload" )
delay( 7 )
for i, member in pairs( members ) do
set_ignore_ai_flag( member, false )
end
for i = 1, 2 do
flee_to_navpoint( members[ i ], flee_navs[ i ], homie, true )
end
for i = 3, 4 do
local target_npc = members[ i ]
-- force homie to fire
-- ai_do_scripted_fire( homie, target_npc )
force_fire( homie, "nav_homie_kill_fire_at", true )
-- kill it
turn_vulnerable( target_npc )
--effect_play_on_human( "Effect BloodHit", target_npc, "Head" )
character_kill( target_npc )
delay( 0.5 )
end
turn_vulnerable( homie )
character_prevent_flinching( homie, false )
set_ignore_ai_flag( homie, false )
follower_make_independent( homie, false )
end
function dlc2_m02_wait_for_trigger_hit( trigger_name )
while true do
if object_is_in_trigger( trigger_name, LOCAL_PLAYER ) == true then
break
end
if coop_is_active() == true and object_is_in_trigger( trigger_name, REMOTE_PLAYER ) == true then
break
end
thread_yield()
end
end
function dlc2_m02_brutina()
local brutina = Dlc2_m02_characters.brutina
local homie = Dlc2_m02_characters.alien_homie
dlc2_m02_set_up_spawn_phase( Dlc2_m02_cspawn_data.brutina )
group_create( Dlc2_m02_groups.brutina.name, true )
ai_do_scripted_move( brutina, "nav_brutina_mark_1", true, false )
marker_add( brutina, MINIMAP_ICON_KILL, OI_ASSET_KILL, OI_FLAGS_FULL, SYNC_ALL )
objective_text( 0, Dlc2_m02_text.kill_brutina, nil, nil, SYNC_ALL, OI_ASSET_KILL )
while get_dist( brutina, "nav_brutina_mark_1" ) > 1 and character_is_dead( brutina ) == false do
thread_yield()
end
dlc2_m02_convo_play( Dlc2_m02_convos.see_brutina, false, true )
ai_do_scripted_rush( brutina, homie )
ai_add_enemy_target( brutina, homie, ATTACK_NOW_NEVER_LOSE, true )
while character_is_dead( brutina ) == false do
thread_yield()
end
dlc2_m02_convo_play( Dlc2_m02_convos.brutina_defeated_01, false, true )
hud_achievement_show_progress( "Xenaphobe", 1, 1 )
objective_text_clear( 0 )
marker_remove( brutina )
end
function dlc2_m02_obj_shut_down_forcefield()
local generator_nav = "nav_generator"
local console_nav = "nav_generator"
local generator = "mov_generator"
local wall = "mov_hanger_wall"
local homie = Dlc2_m02_characters.alien_homie
local approach_trigger = "trg_machine_approach_gen"
-- obj: get to console
objective_text( 0, "DLC2_M02_GO_TO_CONSOLE", nil, nil, SYNC_LOCAL, OI_ASSET_LOCATION )
objective_text( 1, "DLC2_M02_GO_TO_CONSOLE", nil, nil, SYNC_REMOTE, OI_ASSET_LOCATION )
dlc2_m02_trail_start( Dlc2_m02_trails.hanger2 )
audio_object_post_event( "M02_Part3_Security_Console", nil, nil, LOCAL_PLAYER )
dlc2_m02_wait_for_trigger_hit( approach_trigger )
local remote_arrived = coop_is_active() == false
while object_is_in_trigger( approach_trigger, LOCAL_PLAYER ) == false do
if remote_arrived == false and object_is_in_trigger( approach_trigger, REMOTE_PLAYER ) == true then
objective_text( 1, Dlc2_m02_text.wait_for_homie, nil, nil, SYNC_REMOTE, OI_ASSET_LOCATION )
remote_arrived = true
end
thread_yield()
end
dlc2_m02_trail_stop()
audio_object_post_event( "M02_Part3_Kwilanna_1", nil, nil, LOCAL_PLAYER )
dlc2_m02_convo_play( Dlc2_m02_convos.disable_generator_01, false, true)
objective_text_clear( 0 )
objective_text_clear( 1 )
-- obj: defend homie
marker_remove( console_nav )
marker_add( homie, MINIMAP_ICON_PROTECT_ACQUIRE, OI_ASSET_DEFEND, OI_FLAGS_FULL, SYNC_ALL )
objective_text( 0, Dlc2_m02_text.protect_homie, nil, nil, SYNC_ALL, OI_ASSET_DEFEND )
-- homie activates console
turn_invulnerable( homie )
follower_make_independent( homie, true )
set_ignore_ai_flag( homie, true )
character_release_human_shield( homie )
ai_do_scripted_move( homie, console_nav, true, false )
while get_dist( homie, console_nav ) > 3 do
thread_yield()
end
-- animate disabling
local anim_name = "m14 transmitter in"
local force_play = false
local percentage = 1.0
local stand_still = true
local zero_movement = true
character_allow_ragdoll( homie, false )
set_animation_set( homie, "PLYM" )
set_animation_state( homie, "m14 transmitter idle", console_nav )
action_play( homie, anim_name, anim_name, force_play, percentage, stand_still, zero_movement, console_nav )
delay( 5.25 )
-- homie is shocked
clear_animation_state( homie )
set_animation_set( homie, "COP" )
character_prevent_flinching( homie, true )
local shock_effect_handle = effect_play_on_human( "vfx_electric_body", homie, "spine2", true )
audio_object_post_event( "M02_Part3_Kwilanna_2", nil, nil, LOCAL_PLAYER )
dlc2_m02_convo_play( Dlc2_m02_convos.disable_generator_02, false, true)
dlc2_m02_convo_play( Dlc2_m02_convos.disable_generator_03, false, false)
-- obj: destroy generator
marker_remove( homie )
marker_add( generator, MINIMAP_ICON_KILL, OI_ASSET_KILL, OI_FLAGS_FULL, SYNC_ALL )
objective_text( 0, "DLC2_M02_DESTORY_GENERATOR", nil, nil, SYNC_ALL, OI_ASSET_KILL )
local mover = generator
mesh_mover_set_invulnerable( mover, false )
-- set up progress bar
local prev_hit_points = get_current_hit_points( mover )
local max_hit_points = get_max_hit_points( mover )
local current_hit_points = prev_hit_points
hud_bar_on( 1, "health", Dlc2_m02_text.progress, max_hit_points )
hud_bar_set_value( 1, 0 )
repeat
thread_yield()
current_hit_points = get_current_hit_points( mover )
if prev_hit_points ~= current_hit_points then
hud_bar_set_value( 1, max_hit_points - current_hit_points )
end
until current_hit_points <= 0
-- explode with camera shake
character_allow_ragdoll( homie, true )
mesh_mover_set_invulnerable( wall, false )
mesh_mover_set_invulnerable( generator, false )
explosion_create( "alien_mindcontrol", "nav_generator_explosion", LOCAL_PLAYER, nil, "vfx_mindcontrol_exp" )
camera_shake_play( "m24_marsquake", 6 )
effect_stop( shock_effect_handle )
mesh_mover_hide( "mov_forcefield" )
set_unjackable_flag( Dlc2_m02_vehicles.saucer, false )
vehicle_set_keyframed_physics( Dlc2_m02_vehicles.saucer, false )
-- down local player
player_movement_disable( LOCAL_PLAYER )
character_ragdoll( LOCAL_PLAYER, nil, nil, nil, nil, true )
audio_object_post_event( "M02_Forcefield_Disable", nil, nil, LOCAL_PLAYER )
dlc2_m02_convo_play( Dlc2_m02_convos.saving_player_01, false, true)
-- clear the progress bar
marker_remove( generator )
objective_text_clear( 0 )
hud_bar_off( 1 )
while character_is_ragdolled( homie ) == true do
thread_yield()
end
-- homie revives player
ai_do_scripted_move( homie, LOCAL_PLAYER, true, false )
local elapsed_time = 0.0
while get_dist( homie, LOCAL_PLAYER ) > 2 do
thread_yield()
elapsed_time = elapsed_time + get_frame_time()
if elapsed_time > 5 then
teleport_to_object( homie, LOCAL_PLAYER )
break
end
end
dlc2_m02_convo_play( Dlc2_m02_convos.jumping_to_end, false, true)
character_fake_revival_start( LOCAL_PLAYER )
action_play_synced( LOCAL_PLAYER, homie, "DBNO revive" )
character_fake_revival_end( LOCAL_PLAYER )
player_movement_enable( LOCAL_PLAYER )
turn_vulnerable( homie )
character_prevent_flinching( homie, false )
set_ignore_ai_flag( homie, false )
follower_make_independent( homie, false )
end
function dlc2_m02_trail_start( trail_data, end_point_mod )
dlc2_m02_trail_stop()
Dlc2_m02_threads.trail = thread_new( "dlc2_m02_trail_thread", trail_data, end_point_mod )
end
function dlc2_m02_trail_stop()
if Dlc2_m02_threads.trail ~= nil then
thread_kill( Dlc2_m02_threads.trail )
Dlc2_m02_threads.trail = nil
end
if Dlc2_m02_status.trail_current ~= nil then
marker_remove( Dlc2_m02_status.trail_current )
Dlc2_m02_status.trail_current = nil
end
end
function dlc2_m02_trail_thread( trail_data, end_point_mod )
local current_nav_index = 1
local current_nav = trail_data[ 1 ]
local new_nav_index = 1
marker_add( current_nav, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_FULL, SYNC_ALL )
Dlc2_m02_status.trail_current = current_nav
while true do
for i = current_nav_index, #trail_data do
local nav = trail_data[ i ]
local d = get_dist( nav, LOCAL_PLAYER )
if coop_is_active() == true then
local d2 = get_dist( nav, REMOTE_PLAYER )
if d2 < d then
d = d2
end
end
if d < 2 then
new_nav_index = i + 1
break
end
end
local new_nav = trail_data[ new_nav_index ]
if new_nav_index ~= current_nav_index then
if new_nav == nil then
break
end
marker_remove( current_nav )
current_nav = new_nav
current_nav_index = new_nav_index
if trail_data[ current_nav_index + 1 ] == nil then
-- last nav may require modification
if end_point_mod == "use" then
marker_add( current_nav, MINIMAP_ICON_USE, OI_ASSET_USE, OI_FLAGS_FULL, SYNC_ALL )
else
marker_add( current_nav, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_FULL, SYNC_ALL )
end
else
marker_add( current_nav, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_FULL, SYNC_ALL )
end
Dlc2_m02_status.trail_current = current_nav
end
thread_yield()
end
end
function dlc2_m02_clapboard_setup()
local count = 0
for i, d in pairs( Dlc2_m02_clapboards ) do
if dlc2_m02_clapboards_get( i ) == false then
trigger_enable( d.trigger, true )
on_trigger( "dlc2_m02_clapboard_cb", d.trigger )
item_show( d.item )
if d.effect_handle == nil then
d.effect_handle = effect_play( d.effect, true )
end
else
item_hide( d.item )
d.collected = true
count = count + 1
end
end
Dlc2_m02_achievements.lights_camera_action.count = count
end
function dlc2_m02_clapboard_cb( char, trigger )
trigger_enable( trigger, false )
on_trigger( "", trigger )
-- find the index
local index = -1
for i, d in pairs( Dlc2_m02_clapboards ) do
if d.trigger == trigger then
index = i
break
end
end
if index == -1 then
return
end
-- set the flag
Dlc2_m02_clapboards[ index ].collected = true
dlc2_m02_helper_achievement_increment( Dlc2_m02_achievements.lights_camera_action )
audio_object_post_event( "M02_ClapBoard_Pickup", nil, nil, LOCAL_PLAYER )
-- dissappear the clapboard
local c = Dlc2_m02_clapboards[ index ]
item_hide( c.item )
if c.effect_handle ~= nil then
effect_stop( c.effect_handle )
c.effect_handle = nil
end
end
function dlc2_m02_backstage_01_roof( activator, trigger )
on_trigger( "", trigger )
trigger_enable( trigger, false )
dlc2_m02_convo_play( Dlc2_m02_convos.bs_1_walk_on_roof, false, true )
end
function dlc2_m02_amazon_damaged_cb( npc, attacker, pct, explosion, melee )
if pct < 0.001 then
if attacker == LOCAL_PLAYER or attacker == REMOTE_PLAYER then
if melee == true then
dlc2_m02_helper_achievement_increment( Dlc2_m02_achievements.man_power )
on_take_damage( "", npc )
elseif inv_item_is_equipped( "DLC_LaserPistol", attacker ) == true then
dlc2_m02_helper_achievement_increment( Dlc2_m02_achievements.pew_pew_pew )
on_take_damage( "", npc )
end
end
end
end
function dlc2_m02_helper_achievements_write_checkpoint()
-- Write the achievement data for the checkpoint
for i, achievement in pairs( Dlc2_m02_achievements ) do
dlc_achievement_counter_set( achievement.slot_idx, achievement.current_count )
end
-- clapboards
for i, clapboard in pairs( Dlc2_m02_clapboards ) do
if clapboard.collected == true then
dlc2_m02_clapboards_set( i )
end
end
end
function dlc2_m02_helper_achievement_reset( achievement_table )
dlc_achievement_counter_set( achievement_table.slot_idx, 0 )
achievement_table.current_count = 0
end
-- Read the stored achievement counter from the previous checkpoint
function dlc2_m02_helper_achievement_read_checkpoint( achievement_table )
for i, achievement in pairs( achievement_table ) do
achievement.current_count = dlc_achievement_counter_get( achievement.slot_idx )
end
end
-- Increment an achievement counter
function dlc2_m02_helper_achievement_increment( achievement_table )
-- Check if the target goal has already been reached
if ( achievement_table.current_count >= achievement_table.target_goal ) then
return
end
-- Increment the counter
achievement_table.current_count = achievement_table.current_count + 1
-- Show the progress HUD
hud_achievement_show_progress( achievement_table.name, achievement_table.current_count, achievement_table.target_goal )
end
function dlc2_m02_failed_to_protect()
mission_end_failure( "dlc2_m02", "dlc2_m02_mission_fail_didnt_protect_homie" )
end
function dlc2_m02_room3_cue_music()
trigger_enable( "trg_room3_cue_music", false )
on_trigger( "", "trg_room3_cue_music" )
audio_object_post_event( "M02_Part2_Music_Start", nil, nil, LOCAL_PLAYER )
end
function dlc2_m02_setup_convo_trigger( trigger, convo )
if Dlc2_m02_status.convo_triggers == nil then
Dlc2_m02_status.convo_triggers = { }
end
Dlc2_m02_status.convo_triggers[ trigger ] = convo
trigger_enable( trigger, true )
on_trigger( "dlc2_m02_convo_trigger_cb", trigger )
end
function dlc2_m02_convo_trigger_cb( char, trigger )
if Dlc2_m02_status.convo_triggers[ trigger ] ~= nil then
if dlc2_m02_convo_is_playing() == false then
dlc2_m02_convo_play( Dlc2_m02_status.convo_triggers[ trigger ], false, false )
trigger_enable( trigger, false )
on_trigger( "", trigger )
end
Dlc2_m02_status.convo_triggers[ trigger ] = nil
end
end
function dlc2_m02_enable_traps( enable )
local triggers = {
Dlc2_m02_triggers.electric_trap_1,
Dlc2_m02_triggers.electric_trap_2,
Dlc2_m02_triggers.fire_trap,
}
for i, t in pairs( triggers ) do
trigger_enable( t, enable )
end
if enable then
on_trigger( "dlc2_m02_trap_electric", Dlc2_m02_triggers.electric_trap_1 )
on_trigger( "dlc2_m02_trap_electric", Dlc2_m02_triggers.electric_trap_2 )
on_trigger( "dlc2_m02_trap_fire", Dlc2_m02_triggers.fire_trap )
else
for i, t in pairs( triggers ) do
on_trigger( "", t )
end
end
end
function dlc2_m02_trap_electric( npc, trigger )
if npc == nil then
return
end
local impulse_nav
if trigger == Dlc2_m02_triggers.electric_trap_1 then
impulse_nav = "nav_electric_1"
else
impulse_nav = "nav_electric_2"
end
character_ragdoll( npc, 3 * 1000, 10, impulse_nav )
local shock_effect_handle = effect_play_on_human( "vfx_electric_body", npc, "spine2", true )
delay( 3 )
effect_stop( shock_effect_handle )
end
function dlc2_m02_trap_fire( npc )
if npc == nil then
return
end
character_ignite( npc )
end
function dlc2_m02_film_grain_unload( b )
if Dlc2_m02_status.film_grain == true then
Dlc2_m02_status.film_grain = false
dlc_gis_film_grain_unload( b )
audio_object_post_event( "M02_Cut", nil, nil, LOCAL_PLAYER )
end
end
function dlc2_m02_film_grain_load()
if Dlc2_m02_status.film_grain ~= true then
Dlc2_m02_status.film_grain = true
dlc_gis_film_grain_load()
audio_object_post_event( "M02_Action", nil, nil, LOCAL_PLAYER )
end
end