./dlc2_m01.lua

  1. --[[ 
  2. 	dlc2_m01.lua 
  3. 	SR3 Dlc2 Mission Script (GiS) 
  4. 	DATE: 09/22/11 
  5. 	AUTHOR:	Matt.Gawalek 
  6. ]]-- 
  7.  
  8. -- Checkpoints -- 
  9. 	Dlc2_m01_checkpoints = { 
  10. 		start = { 
  11. 			name = MISSION_START_CHECKPOINT, 
  12. 			player_navs = { "nav_player_start_chk01_01", "nav_player_start_chk01_02" }, 
  13. 		}, 
  14. 		armory_take1 = { 
  15. 			name = "dlc2_m01_armory_take1", 
  16. 			player_navs = { "nav_player_start_armory 01", "nav_player_start_armory 02" }, 
  17. 		}, 
  18. 		armory_take2 = { 
  19. 			name = "dlc2_m01_armory_take2", 
  20. 			player_navs = { "nav_player_start_chk02_01", "nav_player_start_chk02_01" }, 
  21. 		}, 
  22. 		escape_start = { 
  23. 			name = "dlc2_m01_escape_start", 
  24. 			player_navs = { "nav_player_start_chk03_01", "nav_player_start_chk03_01" }, 
  25. 		}, 
  26. 		rail_dt_02 = { 
  27. 			name = "dlc2_m01_escape_dt_02", 
  28. 			player_navs = { "nav_player_start_chk04_01", "nav_player_start_chk04_01" }, 
  29. 		}, 
  30. 		alien_ambush = { 
  31. 			name = "dlc2_m01_alien_ambush", 
  32. 			player_navs = { "nav_player_start_chk05_01", "nav_player_start_chk05_01" }, 
  33. 		}, 
  34. 		rail_nw_01 = { 
  35. 			name = "dlc2_m01_rail_nw_01", 
  36. 			player_navs = { "nav_player_start_chk06_01", "nav_player_start_chk06_01" }, 
  37. 		}, 
  38. 		jump_take2 = { 
  39. 			name = "dlc2_m01_jump_take2", 
  40. 			player_navs = { "nav_player_start_chk07_01", "nav_player_start_chk07_01" }, 
  41. 		}, 
  42. 		finale = { 
  43. 			name = "dlc2_m01_finale", 
  44. 			player_navs = { "nav_player_start_chk08_01", "nav_player_start_chk08_01" }, 
  45. 		}, 
  46. 	} 
  47. 	 
  48. -- Tweak Values -- 
  49. 	Dlc2_m01_tweak_values = { 
  50. 		--[[  
  51. 			Armory Take1 
  52. 			--]]	 
  53. 		 
  54. 		-- Player load-out 
  55. 		armory_inventory_take1 = { 
  56. 			{ weapon = "SMG-Gang", upgrade_lvl = WEAPON_LEVEL1 }, 
  57. 			{ weapon = "Rifle-Gang", upgrade_lvl = WEAPON_LEVEL1 }, 
  58. 		}, 
  59. 		 
  60. 		-- Player attack multiplier (greater than 1 for increased attack damage, less than 1 for less damage) 
  61. 		armory_player_atk_mult_take1 = 1.8, 
  62. 		 
  63. 		-- Fail time (ms) for the player if the enter the heli_pad before parking the car 
  64. 		heli_pad_evacuate_time = 15000, 
  65. 		 
  66. 		-- Trigger the guards at the gate to move into place when this many tower guards remain 
  67. 		num_tower_guards_to_trigger_gate = 1, 
  68. 		 
  69. 		--[[  
  70. 			Armory Take2 
  71. 			--]]		 
  72.  
  73. 		-- Player load-out (Used for the rest of the mission as well) 
  74. 		armory_inventory_take2 = { 
  75. 			{ weapon = "Grenade", upgrade_lvl = WEAPON_LEVEL4, is_grenade = true }, 
  76. 			{ weapon = "SMG-Gang", upgrade_lvl = WEAPON_LEVEL3 }, 
  77. 			{ weapon = "Rifle-Gang", upgrade_lvl = WEAPON_LEVEL4 }, 
  78. 		}, 
  79. 		 
  80. 		-- Player attack multiplier (greater than 1 for increased attack damage, less than 1 for less damage) 
  81. 		armory_player_atk_mult_take2 = 1.0, 
  82. 		 
  83. 		-- Notoriety level after rescueing Kwilanna 
  84. 		armory_notoriety_rescue_kwilanna = 5, 
  85. 		 
  86. 		--[[  
  87. 			Rail sequence  
  88. 			--]] 
  89. 			 
  90. 		-- How far from each navpoint the player's vehicle must get in the rail to consider the path complete	 
  91. 		player_veh_pathfind_dist = 10.0, 
  92. 		player_veh_pathfind_speed = 70.0, 
  93. 		 
  94. 		parked_car_exp_cooldown_min = 2.0, 
  95. 		parked_car_exp_cooldown_max = 5.0, 
  96. 		 
  97. 		-- Player attack multiplier (greater than 1 for increased attack damage, less than 1 for less damage) 
  98. 		rail_player_atk_mult_start = 1.0, 
  99. 		rail_player_atk_mult_dt2 = 4.0, 
  100. 		rail_player_atk_mult_nw = 2.0, 
  101. 		rail_player_atk_mult_end = 2.0, 
  102. 		 
  103. 		-- Player attack multipliers for HARDCORE difficulty 
  104. 		rail_player_atk_mult_start_hc = 1.1, 
  105. 		rail_player_atk_mult_dt2_hc = 4.1, 
  106. 		rail_player_atk_mult_nw_hc = 2.4, 
  107. 		rail_player_atk_mult_end_hc = 2.4, 
  108.  
  109. 		-- Rail vehicle hitpoints 
  110. 		player_veh_hitpoints = 19500, 
  111. 		player_veh_nw_hitpoints = 34500, 
  112. 		 
  113. 		-- Rail vehicle hitpoints for HARDCORE difficulty 
  114. 		player_veh_hitpoints_hc = 19501, 
  115. 		player_veh_nw_hitpoints_hc = 45001,		 
  116. 		 
  117. 		remote_player_weapon = "Rifle-Gang", 
  118. 		fake_notoriety_level = 5, -- Fake notoriety level displayed to the HUD 
  119. 		dt_police_notoriety = 4, -- Real notoriety level that controls spawning rate 
  120. 		ng_vehicle_chase_speed = 85.0, 
  121. 		ng_heli_follow_dist = 20.0, 
  122. 		 
  123. 		alien_default_hp_mult = 2.6, 
  124. 		 
  125. 		 
  126. 		num_alien_notority_vehicles = 4.0, 
  127. 	} 
  128. 	 
  129. -- Groups -- 
  130. 	Dlc2_m01_groups = { 
  131. 		courtesy_veh_01 = { 
  132. 			name = "group_courtesy_veh_chk_01", 
  133. 			vehicles = { "veh_player_start_chk01_01", "veh_player_start_chk01_02" }, 
  134. 		}, 
  135.  
  136. 		kwilanna = { 
  137. 			name = "group_kwilanna_01", 
  138. 			kwilanna = "npc_kwilanna_01", 
  139. 		}, 
  140. 		 
  141. 		kwilanna_heli = { 
  142. 			name = "group_kwilanna_heli", 
  143. 			heli = { 
  144. 				vehicle = "veh_kwilanna_heli_01", 
  145. 				pilot = "npc_kwilanna_heli_pilot_01", 
  146. 			}, 
  147. 		}, 
  148. 		 
  149. 		armory_camera_men = { 
  150. 			name = "group_armory_cameramen_01", 
  151. 			npcs = {  
  152. 				"npc_armory_cameraman_01", "npc_armory_cameraman_02", "npc_armory_cameraman_03", "npc_armory_cameraman_04", "npc_armory_cameraman_05", "npc_armory_cameraman_06", 
  153. 				"npc_armory_cameraman_07", "npc_armory_cameraman_08", "npc_armory_cameraman_09", "npc_armory_cameraman_10", "npc_armory_cameraman_11", "npc_armory_cameraman_12", 
  154. 				"npc_armory_cameraman_13", 
  155. 			}, 
  156. 		}, 
  157. 		 
  158. 		armory_car_husks = { 
  159. 			name = "group_armory_car_husks", 
  160. 			vehicles = { 
  161. 				"veh_armory_husk 01", "veh_armory_husk 02", "veh_armory_husk 03", "veh_armory_husk 04", "veh_armory_husk 05",  
  162. 			}, 
  163. 		}, 
  164. 		 
  165. 		armory_take_01 = { 
  166. 			name = "group_armory_take_01", 
  167. 			npcs = {  
  168. 				"npc_armory_take1_01", "npc_armory_take1_02", "npc_armory_take1_03", "npc_armory_take1_04", "npc_armory_take1_05", 
  169. 				"npc_armory_take1_06", "npc_armory_take1_10", "npc_armory_take1_11", "npc_armory_take1_12", "npc_armory_take1_13", 
  170. 			}, 
  171. 			suvs = { 
  172. 				"veh_armory_suv_take1_01", "veh_armory_suv_take1_02", "veh_armory_suv_take1_03", "veh_armory_suv_take1_04", 
  173. 				"veh_armory_suv_take1_05", "veh_armory_suv_take1_06", 
  174. 			}, 
  175. 			cars = { 
  176. 				"veh_armory_car_take1_01", "veh_armory_car_take1_02", 
  177. 			}, 
  178. 			helis = { 
  179. 				"veh_armory_heli_take1_01", "veh_armory_heli_take1_02", "veh_armory_heli_take1_03", 
  180. 			}, 
  181. 			tower_guards = { 
  182. 				--[["npc_armory_take1_07",--]] "npc_armory_take1_08", --[["npc_armory_take1_09", "npc_armory_take1_13", "npc_armory_take1_14",--]] 
  183. 			}, 
  184. 		}, 
  185. 		 
  186. 		gate_gaurd_take_01 = { 
  187. 			name = "group_gate_guard_take1", 
  188. 			chase_npcs = { 
  189. 				{ npc = "npc_gate_guard_take1_01", nav = "nav_gate_guard_pos 01", leash = 4.0 }, 
  190. 				{ npc = "npc_gate_guard_take1_02", nav = "nav_gate_guard_pos 02", leash = 4.0 }, 
  191. 				{ npc = "npc_gate_guard_take1_03", nav = "nav_gate_guard_pos 03", leash = 10.0, delay = 8.0 }, 
  192. 				{ npc = "npc_gate_guard_take1_04", nav = "nav_gate_guard_pos 04", leash = 10.0, delay = 8.2 },				 
  193. 			}, 
  194. 		}, 
  195. 		 
  196. 		stair_guard_take_01 = { 
  197. 			name = "group_stair_guard_take1", 
  198. 			chase_npcs = { 
  199. 				{ npc = "npc_stair_guard_take1_01", nav = "nav_player_start_chk03_01", leash = 3.0 }, 
  200. 			}, 
  201. 		}, 
  202. 		 
  203. 		armory_take_02 = { 
  204. 			name = "group_armory_take_02", 
  205. 			npcs = { 
  206. 				"npc_armory_take2_01", "npc_armory_take2_02", "npc_armory_take2_03", "npc_armory_take2_04", "npc_armory_take2_05", 
  207. 				"npc_armory_take2_06", "npc_armory_take2_07", "npc_armory_take2_08", "npc_armory_take2_09", --[["npc_armory_take2_10",--]] 
  208. 				"npc_armory_take2_11", "npc_armory_take2_12", "npc_armory_take2_13", --[["npc_armory_take2_14",--]] "npc_armory_take2_15", 
  209. 				"npc_armory_take2_16", "npc_armory_take2_17", "npc_armory_take2_18", "npc_armory_take2_19", "npc_armory_take2_20", 
  210. 				 
  211. 				--[["npc_armory_suv_take2_01",--]] "npc_armory_suv_take2_02", --[["npc_armory_suv_take2_03",--]] "npc_armory_suv_take2_04", 
  212. 				"npc_armory_suv_take2_05", "npc_armory_suv_take2_06", 
  213. 				 
  214. 				"npc_armory_suv_take2_10", "npc_armory_suv_take2_12", 
  215. 			}, 
  216. 			suvs = { 
  217. 				"veh_armory_suv_take2_02", "veh_armory_suv_take2_04", 
  218. 				"veh_armory_suv_take2_05", "veh_armory_suv_take2_06", "veh_armory_suv_take2_07", "veh_armory_suv_take2_08", 
  219. 				"veh_armory_suv_take2_09", "veh_armory_suv_take2_10", "veh_armory_suv_take2_11", "veh_armory_suv_take2_12", 
  220. 			}, 
  221. 			cars = { 
  222. 				"veh_armory_car_take2_01", "veh_armory_car_take2_02", 
  223. 			}, 
  224. 			helis = { 
  225. 				"veh_armory_heli_take2_01", "veh_armory_heli_take2_02", "veh_armory_heli_take2_03", 
  226. 			}, 
  227.  
  228. 			-- List of manned vehicles that should have a gunner on the mounted turret 
  229. 			manned_vehicles = { 
  230. 				{ vehicle = "veh_armory_suv_take2_02", gunner = "npc_armory_suv_take2_02" }, 
  231. 				{ vehicle = "veh_armory_suv_take2_04", gunner = "npc_armory_suv_take2_04" }, 
  232. 				{ vehicle = "veh_armory_suv_take2_05", gunner = "npc_armory_suv_take2_05" }, 
  233. 				{ vehicle = "veh_armory_suv_take2_06", gunner = "npc_armory_suv_take2_06" }, 
  234. 				{ vehicle = "veh_armory_suv_take2_10", gunner = "npc_armory_suv_take2_10" }, 
  235. 				{ vehicle = "veh_armory_suv_take2_12", gunner = "npc_armory_suv_take2_12" }, 
  236. 			}, 
  237. 		}, 
  238. 		 
  239. 		armory_player_heli = { 
  240. 			name = "group_player_heli", 
  241. 			heli = { 
  242. 				vehicle = "veh_player_heli", 
  243. 				pilot = "npc_player_heli_pilot", 
  244. 			}, 
  245. 		}, 
  246. 		 
  247. 		armory_drop_off = { 
  248. 			name = "group_armory_drop_off", 
  249. 			heli = { 
  250. 				vehicle = "veh_armory_drop_off", 
  251. 				pilots = { "npc_armory_drop_off_01", "npc_armory_drop_off_02" }, 
  252. 				soldiers = { "npc_armory_drop_off_03", "npc_armory_drop_off_04", "npc_armory_drop_off_05", "npc_armory_drop_off_06" }, 
  253. 				path = "path_armory_drop_off", 
  254. 				speed = 25.0, 
  255. 			}, 
  256. 		}, 
  257. 		 
  258. 		armory_get_away_car = { 
  259. 			name = "group_armory_get_away_car", 
  260. 			vehicle = "veh_armory_get_away_car", 
  261. 		}, 
  262. 		 
  263. 		armory_persue_heli = { 
  264. 			name = "group_armory_persue_heli", 
  265. 			chase_vehicles = { 
  266. 				{ vehicle = "veh_armory_persue_heli 01", npcs = { "npc_armory_persue_heli 01", "npc_armory_persue_heli 02" }, paths = { "path_armory_persue_heli 01" }, orient = HELI_PF_FACE_TARGET, }, 
  267. 				{ vehicle = "veh_armory_persue_heli 02", npcs = { "npc_armory_persue_heli 03", "npc_armory_persue_heli 04" }, paths = { "path_armory_persue_heli 02" }, orient = HELI_PF_FACE_TARGET, }, 
  268. 			}, 
  269. 		}, 
  270. 		 
  271. 		armory_camera_persue_heli = { 
  272. 			name = "group_cameramen_heli_001", 
  273. 			heli = { vehicle = "veh_camera_persue_heli 01", npcs = { "npc_heli_cameraman_001", "npc_heli_cameraman_002" }, paths = { "path_cameraman_rail_heli_01" }, follow_dist = 10.0, delay = 4.5 }, 
  274. 		}, 
  275. 		 
  276. 		-- Expects "group_armory_get_away_car" is also created for the vehicle (this only creates the NPCs to go in the vehicle) 
  277. 		dt_get_away_car_drop_off = { 
  278. 			name = "group_get_away_car_drop_off", 
  279. 			npcs = { "npc_ng_get_away_car 001", "npc_ng_get_away_car 002", "npc_ng_get_away_car 003" }, 
  280. 			path = "nav_armory_get_away_stop", 
  281. 		}, 
  282. 		 
  283. 		dt_camera_men_01 = { 
  284. 			name = "group_dt_cameramen_01", 
  285. 			npcs = { 
  286. 				"npc_dt_camerman_01 01", "npc_dt_camerman_01 02", "npc_dt_camerman_01 03", "npc_dt_camerman_01 04", 
  287. 				"npc_dt_camerman_01 05", "npc_dt_camerman_01 06", "npc_dt_camerman_01 07", "npc_dt_camerman_01 08", 
  288. 				"npc_dt_camerman_01 09", 
  289. 			}, 
  290. 		}, 
  291. 		 
  292. 		dt_camera_men_02 = { 
  293. 			name = "group_dt_cameramen_02", 
  294. 			npcs = { 
  295. 				"npc_dt_camerman_02 01", "npc_dt_camerman_02 02", "npc_dt_camerman_02 03", "npc_dt_camerman_02 04", 
  296. 				"npc_dt_camerman_02 05", "npc_dt_camerman_02 06", "npc_dt_camerman_02 07", "npc_dt_camerman_02 08", 
  297. 				"npc_dt_camerman_02 09", "npc_dt_camerman_02 10", "npc_dt_camerman_02 11" 
  298. 			}, 
  299. 		}, 
  300. 		 
  301. 		dt_chase_ng_04 = { 
  302. 			name = "group_dt_chase_ng 04", 
  303. 			chase_vehicles = { 
  304. 				{ vehicle = "veh_ng_dt_04 01", npcs = { "npc_ng_dt_04 01", "npc_ng_dt_04 02" }, paths = { "path_ng_dt_04 01", "path_ng_dt_04 01a" }, exp_factor = 0.1, follow_dist = 10.0 }, 
  305. 				{ vehicle = "veh_ng_dt_04 02", npcs = { "npc_ng_dt_04 03", "npc_ng_dt_04 04" }, paths = { "path_ng_dt_04 01", "path_ng_dt_04 02a" }, exp_factor = 0.1, follow_dist = 10.0 }, 
  306. 				{ vehicle = "veh_ng_dt_04 03", npcs = { "npc_ng_dt_04 05", "npc_ng_dt_04 06" }, paths = { "path_ng_dt_04 01", "path_ng_dt_04 03a" }, exp_factor = 0.1, follow_dist = 10.0 }, 
  307. 			}, 
  308. 		}, 
  309. 		 
  310. 		dt_chase_ng_05 = { 
  311. 			name = "group_dt_chase_ng 05", 
  312. 			chase_vehicles = { 
  313. 				{ vehicle = "veh_ng_dt_05 01", npcs = { "npc_ng_dt_05 01", "npc_ng_dt_05 02" }, paths = { "path_ng_dt_05 01" }, exp_factor = 0.1 }, 
  314. 				{ vehicle = "veh_ng_dt_05 02", npcs = { "npc_ng_dt_05 03", "npc_ng_dt_05 04" }, paths = { "path_ng_dt_05 02" }, exp_factor = 0.1 }, 
  315. 				{ vehicle = "veh_ng_dt_05 03", npcs = { "npc_ng_dt_05 05", "npc_ng_dt_05 06" }, paths = { "path_ng_dt_05 03" }, exp_factor = 0.1 }, 
  316. 			}, 
  317. 		}, 
  318. 		 
  319. 		dt_chase_ng_06 = { 
  320. 			name = "group_dt_chase_ng 06", 
  321. 			chase_vehicles = { 
  322. 				{ vehicle = "veh_ng_dt_06 01", npcs = { "npc_ng_dt_06 01", "npc_ng_dt_06 02" }, paths = { "path_ng_dt_06 01" }, exp_factor = 0.1 }, 
  323. 				{ vehicle = "veh_ng_dt_06 02", npcs = { "npc_ng_dt_06 03", "npc_ng_dt_06 04" }, paths = { "path_ng_dt_06 02" }, exp_factor = 0.1 }, 
  324. 			}, 
  325. 		}, 
  326. 		 
  327. 		dt_chase_ng_07 = { 
  328. 			name = "group_dt_chase_ng 07", 
  329. 			chase_vehicles = { 
  330. 				{ vehicle = "veh_ng_dt_07 01", npcs = { "npc_ng_dt_07 01", "npc_ng_dt_07 02" }, exp_factor = 0.1 }, 
  331. 				{ vehicle = "veh_ng_dt_07 02", npcs = { "npc_ng_dt_07 03", "npc_ng_dt_07 04" }, exp_factor = 0.1 }, 
  332. 				{ vehicle = "veh_ng_dt_07 03", npcs = { "npc_ng_dt_07 05", "npc_ng_dt_07 06" }, exp_factor = 0.1 }, 
  333. 				{ vehicle = "veh_ng_dt_07 04", npcs = { "npc_ng_dt_07 07", "npc_ng_dt_07 08" }, exp_factor = 0.1 }, 
  334. 			}, 
  335. 		}, 
  336. 		 
  337. 		dt_chase_ng_08 = { 
  338. 			name = "group_dt_chase_ng 08", 
  339. 			chase_vehicles = { 
  340. 				{ vehicle = "veh_ng_dt_08 01", npcs = { "npc_ng_dt_08 01", "npc_ng_dt_08 02" }, paths = { "path_ng_dt_08_01" }, exp_factor = 0.1 }, 
  341. 				{ vehicle = "veh_ng_dt_08 02", npcs = { "npc_ng_dt_08 03", "npc_ng_dt_08 04" }, paths = { "path_ng_dt_08_02" }, exp_factor = 0.1 }, 
  342. 			}, 
  343. 		}, 
  344. 		 
  345. 		dt_chase_ng_09 = { 
  346. 			name = "group_dt_chase_ng 09", 
  347. 			chase_vehicles = { 
  348. 				{ vehicle = "veh_ng_dt_09 01", npcs = { "npc_ng_dt_09 01", "npc_ng_dt_09 02" }, paths = { "path_ng_dt_09_01" }, exp_factor = 0.1 }, 
  349. 				{ vehicle = "veh_ng_dt_09 02", npcs = { "npc_ng_dt_09 03", "npc_ng_dt_09 04" }, paths = { "path_ng_dt_09_02" }, exp_factor = 0.1 }, 
  350. 				{ vehicle = "veh_ng_dt_09 03", npcs = { "npc_ng_dt_09 05", "npc_ng_dt_09 06" }, paths = { "path_ng_dt_09_03" }, exp_factor = 0.1 }, 
  351. 			}, 
  352. 		}, 
  353. 		 
  354. 		dt_chase_ng_10 = { 
  355. 			name = "group_dt_chase_ng 10", 
  356. 			chase_vehicles = { 
  357. 				{ vehicle = "veh_ng_dt_10 01", npcs = { "npc_ng_dt_10 01", "npc_ng_dt_10 02" }, paths = { "path_ng_dt_10_01" }, exp_factor = 0.1 }, 
  358. 				{ vehicle = "veh_ng_dt_10 02", npcs = { "npc_ng_dt_10 03", "npc_ng_dt_10 04" }, paths = { "path_ng_dt_10_02" }, exp_factor = 0.1 }, 
  359. 			}, 
  360. 		},		 
  361. 		 
  362. 		ng_bridge_roadblock = { 
  363. 			name = "group_ng_bridge_roadblock", 
  364. 			vehicles = { 
  365. 				{ vehicle = "veh_ng_roadblock_tank 01", npcs = { "npc_ng_roadblock 01", "npc_ng_roadblock 02" } }, 
  366. 				{ vehicle = "veh_ng_roadblock_tank 02", npcs = { "npc_ng_roadblock 03", "npc_ng_roadblock 04" } }, 
  367. 				{ vehicle = "veh_ng_roadblock_suv 01", npcs = { "npc_ng_roadblock 05", "npc_ng_roadblock 06" } }, 
  368. 				{ vehicle = "veh_ng_roadblock_suv 02", npcs = { "npc_ng_roadblock 07", "npc_ng_roadblock 08" } }, 
  369. 				{ vehicle = "veh_ng_roadblock_suv 03", npcs = { "npc_ng_roadblock 09", "npc_ng_roadblock 10" } }, 
  370. 				{ vehicle = "veh_ng_roadblock_suv 04", npcs = { "npc_ng_roadblock 11", "npc_ng_roadblock 12" } }, 
  371. 				{ vehicle = "veh_ng_roadblock_heli 01", npcs = { "npc_ng_roadblock 13", "npc_ng_roadblock 14" }, hover_nav = "nav_ng_roadblock_heli_pos 01" }, 
  372. 				{ vehicle = "veh_ng_roadblock_heli 02", npcs = { "npc_ng_roadblock 15", "npc_ng_roadblock 16" }, hover_nav = "nav_ng_roadblock_heli_pos 02" }, 
  373. 			}, 
  374. 		}, 
  375. 		 
  376. 		ng_roadblock_pursuers = { 
  377. 			name = "group_ng_roadblock_pursuers", 
  378. 			chase_vehicles = { 
  379. 				{ vehicle = "veh_ng_roadblock_pursuer 01", npcs = { "npc_ng_roadblock_pursuer 01", "npc_ng_roadblock_pursuer 02" }, paths = { "path_ng_roadblock_pursuer 01" } }, 
  380. 				{ vehicle = "veh_ng_roadblock_pursuer 02", npcs = { "npc_ng_roadblock_pursuer 03", "npc_ng_roadblock_pursuer 04" }, paths = { "path_ng_roadblock_pursuer 02" } }, 
  381. 			}, 
  382. 		},		 
  383. 		 
  384. 		alien_bridge_ambush = { 
  385. 			name = "group_nw_chase_alien 01", 
  386. 			vehicles = { 
  387. 				{ vehicle = "veh_alien_nw_01 01", npcs = { "npc_alien_nw_01 01", "npc_alien_nw_01 02" }, fly_to_nav = "nav_alien_nw_fly_to_01 001", target_nav = "nav_alien_nw_target_pos_01 01", paths = { "path_alien_ambush_01" }, follow_dist = 15.0, delay = 5.0, thread_id = -1, is_alien = true }, 
  388. 				{ vehicle = "veh_alien_nw_01 02", npcs = { "npc_alien_nw_01 03", "npc_alien_nw_01 04" }, fly_to_nav = "nav_alien_nw_fly_to_01 002", target_nav = "nav_alien_nw_target_pos_01 02", paths = { "path_alien_ambush_02" }, follow_dist = 15.0, delay = 5.0, thread_id = -1, is_alien = true }, -- out of order so they attack in the correct order 
  389. 			}, 
  390. 		}, 
  391. 		 
  392. 		nw_cameramen_01 = { 
  393. 			name = "group_nw_cameramen_01", 
  394. 			npcs = { 
  395. 				"npc_nw_cameraman_01", "npc_nw_cameraman_02", "npc_nw_cameraman_03", "npc_nw_cameraman_04", "npc_nw_cameraman_05", 
  396. 				"npc_nw_cameraman_06", "npc_nw_cameraman_07", "npc_nw_cameraman_08", "npc_nw_cameraman_09", "npc_nw_cameraman_10", 
  397. 				"npc_nw_cameraman_11", "npc_nw_cameraman_12", "npc_nw_cameraman_13",  
  398. 			}, 
  399. 		}, 
  400. 		 
  401. 		nw_cameramen_02 = { 
  402. 			name = "group_nw_cameramen_02", 
  403. 			npcs = { 
  404. 				"npc_nw_cameraman_14", "npc_nw_cameraman_15", "npc_nw_cameraman_16", "npc_nw_cameraman_17", "npc_nw_cameraman_18", 
  405. 				"npc_nw_cameraman_19", "npc_nw_cameraman_20", "npc_nw_cameraman_21", "npc_nw_cameraman_22", "npc_nw_cameraman_23", 
  406. 				"npc_nw_cameraman_24", "npc_nw_cameraman_25", "npc_nw_cameraman_26", "npc_nw_cameraman_27", "npc_nw_cameraman_28", 
  407. 			}, 
  408. 		}, 
  409. 		 
  410. 		alien_nw01_ambush = { 
  411. 			name = "group_nw_chase_alien_01", 
  412. 			chase_vehicles = { 
  413. 				{ vehicle = "veh_alien_nw01_001", npcs = { "npc_alien_nw01_001", "npc_alien_nw01_002" }, paths = { "path_alien_nw01_001"}, follow_dist = 10.0, orient = HELI_PF_FACE_TARGET, is_alien = true }, 
  414. 			}, 
  415. 		}, 
  416. 		alien_nw02_ambush = { 
  417. 			name = "group_nw_chase_alien 02", 
  418. 			chase_vehicles = { 
  419. 				{ vehicle = "veh_alien_nw02_001", npcs = { "npc_alien_nw02_001", "npc_alien_nw02_002" }, paths = { "path_alien_nw02_001"}, follow_dist = 10.0, orient = HELI_PF_FACE_TARGET, is_alien = true}, 
  420. 			}, 
  421. 		}, 
  422. 		alien_nw03_ambush = { 
  423. 			name = "group_nw_chase_alien 03", 
  424. 			chase_vehicles = { 
  425. 				{ vehicle = "veh_alien_nw03_001", npcs = { "npc_alien_nw03_001", "npc_alien_nw03_002" }, paths = { "path_alien_nw03_001"}, follow_dist = 10.0, is_alien = true}, 
  426. 			},		 
  427. 		}, 
  428. 		alien_nw04_ambush = { 
  429. 			name = "group_nw_chase_alien 04", 
  430. 			chase_vehicles = { 
  431. 				{ vehicle = "veh_alien_nw04_001", npcs = { "npc_alien_nw04_001", "npc_alien_nw04_002" }, paths = { "path_alien_nw04_001"}, follow_dist = 15.0, is_alien = true}, 
  432. 			},		 
  433. 		}, 
  434. 		alien_nw05_ambush = { 
  435. 			name = "group_nw_chase_alien 05", 
  436. 			chase_vehicles = { 
  437. 				{ vehicle = "veh_alien_nw05_001", npcs = { "npc_alien_nw05_001", "npc_alien_nw05_002" }, paths = { "path_alien_nw05_001"}, follow_dist = 10.0, is_alien = true}, 
  438. 			},		 
  439. 		}, 
  440. 		alien_nw06_ambush = { 
  441. 			name = "group_nw_chase_alien 06", 
  442. 			chase_vehicles = { 
  443. 				{ vehicle = "veh_alien_nw06_001", npcs = { "npc_alien_nw06_001", "npc_alien_nw06_002" }, paths = { "path_alien_nw06_001"}, follow_dist = 10.0, is_alien = true}, 
  444. 			},		 
  445. 		}, 
  446. 		alien_nw07_ambush = { 
  447. 			name = "group_nw_chase_alien 07", 
  448. 			chase_vehicles = { 
  449. 				{ vehicle = "veh_alien_nw07_001", npcs = { "npc_alien_nw07_001", "npc_alien_nw07_002" }, paths = { "path_alien_nw07_001"}, follow_dist = 10.0, is_alien = true}, 
  450. 			},		 
  451. 		}, 
  452. 		alien_nw08_ambush = { 
  453. 			name = "group_nw_chase_alien 08", 
  454. 			chase_vehicles = { 
  455. 				{ vehicle = "veh_alien_nw08_001", npcs = { "npc_alien_nw08_001", "npc_alien_nw08_002" }, paths = { "path_alien_nw08_001"}, follow_dist = 10.0, is_alien = true}, 
  456. 			},		 
  457. 		}, 
  458. 		alien_end_ambush_01 = { 
  459. 			name = "group_alien_end 01", 
  460. 			chase_vehicles = { 
  461. 				{ vehicle = "veh_alien_end_01 01", npcs = { "npc_alien_end_01 01", "npc_alien_end_01 02" }, paths = { "path_alien_end_01 01" }, follow_dist = 5.0, is_alien = true }, 
  462. 				{ vehicle = "veh_alien_end_01 02", npcs = { "npc_alien_end_01 03", "npc_alien_end_01 04" }, paths = { "path_alien_end_01 02" }, follow_dist = 8.0, is_alien = true }, 
  463. 			}, 
  464. 		}, 
  465. 		alien_end_ambush_02 = { 
  466. 			name = "group_alien_end 02", 
  467. 			chase_vehicles = { 
  468. 				{ vehicle = "veh_alien_end_02 01", npcs = { "npc_alien_end_02 01", "npc_alien_end_02 02" }, paths = { "path_alien_end_02 01" }, is_alien = true }, 
  469. 				{ vehicle = "veh_alien_end_02 02", npcs = { "npc_alien_end_02 03", "npc_alien_end_02 04" }, paths = { "path_alien_end_02 02" }, is_alien = true }, 
  470. 			}, 
  471. 		},		 
  472. 		alien_tunnel_ambush = { 
  473. 			name = "group_alien_tunnel 01", 
  474. 			chase_vehicles = { 
  475. 				{ vehicle = "veh_alien_bike_tunnel 01", npcs = { "npc_alient_bike_tunnel 01" }, paths = { "path_alien_bike_tunnel 01" }, follow_dist = 12.0, delay = 0.0, exp_factor = 0.1, is_alien = true }, 
  476. 				{ vehicle = "veh_alien_bike_tunnel 02", npcs = { "npc_alient_bike_tunnel 02" }, paths = { "path_alien_bike_tunnel 02" }, follow_dist = 13.0, delay = 0.4, exp_factor = 0.1, is_alien = true }, 
  477. 				{ vehicle = "veh_alien_bike_tunnel 03", npcs = { "npc_alient_bike_tunnel 03" }, paths = { "path_alien_bike_tunnel 03" }, follow_dist = 11.0, delay = 0.9, exp_factor = 0.1, is_alien = true }, 
  478. 				{ vehicle = "veh_alien_bike_tunnel 04", npcs = { "npc_alient_bike_tunnel 04" }, paths = { "path_alien_bike_tunnel 04" }, follow_dist = 11.0, delay = 1.0, exp_factor = 0.1, is_alien = true }, 
  479. 				{ vehicle = "veh_alien_bike_tunnel 05", npcs = { "npc_alient_bike_tunnel 05" }, paths = { "path_alien_bike_tunnel 05" }, follow_dist = 12.0, delay = 0.8, exp_factor = 0.1, is_alien = true }, 
  480. 				{ vehicle = "veh_alien_bike_tunnel 06", npcs = { "npc_alient_bike_tunnel 06" }, paths = { "path_alien_bike_tunnel 06" }, follow_dist = 13.0, delay = 0.8, exp_factor = 0.1, is_alien = true }, 
  481. 			}, 
  482. 		}, 
  483. 	} 
  484. 	 
  485. -- Rail Sequence Ambushes -- 
  486. 	Dlc2_m01_rail_ambushes = { 
  487. 		helipad_take1 = { 
  488. 			-- THESE ARE REFERENCED EXTERNALLY BY INDEX.  
  489. 			-- 
  490. 			-- BE CAREFUL CHANGING THE ORDER (ADD NEW ENTRIES TO THE END IF IN DOUBT) 
  491. 			{ 
  492. 				group = Dlc2_m01_groups.gate_gaurd_take_01, 
  493. 				create_trigger = nil, 
  494. 				activate_trigger = "tgr_heli_pad_gate", 
  495. 				behavior = "attack_region", 
  496. 				group_threads = { }, created = false, activated = false, 
  497. 			}, 
  498. 			{ 
  499. 				group = Dlc2_m01_groups.stair_guard_take_01, 
  500. 				create_trigger = nil, 
  501. 				activate_trigger = "tgr_stair_guard", 
  502. 				behavior = "retreat", 
  503. 				group_threads = { }, created = false, activated = false, 
  504. 			}, 
  505. 		}, 
  506. 	 
  507. 		escape_start = { 
  508. 			{ 
  509. 				group = Dlc2_m01_groups.armory_persue_heli, 
  510. 				create_trigger = "tgr_pursue_heli_create", 
  511. 				activate_trigger = "tgr_pursue_heli_activate", 
  512. 				behavior = "heli_path_retreat", 
  513. 				speed = 55.0, 
  514. 				group_threads = { }, create = false, activated = false, 
  515. 			}, 
  516. 		}, 
  517. 	 
  518. 		dt_island = { 
  519. 		 
  520. 		}, 
  521. 		 
  522. 		dt_island_02 = { 
  523. 			{  
  524. 				group = Dlc2_m01_groups.dt_chase_ng_04, 
  525. 				create_trigger = "tgr_ng_dt_create_04", 
  526. 				activate_trigger = "tgr_ng_dt_activate_04", 
  527. 				behavior = "heli_follow", 
  528. 				speed = -1, 
  529. 				group_threads = { }, created = false, activated = false, 
  530. 			}, 
  531. 			{  
  532. 				group = Dlc2_m01_groups.dt_chase_ng_05, 
  533. 				create_trigger = "tgr_ng_dt_create_05", 
  534. 				activate_trigger = "tgr_ng_dt_activate_05", 
  535. 				behavior = "path_navmesh", 
  536. 				speed = 75, 
  537. 				group_threads = { }, created = false, activated = false, 
  538. 			}, 
  539. 			{  
  540. 				group = Dlc2_m01_groups.dt_chase_ng_06, 
  541. 				create_trigger = "tgr_ng_dt_create_06", 
  542. 				activate_trigger = "tgr_ng_dt_activate_06", 
  543. 				behavior = "path_navmesh", 
  544. 				speed = 80, 
  545. 				group_threads = { }, created = false, activated = false, 
  546. 			}, 
  547. 			{  
  548. 				group = Dlc2_m01_groups.dt_chase_ng_07, 
  549. 				create_trigger = "tgr_ng_dt_create_07", 
  550. 				activate_trigger = "tgr_ng_dt_activate_07", 
  551. 				behavior = "chase", 
  552. 				speed = 85, 
  553. 				group_threads = { }, created = false, activated = false, 
  554. 			}, 
  555. 			{  
  556. 				group = Dlc2_m01_groups.dt_chase_ng_08, 
  557. 				create_trigger = "tgr_ng_dt_create_08", 
  558. 				activate_trigger = "tgr_ng_dt_activate_08", 
  559. 				behavior = "path_navmesh", 
  560. 				speed = 95, 
  561. 				group_threads = { }, created = false, activated = false, 
  562. 			}, 
  563. 			{ 
  564. 				group = Dlc2_m01_groups.dt_chase_ng_09, 
  565. 				create_trigger = "tgr_ng_dt_create_09", 
  566. 				activate_trigger = "tgr_ng_dt_activate_09", 
  567. 				behavior = "path_navmesh", 
  568. 				speed = 75, 
  569. 				group_threads = { }, created = false, activated = false, 
  570. 			}, 
  571. 			{ 
  572. 				group = Dlc2_m01_groups.dt_chase_ng_10, 
  573. 				create_trigger = "tgr_ng_dt_create_10", 
  574. 				activate_trigger = "tgr_ng_dt_activate_10", 
  575. 				behavior = "path_navmesh", 
  576. 				speed = 85, 
  577. 				group_threads = { }, created = false, activated = false, 
  578. 			}, 
  579. 		}, 
  580. 		 
  581. 		alien_ambush = { 
  582. 			{  
  583. 				group = Dlc2_m01_groups.ng_roadblock_pursuers, 
  584. 				create_trigger = "tgr_ng_rb_pursuer_create", 
  585. 				activate_trigger = "tgr_ng_rb_pursuer_activate", 
  586. 				behavior = "path_navmesh_exit", 
  587. 				speed = -1, 
  588. 				group_threads = { }, created = false, activated = false, 
  589. 			}, 
  590. 		},		 
  591. 		 
  592. 		nw_island = { 
  593. 			{ 
  594. 				group = Dlc2_m01_groups.alien_nw01_ambush, 
  595. 				create_trigger = "tgr_al_create_01", 
  596. 				activate_trigger = "tgr_al_activate_01", 
  597. 				behavior = "heli_follow", 
  598. 				speed = 100, 
  599. 				hp_multiplier = Dlc2_m01_tweak_values.alien_default_hp_mult, 
  600. 				group_threads = { }, created = false, activated = false, 
  601. 			}, 
  602. 			{ 
  603. 				group = Dlc2_m01_groups.alien_nw02_ambush, 
  604. 				create_trigger = "tgr_al_create_02", 
  605. 				activate_trigger = "tgr_al_activate_02", 
  606. 				behavior = "heli_follow_explode", 
  607. 				speed = 100, 
  608. 				hp_multiplier = Dlc2_m01_tweak_values.alien_default_hp_mult, 
  609. 				group_threads = { }, created = false, activated = false, 
  610. 			}, 
  611. 			{ 
  612. 				group = Dlc2_m01_groups.alien_nw03_ambush, 
  613. 				create_trigger = "tgr_al_create_03", 
  614. 				activate_trigger = "tgr_al_activate_03", 
  615. 				behavior = "heli_follow_explode", 
  616. 				speed = 100, 
  617. 				hp_multiplier = Dlc2_m01_tweak_values.alien_default_hp_mult, 
  618. 				group_threads = { }, created = false, activated = false, 
  619. 			}, 
  620. 			{ 
  621. 				group = Dlc2_m01_groups.alien_nw04_ambush, 
  622. 				create_trigger = "tgr_al_create_04", 
  623. 				activate_trigger = "tgr_al_activate_04", 
  624. 				behavior = "heli_follow", 
  625. 				speed = 100, 
  626. 				hp_multiplier = Dlc2_m01_tweak_values.alien_default_hp_mult, 
  627. 				group_threads = { }, created = false, activated = false, 
  628. 			}, 
  629. 			{ 
  630. 				group = Dlc2_m01_groups.alien_nw05_ambush, 
  631. 				create_trigger = "tgr_al_create_05", 
  632. 				activate_trigger = "tgr_al_activate_05", 
  633. 				behavior = "heli_follow", 
  634. 				speed = 100, 
  635. 				hp_multiplier = Dlc2_m01_tweak_values.alien_default_hp_mult, 
  636. 				group_threads = { }, created = false, activated = false, 
  637. 			}, 
  638. 			{ 
  639. 				group = Dlc2_m01_groups.alien_nw06_ambush, 
  640. 				create_trigger = "tgr_al_create_06", 
  641. 				activate_trigger = "tgr_al_activate_06", 
  642. 				behavior = "heli_follow", 
  643. 				speed = 100, 
  644. 				hp_multiplier = Dlc2_m01_tweak_values.alien_default_hp_mult, 
  645. 				group_threads = { }, created = false, activated = false, 
  646. 			}, 
  647. 			{ 
  648. 				group = Dlc2_m01_groups.alien_nw07_ambush, 
  649. 				create_trigger = "tgr_al_create_07", 
  650. 				activate_trigger = "tgr_al_activate_07", 
  651. 				behavior = "heli_follow", 
  652. 				speed = 100, 
  653. 				hp_multiplier = Dlc2_m01_tweak_values.alien_default_hp_mult, 
  654. 				group_threads = { }, created = false, activated = false, 
  655. 			}, 
  656. 			{ 
  657. 				group = Dlc2_m01_groups.alien_nw08_ambush, 
  658. 				create_trigger = "tgr_al_create_08", 
  659. 				activate_trigger = "tgr_al_activate_08", 
  660. 				behavior = "heli_path", 
  661. 				speed = 100, 
  662. 				hp_multiplier = Dlc2_m01_tweak_values.alien_default_hp_mult, 
  663. 				group_threads = { }, created = false, activated = false, 
  664. 			}, 
  665. 		},	 
  666. 		 
  667. 		take2 = { 
  668. 			{ 
  669. 				group = Dlc2_m01_groups.alien_end_ambush_01, 
  670. 				create_trigger = "tgr_al_end_create_01", 
  671. 				activate_trigger = "tgr_al_end_activate_01", 
  672. 				behavior = "heli_path", 
  673. 				speed = 70, 
  674. 				hp_multiplier = 2, 
  675. 				group_threads = { }, created = false, activated = false, 
  676. 			}, 
  677. 			{ 
  678. 				group = Dlc2_m01_groups.alien_end_ambush_02, 
  679. 				create_trigger = "tgr_al_end_create_02", 
  680. 				activate_trigger = "tgr_al_end_activate_02", 
  681. 				behavior = "heli_path_explode", 
  682. 				speed = 57, 
  683. 				hp_multiplier = Dlc2_m01_tweak_values.alien_default_hp_mult, 
  684. 				group_threads = { }, created = false, activated = false, 
  685. 			},			 
  686. 			{ 
  687. 				group = Dlc2_m01_groups.alien_tunnel_ambush, 
  688. 				create_trigger = "tgr_alien_tunnel_create 01", 
  689. 				activate_trigger = "tgr_alien_tunnel_activate 01", 
  690. 				behavior = "heli_follow_explode", 
  691. 				speed = 75, 
  692. 				group_threads = { }, created = false, activated = false, 
  693. 			}, 
  694. 		}, 
  695. 	}	 
  696. 	 
  697. -- Objectives -- 
  698. 	Dlc2_m01_objectives = { 
  699. 		get_in_car = { tag = "DLC2_M01_OBJ_GO_TO_VEHICLE", icon = OI_ASSET_USE }, 
  700. 		go_to_armory = { tag = "DLC2_M01_OBJ_GO_TO_ARMORY", icon = OI_ASSET_LOCATION }, 
  701. 		rescue_kwilanna = { tag = "DLC2_M01_OBJ_RESCUE_ALIEN", icon = OI_ASSET_USE }, 
  702. 		breach_heliport = { tag = "DLC2_M01_OBJ_BREACH_HELIPORT", icon = OI_ASSET_LOCATION }, 
  703. 		jump_from_heli = { tag = "DLC2_M01_OBJ_JUMP", icon = OI_ASSET_USE }, 
  704. 		land_on_target = { tag = "DLC2_M01_OBJ_LAND_TARGET", icon = OI_ASSET_LOCATION }, 
  705. 		get_in_helicopter = { tag = "DLC2_M01_OBJ_GO_TO_HELICOPTER", icon = OI_ASSET_USE }, 
  706. 		get_in_escape_vehicle = { tag = "DLC2_M01_OBJ_GO_TO_VEHICLE", icon = OI_ASSET_USE }, 
  707. 		escape_nat_guard = { tag = "DLC2_M01_OBJ_ESCAPE_NG", icon = OI_ASSET_LOCATION }, 
  708. 		kill_nat_guard = { tag = "DLC2_M01_OBJ_KILL_NAT_GUARD", icon = OI_ASSET_KILL }, 
  709. 		destroy_pursuers = { tag = "DLC2_M01_OBJ_DESTROY_PURSUERS", icon = OI_ASSET_KILL }, 
  710. 		prepare_for_jump = { tag = "DLC2_M01_OBJ_PREPARE_JUMP", icon = OI_ASSET_LOCATION }, 
  711. 	} 
  712. 	 
  713. -- Characters -- 
  714. 	Dlc2_m01_characters = { 
  715. 		kwilanna = Dlc2_m01_groups.kwilanna.kwilanna, 
  716. 	} 
  717. 	 
  718.  
  719. -- Navpoints -- 
  720. 	Dlc2_m01_navpoints = { 
  721. 		mission_end = { "nav_player_start_chk01_01", "nav_player_start_chk01_02" }, 
  722. 		armory_location = "nav_armory_location", 
  723. 		armory_waypoint = "nav_player_start_armory 02", 
  724. 		kwilanna_rescue_orient = "nav_kwilanna_resuce_orient", 
  725. 		kwilanna_rescue_anim_orient = "nav_kwilanna_rescue_anim_orient", 
  726. 		saints_hq = "nav_saints_hq", 
  727. 		player_vehicle_chk04 = "nav_player_vehicle_chk04", 
  728. 		player_vehicle_chk05 = "nav_player_vehicle_chk05", 
  729. 		player_vehicle_chk06 = "nav_player_vehicle_chk06", 
  730. 		player_vehicle_chk07 = "nav_player_vehicle_chk07", 
  731. 		player_vehicle_chk08 = "nav_player_vehicle_chk08", 
  732. 		alien_ambush_explosions = { "nav_alien_ambush_exp 001", "nav_alien_ambush_exp 002", "nav_alien_ambush_exp 003", "nav_alien_ambush_exp 004", 
  733. 									"nav_alien_ambush_exp 005", "nav_alien_ambush_exp 006", "nav_alien_ambush_exp 007", "nav_alien_ambush_exp 008" }, 
  734. 	} 
  735. 	 
  736. -- Triggers -- 
  737. 	Dlc2_m01_triggers = { 
  738. 		armory_island = "tgr_armory_island_volume", 
  739. 		armory_parking_location = "tgr_armory_parking_spot", 
  740. 		heli_pad_area = "tgr_heli_pad_volume", 
  741. 		tgr_kwilanna_heli_radius = "tgr_kwilanna_heli_radius", 
  742. 		player_landing_area = "tgr_landing_area", 
  743. 		player_landing_bulls_eye = "tgr_landing_bulls_eye", 
  744. 		armory_cont_exp = "tgr_armory_cont_explosion", 
  745. 		rescue_kwilanna = "tgr_rescue_kwilanna", 
  746. 		call_out_helis = "tgr_escape_car_create", 
  747. 		player_heli_shot = "tgr_player_heli_shot", 
  748. 		player_heli_bail = "tgr_heli_bail_out", 
  749. 		player_heli_crash_area = "tgr_heli_crash_area", 
  750. 		convo_assault_drive_01 = "tgr_convo_assult_drive_01", 
  751. 		convo_assault_drive_02 = "tgr_convo_assult_drive_02", 
  752. 		convo_assault_drive_03 = "tgr_convo_assult_drive_03", 
  753. 		convo_tunnel_entrance = "tgr_tunnel_entrace_dialog", 
  754. 		tunnel_explosions = "tgr_alien_tunnel_explosions", 
  755. 	} 
  756. 	 
  757. -- Movers -- 
  758. 	Dlc2_m01_movers = { 
  759. 		armory_fence_to_remove = { 
  760. 			"mvr_armory_fence 001", "mvr_armory_fence 002", "mvr_armory_fence 003", "mvr_armory_fence 004", "mvr_armory_fence 005", 
  761. 			"mvr_armory_fence 006", "mvr_armory_fence 007", "mvr_armory_fence 008", "mvr_armory_fence 009", "mvr_armory_fence 010", 
  762. 			"mvr_armory_fence 011", "mvr_armory_fence 012", "mvr_armory_fence 013", "mvr_armory_fence 014", "mvr_armory_fence 015", 
  763. 			"mvr_armory_fence 016", "mvr_armory_fence 017", "mvr_armory_fence 018", "mvr_armory_fence 019", "mvr_armory_fence 020", 
  764. 			"mvr_armory_fence 021" 
  765. 		}, 
  766. 	} 
  767. 	 
  768. -- Rail Sequence Loops -- 
  769. 	Dlc2_m01_rail_loops = { 
  770. 		dt_island_02 = { 
  771. 			segments = { 
  772. 				{ 
  773. 					navs = { 
  774. 						"nav_player_rail_dt_02 000", 
  775. 						"nav_player_rail_dt_02 001", "nav_player_rail_dt_02 002", "nav_player_rail_dt_02 003", "nav_player_rail_dt_02 004", 
  776. 						"nav_player_rail_dt_02 005", "nav_player_rail_dt_02 006", "nav_player_rail_dt_02 007", "nav_player_rail_dt_02 008", 
  777. 						"nav_player_rail_dt_02 009", "nav_player_rail_dt_02 010" 
  778. 					}, 
  779. 					navmesh = true, 
  780. 					delay = 1.0, 
  781. 				}, 
  782. 				{ 
  783. 					navs = { 
  784. 						"nav_player_rail_dt_02 011", "nav_player_rail_dt_02 012", "nav_player_rail_dt_02 013", 
  785. 						"nav_player_rail_dt_02 014", "nav_player_rail_dt_02 015", "nav_player_rail_dt_02 016", "nav_player_rail_dt_02 017", 
  786. 						"nav_player_rail_dt_02 018", "nav_player_rail_dt_02 019", "nav_player_rail_dt_02 020", "nav_player_rail_dt_02 021", 
  787. 						"nav_player_rail_dt_02 022", "nav_player_rail_dt_02 023", "nav_player_rail_dt_02 024", "nav_player_rail_dt_02 025", 
  788. 						"nav_player_rail_dt_02 026", 
  789. 					}, 
  790. 					navmesh = true, 
  791. 				},				 
  792. 			},		 
  793. 		}, 
  794. 		alien_ambush = { 
  795. 			segments = { 
  796. 				{ 
  797. 					navs = { 
  798. 						"nav_player_rail_nw_01 000", 
  799. 						"nav_player_rail_nw_01 001", "nav_player_rail_nw_01 002", "nav_player_rail_nw_01 003", "nav_player_rail_nw_01 004", 
  800. 						"nav_player_rail_nw_01 005", 
  801. 					}, 
  802. 					navmesh = true, 
  803. 				}, 
  804. 			}, 
  805. 		}, 
  806. 		nw_island = { 
  807. 			segments = { 
  808.  
  809. 				{ 
  810. 					navs = { 
  811. 						"nav_player_rail_nw_01 006", "nav_player_rail_nw_01 007", 
  812. 						"nav_player_rail_nw_01 008", "nav_player_rail_nw_01 008", "nav_player_rail_nw_01 009", "nav_player_rail_nw_01 010", 
  813. 						"nav_player_rail_nw_01 011", "nav_player_rail_nw_01 012", "nav_player_rail_nw_01 013", "nav_player_rail_nw_01 014", 
  814. 						"nav_player_rail_nw_01 015", "nav_player_rail_nw_01 016", "nav_player_rail_nw_01 017", "nav_player_rail_nw_01 018", 
  815. 						"nav_player_rail_nw_01 019", "nav_player_rail_nw_01 020", "nav_player_rail_nw_01 021", "nav_player_rail_nw_01 022", 
  816. 						"nav_player_rail_nw_01 023", "nav_player_rail_nw_01 024", "nav_player_rail_nw_01 025", "nav_player_rail_nw_01 026", 
  817. 						"nav_player_rail_nw_01 027", "nav_player_rail_nw_01 028",  
  818. 					}, 
  819. 					navmesh = true, 
  820. 					delay = 1.5, 
  821. 				},						 
  822. 				{ 
  823. 					navs = { 
  824. 						"nav_player_rail_nw_01 029", "nav_player_rail_nw_01 030", 
  825. 					}, 
  826. 					navmesh = true, 
  827. 					delay = 1.5, 
  828. 				},			 
  829. 				{ 
  830. 					navs = { 
  831. 						"nav_player_rail_nw_01 031", "nav_player_rail_nw_01 032", "nav_player_rail_nw_01 033", "nav_player_rail_nw_01 034", 
  832. 						"nav_player_rail_nw_01 035", "nav_player_rail_nw_01 036", "nav_player_rail_nw_01 037", "nav_player_rail_nw_01 038", 
  833. 						"nav_player_rail_nw_01 039", "nav_player_rail_nw_01 040", "nav_player_rail_nw_01 041", 
  834. 						"nav_player_rail_nw_01 042", "nav_player_rail_nw_01 042",					 
  835. 						"nav_player_rail_nw_01 043", "nav_player_rail_nw_01 044", "nav_player_rail_nw_01 045", "nav_player_rail_nw_01 046", 
  836. 						"nav_player_rail_nw_01 047", "nav_player_rail_nw_01 047", "nav_player_rail_nw_01 049", "nav_player_rail_nw_01 050", 
  837. 						"nav_player_rail_nw_01 051", "nav_player_rail_nw_01 052", "nav_player_rail_nw_01 053", "nav_player_rail_nw_01 054", 
  838. 						"nav_player_rail_nw_01 055", "nav_player_rail_nw_01 056", "nav_player_rail_nw_01 057", "nav_player_rail_nw_01 058", 
  839. 						"nav_player_rail_nw_01 059", "nav_player_rail_nw_01 060", "nav_player_rail_nw_01 061", "nav_player_rail_nw_01 062", 
  840. 						"nav_player_rail_nw_01 063", "nav_player_rail_nw_01 064", "nav_player_rail_nw_01 065", "nav_player_rail_nw_01 066", 
  841. 						"nav_player_rail_nw_01 067", "nav_player_rail_nw_01 068", "nav_player_rail_nw_01 069", "nav_player_rail_nw_01 070", 
  842. 						"nav_player_rail_nw_01 071",  
  843. 					}, 
  844. 					navmesh = true, 
  845. 				},				 
  846. 			}, 
  847. 		}, 
  848. 		jump = { 
  849. 			segments = { 
  850. 				{ 
  851. 					navs = { 
  852. 						"nav_player_rail_nw_01 072", "nav_player_rail_nw_01 073", "nav_player_rail_nw_01 074", 
  853. 					}, 
  854. 					navmesh = true, 
  855. 				}, 
  856. 			}, 
  857. 		}, 
  858. 		rail_end = { 
  859. 			segments = { 
  860. 				{ 
  861. 					navs = { 
  862. 						"nav_player_rail_nw_01 072", "nav_player_rail_nw_01 073", 
  863. 					}, 
  864. 					navmesh = true, 
  865. 				}, 
  866. 				{ 
  867. 					navs = { 
  868. 						"nav_player_rail_end 001", "nav_player_rail_end 002", "nav_player_rail_end 003", "nav_player_rail_end 004", 
  869. 						"nav_player_rail_end 005", "nav_player_rail_end 006", 
  870. 					}, 
  871. 					navmesh = true, 
  872. 					delay = 1.0, 
  873. 				}, 
  874. 			}, 
  875. 		}, 
  876. 		finale = { 
  877. 			segments = { 
  878. 				{ 
  879. 					navs = { 
  880. 						"nav_player_rail_end 007", "nav_player_rail_end 008", 
  881. 						"nav_player_rail_end 009", "nav_player_rail_end 010", "nav_player_rail_end 011", "nav_player_rail_end 012", 
  882. 						"nav_player_rail_end 013", "nav_player_rail_end 014", 
  883. 						"nav_player_rail_end 015", "nav_player_rail_end 016", "nav_player_rail_end 017", "nav_player_rail_end 018", 
  884. 						"nav_player_rail_end 019", "nav_player_rail_end 020", "nav_player_rail_end 021", 
  885. 					}, 
  886. 					navmesh = true, 
  887. 				}, 
  888. 			},			 
  889. 		}, 
  890. 	} 
  891. 	 
  892. 	Dlc2_m01_vfx = { 
  893. 		car_husks = { 
  894. 			{ name = "vfx_car_husk 01", handle = -1 }, 
  895. 			{ name = "vfx_car_husk 02", handle = -1 }, 
  896. 			{ name = "vfx_car_husk 03", handle = -1 }, 
  897. 		}, 
  898. 		player_landing_flares = { 
  899. 			{ name = "vfx_landing_flare 01", handle = -1 }, 
  900. 			{ name = "vfx_landing_flare 02", handle = -1 }, 
  901. 			{ name = "vfx_landing_flare 03", handle = -1 }, 
  902. 			{ name = "vfx_landing_flare 04", handle = -1 }, 
  903. 			{ name = "vfx_landing_flare 05", handle = -1 }, 
  904. 			{ name = "vfx_landing_flare 06", handle = -1 }, 
  905. 			{ name = "vfx_landing_flare 07", handle = -1 }, 
  906. 			{ name = "vfx_landing_flare 08", handle = -1 }, 
  907. 			{ name = "vfx_landing_flare 09", handle = -1 }, 
  908. 		}, 
  909. 		player_heli_fire = { name = "vfx_player_heli_fire", handle = -1 }, 
  910. 		bridge_smoke = { 
  911. 			{ name = "vfx_bridge_smoke 01", handle = -1 }, 
  912. 			{ name = "vfx_bridge_smoke 02", handle = -1 }, 
  913. 		}, 
  914. 		tunnel_smoke = {  
  915. 			{ name = "vfx_tunnel_smoke 01", handle = -1 }, 
  916. 			{ name = "vfx_tunnel_smoke 02", handle = -1 }, 
  917. 		}, 
  918. 		tunnel_explosions = { 
  919. 			{ name = "vfx_tunnel_exp 01", handle = -1 }, 
  920. 			{ name = "vfx_tunnel_exp 02", handle = -1 }, 
  921. 			{ name = "vfx_tunnel_exp 03", handle = -1 }, 
  922. 			{ name = "vfx_tunnel_exp 04", handle = -1 }, 
  923. 		}, 
  924. 	} 
  925. 	 
  926. 	Dlc2_m01_personas = { 
  927. 		--kwilanna = { name = "PAK2_Kwilanna", persona_id = INVALID_PERSONA_HANDLE, }, 
  928. 		director = { name = "PAK2_Director", persona_id = INVALID_PERSONA_HANDLE, }, 
  929. 	} 
  930. 	 
  931. 	Dlc2_m01_conversations = { 
  932. 		mission_start = { name = "DLC2_M01_Mission_Start", load_direct = false, }, 
  933. 		untie_kwilanna_take1 = { name = "DLC2_M01_Take_1_Untie_Alien", load_direct = false, }, 
  934. 		armory_take1_wrap = { name = "DLC2_M01_Take_1_After_Cut", load_direct = false, }, 
  935. 		untie_kwilanna_take2 = { name = "DLC2_M01_Take_2_Untie_Alien", load_direct = false, }, 
  936. 		player_heli_escape_start = { name = "DLC2_M01_Take_2_Flying", load_direct = false, }, 
  937. 		player_heli_crash = { name = "DLC2_M01_Heli_Crash", load_direct = false, }, 
  938. 		player_heli_downed = { name = "DLC2_M01_Heli_Down", load_direct = false, }, 
  939. 		director_cut_good = { name = "DLC2_M01_Take_2_Cut", load_direct = false, }, 
  940. 		take_car = { name = "DLC2_M01_Get_in_Car", load_direct = false, }, 
  941. 		humvee_driving_01 = { name = "DLC2_M01_Assault_Drive1", load_direct = false, }, 
  942. 		humvee_driving_02 = { name = "DLC2_M01_Assault_Drive2", load_direct = false, }, 
  943. 		humvee_driving_03 = { name = "DLC2_M01_Assault_Drive3", load_direct = false, },		 
  944. 		--alien_roadblock_assault = {te name = "DLC2_M01_Alien_Assault", load_direct = false, }, 
  945. 		jump_setup = { name = "DLC2_M01_Setting_Up_Jump", load_direct = false, }, 
  946. 		jump_attempt = { name  = "DLC2_M01_First_Jump_Attempt", load_direct = false, }, 
  947. 		jump_fail = { name = "DLC2_M01_First_Jump_Fail", load_direct = false, },	 
  948. 		jump_take2_start = { name = "DLC2_M01_Second_Jump_Begin", load_direct = false, }, 
  949. 		jump_take2_skip = { name = "DLC2_M01_Second_Jump_Miss", load_direct = false, }, 
  950. 		drive_to_tunnel = { name = "DLC2_M01_Drive_to_Tunnel_1", load_direct = false, }, 
  951. 		stop_in_tunnel = { name = "DLC2_M01_Stop_In_Tunnel", load_direct = false, }, 
  952. 		tunnel_jet_bikes = { name = "DLC2_M01_Ships_In_Tunnel", load_direct = false, }, 
  953. 	} 
  954. 	 
  955. 	Dlc2_m01_dialog_lines = { 
  956. 		start_action = { name = "pak2_m01_take_1_start_action", persona = Dlc2_m01_personas.director.name, }, 
  957. 		armory_drive_start = { name = "pak2_m01_take_1_drive_begin", persona = LOCAL_PLAYER, }, 
  958. 		armory_drive_end = { name = "pak2_m01_take_1_drive_ending", persona = LOCAL_PLAYER, }, 
  959. 		armory_arrive = { name = "pak2_m01_take_1_heliport_setup", persona = Dlc2_m01_personas.director.name, }, 
  960. 		armory_take1_cut = { name = "pak2_m01_take_1_cut_01", persona = Dlc2_m01_personas.director.name, }, 
  961. 		armory_take2_action = { name = "pak2_m01_take_2_start_action", persona = Dlc2_m01_personas.director.name, }, 
  962. 		player_parachute = { name = "pak2_m01_take_2_parachute", persona = LOCAL_PLAYER, }, 
  963. 		director_parachute_obj = { name = "pak2_m01_hit_landing_target", persona = Dlc2_m01_personas.director.name, }, 
  964. 		director_parachute_fail = { name = "pak2_m01_miss_landing", persona = Dlc2_m01_personas.director.name, }, 
  965. 		player_exp_callout_01 = { name = "pak2_m01_take_1_explosions_01", persona = LOCAL_PLAYER, }, 
  966. 		player_exp_callout_02 = { name = "pak2_m01_take_1_explosions_02", persona = LOCAL_PLAYER, }, 
  967. 		player_exp_callout_03 = { name = "pak2_m01_take_1_explosions_03", persona = LOCAL_PLAYER, }, 
  968. 		untie_kwilanna_take2_01 = { name = "pak2_m01_take_2_untie_alien_01", persona = LOCAL_PLAYER, }, 
  969. 		untie_kwilanna_take2_02 = { name = "pak2_m01_take_2_untie_alien_02", persona = Dlc2_m01_characters.kwilanna, }, 
  970. 		untie_kwilanna_take2_03 = { name = "pak2_m01_take_2_untie_alien_03", persona = LOCAL_PLAYER, }, 
  971. 		player_heli_shot = { name = "pak2_m01_heli_crashed_into_01", persona = Dlc2_m01_characters.kwilanna }, 
  972. 		heli_call_out = { name = "pak2_m01_assault_drive3_02", persona = LOCAL_PLAYER, }, 
  973. 		car_chase_explosions = { name = "pak2_m01_car_chase_explosions", persona = LOCAL_PLAYER, }, 
  974. 		bridge_roadblock = { name = "pak2_m01_bridge_blockade_01", persona = Dlc2_m01_characters.kwilanna, }, 
  975. 		aliens_attack = { name = "pak2_m01_alien_assault_01", persona = Dlc2_m01_characters.kwilanna, }, 
  976. 		reach_tunnel = { name = "pak2_m01_reaching_tunnel_01", persona = LOCAL_PLAYER, }, 
  977. 		tunnel_ufo_crash_01 = { name = "pak2_m01_stop_in_tunnel_01", persona = LOCAL_PLAYER, }, 
  978. 		tunnel_ufo_crash_02 = { name = "pak2_m01_ships_crash_inside_01", persona = Dlc2_m01_characters.kwilanna, }, 
  979. 		jet_bikes = { name = "pak2_m01_ships_in_tunnel_01", persona = Dlc2_m01_characters.kwilanna, }, 
  980. 		mission_end = { name = "pak2_m01_end_01", persona = LOCAL_PLAYER, }, 
  981. 		mission_end_02 = { name = "pak2_m01_end_01", persona = Dlc2_m01_personas.director.name, }, 
  982. 		 
  983. 		director_generic_positive = { name = "pak2_generic_positives", persona = Dlc2_m01_personas.director.name, }, 
  984. 		director_generic_action = { name = "pak2_generic_actions", persona = Dlc2_m01_personas.director.name, }, 
  985. 		director_generic_camera = { name = "pak2_camera_comments", persona = Dlc2_m01_personas.director.name, }, 
  986. 		director_generic_cut = { name = "pak2_generic_cuts", persona = Dlc2_m01_personas.director.name, }, 
  987. 		director_generic_berating = { name = "pak2_generic_berating", persona = Dlc2_m01_personas.director.name, }, 
  988. 	} 
  989. 	 
  990. 	Dlc2_m01_dialog_queue = { 
  991. 		playing  = { 
  992. 			thread_id = INVALID_THREAD_HANDLE, 
  993. 			dialog_handle = INVALID_CONVERSATION_HANDLE, 
  994. 			dialog_table = nil, 
  995. 		}, 
  996. 		list = {}, 
  997. 		size = 0, 
  998. 	}	 
  999. 		 
  1000. -- Cutscenes -- 
  1001. 	Dlc2_m01_cutscenes = { 
  1002. 		intro = "dlc2_gis_intro", 
  1003. 		outro = "",  
  1004. 	} 
  1005. 	 
  1006. -- Threads -- 
  1007. 	Dlc2_m01_threads = { 
  1008. 		process_dialog = INVALID_THREAD_HANDLE, 
  1009. 		film_grain_load = INVALID_THREAD_HANDLE, 
  1010. 		kwilanna_pos_process = INVALID_THREAD_HANDLE, 
  1011. 		armory_explosion_dialog = INVALID_THREAD_HANDLE, 
  1012. 		armory_heli_drop_off = INVALID_THREAD_HANDLE, 
  1013. 		kwilanna_vehicle_enter = INVALID_THREAD_HANDLE, 
  1014. 		heli_crash_area = INVALID_THREAD_HANDLE, 
  1015. 		rail_loop_process = INVALID_THREAD_HANDLE, 
  1016. 		parked_car_explosions = INVALID_THREAD_HANDLE, 
  1017. 		alien_ambush_explosions = INVALID_THREAD_HANDLE, 
  1018. 		player_heli_crash = INVALID_THREAD_HANDLE, 
  1019. 	} 
  1020. 	 
  1021. -- Achievement data 
  1022. 	Dlc2_m01_acheivements = { 
  1023. 		cameramen = { 
  1024. 			name = "Cameramen Down", 
  1025. 			slot_idx = 0, 
  1026. 			current_count = 0, 
  1027. 			target_goal = 15, 
  1028. 		}, 
  1029. 		alien_ships = { 
  1030. 			name = "Blowing the Budget", 
  1031. 			slot_idx = 1, 
  1032. 			current_count = 0, 
  1033. 			target_goal = 20, 
  1034. 		}, 
  1035. 	} 
  1036. 	 
  1037. -- Runtime data -- 
  1038. 	Dlc2_m01_runtime = { 
  1039. 		stag_lockdown_active = false, 
  1040. 	 
  1041. 		current_checkpoint = nil, 
  1042. 		kwilanna_rescued_by = nil, 
  1043. 		armory_cont_exp_triggered_by = nil, 
  1044. 		reached_armory_parking_area_by = nil, 
  1045. 		 
  1046. 		num_players_in_heli_pad = 0, 
  1047. 		 
  1048. 		local_player_had_backpack = false, 
  1049. 		remote_player_had_backpack = false, 
  1050.  
  1051. 		kwilanna_invulnerable = false, 
  1052. 		kwilanna_damaged_by_player = false, 
  1053. 		entered_coutesy_vehicle = false, 
  1054. 		reached_armory_island = false, 
  1055. 		 
  1056. 		entered_heli_pad = false, 
  1057. 		player_jumped_from_heli = false, 
  1058. 		take_2_music_trigger = false, 
  1059. 		player_entered_landing_area = false, 
  1060. 		local_player_entered_landing_area = false, 
  1061. 		remote_player_entered_landing_area = false, 
  1062. 		kwilanna_heli_radius_triggered = false, 
  1063. 		gate_guards_triggered = false, 
  1064. 		rescued_kwilanna = false, 
  1065. 		called_out_helis = false, 
  1066. 		heli_shot_down = false, 
  1067. 		player_outside_crash_area = false, 
  1068. 		played_to_bridge_music = false, 
  1069. 		assult_drive_convo_01_triggered = false, 
  1070. 		assult_drive_convo_02_triggered = false, 
  1071. 		assult_drive_convo_03_triggered = false, 
  1072. 		alien_ambush_triggered = false, 
  1073. 		tunnel_explosions_triggered = false, 
  1074. 		tunnel_explosions_triggered = false, 
  1075. 		played_cameraman_line = false, 
  1076. 		 
  1077. 		num_tower_guards_alive = 0, 
  1078. 	} 
  1079. 	 
  1080. -- List of players (can be used to iterate over for common setup in co-op games) -- 
  1081. 	Dlc2_m01_player_list = { LOCAL_PLAYER }	-- REMOTE_PLAYER will be added on initialization if co-op is active 
  1082. 	 
  1083. 	Dlc2_m01_chase_vehicle_cleanup_dist = 200 
  1084. 	 
  1085. 	-- Conversation enums 
  1086. 	DLC2_M01_CONVO_PLAY_LAST = 0 
  1087. 	DLC2_M01_CONVO_PLAY_NEXT = 1 
  1088. 	DLC2_M01_CONVO_PLAY_IMMEDIATE = 2 
  1089. 	 
  1090.  
  1091. -- ************************* 
  1092. -- 
  1093. -- Standard Functions 
  1094. -- 
  1095. -- ************************* 
  1096.  
  1097. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  1098. -- at the specified checkpoint. 
  1099. -- CALLED FROM CODE 
  1100. -- 
  1101. -- checkpoint_name:		The checkpoint the mission should begin at 
  1102. -- is_restart:			TRUE if the mission is restarting, FALSE otherwise 
  1103. function dlc2_m01_start(checkpoint_name, is_restart) 
  1104. 	Dlc2_m01_runtime.local_player_had_backpack = player_parachute_has_backpack(LOCAL_PLAYER) 
  1105. 	if (coop_is_active() == true) then 
  1106. 		Dlc2_m01_runtime.remote_player_had_backpack = player_parachute_has_backpack(REMOTE_PLAYER) 
  1107. 	end 
  1108.  
  1109. 	-- Put players in the custom outfit 
  1110. 	customization_outfit_wear("GiS Mission One") 
  1111. 	 
  1112. 	-- Dismiss all homies 
  1113. 	party_dismiss_all() 
  1114.  
  1115. 	-- Check if this mission starting from the beginning 
  1116. 	if (checkpoint_name == Dlc2_m01_checkpoints.start.name) then 
  1117. 		-- Clear all of the acievement counters 
  1118. 		for i, achievement in pairs(Dlc2_m01_acheivements) do 
  1119. 			dlc2_m01_helper_achievement_reset(achievement) 
  1120. 		end 
  1121. 	 
  1122. 		if (is_restart == false) then 
  1123. 			-- First time playing mission 
  1124. 			 
  1125. 			-- Play an intro cutscene??? 
  1126. 			if (Dlc2_m01_cutscenes.intro ~= "") then 
  1127. 				cutscene_play(Dlc2_m01_cutscenes.intro, nil, Dlc2_m01_checkpoints.start.player_navs, false) 
  1128. 			end 
  1129. 		end 
  1130. 	end 
  1131. 	 
  1132. 	-- Initialize the mission for the current checkpoint 
  1133. 	dlc2_m01_initialize(checkpoint_name, is_restart) 
  1134. 	 
  1135. 	-- Run the mission from the current checkpoint 
  1136. 	dlc2_m01_run(checkpoint_name) 
  1137. end 
  1138.  
  1139. -- This is the primary function responsible for cleaning up the entire mission 
  1140. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  1141. function dlc2_m01_cleanup() 
  1142. 	-- Call of the individual objective clean-up functions 
  1143. 	dlc2_m01_get_in_courtesy_vehicle_take1_cleanup(true) 
  1144. 	dlc2_m01_go_to_armory_take1_cleanup(true) 
  1145. 	dlc2_m01_go_to_helipad_take1_cleanup(true) 
  1146. 	dlc2_m01_rescue_kwilanna_take1_cleanup(true) 
  1147. 	dlc2_m01_armory_take1_wrap_cleanup(true) 
  1148. 	dlc2_m01_go_to_armory_take2_cleanup(true) 
  1149. 	dlc2_m01_rescue_kwilanna_take2_cleanup(true) 
  1150. 	dlc2_m01_get_in_escape_vehicle_cleanup(true) 
  1151. 	dlc2_m01_escape_start_cleanup(true) 
  1152. 	dlc2_m01_cleanup_armory_take2_wrap(true) 
  1153. 	dlc2_m01_cleanup_steal_humvee(true) 
  1154. 	dlc_m01_rail_sequence_dt_loop_02_cleanup(true) 
  1155. 	dlc2_m01_alien_ambush_cleanup(true) 
  1156. 	dlc_m01_rail_sequence_nw_loop_cleanup(true) 
  1157. 	dlc2_m01_jump_take1_cleanup(true) 
  1158. 	dlc2_m01_jump_take2_cleanup(true) 
  1159. 	dlc2_m01_alien_finale_cleanup(true) 
  1160. 	 
  1161. 	if (Dlc2_m01_runtime.stag_lockdown_active == true) then 
  1162. 		city_zone_swap("lockdown", true) 
  1163. 	end	 
  1164. 	 
  1165. 	-- Remove any callbacks we may have registered 
  1166. 	on_death("", Dlc2_m01_characters.kwilanna) 
  1167. 	on_dismiss("", Dlc2_m01_characters.kwilanna) 
  1168. 	on_revived("", Dlc2_m01_characters.kwilanna) 
  1169. 	on_incapacitated("", Dlc2_m01_characters.kwilanna) 
  1170. 	on_vehicle_destroyed("", Dlc2_m01_groups.armory_get_away_car.vehicle) 
  1171. 	dlc2_m01_helper_cleanup_camera_man(Dlc2_m01_groups.armory_camera_persue_heli.heli.npcs[2])	 
  1172. 	 
  1173. 	for i, vehicle_table in pairs(Dlc2_m01_groups.alien_bridge_ambush.vehicles) do 
  1174. 		on_vehicle_destroyed("", vehicle_table.vehicle) 
  1175. 	end 
  1176. 	 
  1177. 	-- Clean-up all the script groups 
  1178. 	for i, group in pairs(Dlc2_m01_groups) do 
  1179. 		if (group_is_loaded(group.name) == true) then 
  1180. 			group_destroy(group.name) 
  1181. 		end 
  1182. 	end 
  1183. 	 
  1184. 	-- Clean-up any threads that might still be processing 
  1185. 	for i, thread in pairs(Dlc2_m01_threads) do 
  1186. 		if (thread_check_done(thread) == false) then 
  1187. 			thread_kill(thread) 
  1188. 			thread = INVALID_THREAD_HANDLE 
  1189. 		end 
  1190. 	end 
  1191. 	 
  1192. 	-- Clean-up the players 
  1193. 	for i, player in pairs(Dlc2_m01_player_list) do 
  1194. 		set_player_can_enter_exit_vehicles(player, true) 
  1195. 		hud_prompt_clear(player) 
  1196. 		character_set_attack_multiplier(player, 1.0) 
  1197. 		turn_vulnerable(player) 
  1198. 		human_gravity_enable(player, true) 
  1199. 	end 
  1200. 	 
  1201. 	if (Dlc2_m01_runtime.local_player_had_backpack == false) then 
  1202. 		player_parachute_wear_backpack(LOCAL_PLAYER, false) 
  1203. 	end 
  1204. 	if (coop_is_active() == true and Dlc2_m01_runtime.remote_player_had_backpack == false) then 
  1205. 		player_parachute_wear_backpack(REMOTE_PLAYER, false) 
  1206. 	end 
  1207. 	 
  1208. 	-- Remove the Player(s) costumes 
  1209. 	customization_item_revert()	 
  1210. 	 
  1211. 	-- Clean-up any looping VFX 
  1212. 	for i, vfx in pairs(Dlc2_m01_vfx) do 
  1213. 		if (vfx.name == nil) then 
  1214. 			for j, vfx_sub in pairs(vfx) do 
  1215. 				if (vfx_sub.handle ~= -1) then 
  1216. 					effect_stop(vfx_sub.handle) 
  1217. 				end 
  1218. 			end 
  1219. 		else 
  1220. 			if (vfx.handle ~= -1) then 
  1221. 				effect_stop(vfx.handle) 
  1222. 			end 
  1223. 		end 
  1224. 	end 
  1225.  
  1226. 	-- Kill the conversation thread 
  1227. 	dlc2_m01_helper_dialog_kill_all() 
  1228. 	if (thread_check_done(Dlc2_m01_threads.process_dialog) == false) then 
  1229. 		thread_kill(Dlc2_m01_threads.process_dialog) 
  1230. 		Dlc2_m01_threads.process_dialog = INVALID_THREAD_HANDLE 
  1231. 	end 
  1232. 	 
  1233. 	-- Unload any personas 
  1234. 	for i, persona in pairs(Dlc2_m01_personas) do 
  1235. 		if (persona.persona_id ~= INVALID_PERSONA_HANDLE) then 
  1236. 			audio_persona_remove_2d(persona.persona_id) 
  1237. 			persona.persona_id = INVALID_PERSONA_HANDLE 
  1238. 		end 
  1239. 	end 
  1240. 	 
  1241. 	-- Remove Kwilanna from the player's party 
  1242. 	party_dismiss(Dlc2_m01_characters.kwilanna) 
  1243. 	 
  1244. 	-- Remove the film grain UI 
  1245. 	dlc_gis_film_grain_unload(false) 
  1246.  
  1247. 	-- Re-enable notoriety aircraft spawning 
  1248. 	notoriety_force_no_air_spawn(false)		 
  1249. 	 
  1250. 	-- Reset notoriety 
  1251. 	notoriety_reset("Police") 
  1252. 	notoriety_reset("Luchadores") 
  1253. 	notoriety_reset("Deckers") 
  1254. 	notoriety_reset("Morningstar") 
  1255. 	notoriety_force_no_spawn("STAG", false)	 
  1256. 	notoriety_force_no_spawn_group("police_tank", false) 
  1257. 	 
  1258. 	-- Re-enable notoriety decay 
  1259. 	notoriety_set_can_decay(true) 
  1260. 	 
  1261. 	-- Re-eanbled restricted areas 
  1262. 	notoriety_restricted_zones_enable(true)	 
  1263. 	 
  1264. 	team_make_unfriendly("Police", "Playas") 
  1265. 	team_make_unfriendly("Playas", "Deckers") 
  1266. 	team_make_unfriendly("Police", "Deckers") 
  1267. 	 
  1268. 	-- Remove the fake notoriety HUD 
  1269. 	hud_set_fake_notoriety("Police", false) 
  1270. 	 
  1271. 	-- Re-enable parking spawns 
  1272. 	parking_spot_disable_all(false) 
  1273. 	 
  1274. 	-- Re-enable roadblocks 
  1275. 	roadblocks_enable(true) 
  1276. 	 
  1277. 	-- Re-eanbel flashpoints 
  1278. 	flashpoints_enable(true) 
  1279. 	 
  1280. 	-- Re-enable ambient gang spawns 
  1281. 	ambient_gang_spawn_enable(true) 
  1282. 	ambient_cop_spawn_enable(true) 
  1283. 	 
  1284. 	-- Re-enable peds and vehicles 
  1285. 	spawning_pedestrians(true) 
  1286. 	spawning_vehicles(true)		 
  1287. 	 
  1288. 	-- Make sure to clean-up the HUD critical timer 
  1289. 	hud_critical_timer_stop() 
  1290. 	 
  1291. 	-- Re-enable car radios 
  1292. 	radio_global_block(false)	 
  1293. 	 
  1294. 	continuous_explosion_stop() 
  1295. 	 
  1296. 	character_ragdoll_clear_last_resort_position() 
  1297. 	persona_clear_global_situation_override() 
  1298. end 
  1299.  
  1300.  
  1301. -- ************************* 
  1302. -- 
  1303. -- Local Functions 
  1304. -- 
  1305. -- ************************* 
  1306.  
  1307. -- *************************************************** 
  1308. -- Initilization Functions 
  1309. -- *************************************************** 
  1310.  
  1311. -- Initialize the mission for the specified checkpoint 
  1312. -- 
  1313. -- checkpoint_name:	Checkpoint to initialize the mission to 
  1314. -- is_restart:		Whether or not the mission is being restarted. 
  1315. function dlc2_m01_initialize(checkpoint_name, is_restart) 
  1316. 	-- Make sure the screen is completly faded out 
  1317. 	mission_start_fade_out(0.0) 
  1318. 	 
  1319. 	-- Set the mission author 
  1320. 	set_mission_author("matt.gawalek") 
  1321. 	 
  1322. 	-- Common initialization 
  1323. 	dlc2_m01_initialize_common() 
  1324. 	 
  1325. 	-- Checkpoint sepcific initialization 
  1326. 	dlc2_m01_initialize_checkpoint(checkpoint_name, is_restart) 
  1327. 	 
  1328. 	-- Start fading in 
  1329. 	mission_start_fade_in() 
  1330. end 
  1331.  
  1332. -- Handle any common initialization necessary for all checkpoints 
  1333. function dlc2_m01_initialize_common() 
  1334. 	if (coop_is_active() == true) then 
  1335. 		Dlc2_m01_player_list[2] = REMOTE_PLAYER 
  1336. 	end 
  1337. 	 
  1338. 	if (city_zone_swap_is_active("lockdown") == true) then 
  1339. 		Dlc2_m01_runtime.stag_lockdown_active = true 
  1340. 		city_zone_swap("lockdown", false) 
  1341. 	end 
  1342. 	 
  1343. 	-- Initialize the dialog lines 
  1344. 	for i, convo in pairs(Dlc2_m01_conversations) do 
  1345. 		convo.is_convo = true 
  1346. 		convo.queued = false 
  1347. 		convo.started = false 
  1348. 		convo.completed = false 
  1349. 		convo.ended = false 
  1350. 	end 
  1351. 	for i, line in pairs(Dlc2_m01_dialog_lines) do 
  1352. 		line.is_convo = false 
  1353. 		line.queued = false 
  1354. 		line.started = false 
  1355. 		line.completed = false 
  1356. 		line.ended = false 
  1357. 	end 
  1358. 	 
  1359. 	-- Load any personas 
  1360. 	for i, persona in pairs(Dlc2_m01_personas) do 
  1361. 		if (persona.persona_id == INVALID_PERSONA_HANDLE) then 
  1362. 			persona.persona_id = audio_persona_load_2d(persona.name) 
  1363. 		end 
  1364. 	end 
  1365. 	 
  1366. 	-- Start the conversation thread 
  1367. 	Dlc2_m01_threads.process_dialog = thread_new("dlc2_m01_thread_process_dialog")	 
  1368. 	 
  1369. 	-- Disable gang notoriety 
  1370. 	notoriety_set_min_and_max("Luchadores", 0, 0) 
  1371. 	notoriety_set_min_and_max("Deckers", 0, 0) 
  1372. 	notoriety_set_min_and_max("morningstar", 0, 0) 
  1373. 	 
  1374. 	-- Disable notoriety decay and notoriety aircraft spawning 
  1375. 	notoriety_set_can_decay(false) 
  1376. 	notoriety_force_no_air_spawn(true) 
  1377. 	 
  1378. 	-- Disable STAG notoriety 
  1379. 	notoriety_force_no_spawn("STAG", true)	 
  1380. 	 
  1381. 	-- Disable tank notoriety spawns 
  1382. 	notoriety_force_no_spawn_group("police_tank", true) 
  1383. 	 
  1384. 	-- Disable restricted areas 
  1385. 	notoriety_restricted_zones_enable(false) 
  1386. 	 
  1387. 	-- Make the Deckers Gang and Playa teams allies (camera men are set to Deckers) 
  1388. 	team_make_allies("Playas", "Deckers") 
  1389. 	team_make_allies("Police", "Deckers") 
  1390. 	 
  1391. 	-- Disable car radios 
  1392. 	radio_global_block(true) 
  1393. 	 
  1394. 	-- Disable roadblocks 
  1395. 	roadblocks_enable(false) 
  1396. 	 
  1397. 	-- Disable ambient gang spawns 
  1398. 	ambient_gang_spawn_enable(false) 
  1399. 	 
  1400. 	-- Disable peds and vehicles 
  1401. 	spawning_pedestrians(false) 
  1402. 	spawning_vehicles(false)	 
  1403. 	 
  1404. 	-- Re-eanbel flashpoints 
  1405. 	flashpoints_enable(false)	 
  1406. 	 
  1407. 	-- Setup Kwilanna 
  1408. 	group_create(Dlc2_m01_groups.kwilanna.name, true) 
  1409. 	npc_combat_enable(Dlc2_m01_characters.kwilanna, false) -- disable combat for Kwilanna 
  1410. 	set_suppress_synced_attacks_flag(Dlc2_m01_characters.kwilanna, true) -- Kwillanna cannot be synced attacked 
  1411. 	on_death("dlc2_m01_kwilanna_died_cb", Dlc2_m01_characters.kwilanna) 
  1412. 	on_revived("dlc2_m01_kwilanna_revived_cb", Dlc2_m01_characters.kwilanna) 
  1413. 	on_incapacitated("dlc2_m01_kwilanna_downed_cb", Dlc2_m01_characters.kwilanna) 
  1414. 	persona_set_global_situation_override(9) 
  1415. 	 
  1416. 	-- Read the achievement data from the checkpoint 
  1417. 	for i, achievement in pairs(Dlc2_m01_acheivements) do 
  1418. 		dlc2_m01_helper_achievement_read_checkpoint(achievement) 
  1419. 	end	 
  1420. 	 
  1421. 	-- Set the waypoints to teleport the player if they cancel this mission (necessary because of the potential zone swaps) 
  1422. 	mission_set_cancel_warp_location(Dlc2_m01_checkpoints.start.player_navs[1], Dlc2_m01_checkpoints.start.player_navs[2]) 
  1423. end 
  1424.  
  1425. -- Handle any checkpoint specific initialization 
  1426. -- 
  1427. -- checkpoint_name:	Checkpoint to initialize the mission to 
  1428. -- is_restart:		Whether or not the mission is being restarted. 
  1429. function dlc2_m01_initialize_checkpoint(checkpoint_name, is_restart) 
  1430. 	if (checkpoint_name == Dlc2_m01_checkpoints.start.name) then 
  1431. 		dlc2_m01_go_to_armory_take1_initialize() -- player teleport happens internally 
  1432. 		 
  1433. 	elseif (checkpoint_name == Dlc2_m01_checkpoints.armory_take1.name) then 
  1434. 		dlc2_m01_armory_take1_initialize() -- player teleport happens internally 
  1435. 	 
  1436. 	elseif (checkpoint_name == Dlc2_m01_checkpoints.armory_take2.name) then 
  1437. 		dlc2_m01_go_to_armory_take2_initialize() -- player teleport happens internally 
  1438. 		 
  1439. 	elseif (checkpoint_name == Dlc2_m01_checkpoints.escape_start.name) then 
  1440. 		dlc2_m01_escape_start_initialize() -- player teleport happens internally 
  1441. 		 
  1442. 	elseif (checkpoint_name == Dlc2_m01_checkpoints.rail_dt_02.name) then 
  1443. 		dlc2_m01_rail_dt_02_initialize() -- player teleport happens internally 
  1444. 		 
  1445. 	elseif (checkpoint_name == Dlc2_m01_checkpoints.alien_ambush.name) then 
  1446. 		dlc2_m01_alien_ambush_initialize() -- player teleport happens internally 
  1447. 		 
  1448. 	elseif (checkpoint_name == Dlc2_m01_checkpoints.rail_nw_01.name) then 
  1449. 		dlc2_m01_rail_nw_01_initialize() -- player teleport happens internally 
  1450. 		 
  1451. 	elseif (checkpoint_name == Dlc2_m01_checkpoints.jump_take2.name) then 
  1452. 		dlc2_m01_jump_take2_initialize() -- player teleport happens internally 
  1453. 		 
  1454. 	elseif (checkpoint_name == Dlc2_m01_checkpoints.finale.name) then 
  1455. 		dlc2_m01_finale_initialize() -- player teleport happens internally 
  1456. 		 
  1457. 	end 
  1458. end 
  1459.  
  1460.  
  1461.  
  1462. -- *************************************************** 
  1463. -- Process Functions 
  1464. -- *************************************************** 
  1465.  
  1466. -- Main mission processing function 
  1467. -- 
  1468. -- checkpoint_name:		Name of the checkpoint to run the mission from 
  1469. function dlc2_m01_run(checkpoint_name) 
  1470.  
  1471. 	Dlc2_m01_runtime.current_checkpoint = checkpoint_name 
  1472.  
  1473.    -- make sure player personas are set to dlc2 
  1474. 	persona_set_dlc_bundle(2) 
  1475.  
  1476. 	if (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.start.name) then 
  1477. 		dlc2_m01_get_in_courtesy_vehicle_take1_process() 
  1478. 		dlc2_m01_go_to_armory_take1_process() 
  1479. 		 
  1480. 		-- Set the next checkpoint 
  1481. 		Dlc2_m01_runtime.current_checkpoint = Dlc2_m01_checkpoints.armory_take1.name 
  1482. 		mission_set_checkpoint(Dlc2_m01_runtime.current_checkpoint, true) 
  1483. 		 
  1484. 		-- Write the achievement data for the checkpoint 
  1485. 		for i, achievement in pairs(Dlc2_m01_acheivements) do 
  1486. 			dlc2_m01_helper_achievement_write_checkpoint(achievement) 
  1487. 		end 
  1488. 	end 
  1489. 	 
  1490. 	if (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.armory_take1.name) then 
  1491. 		dlc2_m01_go_to_helipad_take1() 
  1492. 		dlc2_m01_rescue_kwilanna_take1_process() 
  1493. 		dlc2_m01_armory_take1_wrap() 
  1494. 		 
  1495. 		-- Set the next checkpoint 
  1496. 		Dlc2_m01_runtime.current_checkpoint = Dlc2_m01_checkpoints.armory_take2.name 
  1497. 		mission_set_checkpoint(Dlc2_m01_runtime.current_checkpoint, true) 
  1498. 		 
  1499. 		-- Write the achievement data for the checkpoint 
  1500. 		for i, achievement in pairs(Dlc2_m01_acheivements) do 
  1501. 			dlc2_m01_helper_achievement_write_checkpoint(achievement) 
  1502. 		end		 
  1503. 		 
  1504. 		-- Do the transition into the second take of the Armory 
  1505. 		mission_start_fade_out() 
  1506. 		 
  1507. 		-- Clean-up the first take 
  1508. 		if (group_is_loaded(Dlc2_m01_groups.courtesy_veh_01.name) == true) then 
  1509. 			group_destroy(Dlc2_m01_groups.courtesy_veh_01.name) 
  1510. 		end 
  1511. 		if (group_is_loaded(Dlc2_m01_groups.kwilanna_heli.name) == true) then 
  1512. 			group_destroy(Dlc2_m01_groups.kwilanna_heli.name) 
  1513. 		end 
  1514. 		if (group_is_loaded(Dlc2_m01_groups.armory_take_01.name) == true) then 
  1515. 			group_destroy(Dlc2_m01_groups.armory_take_01.name) 
  1516. 		end 
  1517. 		if (group_is_loaded(Dlc2_m01_groups.armory_camera_men.name) == true) then 
  1518. 			group_destroy(Dlc2_m01_groups.armory_camera_men.name) 
  1519. 		end 
  1520. 		if (group_is_loaded(Dlc2_m01_groups.armory_car_husks.name) == true) then 
  1521. 			group_destroy(Dlc2_m01_groups.armory_car_husks.name) 
  1522. 		end 
  1523. 		 
  1524. 		-- Remove Kwilanna from the player's party and make her vulnerable again 
  1525. 		party_dismiss(Dlc2_m01_characters.kwilanna) 
  1526. 		dlc2_m01_helper_set_kwilanna_invulnerable(true, true) 
  1527. 		 
  1528. 		thread_yield() 
  1529. 		 
  1530. 		-- Initialize the second take 
  1531. 		dlc2_m01_go_to_armory_take2_initialize() 
  1532. 		 
  1533. 		mission_start_fade_in() 
  1534. 	end 
  1535. 	 
  1536. 	if (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.armory_take2.name) then 
  1537. 		dlc2_m01_go_to_armory_take2_process() 
  1538. 		dlc2_m01_rescue_kwilanna_take2_process() 
  1539. 		dlc2_m01_get_in_escape_vehicle_process() 
  1540. 		 
  1541. 		-- Set the next checkpoint 
  1542. 		Dlc2_m01_runtime.current_checkpoint = Dlc2_m01_checkpoints.escape_start.name 
  1543. 		mission_set_checkpoint(Dlc2_m01_runtime.current_checkpoint, true) 
  1544. 		 
  1545. 		-- Write the achievement data for the checkpoint 
  1546. 		for i, achievement in pairs(Dlc2_m01_acheivements) do 
  1547. 			dlc2_m01_helper_achievement_write_checkpoint(achievement) 
  1548. 		end		 
  1549. 	end 
  1550. 	 
  1551. 	if (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.escape_start.name) then 
  1552. 		dlc2_m01_escape_start_process() 
  1553. 		dlc2_m01_process_armory_take2_wrap() 
  1554. 		dlc2_m01_process_steal_humvee() 
  1555. 		 
  1556. 		-- Set the next checkpoint 
  1557. 		Dlc2_m01_runtime.current_checkpoint = Dlc2_m01_checkpoints.rail_dt_02.name 
  1558. 		mission_set_checkpoint(Dlc2_m01_runtime.current_checkpoint, true) 
  1559. 		 
  1560. 		-- Write the achievement data for the checkpoint 
  1561. 		for i, achievement in pairs(Dlc2_m01_acheivements) do 
  1562. 			dlc2_m01_helper_achievement_write_checkpoint(achievement) 
  1563. 		end		 
  1564. 	end 
  1565. 	 
  1566. 	if (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.rail_dt_02.name) then 
  1567. 		dlc_m01_rail_sequence_dt_loop_02_process() 
  1568. 		 
  1569. 		-- Set the next checkpoint (DEBUG checkpoint so don't call mission_set_checkpoint) 
  1570. 		Dlc2_m01_runtime.current_checkpoint = Dlc2_m01_checkpoints.alien_ambush.name 
  1571. 	end 
  1572. 	 
  1573. 	if (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.alien_ambush.name) then 
  1574. 		dlc2_m01_alien_ambush_process() 
  1575. 		 
  1576. 		-- Set the next checkpoint 
  1577. 		Dlc2_m01_runtime.current_checkpoint = Dlc2_m01_checkpoints.rail_nw_01.name 
  1578. 		mission_set_checkpoint(Dlc2_m01_runtime.current_checkpoint, true) 
  1579. 		 
  1580. 		-- Write the achievement data for the checkpoint 
  1581. 		for i, achievement in pairs(Dlc2_m01_acheivements) do 
  1582. 			dlc2_m01_helper_achievement_write_checkpoint(achievement) 
  1583. 		end		 
  1584. 	end 
  1585. 	 
  1586. 	if (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.rail_nw_01.name) then 
  1587. 		dlc_m01_rail_sequence_nw_loop_process() 
  1588. 		dlc2_m01_jump_take1_process() 
  1589. 		 
  1590. 		-- Set the next checkpoint 
  1591. 		Dlc2_m01_runtime.current_checkpoint = Dlc2_m01_checkpoints.jump_take2.name 
  1592. 		mission_set_checkpoint(Dlc2_m01_runtime.current_checkpoint, true) 
  1593. 		 
  1594. 		-- Write the achievement data for the checkpoint 
  1595. 		for i, achievement in pairs(Dlc2_m01_acheivements) do 
  1596. 			dlc2_m01_helper_achievement_write_checkpoint(achievement) 
  1597. 		end		 
  1598. 		 
  1599. 		-- Do the transition into the second take of the jump 
  1600. 		mission_start_fade_out() 
  1601. 		 
  1602. 		-- Clean-up all the ambush groups 
  1603. 		for i, ambush_group in pairs(Dlc2_m01_rail_ambushes) do 
  1604. 			for j, ambush in pairs(ambush_group) do 
  1605. 				dlc2_m01_cleanup_rail_ambush(ambush) 
  1606. 			end 
  1607. 		end 
  1608. 		 
  1609. 		-- Destroy any script groups that may be aroudn 
  1610. 		for i, group in pairs(Dlc2_m01_groups) do 
  1611. 			if (group_is_loaded(group.name) == true) then 
  1612. 				group_destroy(group.name) 
  1613. 			end 
  1614. 		end 
  1615. 		 
  1616. 		thread_yield() 
  1617.  
  1618. 		-- Initialize the second take 
  1619. 		dlc2_m01_initialize_common() 
  1620. 		dlc2_m01_initialize_checkpoint(Dlc2_m01_checkpoints.jump_take2.name, false) 
  1621. 		 
  1622. 		mission_start_fade_in()		 
  1623. 	end 
  1624. 	 
  1625. 	if (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.jump_take2.name) then 
  1626. 		dlc2_m01_jump_take2_process() 
  1627. 		 
  1628. 		-- Set the next checkpoint (DEBUG checkpoint so don't call mission_set_checkpoint) 
  1629. 		Dlc2_m01_runtime.current_checkpoint = Dlc2_m01_checkpoints.finale.name 
  1630. 	end 
  1631. 	 
  1632. 	if (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.finale.name) then 
  1633. 		dlc2_m01_alien_finale_process() 
  1634. 	end 
  1635. 	 
  1636. 	delay(1.0) 
  1637. 	 
  1638. 	-- Fade-out and teleport the players back to the mission start navpoints 
  1639. 	fade_out(1.0) 
  1640. 	fade_out_block() 
  1641. 	teleport_coop(Dlc2_m01_navpoints.mission_end[1], Dlc2_m01_navpoints.mission_end[2], true) 
  1642.  
  1643. 	-- Call mission success 
  1644. 	mission_end_success("dlc2_m01", Dlc2_m01_cutscenes.outro, Dlc2_m01_navpoints.mission_end)	 
  1645. end 
  1646.  
  1647.  
  1648. --[[ 
  1649. 	Checkpoint 01 - Rescue Kwilanna from the Armory (Take1) 
  1650. 	--]] 
  1651.  
  1652. -- Initialization for the "go to the armory" objective 
  1653. function dlc2_m01_go_to_armory_take1_initialize() 
  1654. 	dlc2_m01_go_to_armory_initialize_common() 
  1655. 	dlc2_m01_armory_take1_initialize_common() 
  1656.  
  1657. 	-- Create the courtesy vehicle for the players 
  1658. 	group_create(Dlc2_m01_groups.courtesy_veh_01.name, true) -- wait for the group to load 
  1659. 	 
  1660. 	-- Hide the second courtesy vehicle if this isn't coop 
  1661. 	if (coop_is_active() == false) then 
  1662. 		vehicle_hide(Dlc2_m01_groups.courtesy_veh_01.vehicles[2]) 
  1663. 	end 
  1664. 	 
  1665. 	-- Teleport the player's to the start navs 
  1666. 	teleport_coop(Dlc2_m01_checkpoints.start.player_navs[1], Dlc2_m01_checkpoints.start.player_navs[2], true) 
  1667. 	 
  1668. 	-- Teleport Kwilanna 
  1669. 	--teleport(Dlc2_m01_characters.kwilanna, Dlc2_m01_navpoints.kwilanna_rescue_orient, true, false, 0.0, 0.0, 0.0, false)	 
  1670. 	 
  1671. 	-- Set the objective text and add an object indicator at the Armory 
  1672. 	objective_text(0, Dlc2_m01_objectives.get_in_car.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.get_in_car.icon)	 
  1673. 	marker_add(Dlc2_m01_groups.courtesy_veh_01.vehicles[1], MINIMAP_ICON_USE, OI_ASSET_USE, OI_FLAGS_FULL, SYNC_ALL) 
  1674. end 
  1675.  
  1676. -- Process the "get in a vehicle" objective 
  1677. function dlc2_m01_get_in_courtesy_vehicle_take1_process() 
  1678. 	-- Register a callback on the coutesy vehicle with the marker, so we can remove the marker if the vehicle is destroyed 
  1679. 	on_vehicle_destroyed("dlc2_m01_courtest_vehicle_destroyed_cb", Dlc2_m01_groups.courtesy_veh_01.vehicles[1]) 
  1680.  
  1681. 	-- Register a callback for when any player enter's a vehicle, and set the player damage multipliers 
  1682. 	for i, player in pairs(Dlc2_m01_player_list) do 
  1683. 		on_vehicle_enter("dlc2_m01_entered_courtesy_vehicle_cb", player) 
  1684. 		character_set_attack_multiplier(player, Dlc2_m01_tweak_values.armory_player_atk_mult_take1) 
  1685. 	end 
  1686. 	 
  1687. 	delay(0.5) 
  1688. 	 
  1689. 	-- Play the intro conversation 
  1690. 	dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.mission_start, DLC2_M01_CONVO_PLAY_IMMEDIATE, 1.0) 
  1691. 	 
  1692. 	-- Wait until the player gets into a vehicle 
  1693. 	while(Dlc2_m01_runtime.entered_coutesy_vehicle == false) do 
  1694. 		thread_yield() 
  1695. 	end 
  1696. 	 
  1697. 	dlc2_m01_get_in_courtesy_vehicle_take1_cleanup(false) 
  1698. end 
  1699.  
  1700. -- Clean-up the "get into vehicle" objective 
  1701. -- 
  1702. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  1703. function dlc2_m01_get_in_courtesy_vehicle_take1_cleanup(exiting) 
  1704. 	on_vehicle_destroyed("", Dlc2_m01_groups.courtesy_veh_01.vehicles[1]) 
  1705.  
  1706. 	-- Remove callback for when any player enter's a vehicle 
  1707. 	for i, player in pairs(Dlc2_m01_player_list) do 
  1708. 		on_vehicle_enter("", player) 
  1709. 	end	 
  1710. 	 
  1711. 	-- Remove the marker 
  1712. 	marker_remove(Dlc2_m01_groups.courtesy_veh_01.vehicles[1]) 
  1713. end 
  1714.  
  1715. -- Callback for when the courtest vehicle with the marker on it is destroyed 
  1716. function dlc2_m01_courtest_vehicle_destroyed_cb() 
  1717. 	-- Remove the marker 
  1718. 	marker_remove(Dlc2_m01_groups.courtesy_veh_01.vehicles[1]) 
  1719. end 
  1720.  
  1721. -- Callback for when a player enters a vehicle 
  1722. function dlc2_m01_entered_courtesy_vehicle_cb() 
  1723. 	Dlc2_m01_runtime.entered_coutesy_vehicle = true 
  1724. end 
  1725.  
  1726. -- Process the "go to the armory" objective 
  1727. function dlc2_m01_go_to_armory_take1_process() 
  1728. 	-- Set the objective text and add an object indicator at the Armory 
  1729. 	objective_text(0, Dlc2_m01_objectives.go_to_armory.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.go_to_armory.icon)	 
  1730. 	marker_add(Dlc2_m01_navpoints.armory_waypoint, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1731. 	waypoint_add(Dlc2_m01_navpoints.armory_waypoint, SYNC_ALL)	 
  1732.  
  1733. 	-- Enable the trigger for the parking location 
  1734. 	on_trigger("dlc2_m01_armory_parking_triggered_cb", Dlc2_m01_triggers.armory_parking_location) 
  1735. 	trigger_enable(Dlc2_m01_triggers.armory_parking_location, true) 
  1736. 	 
  1737. 	-- Enable the trigger for the Armory Island 
  1738. 	on_trigger("dlc2_m01_armory_island_entered_take1_cb", Dlc2_m01_triggers.armory_island) 
  1739. 	on_trigger_exit("dlc2_m01_armory_island_exited_cb", Dlc2_m01_triggers.armory_island) 
  1740. 	trigger_enable(Dlc2_m01_triggers.armory_island, true)		 
  1741. 	 
  1742. 	-- Wait until the player has reached the Armory 
  1743. 	Dlc2_m01_runtime.reached_armory_parking_area_by = nil 
  1744. 	while(Dlc2_m01_runtime.reached_armory_parking_area_by == nil) do 
  1745. 		thread_yield() 
  1746. 	end 
  1747. 	 
  1748. 	dlc2_m01_go_to_armory_take1_cleanup(false) 
  1749. end 
  1750.  
  1751. -- Clean-up the "go to the armory" objective 
  1752. -- 
  1753. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  1754. function dlc2_m01_go_to_armory_take1_cleanup(exiting) 
  1755. 	-- Remove the marker at the Armory 
  1756. 	marker_remove(Dlc2_m01_navpoints.armory_waypoint) 
  1757. 	waypoint_remove(SYNC_ALL) 
  1758. 	 
  1759. 	if (exiting == true) then 
  1760. 		if (group_is_loaded(Dlc2_m01_groups.courtesy_veh_01.name) == true) then 
  1761. 			-- If a player is in any of the courtesy vehicles, release that vehicle to the world 
  1762. 			for i, vehicle in pairs(Dlc2_m01_groups.courtesy_veh_01.vehicles) do 
  1763. 				for j, player in pairs(Dlc2_m01_player_list) do 
  1764. 					if (character_is_in_vehicle(player, vehicle) == true) then 
  1765. 						release_to_world(vehicle) 
  1766. 						break 
  1767. 					end 
  1768. 				end 
  1769. 			end 
  1770. 					 
  1771. 			-- Destroy the courtesy vehicle group 
  1772. 			group_destroy(Dlc2_m01_groups.courtesy_veh_01.name) 
  1773. 		end 
  1774. 	end 
  1775. end 
  1776.  
  1777. -- Initialization for the "resuce Kwilanna" objective (take1) 
  1778. function dlc2_m01_armory_take1_initialize() 
  1779. 	-- No longer required to reach parking area, so mark that as completed 
  1780. 	Dlc2_m01_runtime.reached_armory_parking_area_by = LOCAL_PLAYER 
  1781.  
  1782. 	dlc2_m01_go_to_armory_initialize_common() 
  1783. 	dlc2_m01_armory_take1_initialize_common() 
  1784. 	 
  1785. 	-- Disable parking spots 
  1786. 	parking_spot_disable_all(true) 
  1787. 	 
  1788. 	-- Disable Police notoriety 
  1789. 	notoriety_force_no_spawn("Police", true)	 
  1790.  
  1791. 	-- Teleport the player's to the start navs 
  1792. 	teleport_coop(Dlc2_m01_checkpoints.armory_take1.player_navs[1], Dlc2_m01_checkpoints.armory_take1.player_navs[2], true)	 
  1793. 	 
  1794. 	-- Load the film grain UI 
  1795. 	dlc2_m01_load_film_grain()	 
  1796. 	 
  1797. 	-- Teleport Kwilanna 
  1798. 	teleport(Dlc2_m01_characters.kwilanna, Dlc2_m01_navpoints.kwilanna_rescue_orient, true, false, 0.0, 0.0, 0.0, false)	 
  1799. end 
  1800.  
  1801. -- Process the "go to the helipad" objective 
  1802. function dlc2_m01_go_to_helipad_take1() 
  1803. 	-- Set the objective text and add an object indicator at the Heliport 
  1804. 	objective_text(0, Dlc2_m01_objectives.breach_heliport.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.breach_heliport.icon) 
  1805.  
  1806. 	-- Add the marker at the helipad 
  1807. 	marker_add(Dlc2_m01_navpoints.armory_location, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1808. 	 
  1809. 	-- Play some dialog 
  1810. 	Dlc2_m01_dialog_lines.armory_drive_end.persona = Dlc2_m01_runtime.reached_armory_parking_area_by 
  1811. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.armory_drive_end, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  1812. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.armory_arrive, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  1813. 	 
  1814. 	-- Update the music 
  1815. 	audio_object_post_event("Take_One") 
  1816. 	 
  1817. 	-- Disable peds and vehicles 
  1818. 	--spawning_pedestrians(false) 
  1819. 	--spawning_vehicles(false)	 
  1820. 	 
  1821. 	-- Setup all of the ambushes 
  1822. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.helipad_take1) do 
  1823. 		dlc2_m01_setup_rail_ambush(ambush) 
  1824. 	end		 
  1825. 	 
  1826. 	-- Wait until the player reaches the Heli Pad 
  1827. 	while(Dlc2_m01_runtime.entered_heli_pad == false) do 
  1828. 		thread_yield() 
  1829. 	end	 
  1830.  
  1831. 	dlc2_m01_go_to_helipad_take1_cleanup() 
  1832. end 
  1833.  
  1834. -- Clean-up the "go to the helipad" objective 
  1835. -- 
  1836. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  1837. function dlc2_m01_go_to_helipad_take1_cleanup(exiting) 
  1838. 	-- Remove the marker 
  1839. 	marker_remove(Dlc2_m01_navpoints.armory_location) 
  1840. 	 
  1841. 	-- Disable the Armory trigger volume 
  1842. 	on_trigger("", Dlc2_m01_triggers.heli_pad_area) 
  1843. 	on_trigger_exit("", Dlc2_m01_triggers.heli_pad_area) 
  1844. 	trigger_enable(Dlc2_m01_triggers.heli_pad_area, false)	 
  1845. 	 
  1846. 	-- Disable the trigger for the parking location 
  1847. 	on_trigger("", Dlc2_m01_triggers.armory_parking_location) 
  1848. 	trigger_enable(Dlc2_m01_triggers.armory_parking_location, false)		 
  1849. 	 
  1850. 	-- Remove on_death callbacks for the tower guards 
  1851. 	for i, guard in pairs(Dlc2_m01_groups.armory_take_01.tower_guards) do 
  1852. 		on_death("", guard) 
  1853. 	end	 
  1854. end 
  1855.  
  1856. -- Process the "rescue Kwilanna" objective 
  1857. function dlc2_m01_rescue_kwilanna_take1_process() 
  1858. 	-- Set the objective text and add an object indicator at the Armory 
  1859. 	objective_text(0, Dlc2_m01_objectives.rescue_kwilanna.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.rescue_kwilanna.icon)	 
  1860. 	marker_add(Dlc2_m01_characters.kwilanna, MINIMAP_ICON_USE, OI_ASSET_USE, OI_FLAGS_FULL, SYNC_ALL) 
  1861.  
  1862. 	-- Enable the trigger to resuce Kwilanna 
  1863. 	Dlc2_m01_runtime.rescued_kwilanna = false 
  1864. 	trigger_enable(Dlc2_m01_triggers.rescue_kwilanna, true) 
  1865. 	on_trigger("dlc2_m01_resuce_kwilanna_cb", Dlc2_m01_triggers.rescue_kwilanna) 
  1866. 	 
  1867. 	-- Enable the trigger around kwilanna 
  1868. 	Dlc2_m01_runtime.kwilanna_heli_radius_triggered = false 
  1869. 	trigger_enable(Dlc2_m01_triggers.tgr_kwilanna_heli_radius, true) 
  1870. 	on_trigger("dlc2_m01_kwilanna_heli_radius_cb", Dlc2_m01_triggers.tgr_kwilanna_heli_radius) 
  1871. 	 
  1872. 	-- Register a callback for when the guards at the top of the stairs are damaged 
  1873. 	for i, npc_table in pairs(Dlc2_m01_groups.stair_guard_take_01.chase_npcs) do 
  1874. 		on_take_damage("dlc2_m01_stair_guard_damaged_cb", npc_table.npc) 
  1875. 	end 
  1876.  
  1877. 	-- Wait until a player triggers the resuce Kwilanna animation 
  1878. 	while(Dlc2_m01_runtime.rescued_kwilanna == false) do 
  1879. 		thread_yield() 
  1880. 	end 
  1881. 	 
  1882. 	dlc2_m01_rescue_kwilanna_take1_cleanup() 
  1883. end 
  1884.  
  1885. -- Clean-up the "rescue Kwilanna" objective 
  1886. -- 
  1887. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  1888. function dlc2_m01_rescue_kwilanna_take1_cleanup(exiting) 
  1889. 	-- Remove the marker 
  1890. 	marker_remove(Dlc2_m01_characters.kwilanna) 
  1891. 	 
  1892. 	-- Disable the trigger to rescue Kwilanna 
  1893. 	on_trigger("", Dlc2_m01_triggers.rescue_kwilanna) 
  1894. 	trigger_enable(Dlc2_m01_triggers.rescue_kwilanna, false) 
  1895. 	 
  1896. 	-- Disable the trigger for the radius around Kwilanna's helicopter 
  1897. 	on_trigger("", Dlc2_m01_triggers.tgr_kwilanna_heli_radius)	 
  1898. 	trigger_enable(Dlc2_m01_triggers.tgr_kwilanna_heli_radius, false) 
  1899. 	 
  1900. 	-- Remove a callback for when the guards at the top of the stairs are damaged 
  1901. 	for i, npc_table in pairs(Dlc2_m01_groups.stair_guard_take_01.chase_npcs) do 
  1902. 		on_take_damage("", npc_table.npc) 
  1903. 	end	 
  1904. end 
  1905.  
  1906. -- Callback for when one of the guards at the top of the stairs is damaged 
  1907. function dlc2_m01_stair_guard_damaged_cb(victim) 
  1908. 	-- Activate the ambush callback for the stair guard group 
  1909. 	dlc2_m01_ambush_activate_triggered_cb(LOCAL_PLAYER, Dlc2_m01_rail_ambushes.helipad_take1[2].activate_trigger) 
  1910. end 
  1911.  
  1912. -- Process the "take1 wrap" sequence, where the directory yells "Cut!" to reshoot this sequence 
  1913. function dlc2_m01_armory_take1_wrap() 
  1914. 	-- Wait for the conversation to finish (director yells cut at the end of the conversation 
  1915. 	while(dlc2_m01_helper_dialog_check_done(Dlc2_m01_conversations.untie_kwilanna_take1) == false) do 
  1916. 		thread_yield() 
  1917. 	end 
  1918. 	 
  1919. 	delay(0.5) 
  1920. 	 
  1921. 	objective_text_clear(0) 
  1922. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.armory_take1_cut, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  1923. 	dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.armory_take1_wrap, DLC2_M01_CONVO_PLAY_LAST, 0.0) 
  1924. 	 
  1925. 	-- Remove the film grain UI 
  1926. 	dlc_gis_film_grain_unload() 
  1927. 	 
  1928. 	delay(0.5) 
  1929. 	 
  1930. 	-- Update the music 
  1931. 	audio_object_post_event("Take_One_Cut")	 
  1932. 	 
  1933. 	-- Wipe all police notoriety 
  1934. 	notoriety_reset("Police") 
  1935. 	notoriety_set("Police", 0) 
  1936. 	notoriety_set_max("Police", 0) 
  1937. 	 
  1938. 	-- Make all NPCs idle, and make the Police team friendly with the Playas team 
  1939. 	ai_force_team_idle("None") 
  1940. 	team_make_allies("Police", "Playas") 
  1941. 	 
  1942. 	-- Set Kwilanna's animation state 
  1943. 	npc_combat_enable(Dlc2_m01_characters.kwilanna, false) 
  1944. 	npc_leash_to_object(Dlc2_m01_characters.kwilanna, Dlc2_m01_runtime.kwilanna_rescued_by, 5.0) 
  1945. 	 
  1946. 	-- Make Everyone Invulnerable 
  1947. 	dlc2_m01_helper_set_kwilanna_invulnerable(true, false) 
  1948. 	 
  1949. 	-- Manually update all the NPCs we directly spawning in the mission 
  1950. 	for i, npc in pairs(Dlc2_m01_groups.armory_take_01.npcs) do 
  1951. 		dlc2_m01_make_npc_idle(npc) 
  1952. 	end 
  1953. 	for i, npc_table in pairs(Dlc2_m01_groups.gate_gaurd_take_01.chase_npcs) do 
  1954. 		dlc2_m01_make_npc_idle(npc_table.npc) 
  1955. 	end	 
  1956. 	for i, npc_table in pairs(Dlc2_m01_groups.stair_guard_take_01.chase_npcs) do 
  1957. 		dlc2_m01_make_npc_idle(npc_table.npc) 
  1958. 	end 
  1959. 	for i, npc in pairs(Dlc2_m01_groups.armory_camera_men.npcs) do 
  1960. 		dlc2_m01_make_npc_idle(npc) 
  1961. 	end 
  1962. 	dlc2_m01_make_npc_idle(Dlc2_m01_groups.kwilanna_heli.heli.pilot) 
  1963. 	 
  1964. 	-- Make the player's invulnerable and revive them if they're downed 
  1965. 	for i, player in pairs(Dlc2_m01_player_list) do 
  1966. 		if (human_is_downed(player) == true) then 
  1967. 			player_revive(player) 
  1968. 		end 
  1969. 		 
  1970. 		turn_invulnerable(player) 
  1971. 	end 
  1972. 	 
  1973. 	-- Wait for the conversation to finish 
  1974. 	while(dlc2_m01_helper_dialog_check_done(Dlc2_m01_conversations.armory_take1_wrap) == false) do 
  1975. 		thread_yield() 
  1976. 	end 
  1977. 	 
  1978. 	-- Make sure kwilanna isn't downed 
  1979. 	if (human_is_downed(Dlc2_m01_characters.kwilanna) == true) then 
  1980. 		npc_revive(Dlc2_m01_characters.kwilanna) 
  1981. 	end	 
  1982. 	 
  1983. 	-- Make sure none of the players are downed 
  1984. 	for i, player in pairs(Dlc2_m01_player_list) do 
  1985. 		if (human_is_downed(player) == true) then 
  1986. 			player_revive(player) 
  1987. 		end 
  1988. 	end 
  1989. 	 
  1990. 	delay(2.0) 
  1991. 	 
  1992. 	dlc2_m01_armory_take1_wrap_cleanup(false) 
  1993. end 
  1994.  
  1995. -- Clean-up the "take1 wrap" sequence, where the directory yells "Cut!" to reshoot this sequence 
  1996. -- 
  1997. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  1998. function dlc2_m01_armory_take1_wrap_cleanup(exiting) 
  1999. 	-- Disable the trigger for the Armory Island 
  2000. 	on_trigger("", Dlc2_m01_triggers.armory_island) 
  2001. 	on_trigger_exit("", Dlc2_m01_triggers.armory_island)	 
  2002. 	trigger_enable(Dlc2_m01_triggers.armory_island, false) 
  2003. 	 
  2004. 	-- Clean-up all of the ambushes 
  2005. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.helipad_take1) do 
  2006. 		dlc2_m01_cleanup_rail_ambush(ambush) 
  2007. 	end 
  2008. 	 
  2009. 	-- Clean-up the cameramen 
  2010. 	for i, npc in pairs(Dlc2_m01_groups.armory_camera_men.npcs) do 
  2011. 		dlc2_m01_helper_cleanup_camera_man(npc) 
  2012. 	end		 
  2013. 	 
  2014. 	npc_leash_remove(Dlc2_m01_characters.kwilanna) 
  2015. 	 
  2016. 	-- Remove the players weapon load-out 
  2017. 	dlc2_m01_helper_remove_temp_weapons(Dlc2_m01_tweak_values.armory_inventory_take1) 
  2018. 	 
  2019. 	-- Clear the animation state 
  2020. 	set_script_animation_state(Dlc2_m01_characters.kwilanna, nil) 
  2021. end 
  2022.  
  2023. function dlc2_m01_make_npc_idle(npc) 
  2024. 	if (human_is_downed(npc) == true) then 
  2025. 		npc_revive(npc) 
  2026. 	end 
  2027. 	 
  2028. 	--turn_invulnerable(npc)	 
  2029. 	npc_combat_enable(npc, false) 
  2030. 	 
  2031. 	local behavior_idx = rand_int(1, 3) 
  2032. 	if (behavior_idx == 1) then 
  2033. 		wander_start(npc, nil, 50.0) 
  2034. 	elseif (behavior_idx == 2) then 
  2035. 		set_script_animation_state(npc, "bus loiter a") 
  2036. 	elseif (behavior_idx == 3) then 
  2037. 		set_script_animation_state(npc, "bus loiter d") 
  2038. 	elseif (behavior_idx == 4) then 
  2039. 		set_script_animation_state(npc, "cellphone c") 
  2040. 	end 
  2041.  
  2042. end 
  2043.  
  2044.  
  2045. --[[ 
  2046. 	Checkpoint 02 - Rescue Kwilanna from the Armory (Take2) 
  2047. 	--]] 
  2048.  
  2049. -- Initialize the second take of the Armory seuqence 
  2050. function dlc2_m01_go_to_armory_take2_initialize() 
  2051. 	dlc2_m01_go_to_armory_initialize_common() 
  2052.  
  2053. 	-- Create the script group for the second take 
  2054. 	group_create(Dlc2_m01_groups.armory_take_02.name, true) 
  2055. 	 
  2056. 	-- Put the gunners in all the manned vehicles 
  2057. 	for i, manned_vehicle in pairs(Dlc2_m01_groups.armory_take_02.manned_vehicles) do 
  2058. 		vehicle_suppress_npc_exit(manned_vehicle.vehicle, true) 
  2059. 		vehicle_enter_teleport(manned_vehicle.gunner, manned_vehicle.vehicle, 1, true) 
  2060. 	end 
  2061. 	 
  2062. 	-- Lock all the helicopters 
  2063. 	for i, heli in pairs(Dlc2_m01_groups.armory_take_02.helis) do 
  2064. 		set_unjackable_flag(heli, true) 
  2065. 		set_unenterable_for_player(heli, true) 
  2066. 	end	 
  2067. 	 
  2068. 	-- Create the player's heli 
  2069. 	group_create_hidden(Dlc2_m01_groups.armory_player_heli.name, true) 
  2070. 	 
  2071. 	-- Create the escape vehicle 
  2072. 	local veh_hitpoints = Dlc2_m01_tweak_values.player_veh_hitpoints 
  2073. 	if (difficulty_get_level() == 2) then 
  2074. 		veh_hitpoints = Dlc2_m01_tweak_values.player_veh_hitpoints_hc 
  2075. 	end		 
  2076. 	dlc2_m01_setup_escape_vehicle(veh_hitpoints) 
  2077. 	set_unjackable_flag(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  2078. 	set_unenterable_for_player(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  2079. 	turn_invulnerable(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  2080. 	 
  2081. 	-- Setup the get away car drop off group 
  2082. 	dlc2_m01_setup_get_away_car_drop_off_group() 
  2083. 	 
  2084. 	-- Create the camera men helicopter 
  2085. 	dlc2_m01_setup_heli_cameramen() 
  2086. 	 
  2087. 	-- Setup the downtown camera men 
  2088. 	dlc2_m01_setup_downtown_camera_men_01() 
  2089. 	 
  2090. 	-- Disable gravity on the players 
  2091. 	for i, player in pairs(Dlc2_m01_player_list) do 
  2092. 		human_gravity_enable(player, false) 
  2093. 	end 
  2094. 	 
  2095. 	-- Teleport the player's to the start navs 
  2096. 	teleport_coop(Dlc2_m01_checkpoints.armory_take2.player_navs[1], Dlc2_m01_checkpoints.armory_take2.player_navs[2], true)	 
  2097. 	 
  2098. 	-- Give the players weapon load-out 
  2099. 	dlc2_m01_helper_give_temp_weapons(Dlc2_m01_tweak_values.armory_inventory_take2)	 
  2100. 	 
  2101. 	-- Setup the player's helicopter 
  2102. 	vehicle_set_keyframed_physics(Dlc2_m01_groups.armory_player_heli.heli.vehicle, true) 
  2103. 	turn_invulnerable(Dlc2_m01_groups.armory_player_heli.heli.vehicle) 
  2104. 	turn_invulnerable(Dlc2_m01_groups.armory_player_heli.heli.pilot) 
  2105. 	vehicle_suppress_npc_exit(Dlc2_m01_groups.armory_player_heli.heli.vehicle, true) 
  2106. 	vehicle_enter_teleport(Dlc2_m01_groups.armory_player_heli.heli.pilot, Dlc2_m01_groups.armory_player_heli.heli.vehicle, 0, true) 
  2107. 	set_ignore_ai_flag(Dlc2_m01_groups.armory_player_heli.heli.pilot, true) 
  2108. 	set_dont_attack_me_on_sight_flag(Dlc2_m01_groups.armory_player_heli.heli.pilot, true) 
  2109. 	radio_block(Dlc2_m01_groups.armory_player_heli.heli.vehicle)	 
  2110. 	set_unjackable_flag(Dlc2_m01_groups.armory_player_heli.heli.vehicle, true) 
  2111. 	set_unenterable_for_player(Dlc2_m01_groups.armory_player_heli.heli.vehicle, true) 
  2112. 	 
  2113. 	-- Show the helicopter and make it fly to it's hover navpoint 
  2114. 	group_show(Dlc2_m01_groups.armory_player_heli.name) 
  2115. 	thread_yield() 
  2116. 	 
  2117. 	vehicle_enter_teleport(LOCAL_PLAYER, Dlc2_m01_groups.armory_player_heli.heli.vehicle, 5, true) 
  2118. 	set_player_can_enter_exit_vehicles(LOCAL_PLAYER, false) 
  2119. 	if (coop_is_active() == true) then 
  2120. 		vehicle_enter_teleport(REMOTE_PLAYER, Dlc2_m01_groups.armory_player_heli.heli.vehicle, 3, true) 
  2121. 		set_player_can_enter_exit_vehicles(REMOTE_PLAYER, false) 
  2122. 	end 
  2123. 	 
  2124. 	-- Re-enable gravity on the players 
  2125. 	for i, player in pairs(Dlc2_m01_player_list) do 
  2126. 		human_gravity_enable(player, true) 
  2127. 	end	 
  2128. 	 
  2129. 	-- Teleport Kwilanna 
  2130. 	teleport(Dlc2_m01_characters.kwilanna, Dlc2_m01_navpoints.kwilanna_rescue_orient, true, false, 0.0, 0.0, 0.0, false) 
  2131. 	 
  2132. 	-- Make sure all the world settings are correct 
  2133. 	notoriety_reset("Police") 
  2134. 	 
  2135. 	-- No longer required to reach parking area, so mark that as completed 
  2136. 	Dlc2_m01_runtime.reached_armory_parking_area_by = LOCAL_PLAYER 
  2137. end 
  2138.  
  2139. -- Process the "go to the armory" objective (take2) 
  2140. function dlc2_m01_go_to_armory_take2_process() 
  2141. 	-- Enable the trigger for the Armory Island 
  2142. 	on_trigger("dlc2_m01_armory_island_entered_take2_cb", Dlc2_m01_triggers.armory_island) 
  2143. 	on_trigger_exit("dlc2_m01_armory_island_exited_cb", Dlc2_m01_triggers.armory_island) 
  2144. 	trigger_enable(Dlc2_m01_triggers.armory_island, true) 
  2145. 	 
  2146. 	-- Enable the trigger for the landing area 
  2147. 	on_trigger("dlc2_m01_landing_area_cb", Dlc2_m01_triggers.player_landing_area) 
  2148. 	trigger_enable(Dlc2_m01_triggers.player_landing_area, true) 
  2149. 	 
  2150. 	-- Enable the trigger for the landing bulls eye (no on-enter callback) 
  2151. 	trigger_enable(Dlc2_m01_triggers.player_landing_bulls_eye, true) 
  2152. 	 
  2153. 	-- Enabled the trigger for the continuous explosion region 
  2154. 	on_trigger("dlc2_m01_armory_cont_exp_entered_cb", Dlc2_m01_triggers.armory_cont_exp) 
  2155. 	on_trigger_exit("dlc2_m01_armory_cont_exp_exited_cb", Dlc2_m01_triggers.armory_cont_exp) 
  2156. 	trigger_enable(Dlc2_m01_triggers.armory_cont_exp, true) 
  2157. 	 
  2158. 	-- Start continuous explosion 
  2159. 	continuous_explosion_start("Dlc2_m01_armory", Dlc2_m01_navpoints.armory_location) 
  2160. 	continuous_explosion_avoid_object_add(Dlc2_m01_groups.kwilanna_heli.heli.vehicle) 
  2161. 	for i, player in pairs(Dlc2_m01_player_list) do 
  2162. 		continuous_explosion_avoid_object_add(player) 
  2163. 	end	 
  2164. 	 
  2165. 	-- Play some dialog and wait for it to finish 
  2166. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.director_parachute_obj, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  2167. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.armory_take2_action, DLC2_M01_CONVO_PLAY_LAST, 0.0) 
  2168. 	while(dlc2_m01_helper_dialog_check_done(Dlc2_m01_dialog_lines.armory_take2_action) == false) do 
  2169. 		thread_yield() 
  2170. 	end 
  2171. 	 
  2172. 	-- Create the flares to guide the player 
  2173. 	for i, vfx in pairs(Dlc2_m01_vfx.player_landing_flares) do 
  2174. 		vfx.handle = effect_play(vfx.name, true) 
  2175. 	end 
  2176. 	 
  2177. 	-- Make the players vulnerable again 
  2178. 	for i, player in pairs(Dlc2_m01_player_list) do 
  2179. 		turn_vulnerable(player) 
  2180. 	end	 
  2181. 	 
  2182. 	-- Load the film grain UI 
  2183. 	dlc2_m01_load_film_grain() 
  2184. 	 
  2185. 	delay(0.8) 
  2186. 	 
  2187. 	-- Update the music 
  2188. 	audio_object_post_event("Take_Two_Intro")			 
  2189. 	 
  2190. 	-- Set the player damage multipliers 
  2191. 	for i, player in pairs(Dlc2_m01_player_list) do 
  2192. 		character_set_attack_multiplier(player, Dlc2_m01_tweak_values.armory_player_atk_mult_take2) 
  2193. 	end	 
  2194. 	 
  2195. 	-- Prompt the players to jump out of the heli 
  2196. 	hud_prompt(LOCAL_PLAYER, "DLC2_M01_HUD_JUMP", "dlc2_m01_player_jumped_local_cb") 
  2197. 	player_supress_falling_scream(LOCAL_PLAYER) 
  2198. 	set_player_can_enter_exit_vehicles(LOCAL_PLAYER, true) 
  2199. 	if (coop_is_active() == true) then 
  2200. 		hud_prompt(REMOTE_PLAYER, "DLC2_M01_HUD_JUMP", "dlc2_m01_player_jumped_remote_cb") 
  2201. 		player_supress_falling_scream(REMOTE_PLAYER) 
  2202. 		set_player_can_enter_exit_vehicles(REMOTE_PLAYER, true) 
  2203. 	end 
  2204. 	 
  2205. 	-- Set the objective text and add an object indicator at the Armory 
  2206. 	objective_text(0, Dlc2_m01_objectives.jump_from_heli.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.jump_from_heli.icon)	 
  2207. 	 
  2208. 	-- Disable peds and vehicles 
  2209. 	--spawning_pedestrians(false) 
  2210. 	--spawning_vehicles(false)		 
  2211.  
  2212. 	-- Wait until the player has reached the Heli Pad 
  2213. 	Dlc2_m01_runtime.entered_heli_pad = false 
  2214. 	while(Dlc2_m01_runtime.entered_heli_pad == false) do 
  2215. 		thread_yield() 
  2216. 	end 
  2217.  
  2218. 	dlc2_m01_go_to_armory_take2_cleanup(false) 
  2219. end 
  2220.  
  2221. -- Clean-up the "go to the armory' objective (take2) 
  2222. -- 
  2223. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  2224. function dlc2_m01_go_to_armory_take2_cleanup(exiting) 
  2225. 	-- Remove the marker at the Armory 
  2226. 	marker_remove(Dlc2_m01_navpoints.armory_location) 
  2227. 	marker_remove(Dlc2_m01_vfx.player_landing_flares[1]) 
  2228. 	 
  2229. 	-- Disable the Armory trigger volume 
  2230. 	on_trigger("", Dlc2_m01_triggers.heli_pad_area) 
  2231. 	on_trigger_exit("", Dlc2_m01_triggers.heli_pad_area) 
  2232. 	trigger_enable(Dlc2_m01_triggers.heli_pad_area, false) 
  2233. 	 
  2234. 	-- Disable the trigger for the continuous explosion region 
  2235. 	on_trigger("", Dlc2_m01_triggers.armory_cont_exp) 
  2236. 	on_trigger_exit("", Dlc2_m01_triggers.armory_cont_exp) 
  2237. 	trigger_enable(Dlc2_m01_triggers.armory_cont_exp, false) 
  2238. 	 
  2239. 	-- Kill the armory explosion dialog thread 
  2240. 	if (thread_check_done(Dlc2_m01_threads.armory_explosion_dialog) == false) then 
  2241. 		thread_kill(Dlc2_m01_threads.armory_explosion_dialog) 
  2242. 		Dlc2_m01_threads.armory_explosion_dialog = INVALID_THREAD_HANDLE 
  2243. 	end	 
  2244. 	 
  2245. 	-- Stop the continuous explosion 
  2246. 	continuous_explosion_stop()		 
  2247. end 
  2248.  
  2249. -- Callback for when the local players jumps from the starting helicopter 
  2250. function dlc2_m01_player_jumped_local_cb() 
  2251. 	dlc2_m01_player_jumped_process(LOCAL_PLAYER) 
  2252. end 
  2253.  
  2254. -- Callback for when the remote players jumps from the starting helicopter 
  2255. function dlc2_m01_player_jumped_remote_cb() 
  2256. 	dlc2_m01_player_jumped_process(REMOTE_PLAYER) 
  2257. end 
  2258.  
  2259. function dlc2_m01_player_jumped_process(player) 
  2260. 	if (Dlc2_m01_runtime.take_2_music_trigger == false) then 
  2261. 		Dlc2_m01_runtime.take_2_music_trigger = true 
  2262. 	 
  2263. 		-- Update the music 
  2264. 		audio_object_post_event("Take_Two") 
  2265. 	end 
  2266.  
  2267. 	hud_prompt_clear(player) 
  2268. 	vehicle_exit(player) 
  2269.  
  2270. 	if (Dlc2_m01_runtime.player_jumped_from_heli == false) then 
  2271. 		Dlc2_m01_runtime.player_jumped_from_heli = true 
  2272. 		 
  2273. 		-- Set the objective text to land on the target 
  2274. 		objective_text(0, Dlc2_m01_objectives.land_on_target.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.land_on_target.icon)				 
  2275. 		marker_add(Dlc2_m01_vfx.player_landing_flares[1], MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  2276.  
  2277. 		delay(0.5) 
  2278. 		 
  2279. 		Dlc2_m01_dialog_lines.player_parachute.persona = player 
  2280. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.player_parachute, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  2281. 	end 
  2282. end 
  2283.  
  2284. -- Callback for when the player enters the landing area for the second take at the armory 
  2285. -- 
  2286. -- player:		Name of the player that triggered this trigger 
  2287. -- trigger:		Name of the trigger 
  2288. function dlc2_m01_landing_area_cb(player, trigger) 
  2289. 	local landing_area_entered_prev = Dlc2_m01_runtime.player_entered_landing_area 
  2290. 	Dlc2_m01_runtime.player_entered_landing_area = true 
  2291. 	 
  2292. 	-- If this player has already triggered this trigger, then just return 
  2293. 	if (player == LOCAL_PLAYER) then 
  2294. 		if (Dlc2_m01_runtime.local_player_entered_landing_area == true) then 
  2295. 			return 
  2296. 		end 
  2297. 		Dlc2_m01_runtime.local_player_entered_landing_area = true 
  2298. 	else 
  2299. 		if (Dlc2_m01_runtime.remote_player_entered_landing_area == true) then 
  2300. 			return 
  2301. 		end 
  2302. 		Dlc2_m01_runtime.remote_player_entered_landing_area = true	 
  2303. 	end 
  2304. 		 
  2305. 	-- Wait to see if the player enter's the landing area bulls eye 
  2306. 	local elapsed_time = 0.0 
  2307. 	while(elapsed_time < 5.0) do 
  2308. 		-- If the player enters the bulls eye trigger, give them the achievement 
  2309. 		if (object_is_in_trigger(Dlc2_m01_triggers.player_landing_bulls_eye, player) == true) then 
  2310. 			hud_achievement_show_progress("No Stuntman Required", 1, 1, sync_from_player(player)) 
  2311. 			 
  2312. 			dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.director_generic_positive, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  2313. 			break 
  2314. 		end 
  2315. 		 
  2316. 		elapsed_time = elapsed_time + get_frame_time() 
  2317. 		thread_yield() 
  2318. 	end		 
  2319. 	 
  2320. 	-- If this is the first time in the landing area, move the objective and marker 
  2321. 	if (landing_area_entered_prev == false) then 
  2322. 		-- Set enemeis to always see the player 
  2323. 		for i, npc in pairs(Dlc2_m01_groups.armory_take_02.npcs) do 
  2324. 			set_always_sees_player_flag(npc, true) 
  2325. 		end 
  2326.  
  2327. 		-- Set the objective text and add an object indicator at the Heliport 
  2328. 		objective_text(0, Dlc2_m01_objectives.breach_heliport.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.breach_heliport.icon)		 
  2329.  
  2330. 		-- Move the marker 
  2331. 		marker_remove(Dlc2_m01_vfx.player_landing_flares[1]) 
  2332. 		marker_add(Dlc2_m01_navpoints.armory_location, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  2333. 		 
  2334. 		delay(3.0) 
  2335. 		 
  2336. 		tutorial_start("weap_alt_fire", 5.0, true, true) 
  2337. 	end 
  2338. 	 
  2339. 	-- If there are no other players left to land, then remove the flares and tell the helicopter to fly off 
  2340. 	if (landing_area_entered_prev == true or coop_is_active() == false) then 
  2341. 		for i, vfx in pairs(Dlc2_m01_vfx.player_landing_flares) do 
  2342. 			if (vfx.handle ~= -1) then 
  2343. 				effect_stop(vfx.handle) 
  2344. 			end 
  2345. 		end 
  2346. 		 
  2347. 		-- Disable the keyframe for the escape helicopter, and have it fly off 
  2348. 		vehicle_set_keyframed_physics(Dlc2_m01_groups.armory_player_heli.heli.vehicle, false) 
  2349. 		helicopter_enter_retreat(Dlc2_m01_groups.armory_player_heli.heli.vehicle) 
  2350. 		release_to_world(Dlc2_m01_groups.armory_player_heli.heli.vehicle) 
  2351. 	end 
  2352. end 
  2353.  
  2354. -- Callback when a player enters the armory cont explosoin trigger 
  2355. function dlc2_m01_armory_cont_exp_entered_cb(player, trigger) 
  2356. 	if (Dlc2_m01_runtime.armory_cont_exp_triggered_by == nil) then 
  2357. 		Dlc2_m01_runtime.armory_cont_exp_triggered_by = player 
  2358. 		 
  2359. 		-- Play some dialog 
  2360. 		Dlc2_m01_threads.armory_explosion_dialog = thread_new("dlc2_m01_process_armory_explosion_dialog_thread", player) 
  2361. 	end 
  2362. 	 
  2363. 	continuous_explosion_follow_target_add(player)	 
  2364. end 
  2365.  
  2366. -- Callback when a player exits the armory cont explosoin trigger 
  2367. function dlc2_m01_armory_cont_exp_exited_cb(player, trigger) 
  2368. 	continuous_explosion_follow_target_remove(player) 
  2369.  
  2370. 	if (Dlc2_m01_runtime.armory_cont_exp_triggered_by == player) then 
  2371. 		if (thread_check_done(Dlc2_m01_threads.armory_explosion_dialog) == false) then 
  2372. 			thread_kill(Dlc2_m01_threads.armory_explosion_dialog) 
  2373. 			Dlc2_m01_threads.armory_explosion_dialog = INVALID_THREAD_HANDLE 
  2374. 		end 
  2375. 		 
  2376. 		Dlc2_m01_runtime.armory_cont_exp_triggered_by = nil 
  2377. 	end 
  2378. end 
  2379.  
  2380. -- Thread to process dialog for the armory continuous explosions 
  2381. function dlc2_m01_process_armory_explosion_dialog_thread(player) 
  2382. 	delay(3.0) 
  2383. 	 
  2384. 	if (Dlc2_m01_dialog_lines.player_exp_callout_02.ended ~= true) then 
  2385. 		Dlc2_m01_dialog_lines.player_exp_callout_02.persona = player 
  2386. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.player_exp_callout_02, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  2387. 		 
  2388. 		delay(8.0) 
  2389. 	end 
  2390. 	 
  2391. 	if (Dlc2_m01_dialog_lines.player_exp_callout_03.ended ~= true) then 
  2392. 		Dlc2_m01_dialog_lines.player_exp_callout_03.persona = player 
  2393. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.player_exp_callout_03, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  2394. 		 
  2395. 		delay(12.0) 
  2396. 	end		 
  2397. end 
  2398.  
  2399. -- Process the "rescue Kwilanna" objective (take2) 
  2400. function dlc2_m01_rescue_kwilanna_take2_process() 
  2401. 	-- Set the objective text and add an object indicator at the Armory 
  2402. 	objective_text(0, Dlc2_m01_objectives.rescue_kwilanna.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.rescue_kwilanna.icon)	 
  2403. 	marker_add(Dlc2_m01_characters.kwilanna, MINIMAP_ICON_USE, OI_ASSET_USE, OI_FLAGS_FULL, SYNC_ALL) 
  2404.  
  2405. 	-- Enable the trigger to resuce Kwilanna 
  2406. 	trigger_enable(Dlc2_m01_triggers.rescue_kwilanna, true) 
  2407. 	on_trigger("dlc2_m01_resuce_kwilanna_cb", Dlc2_m01_triggers.rescue_kwilanna) 
  2408. 	 
  2409. 	-- Enable the trigger around kwilanna 
  2410. 	Dlc2_m01_runtime.kwilanna_heli_radius_triggered = false 
  2411. 	trigger_enable(Dlc2_m01_triggers.tgr_kwilanna_heli_radius, true) 
  2412. 	on_trigger("dlc2_m01_kwilanna_heli_radius_cb", Dlc2_m01_triggers.tgr_kwilanna_heli_radius)	 
  2413. 	 
  2414. 	-- Kick off a thread to process the helicopter drop off at the armory heli pad 
  2415. 	Dlc2_m01_threads.armory_heli_drop_off = thread_new("dlc2_m01_process_helicopter_drop_off_thread", Dlc2_m01_groups.armory_drop_off) 
  2416.  
  2417. 	-- Wait until a player triggers the resuce Kwilanna animation 
  2418. 	Dlc2_m01_runtime.rescued_kwilanna = false 
  2419. 	Dlc2_m01_runtime.kwilanna_rescued_by = nil 
  2420. 	while(Dlc2_m01_runtime.rescued_kwilanna == false) do 
  2421. 		thread_yield() 
  2422. 	end 
  2423. 	 
  2424. 	dlc2_m01_rescue_kwilanna_take2_cleanup() 
  2425. end 
  2426.  
  2427. -- Clean-up the "rescue Kwilanna" objective (take2) 
  2428. -- 
  2429. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  2430. function dlc2_m01_rescue_kwilanna_take2_cleanup(exiting) 
  2431. 	-- Remove the marker 
  2432. 	marker_remove(Dlc2_m01_characters.kwilanna) 
  2433. 	 
  2434. 	-- Remove the marker at the Armory 
  2435. 	marker_remove(Dlc2_m01_navpoints.armory_location) 
  2436. 	marker_remove(Dlc2_m01_vfx.player_landing_flares[1])	 
  2437. 	 
  2438. 	-- Disable the trigger to rescue Kwilanna 
  2439. 	on_trigger("", Dlc2_m01_triggers.rescue_kwilanna) 
  2440. 	trigger_enable(Dlc2_m01_triggers.rescue_kwilanna, false) 
  2441. 	 
  2442. 	-- Disable the trigger for the radius around Kwilanna's helicopter 
  2443. 	on_trigger("", Dlc2_m01_triggers.tgr_kwilanna_heli_radius)	 
  2444. 	trigger_enable(Dlc2_m01_triggers.tgr_kwilanna_heli_radius, false)	 
  2445.  
  2446. 	-- Clear the Jump prompt, if one of the players is still in the helicopter 
  2447. 	for i, player in pairs(Dlc2_m01_player_list) do 
  2448. 		hud_prompt_clear(player) 
  2449. 	end 
  2450. 	 
  2451. 	if (exiting == true) then 
  2452. 		-- Remove the players weapon load-out 
  2453. 		dlc2_m01_helper_remove_temp_weapons(Dlc2_m01_tweak_values.armory_inventory_take2)	 
  2454. 	end 
  2455. end 
  2456.  
  2457. -- Process the "get into the escape vehicle" objective (take2) 
  2458. function dlc2_m01_get_in_escape_vehicle_process() 
  2459. 	-- Set the objective text 
  2460. 	objective_text(0, Dlc2_m01_objectives.get_in_helicopter.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.get_in_helicopter.icon) 
  2461. 	 
  2462. 	-- Clear enemeis to always seeing the player 
  2463. 	for i, npc in pairs(Dlc2_m01_groups.armory_take_02.npcs) do 
  2464. 		set_always_sees_player_flag(npc, false) 
  2465. 	end 
  2466. 	 
  2467. 	-- Get the gang into the helicopter 
  2468. 	dlc2_m01_helper_get_gang_into_vehicle(Dlc2_m01_groups.kwilanna_heli.heli.vehicle) 
  2469. 	 
  2470. 	-- Turn off police notoriety again 
  2471. 	notoriety_force_no_spawn("Police", true)		 
  2472.  
  2473. 	-- Clean-up 
  2474. 	dlc2_m01_get_in_escape_vehicle_cleanup(false) 
  2475. end 
  2476.  
  2477. -- Clean-up the "get into the escape vehicle" objective (take2) 
  2478. -- 
  2479. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  2480. function dlc2_m01_get_in_escape_vehicle_cleanup(exiting) 
  2481. 	-- Remove the marker 
  2482. 	marker_remove(Dlc2_m01_groups.kwilanna_heli.heli.vehicle) 
  2483. 	 
  2484. 	-- Disable the trigger for the Armory Island 
  2485. 	on_trigger("", Dlc2_m01_triggers.armory_island) 
  2486. 	on_trigger_exit("", Dlc2_m01_triggers.armory_island)	 
  2487. 	trigger_enable(Dlc2_m01_triggers.armory_island, false) 
  2488. 	 
  2489. 	-- Disable the trigger for the landing area 
  2490. 	on_trigger("", Dlc2_m01_triggers.player_landing_area) 
  2491. 	trigger_enable(Dlc2_m01_triggers.player_landing_area, false)	 
  2492. 	 
  2493. 	-- Disable the trigger for the landing bulls eye 
  2494. 	trigger_enable(Dlc2_m01_triggers.player_landing_bulls_eye, false)	 
  2495. 	 
  2496. 	-- Enable peds and vehicles 
  2497. 	--spawning_pedestrians(true) 
  2498. 	--spawning_vehicles(true)		 
  2499. 	 
  2500. 	-- Unregister our callback for vehicle entry 
  2501. 	on_vehicle_enter("", Dlc2_m01_groups.kwilanna_heli.heli.vehicle) 
  2502. 	on_vehicle_exit("", Dlc2_m01_groups.kwilanna_heli.heli.vehicle) 
  2503. end 
  2504.  
  2505.  
  2506. --[[ 
  2507. 	Checkpoint 03 - Escape Sequence Rail Start 
  2508. 	--]] 
  2509.  
  2510. -- Initialize the escape start sequence 
  2511. function dlc2_m01_escape_start_initialize() 
  2512. 	-- Disable parking spots 
  2513. 	parking_spot_disable_all(true) 
  2514. 	 
  2515. 	-- Create some guys at the Armory helipad 
  2516. 	group_create(Dlc2_m01_groups.kwilanna_heli.name, true) 
  2517. 	group_create(Dlc2_m01_groups.armory_take_02, true) 
  2518. 	 
  2519. 	-- Create the escape car (will be used when the heli crashes) 
  2520. 	local veh_hitpoints = Dlc2_m01_tweak_values.player_veh_hitpoints 
  2521. 	if (difficulty_get_level() == 2) then 
  2522. 		veh_hitpoints = Dlc2_m01_tweak_values.player_veh_hitpoints_hc 
  2523. 	end			 
  2524. 	dlc2_m01_setup_escape_vehicle(veh_hitpoints) 
  2525. 	 
  2526. 	-- Setup the get away car drop off group 
  2527. 	dlc2_m01_setup_get_away_car_drop_off_group() 
  2528. 	 
  2529. 	-- Setup the downtown camera men 
  2530. 	dlc2_m01_setup_downtown_camera_men_01() 
  2531. 	 
  2532. 	-- Create the camera men helicopter 
  2533. 	dlc2_m01_setup_heli_cameramen() 
  2534. 	 
  2535. 	-- Hide some characters at the armory, as they don't make sense when starting from the checkpoint 
  2536. 	character_hide("npc_armory_take2_19") 
  2537. 	 
  2538. 	-- Teleport the player's to the start navs 
  2539. 	teleport_coop(Dlc2_m01_checkpoints.escape_start.player_navs[1], Dlc2_m01_checkpoints.escape_start.player_navs[2], true) 
  2540. 	 
  2541. 	-- Make Kwilanna a homie 
  2542. 	party_add(Dlc2_m01_characters.kwilanna, LOCAL_PLAYER) 
  2543. 	on_dismiss("dlc2_m01_kwilanna_dismissed_cb", Dlc2_m01_characters.kwilanna)	 
  2544. 	 
  2545. 	-- Put eveyone into the helicopter 
  2546. 	vehicle_suppress_npc_exit(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, true) 
  2547. 	vehicle_enter_teleport(Dlc2_m01_characters.kwilanna, Dlc2_m01_groups.kwilanna_heli.heli.vehicle, 0, true) 
  2548. 	for i, player in pairs(Dlc2_m01_player_list) do 
  2549. 		-- Clear the Jump prompt, if one of the players is still in the helicopter 
  2550. 		hud_prompt_clear(player) 
  2551. 		-- i starts at index 1, which coincidently is the seat we want to put the first player in 
  2552. 		vehicle_enter_teleport(player, Dlc2_m01_groups.kwilanna_heli.heli.vehicle, i, true) 
  2553. 		set_player_can_enter_exit_vehicles(player, false) 
  2554. 	end 
  2555.  
  2556. 	-- Set fake notoriety 
  2557. 	hud_set_fake_notoriety("Police", true, Dlc2_m01_tweak_values.fake_notoriety_level) 
  2558. 	 
  2559. 	-- Give the players weapon load-out 
  2560. 	dlc2_m01_helper_give_temp_weapons(Dlc2_m01_tweak_values.armory_inventory_take2)		 
  2561. 	 
  2562. 	-- Load the film grain UI 
  2563. 	dlc2_m01_load_film_grain() 
  2564. 	 
  2565. 	-- Start music and say action 
  2566. 	audio_object_post_event("Take_Two")	 
  2567. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.director_generic_action, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  2568. end 
  2569.  
  2570. -- Process the escape start sequence 
  2571. function dlc2_m01_escape_start_process() 
  2572. 	-- Set the objective text and add an object indicator at the Saints HQ 
  2573. 	objective_text(0, Dlc2_m01_objectives.escape_nat_guard.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.escape_nat_guard.icon)	 
  2574. 	marker_add(Dlc2_m01_navpoints.saints_hq, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_FULL, SYNC_ALL) 
  2575. 	 
  2576. 	-- Dont' allow anyone in the get away car to be pulled out 
  2577. 	set_unjackable_flag(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, true) 
  2578. 	vehicle_set_keyframed_physics(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, false) 
  2579. 	 
  2580. 	-- Make everyone in the car invulnerable, and set the player damage multipliers 
  2581. 	dlc2_m01_helper_set_kwilanna_invulnerable(true, false) 
  2582. 	for i, player in pairs(Dlc2_m01_player_list) do 
  2583. 		turn_invulnerable(player) 
  2584. 		 
  2585. 		if (difficulty_get_level() == 2) then 
  2586. 			character_set_attack_multiplier(player, Dlc2_m01_tweak_values.rail_player_atk_mult_start_hc) 
  2587. 		else 
  2588. 			character_set_attack_multiplier(player, Dlc2_m01_tweak_values.rail_player_atk_mult_start) 
  2589. 		end 
  2590. 		character_ragdoll_set_last_valid_position(player, "nav_armory_get_away_stop", true) 
  2591. 	end 
  2592. 	character_ragdoll_set_last_resort_position("nav_armory_get_away_stop") 
  2593. 	 
  2594. 	-- Enable the trigger for when the player's heli gets shot and when the player's should bail 
  2595. 	trigger_enable(Dlc2_m01_triggers.player_heli_shot, true) 
  2596. 	on_trigger("dlc2_m01_player_heli_shot_cb", Dlc2_m01_triggers.player_heli_shot) 
  2597. 	 
  2598. 	-- Enable the trigger for when the players bail out of the heli 
  2599. 	trigger_enable(Dlc2_m01_triggers.player_heli_bail, true) 
  2600. 	on_trigger("dlc2_m01_player_heli_bail_cb", Dlc2_m01_triggers.player_heli_bail) 
  2601. 	 
  2602. 	-- Enable trigger to call out helis 
  2603. 	trigger_enable(Dlc2_m01_triggers.call_out_helis, true) 
  2604. 	on_trigger("dlc2_m01_call_out_helis_cb", Dlc2_m01_triggers.call_out_helis) 
  2605. 	 
  2606. 	-- Disable the armory island exit trigger 
  2607. 	on_trigger_exit("", Dlc2_m01_triggers.armory_island) 
  2608. 	 
  2609. 	-- Disable parking spawns 
  2610. 	parking_spot_disable_all(true) 
  2611. 	 
  2612. 	-- Setup all of the ambushes 
  2613. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.escape_start) do 
  2614. 		dlc2_m01_setup_rail_ambush(ambush) 
  2615. 	end 
  2616. 	 
  2617. 	-- Set the armory camera persue heli going 
  2618. 	thread_new("dlc2_m01_process_ambush_vehicle_thread", Dlc2_m01_groups.armory_camera_persue_heli.heli, "heli_path", -1, false, 1.0, true, Dlc2_m01_groups.kwilanna_heli.heli.vehicle) 
  2619. 	 
  2620. 	-- Disable Police notoriety 
  2621. 	notoriety_force_no_spawn("Police", true) 
  2622. 	 
  2623. 	-- Make the helicopter and escape humvee invulnerable 
  2624. 	turn_invulnerable(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  2625. 	turn_invulnerable(Dlc2_m01_groups.kwilanna_heli.heli.vehicle) 
  2626. 	 
  2627. 	-- Play some dialog 
  2628. 	dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.player_heli_escape_start, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  2629.  
  2630. 	-- Fly the helicopter path 
  2631. 	helicopter_set_dont_use_constraints(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, false) 
  2632. 	helicopter_fly_to_direct_dont_stop(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, 100, "path_player_rail_heli_01") 
  2633. 	helicopter_fly_to_direct_dont_stop(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, 100, "path_player_rail_heli_02") 
  2634.  
  2635. 	-- Make it crash 
  2636. 	Dlc2_m01_threads.player_heli_crash = thread_new("dlc2_m01_process_play_heli_crash_thread") 
  2637.  
  2638. 	-- Cleanup 
  2639. 	dlc2_m01_escape_start_cleanup(false) 
  2640. end 
  2641.  
  2642. -- Cleanup the escape start seqeunce 
  2643. -- 
  2644. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  2645. function dlc2_m01_escape_start_cleanup(exiting) 
  2646. 	-- Remove the marker 
  2647. 	marker_remove(Dlc2_m01_navpoints.saints_hq) 
  2648. 	 
  2649. 	-- Clean-up the cameramen 
  2650. 	for i, npc in pairs(Dlc2_m01_groups.armory_camera_men.npcs) do 
  2651. 		dlc2_m01_helper_cleanup_camera_man(npc) 
  2652. 	end		 
  2653.  
  2654. 	-- The players are now outside of the armory, so it's safe to clean up some script groups to make room for more awesome 
  2655. 	if (group_is_loaded(Dlc2_m01_groups.courtesy_veh_01.name) == true) then 
  2656. 		group_destroy(Dlc2_m01_groups.courtesy_veh_01.name) 
  2657. 	end 
  2658. 	if (group_is_loaded(Dlc2_m01_groups.armory_take_02.name) == true) then 
  2659. 		group_destroy(Dlc2_m01_groups.armory_take_02.name) 
  2660. 	end 
  2661. 	if (group_is_loaded(Dlc2_m01_groups.armory_drop_off.name) == true) then 
  2662. 		group_destroy(Dlc2_m01_groups.armory_drop_off.name) 
  2663. 	end 
  2664. 	if (group_is_loaded(Dlc2_m01_groups.armory_camera_men.name) == true) then 
  2665. 		group_destroy(Dlc2_m01_groups.armory_camera_men.name) 
  2666. 	end 
  2667. 	if (group_is_loaded(Dlc2_m01_groups.armory_car_husks.name) == true) then 
  2668. 		group_destroy(Dlc2_m01_groups.armory_car_husks.name) 
  2669. 	end	 
  2670. 	 
  2671. 	-- Clean-up the car husk VFX 
  2672. 	for i, vfx in pairs(Dlc2_m01_vfx.car_husks) do 
  2673. 		if (vfx.handle ~= -1) then 
  2674. 			effect_stop(vfx.handle) 
  2675. 			vfx.handle = -1 
  2676. 		end 
  2677. 	end 
  2678. 	 
  2679. 	-- Clean-up all of the ambushes 
  2680. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.escape_start) do 
  2681. 		dlc2_m01_cleanup_rail_ambush(ambush) 
  2682. 	end	 
  2683. 	 
  2684. 	-- Disable the trigger for when the player's heli gets shot 
  2685. 	trigger_enable(Dlc2_m01_triggers.player_heli_shot, false) 
  2686. 	on_trigger("", Dlc2_m01_triggers.player_heli_shot) 
  2687. 	 
  2688. 	trigger_enable(Dlc2_m01_triggers.player_heli_bail, false) 
  2689. 	on_trigger("", Dlc2_m01_triggers.player_heli_bail)	 
  2690. 	 
  2691. 	-- Disable trigger to call out helis 
  2692. 	trigger_enable(Dlc2_m01_triggers.call_out_helis, false) 
  2693. 	on_trigger("", Dlc2_m01_triggers.call_out_helis)	 
  2694. end 
  2695.  
  2696. -- Callback when the player's helicopter enter's the trigger where the helicopter is shot down 
  2697. function dlc2_m01_player_heli_shot_cb() 
  2698. 	if (Dlc2_m01_runtime.heli_shot_down == false) then 
  2699. 		Dlc2_m01_runtime.heli_shot_down = true 
  2700. 	 
  2701. 		vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, true, false) 
  2702. 		Dlc2_m01_vfx.player_heli_fire.handle = effect_play_on_script_object(Dlc2_m01_vfx.player_heli_fire.name, Dlc2_m01_groups.kwilanna_heli.heli.vehicle, "exhaust", true) 
  2703. 		 
  2704. 		-- Update the music 
  2705. 		audio_object_post_event("Heli_Crash")			 
  2706.  
  2707. 		delay(0.5) 
  2708. 		 
  2709. 		-- Play some dialog 
  2710. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.player_heli_shot, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  2711. 		thread_yield() 
  2712. 		dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.player_heli_crash, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  2713. 		 
  2714. 		delay(25.0) 
  2715. 		 
  2716. 		effect_stop(Dlc2_m01_vfx.player_heli_fire.handle) 
  2717. 	end 
  2718. end 
  2719.  
  2720. -- Callback when the players should bail from the escape helicopter 
  2721. function dlc2_m01_player_heli_bail_cb() 
  2722. 	trigger_enable(Dlc2_m01_triggers.player_heli_bail, false) 
  2723.  
  2724. 	for i, player in pairs(Dlc2_m01_player_list) do 
  2725. 		set_player_can_enter_exit_vehicles(player, true) 
  2726. 		vehicle_exit_do(player, false, true, true) 
  2727. 		character_ragdoll(player, 1500) 
  2728. 		turn_vulnerable(player) 
  2729. 	end 
  2730. end 
  2731.  
  2732. -- Callback when the trigger to call out helis is it 
  2733. function dlc2_m01_call_out_helis_cb() 
  2734. 	if (Dlc2_m01_runtime.called_out_helis == false) then 
  2735. 		Dlc2_m01_runtime.called_out_helis = true 
  2736. 		 
  2737. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.heli_call_out, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  2738. 	end 
  2739. end 
  2740.  
  2741. -- Thread to process the helicopter crash 
  2742. function dlc2_m01_process_play_heli_crash_thread() 
  2743. 	-- Make everyone bail from the helicopter 
  2744. 	vehicle_suppress_npc_exit(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, false) 
  2745. 	vehicle_exit_do(Dlc2_m01_characters.kwilanna, false, true, true) 
  2746. 	character_set_never_catch_fire(Dlc2_m01_characters.kwilanna, true) 
  2747. 	character_ragdoll(Dlc2_m01_characters.kwilanna, 2000) 
  2748.  
  2749. 	delay(3.0) 
  2750. 	turn_vulnerable(Dlc2_m01_groups.kwilanna_heli.heli.vehicle) 
  2751. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, true, true) 
  2752.  
  2753. 	delay(5.0) 
  2754. 	character_set_never_catch_fire(Dlc2_m01_characters.kwilanna, false) 
  2755. 	dlc2_m01_helper_set_kwilanna_invulnerable(false) 
  2756. end 
  2757.  
  2758. -- Process the armory take2 wrap 
  2759. function dlc2_m01_process_armory_take2_wrap() 
  2760. 	-- Clear objective text 
  2761. 	objective_text_clear(0) 
  2762. 	 
  2763. 	-- Enable the trigger to keep the player at the crash site 
  2764. 	trigger_enable(Dlc2_m01_triggers.player_heli_crash_area, true) 
  2765. 	Dlc2_m01_threads.heli_crash_area = thread_new("dlc2_m01_keep_players_in_crash_area_thread") 
  2766. 	 
  2767. 	npc_combat_enable(Dlc2_m01_characters.kwilanna, false) 
  2768. 	 
  2769. 	-- Add the radius to the minimap 
  2770. 	minimap_icon_add_radius("nav_armory_get_away_stop", trigger_get_radius(Dlc2_m01_triggers.player_heli_crash_area)) 
  2771.  
  2772. 	delay(3.0) 
  2773. 	 
  2774. 	character_ragdoll_clear_last_resort_position() 
  2775. 	 
  2776. 	-- Play some dialog 
  2777. 	dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.player_heli_downed, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  2778. 	while(dlc2_m01_helper_dialog_check_done(Dlc2_m01_conversations.player_heli_downed) == false) do 
  2779. 		thread_yield() 
  2780. 	end 
  2781. 	 
  2782. 	-- Director yells cut 
  2783. 	dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.director_cut_good, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  2784. 	delay(1.0) 
  2785. 	 
  2786. 	dlc_gis_film_grain_unload() 
  2787. 	 
  2788. 	audio_object_post_event("Cut") 
  2789. 	 
  2790. 	-- Make Kwilanna invulnerable 
  2791. 	dlc2_m01_helper_set_kwilanna_invulnerable(true, false) 
  2792. 	 
  2793. 	-- Manually update all the NPCs we directly spawning in the mission 
  2794. 	for i, npc in pairs(Dlc2_m01_groups.dt_camera_men_01.npcs) do 
  2795. 		dlc2_m01_make_npc_idle(npc) 
  2796. 	end 
  2797. 	 
  2798. 	-- Make the player's invulnerable and revive them if they're downed 
  2799. 	for i, player in pairs(Dlc2_m01_player_list) do 
  2800. 		if (human_is_downed(player) == true) then 
  2801. 			player_revive(player) 
  2802. 		end 
  2803. 		 
  2804. 		turn_invulnerable(player) 
  2805. 	end 
  2806. 	 
  2807. 	delay(0.5) 
  2808.  
  2809. 	-- Wait for the dialog to finish 
  2810. 	while(dlc2_m01_helper_dialog_check_done(Dlc2_m01_conversations.director_cut_good) == false) do 
  2811. 		thread_yield() 
  2812. 	end 
  2813. 	 
  2814. 	while(Dlc2_m01_runtime.player_outside_crash_area == true) do 
  2815. 		thread_yield() 
  2816. 	end	 
  2817.  
  2818. 	dlc2_m01_cleanup_armory_take2_wrap() 
  2819. end 
  2820.  
  2821. -- Clean-up the armory take 2 wrap 
  2822. -- 
  2823. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  2824. function dlc2_m01_cleanup_armory_take2_wrap(exiting) 
  2825. 	-- Disable the trigger for the crash area 
  2826. 	trigger_enable(Dlc2_m01_triggers.player_heli_crash_area, false) 
  2827. 	 
  2828. 	if (thread_check_done(Dlc2_m01_threads.heli_crash_area) == false) then 
  2829. 		thread_kill(Dlc2_m01_threads.heli_crash_area) 
  2830. 	end 
  2831. 	minimap_icon_remove_radius("nav_armory_get_away_stop")	 
  2832. end 
  2833.  
  2834. -- Thread to process the critical timer if either player leaves the heli crash area 
  2835. function dlc2_m01_keep_players_in_crash_area_thread() 
  2836. 	Dlc2_m01_runtime.player_outside_crash_area = false 
  2837. 	while(true) do 
  2838. 		if (object_is_in_trigger(Dlc2_m01_triggers.player_heli_crash_area, LOCAL_PLAYER) == true and (coop_is_active() == false or object_is_in_trigger(Dlc2_m01_triggers.player_heli_crash_area, REMOTE_PLAYER) == true) ) then 
  2839. 			if (Dlc2_m01_runtime.player_outside_crash_area == true) then 
  2840. 				hud_critical_timer_stop() 
  2841. 				Dlc2_m01_runtime.player_outside_crash_area = false 
  2842. 			end 
  2843. 		else 
  2844. 			if (Dlc2_m01_runtime.player_outside_crash_area == false) then 
  2845. 				hud_critical_timer_set(10000, "DLC2_M02_OBJ_MISSION_START", "dlc2_m01_player_disobey_failure_cb") 
  2846. 				Dlc2_m01_runtime.player_outside_crash_area = true 
  2847. 			end 
  2848. 		end 
  2849. 		 
  2850. 		thread_yield() 
  2851. 	end 
  2852. end 
  2853.  
  2854. -- Process stealing the Humvee 
  2855. function dlc2_m01_process_steal_humvee() 
  2856. 	-- Load the film grain 
  2857. 	delay(1.0) 
  2858. 	dlc2_m01_load_film_grain() 
  2859. 	 
  2860. 	delay(0.8) 
  2861.  
  2862. 	-- Update the music 
  2863. 	audio_object_post_event("Action_02")		 
  2864. 	 
  2865. 	-- Mark Kwilanna vulnerable again 
  2866. 	dlc2_m01_helper_set_kwilanna_invulnerable(false) 
  2867. 	npc_combat_enable(Dlc2_m01_characters.kwilanna, true) 
  2868.  
  2869. 	-- Make all the cameramen active again 
  2870. 	for i, npc in pairs(Dlc2_m01_groups.dt_camera_men_01.npcs) do 
  2871. 		npc_combat_enable(npc, true) 
  2872. 		turn_vulnerable(npc) 
  2873. 		set_script_animation_state(npc, nil) 
  2874. 	end 
  2875. 	 
  2876. 	-- Make the player's invulnerable and revive them if they're downed 
  2877. 	for i, player in pairs(Dlc2_m01_player_list) do 
  2878. 		turn_vulnerable(player) 
  2879. 	end	 
  2880. 	 
  2881. 	vehicle_show(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  2882. 	group_show(Dlc2_m01_groups.dt_get_away_car_drop_off.name) 
  2883.  
  2884. 	-- Drive the Humvee to the helicopter crash site 
  2885. 	set_unenterable_for_player(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  2886. 	vehicle_pathfind_to(Dlc2_m01_groups.armory_get_away_car.vehicle, Dlc2_m01_groups.dt_get_away_car_drop_off.path, true, true) -- navmesh pathfind, stop at goal 
  2887. 	ai_add_enemy_target(Dlc2_m01_characters.kwilanna, Dlc2_m01_groups.dt_get_away_car_drop_off.npcs[1], ATTACK_NOW_NEVER_LOSE) 
  2888. 	 
  2889. 	-- Make eveyone vulnerable 
  2890. 	for i, npc in pairs(Dlc2_m01_groups.dt_get_away_car_drop_off.npcs) do 
  2891. 		set_ignore_ai_flag(npc, false) 
  2892. 		turn_vulnerable(npc) 
  2893. 	end	 
  2894.  
  2895. 	-- Play some dialog about stealing the humvee 
  2896. 	dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.take_car, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  2897. 	vehicle_exit_group(Dlc2_m01_groups.dt_get_away_car_drop_off.npcs) 
  2898.  
  2899. 	-- Set the objective text and make the enemies in the humvee mission targets (objective) 
  2900. 	objective_text(0, Dlc2_m01_objectives.kill_nat_guard.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.kill_nat_guard.icon) 
  2901. 	process_enemy_set(Dlc2_m01_groups.dt_get_away_car_drop_off.npcs) 
  2902. 	 
  2903. 	delay(1.0) 
  2904. 	 
  2905. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.director_generic_positive, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  2906. 	 
  2907. 	-- Set the objective text to get into the Humvee 
  2908. 	objective_text(0, Dlc2_m01_objectives.get_in_escape_vehicle.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.get_in_escape_vehicle.icon)	 
  2909. 	 
  2910. 	-- Make everyone get into the Humvee 
  2911. 	dlc2_m01_helper_get_gang_into_vehicle(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  2912. 	 
  2913. 	-- Make the Humvee vulnerable 
  2914. 	turn_vulnerable(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  2915. 	 
  2916. 	-- Disable combat for Kwilanna again 
  2917. 	npc_combat_enable(Dlc2_m01_characters.kwilanna, false) 	 
  2918. 	 
  2919. 	-- Clean-up 
  2920. 	dlc2_m01_cleanup_steal_humvee(false) 
  2921. end 
  2922.  
  2923. -- Cleanup the escape start seqeunce 
  2924. -- 
  2925. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  2926. function dlc2_m01_cleanup_steal_humvee(exiting) 
  2927. 	-- Remove the callback and marker on the humvee 
  2928. 	marker_remove(Dlc2_m01_groups.armory_get_away_car.vehicle)  
  2929. 	on_vehicle_enter("", Dlc2_m01_groups.armory_get_away_car.vehicle) 
  2930. 	on_vehicle_exit("", Dlc2_m01_groups.armory_get_away_car.vehicle) 
  2931. end 
  2932.  
  2933. function dlc2_m01_setup_get_away_car_drop_off_group() 
  2934. 	vehicle_hide(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  2935.  
  2936. 	-- Create the NG enemies and place them in the escape vehicle 
  2937. 	group_create_hidden(Dlc2_m01_groups.dt_get_away_car_drop_off.name, true) 
  2938. 	vehicle_enter_group_teleport(Dlc2_m01_groups.dt_get_away_car_drop_off.npcs, Dlc2_m01_groups.armory_get_away_car.vehicle) 
  2939. 	 
  2940. 	-- Show the vehicle and character and make the characters invulnerable 
  2941. 	for i, npc in pairs(Dlc2_m01_groups.dt_get_away_car_drop_off.npcs) do 
  2942. 		set_ignore_ai_flag(npc, true) 
  2943. 		turn_invulnerable(npc) 
  2944. 	end	 
  2945. end 
  2946.  
  2947.  
  2948. --[[ 
  2949. 	Checkpoint 04 - Downtown Rail Sequence 02 (north island) 
  2950. 	--]] 
  2951.  
  2952. -- Initialize the second downtown rail section (north island) 
  2953. function dlc2_m01_rail_dt_02_initialize() 
  2954. 	local veh_hitpoints = Dlc2_m01_tweak_values.player_veh_hitpoints 
  2955. 	if (difficulty_get_level() == 2) then 
  2956. 		veh_hitpoints = Dlc2_m01_tweak_values.player_veh_hitpoints_hc 
  2957. 	end 
  2958.  
  2959. 	-- Do common rail setup 
  2960. 	dlc2_m01_setup_rail_common(Dlc2_m01_checkpoints.rail_dt_02.player_navs, Dlc2_m01_navpoints.player_vehicle_chk04, true, veh_hitpoints) 
  2961. 	 
  2962. 	-- Update the music 
  2963. 	audio_object_post_event("To_The_Bridge")	 
  2964. 	Dlc2_m01_runtime.played_to_bridge_music = true 
  2965. 	 
  2966. 	-- Yell action 
  2967. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.director_generic_action, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  2968. end 
  2969.  
  2970. -- Process the second downtown rail section (north island) 
  2971. function dlc_m01_rail_sequence_dt_loop_02_process() 
  2972. 	-- Change the objective text 
  2973. 	objective_text(0, Dlc2_m01_objectives.destroy_pursuers.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.destroy_pursuers.icon) 
  2974.  
  2975. 	-- Setup all of the ambushes 
  2976. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.dt_island_02) do 
  2977. 		dlc2_m01_setup_rail_ambush(ambush) 
  2978. 	end 
  2979. 	 
  2980. 	-- Set the player attack multiplier 
  2981. 	for i, player in pairs(Dlc2_m01_player_list) do 
  2982. 		if (difficulty_get_level() == 2) then 
  2983. 			character_set_attack_multiplier(player, Dlc2_m01_tweak_values.rail_player_atk_mult_dt2_hc) 
  2984. 		else 
  2985. 			character_set_attack_multiplier(player, Dlc2_m01_tweak_values.rail_player_atk_mult_dt2) 
  2986. 		end 
  2987. 	end 
  2988. 	 
  2989. 	-- Setup the two conversation triggers 
  2990. 	on_trigger("dlc2_m01_assault_drive_01_cb", Dlc2_m01_triggers.convo_assault_drive_01) 
  2991. 	trigger_enable(Dlc2_m01_triggers.convo_assault_drive_01, true) 
  2992. 	on_trigger("dlc2_m01_assault_drive_02_cb", Dlc2_m01_triggers.convo_assault_drive_02) 
  2993. 	trigger_enable(Dlc2_m01_triggers.convo_assault_drive_02, true) 
  2994. 	 
  2995. 	-- Kick of a thread to process the player's rail path 
  2996. 	Dlc2_m01_threads.rail_loop_process = thread_new("dlc2_m01_process_rail_loop", Dlc2_m01_rail_loops.dt_island_02) 
  2997. 	 
  2998. 	delay(3.0) 
  2999. 	 
  3000. 	-- Enable parking spawns 
  3001. 	parking_spot_disable_all(false)		 
  3002. 	 
  3003. 	-- Destroy the dt cameramen 01 group (cannot be release to world since they have a mission only wepaon equipped) 
  3004. 	for i, npc in pairs(Dlc2_m01_groups.dt_camera_men_01.npcs) do 
  3005. 		dlc2_m01_helper_cleanup_camera_man(npc) 
  3006. 	end			 
  3007. 	if (group_is_loaded(Dlc2_m01_groups.dt_camera_men_01.name) == true) then 
  3008. 		group_destroy(Dlc2_m01_groups.dt_camera_men_01.name) 
  3009. 	end	 
  3010. 	 
  3011. 	-- Create the dt camera men 02 group 
  3012. 	group_create(Dlc2_m01_groups.dt_camera_men_02.name, true) 
  3013. 	for i, npc in pairs(Dlc2_m01_groups.dt_camera_men_02.npcs) do 
  3014. 		dlc2_m01_helper_setup_camera_man(npc) 
  3015. 	end	 
  3016. 	 
  3017. 	delay(12.0) 
  3018. 	 
  3019. 	-- Delay a little bit and then start notoriety spawning 
  3020. 	notoriety_force_no_spawn("Police", false) 
  3021. 	notoriety_set_min_and_max("Police", Dlc2_m01_tweak_values.dt_police_notoriety, Dlc2_m01_tweak_values.dt_police_notoriety) 
  3022. 	 
  3023. 	-- Start the rail explosions 
  3024. 	dlc2_m01_helper_setup_rail_explosions() 
  3025. 	 
  3026. 	-- Wait for the rail pathfind to finish 
  3027. 	while(thread_check_done(Dlc2_m01_threads.rail_loop_process) == false) do 
  3028. 		thread_yield() 
  3029. 	end 
  3030. 	 
  3031. 	-- Clean-up this portion of the mission 
  3032. 	dlc_m01_rail_sequence_dt_loop_02_cleanup(false) 
  3033. end 
  3034.  
  3035. -- Clean-up the second downtown rail section (north island) 
  3036. -- 
  3037. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  3038. function dlc_m01_rail_sequence_dt_loop_02_cleanup(exiting) 
  3039. 	-- Clean-up all of the ambushes 
  3040. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.dt_island_02) do 
  3041. 		dlc2_m01_cleanup_rail_ambush(ambush) 
  3042. 	end 
  3043. 	 
  3044. 	-- Destroy the dt cameramen 01 group (cannot be release to world since they have a mission only wepaon equipped) 
  3045. 	for i, npc in pairs(Dlc2_m01_groups.dt_camera_men_01.npcs) do 
  3046. 		dlc2_m01_helper_cleanup_camera_man(npc) 
  3047. 	end			 
  3048. 	if (group_is_loaded(Dlc2_m01_groups.dt_camera_men_01.name) == true) then 
  3049. 		group_destroy(Dlc2_m01_groups.dt_camera_men_01.name) 
  3050. 	end		 
  3051. 	 
  3052. 	-- Disable the two conversation triggers 
  3053. 	on_trigger("", Dlc2_m01_triggers.convo_assault_drive_01) 
  3054. 	trigger_enable(Dlc2_m01_triggers.convo_assault_drive_01, false) 
  3055. 	on_trigger("", Dlc2_m01_triggers.convo_assault_drive_02) 
  3056. 	trigger_enable(Dlc2_m01_triggers.convo_assault_drive_02, false)	 
  3057. end 
  3058.  
  3059. -- Callback for the assault drive convo trigger 01 
  3060. function dlc2_m01_assault_drive_01_cb() 
  3061. 	if (Dlc2_m01_runtime.assult_drive_convo_01_triggered == false) then 
  3062. 		Dlc2_m01_runtime.assult_drive_convo_01_triggered = true 
  3063. 		 
  3064. 		dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.humvee_driving_01, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  3065. 	end 
  3066. end 
  3067.  
  3068. -- Callback for the assault drive convo trigger 02 
  3069. function dlc2_m01_assault_drive_02_cb() 
  3070. 	if (Dlc2_m01_runtime.assult_drive_convo_02_triggered == false) then 
  3071. 		Dlc2_m01_runtime.assult_drive_convo_02_triggered = true 
  3072. 		 
  3073. 		dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.humvee_driving_02, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  3074. 	end 
  3075. end 
  3076.  
  3077.  
  3078. --[[ 
  3079. 	Checkpoint 05 - Alien ambush and NW rail section 
  3080. 	--]] 
  3081.  
  3082. -- Initialize the alien ambush 
  3083. function dlc2_m01_alien_ambush_initialize() 
  3084. 	local veh_hitpoints = Dlc2_m01_tweak_values.player_veh_hitpoints 
  3085. 	if (difficulty_get_level() == 2) then 
  3086. 		veh_hitpoints = Dlc2_m01_tweak_values.player_veh_hitpoints_hc 
  3087. 	end 
  3088.  
  3089. 	-- Do common rail setup 
  3090. 	dlc2_m01_setup_rail_common(Dlc2_m01_checkpoints.alien_ambush.player_navs, Dlc2_m01_navpoints.player_vehicle_chk05, true, veh_hitpoints) 
  3091. end 
  3092.  
  3093. -- Process the alien ambush 
  3094. function dlc2_m01_alien_ambush_process() 
  3095. 	-- Disable police notoriety spawns 
  3096. 	notoriety_force_no_spawn("Police", true) 
  3097.  
  3098. 	-- Setup all of the ambushes 
  3099. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.alien_ambush) do 
  3100. 		dlc2_m01_setup_rail_ambush(ambush) 
  3101. 	end 
  3102.  
  3103. 	-- Kick of a thread to process the player's rail path 
  3104. 	Dlc2_m01_threads.rail_loop_process = thread_new("dlc2_m01_process_rail_loop", Dlc2_m01_rail_loops.alien_ambush) 
  3105.  
  3106. 	-- Create the NG roadblock 
  3107. 	group_create_hidden(Dlc2_m01_groups.ng_bridge_roadblock.name, true) 
  3108. 	for i, vehicle_table in pairs(Dlc2_m01_groups.ng_bridge_roadblock.vehicles) do 
  3109. 		vehicle_suppress_npc_exit(vehicle_table.vehicle, true) 
  3110. 		vehicle_enter_group_teleport(vehicle_table.npcs, vehicle_table.vehicle) 
  3111. 		vehicle_disable_chase(vehicle_table.vehicle, true) 
  3112. 		vehicle_disable_flee(vehicle_table.vehicle, true) 
  3113. 		vehicle_prevent_explosion_fling(vehicle_table.vehicle, true) 
  3114. 		turn_invulnerable(vehicle_table.vehicle, true) 
  3115. 		 
  3116. 		-- If this is a helicopter, make it go idle (so it won't fall) 
  3117. 		if (get_vehicle_type(vehicle_table.vehicle) == VT_HELICOPTER) then 
  3118. 			helicopter_fly_to_do(vehicle_table.vehicle, -1, true, "", false, vehicle_table.hover_nav) 
  3119. 		end 
  3120. 	end 
  3121. 	group_show(Dlc2_m01_groups.ng_bridge_roadblock.name) 
  3122. 	 
  3123. 	-- Create the Alien Ambush group 
  3124. 	group_create_hidden(Dlc2_m01_groups.alien_bridge_ambush.name, true) 
  3125. 	for i, vehicle_table in pairs(Dlc2_m01_groups.alien_bridge_ambush.vehicles) do 
  3126. 		vehicle_suppress_npc_exit(vehicle_table.vehicle, true) 
  3127. 		vehicle_enter_group_teleport(vehicle_table.npcs, vehicle_table.vehicle) 
  3128. 		vehicle_disable_chase(vehicle_table.vehicle, true) 
  3129. 		vehicle_disable_flee(vehicle_table.vehicle, true) 
  3130. 		 
  3131. 		turn_invulnerable(vehicle_table.vehicle, true) 
  3132. 		for i, npc in pairs(vehicle_table.npcs) do 
  3133. 			turn_invulnerable(npc, true) 
  3134. 		end 
  3135. 	end 
  3136. 	 
  3137. 	-- Create the camera men 
  3138. 	group_create(Dlc2_m01_groups.nw_cameramen_01.name, false) -- don't block 
  3139. 	group_create(Dlc2_m01_groups.nw_cameramen_02.name, false) -- don't block 
  3140. 	 
  3141. 	-- Wait until the alien ambush has been triggered 
  3142. 	while(thread_check_done(Dlc2_m01_threads.rail_loop_process) == false) do 
  3143. 		thread_yield() 
  3144. 	end 
  3145. 	 
  3146. 	dlc2_m01_helper_stop_rail_explosions() 
  3147. 	 
  3148. 	-- Stop the player's vehicle and make it invulnerable 
  3149. 	vehicle_speed_cancel(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3150. 	vehicle_stop(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3151. 	turn_invulnerable(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3152. 	 
  3153. 	-- because the player is not driving, vehicle_stop is not clearing the accelerator, 
  3154. 	-- causing audio squeals.  Make sure it is stopped. 
  3155. 	vehicle_freeze(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3156. 	 
  3157. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.bridge_roadblock, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  3158. 	 
  3159. 	delay(1.0) 
  3160. 	 
  3161. 	-- If the player's vehicle is on fire, then just blow them up now (it's weird if they die in the camera cut) 
  3162. 	local smoking, fire = vehicle_get_smoke_and_fire_state(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3163. 	if (fire == true) then 
  3164. 		turn_vulnerable(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3165. 		vehicle_detonate(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3166. 		while(true) do 
  3167. 			thread_yield() 
  3168. 		end 
  3169. 	else 
  3170. 		-- Repair the player's vehicle (if they're not already on fire) 
  3171. 		local veh_hitpoints = Dlc2_m01_tweak_values.player_veh_nw_hitpoints 
  3172. 		if (difficulty_get_level() == 2) then 
  3173. 			veh_hitpoints = Dlc2_m01_tweak_values.player_veh_nw_hitpoints_hc 
  3174. 		end	 
  3175. 	 
  3176. 		set_max_hit_points(Dlc2_m01_groups.armory_get_away_car.vehicle, veh_hitpoints, true) 
  3177. 		vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.armory_get_away_car.vehicle, false, false)	 
  3178. 	end 
  3179. 	 
  3180. 	camera_look_through("nav_camera_look_through", 1.0)	 
  3181. 	 
  3182. 	delay(4.0) 
  3183. 	 
  3184. 	-- Make all of the alien spacecraft fade in and fire at their target navpoints 
  3185. 	for i, vehicle_table in pairs(Dlc2_m01_groups.alien_bridge_ambush.vehicles) do 
  3186. 		-- Fade in the vehicle and show the NPCs 
  3187. 		vehicle_show(vehicle_table.vehicle, true, 1.0) 
  3188. 		for j, npc in pairs(vehicle_table.npcs) do 
  3189. 			character_show(npc) 
  3190. 		end 
  3191. 		 
  3192. 		-- Fly towards the player 
  3193. 		helicopter_fly_to_do(vehicle_table.vehicle, 5, true, "", false, vehicle_table.fly_to_nav) 
  3194. 	 
  3195. 		-- Wait just a tad to stagger the planes warping in 
  3196. 		delay(0.5) 
  3197. 	end 
  3198. 	 
  3199. 	-- Teleport the player's vehicle so it is orientated correctly 
  3200. 	teleport_vehicle(Dlc2_m01_groups.armory_get_away_car.vehicle, "nav_player_rail_nw_01 005") 
  3201.  
  3202. 	-- Update the music 
  3203. 	audio_object_post_event("Alien_Invasion")		 
  3204. 	 
  3205. 	-- Process all the explosions for alien ambush 
  3206. 	Dlc2_m01_threads.alien_ambush_explosions = thread_new("dlc2_m01_alien_ambush_process_explosions") 
  3207. 	while(thread_check_done(Dlc2_m01_threads.alien_ambush_explosions) == false) do 
  3208. 		thread_yield() 
  3209. 	end 
  3210. 	 
  3211. 	delay(2.0) 
  3212. 	 
  3213. 	-- Go hostile towards the player 
  3214. 	for i, vehicle_table in pairs(Dlc2_m01_groups.alien_bridge_ambush.vehicles) do 
  3215. 		turn_vulnerable(vehicle_table.vehicle) 
  3216. 		for j, npc in pairs(vehicle_table.npcs) do 
  3217. 			set_attack_player_flag(npc, true) 
  3218. 			ai_add_enemy_target(npc, LOCAL_PLAYER, ATTACK_NOW_NEVER_LOSE) 
  3219. 			turn_vulnerable(npc) 
  3220. 		end 
  3221. 		 
  3222. 		thread_new("dlc2_m01_alien_ambush_process_alien_fire", vehicle_table.vehicle, Dlc2_m01_groups.armory_get_away_car.vehicle, 4.0) 
  3223.  
  3224. 		vehicle_disable_chase(vehicle_table.vehicle, false) 
  3225. 	end 
  3226. 	 
  3227. 	delay(1.0) 
  3228. 	 
  3229. 	camera_end_look_through(false) 
  3230. 	 
  3231. 	--Make the alien spacecraft fly their chase paths 
  3232. 	for i, vehicle_table in pairs(Dlc2_m01_groups.alien_bridge_ambush.vehicles) do 
  3233. 		vehicle_table.thread_id = thread_new("dlc2_m01_process_ambush_vehicle_thread", vehicle_table, "heli_follow", -1, false, Dlc2_m01_tweak_values.alien_default_hp_mult, true) 
  3234. 	end 
  3235. 	 
  3236. 	delay(1.0) 
  3237. 	 
  3238. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.director_generic_positive, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  3239. 	 
  3240. 	turn_vulnerable(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3241. 	 
  3242. 	-- Play some dialog 
  3243. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.aliens_attack, DLC2_M01_CONVO_PLAY_NEXT, 0.0)	 
  3244. end 
  3245.  
  3246. -- Clean-up the alien ambush 
  3247. -- 
  3248. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  3249. function dlc2_m01_alien_ambush_cleanup(exiting) 
  3250. 	-- Clean-up all of the ambushes 
  3251. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.alien_ambush) do 
  3252. 		dlc2_m01_cleanup_rail_ambush(ambush) 
  3253. 	end 
  3254. 	 
  3255. 	-- Destroy the DT camera men group (cannot be release to world since they have a mission only wepaon equipped) 
  3256. 	for i, npc in pairs(Dlc2_m01_groups.dt_camera_men_02.npcs) do 
  3257. 		dlc2_m01_helper_cleanup_camera_man(npc) 
  3258. 	end			 
  3259. 	if (group_is_loaded(Dlc2_m01_groups.dt_camera_men_02.name) == true) then 
  3260. 		group_destroy(Dlc2_m01_groups.dt_camera_men_02.name) 
  3261. 	end 
  3262. 	 
  3263. 	camera_end_look_through(true) 
  3264. 	 
  3265. 	-- Release the NG roadblock groups to the world 
  3266. 	release_to_world(Dlc2_m01_groups.ng_bridge_roadblock.name) 
  3267. end 
  3268.  
  3269. -- Process the alien spacecraft firing 
  3270. function dlc2_m01_alien_ambush_process_alien_fire(alien_vehicle, target_veh, fire_time, radius, shot_delay, pulse_time, pulse_delay) 
  3271. 	if (radius == nil) then 
  3272. 		radius = 3.5 
  3273. 	end 
  3274. 	if (shot_delay == nil) then 
  3275. 		shot_delay = 0.1 
  3276. 	end 
  3277. 	if (pulse_time == nil) then 
  3278. 		pulse_time = 1.0 
  3279. 	end 
  3280. 	if (pulse_delay == nil) then 
  3281. 		pulse_delay = 0.5 
  3282. 	end 
  3283.  
  3284. 	local elapsed_time = 0.0 
  3285. 	while(elapsed_time < fire_time and vehicle_is_destroyed(alien_vehicle) == false) do 
  3286. 		local pulse_elapsed_time = 0.0 
  3287. 		while(pulse_elapsed_time < pulse_time and vehicle_is_destroyed(alien_vehicle) == false) do 
  3288. 	 
  3289. 			helicopter_shoot_vehicle(alien_vehicle, target_veh, true, radius, true) 
  3290. 			pulse_elapsed_time = pulse_elapsed_time + get_frame_time() 
  3291. 			elapsed_time = elapsed_time + get_frame_time() 
  3292. 			 
  3293. 			delay(shot_delay) 
  3294. 		end 
  3295. 		 
  3296. 		delay(pulse_delay) 
  3297. 	end 
  3298. end 
  3299.  
  3300. -- Thread to proces all the things that go boom at the NG roadblock on the bridge 
  3301. function dlc2_m01_alien_ambush_process_explosions() 
  3302. 	-- Make all of the alien craft fire at their target navpoints 
  3303. 	for i, vehicle_table in pairs(Dlc2_m01_groups.alien_bridge_ambush.vehicles) do 
  3304. 		thread_new("dlc2_m01_alien_ambush_process_alien_fire", vehicle_table.vehicle, Dlc2_m01_groups.ng_bridge_roadblock.vehicles[i].vehicle, 8.0) 
  3305. 		delay(0.15) 
  3306. 	end 
  3307. 	 
  3308. 	delay(0.25) 
  3309. 	 
  3310. 	-- Start some smoke 
  3311. 	Dlc2_m01_vfx.bridge_smoke[1].handle = effect_play(Dlc2_m01_vfx.bridge_smoke[1].name, true) 
  3312. 	Dlc2_m01_vfx.bridge_smoke[2].handle = effect_play(Dlc2_m01_vfx.bridge_smoke[2].name, true) 
  3313. 	 
  3314. 	-- Make a heli crash and burn 
  3315. 	turn_vulnerable(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[8].vehicle) 
  3316. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[8].vehicle, true, true)	 
  3317. 	 
  3318. 	-- Pause before first explosion 
  3319. 	delay(1.75) 
  3320. 	 
  3321. 	-- First explosion flings SUV 04 
  3322. 	vehicle_prevent_explosion_fling(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[6].vehicle, false) 
  3323. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[6].vehicle, true, true) 
  3324. 	delay(0.1) 
  3325. 	turn_vulnerable(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[6].vehicle) 
  3326. 	explosion_create("Medium Bang", Dlc2_m01_navpoints.alien_ambush_explosions[1], nil, false) 
  3327. 	 
  3328. 	delay(0.3) 
  3329. 	 
  3330. 	-- Create the second explosions 
  3331. 	explosion_create("Medium Bang", Dlc2_m01_navpoints.alien_ambush_explosions[2], nil, false)	 
  3332. 	 
  3333. 	-- Create the third explosion which detontates SUV 02 
  3334. 	vehicle_prevent_explosion_fling(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[3].vehicle, false) 
  3335. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[3].vehicle, true, true) 
  3336. 	delay(0.1) 
  3337. 	turn_vulnerable(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[3].vehicle) 
  3338. 	explosion_create("Medium Bang", Dlc2_m01_navpoints.alien_ambush_explosions[3], nil, false)	 
  3339. 	 
  3340. 	delay(0.1) 
  3341. 	 
  3342. 	-- Make a heli crash and burn 
  3343. 	turn_vulnerable(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[7].vehicle) 
  3344. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[7].vehicle, true, true) 
  3345. 	 
  3346. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.car_chase_explosions, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  3347. 	 
  3348. 	-- Explosion 4 kills tank2 
  3349. 	vehicle_prevent_explosion_fling(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[2].vehicle, false) 
  3350. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[2].vehicle, true, true) 
  3351. 	delay(0.1) 
  3352. 	turn_vulnerable(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[2].vehicle) 
  3353. 	vehicle_detonate(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[2].vehicle) 
  3354. 	explosion_create("Medium Bang", Dlc2_m01_navpoints.alien_ambush_explosions[4], nil, false) 
  3355. 	 
  3356. 	delay(0.3) 
  3357. 	 
  3358. 	-- Hide the tank corpse 
  3359. 	vehicle_hide(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[2].vehicle) 
  3360. 	 
  3361. 	-- Explosion 5 kills tank1 and other SUV 
  3362. 	vehicle_prevent_explosion_fling(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[1].vehicle, false) 
  3363. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[1].vehicle, true, true) 
  3364. 	delay(0.1) 
  3365. 	vehicle_prevent_explosion_fling(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[3].vehicle, false) 
  3366. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[3].vehicle, true, true) 
  3367. 	delay(0.1) 
  3368. 	turn_vulnerable(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[1].vehicle) 
  3369. 	turn_vulnerable(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[3].vehicle) 
  3370. 	vehicle_detonate(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[1].vehicle) 
  3371. 	explosion_create("Medium Bang", Dlc2_m01_navpoints.alien_ambush_explosions[5], nil, false)	 
  3372. 	 
  3373. 	delay(0.2) 
  3374. 	 
  3375. 	-- Explosion 6 
  3376. 	explosion_create("Medium Bang", Dlc2_m01_navpoints.alien_ambush_explosions[6], nil, false)	 
  3377. 	 
  3378. 	delay(0.1) 
  3379. 	 
  3380. 	-- Hide the tank corpse 
  3381. 	vehicle_hide(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[1].vehicle)	 
  3382. 	 
  3383. 	-- Explosion 7 kills lsat SUV 
  3384. 	vehicle_prevent_explosion_fling(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[5].vehicle, false) 
  3385. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[5].vehicle, true, true) 
  3386. 	delay(0.1) 
  3387. 	turn_vulnerable(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[5].vehicle) 
  3388. 	explosion_create("Medium Bang", Dlc2_m01_navpoints.alien_ambush_explosions[7], nil, false) 
  3389. 	 
  3390. 	delay(0.2) 
  3391. 	 
  3392. 	-- Explosion 8 
  3393. 	explosion_create("Medium Bang", Dlc2_m01_navpoints.alien_ambush_explosions[8], nil, false)	 
  3394. end 
  3395.  
  3396. -- Callback for when the alien ambush trigger is triggered 
  3397. function dlc2_m01_alien_ambush_triggered_cb() 
  3398. 	Dlc2_m01_runtime.alien_ambush_triggered = true 
  3399. end 
  3400.  
  3401. -- Initialize the alien ambush 
  3402. function dlc2_m01_rail_nw_01_initialize() 
  3403. 	-- Create the roadblock group 
  3404. 	group_create_hidden(Dlc2_m01_groups.ng_bridge_roadblock.name, true) 
  3405.  
  3406. 	-- Setup the alein abmush group 
  3407. 	group_create_hidden(Dlc2_m01_groups.alien_bridge_ambush.name, true) 
  3408. 	 
  3409. 	-- Create the camera men 
  3410. 	group_create(Dlc2_m01_groups.nw_cameramen_01.name, true) 
  3411. 	group_create(Dlc2_m01_groups.nw_cameramen_02.name, true) 
  3412. 	 
  3413. 	-- Start some smoke 
  3414. 	Dlc2_m01_vfx.bridge_smoke[1].handle = effect_play(Dlc2_m01_vfx.bridge_smoke[1].name, true) 
  3415. 	Dlc2_m01_vfx.bridge_smoke[2].handle = effect_play(Dlc2_m01_vfx.bridge_smoke[2].name, true)	 
  3416. 	 
  3417. 	local veh_hitpoints = Dlc2_m01_tweak_values.player_veh_nw_hitpoints 
  3418. 	if (difficulty_get_level() == 2) then 
  3419. 		veh_hitpoints = Dlc2_m01_tweak_values.player_veh_nw_hitpoints_hc 
  3420. 	end		 
  3421.  
  3422. 	-- Do common rail setup 
  3423. 	dlc2_m01_setup_rail_common(Dlc2_m01_checkpoints.rail_nw_01.player_navs, Dlc2_m01_navpoints.player_vehicle_chk06, true, veh_hitpoints) 
  3424. 	 
  3425. 	-- Unhide a few of the roadblock vehicles and turn them to corpses 
  3426. 	vehicle_show(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[2].vehicle) 
  3427. 	vehicle_make_corpse(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[2].vehicle, true) 
  3428. 	vehicle_show(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[3].vehicle) 
  3429. 	vehicle_make_corpse(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[3].vehicle, true) 
  3430. 	vehicle_show(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[5].vehicle) 
  3431. 	vehicle_make_corpse(Dlc2_m01_groups.ng_bridge_roadblock.vehicles[5].vehicle, true)		 
  3432. 	 
  3433. 	-- Make the aliens fly at the player 
  3434. 	for i, vehicle_table in pairs(Dlc2_m01_groups.alien_bridge_ambush.vehicles) do 
  3435. 		vehicle_table.delay = 0	-- override the delay to 0 
  3436. 		teleport_vehicle(vehicle_table.vehicle, vehicle_table.fly_to_nav) 
  3437. 		vehicle_table.thread_id = thread_new("dlc2_m01_process_ambush_vehicle_thread", vehicle_table, "heli_follow", -1, false, Dlc2_m01_tweak_values.alien_default_hp_mult) 
  3438. 	end 
  3439. 	 
  3440. 	-- Release the NG roadblock groups to the world 
  3441. 	release_to_world(Dlc2_m01_groups.ng_bridge_roadblock.name) 
  3442. 	 
  3443. 	-- Update the music 
  3444. 	audio_object_post_event("Alien_Invasion") 
  3445. 	 
  3446. 	-- Say action 
  3447. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.director_generic_action, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  3448. end 
  3449.  
  3450. -- Process the alien ambush 
  3451. function dlc_m01_rail_sequence_nw_loop_process() 
  3452. 	-- Setup all of the ambushes 
  3453. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.nw_island) do 
  3454. 		dlc2_m01_setup_rail_ambush(ambush) 
  3455. 	end 
  3456. 	 
  3457. 	notoriety_force_no_spawn("Police", true) 
  3458. 	ambient_cop_spawn_enable(false) 
  3459.  
  3460. 	-- Set the player attack multiplier 
  3461. 	for i, player in pairs(Dlc2_m01_player_list) do 
  3462. 		if (difficulty_get_level() == 2) then 
  3463. 			character_set_attack_multiplier(player, Dlc2_m01_tweak_values.rail_player_atk_mult_nw_hc) 
  3464. 		else 
  3465. 			character_set_attack_multiplier(player, Dlc2_m01_tweak_values.rail_player_atk_mult_nw) 
  3466. 		end 
  3467. 	end 
  3468. 	 
  3469. 	-- Enable the trigger for the assault drive conversation 
  3470. 	on_trigger("dlc2_m01_assault_drive_03_cb", Dlc2_m01_triggers.convo_assault_drive_03) 
  3471. 	trigger_enable(Dlc2_m01_triggers.convo_assault_drive_03, true)	 
  3472.  
  3473. 	-- Kick of a thread to process the player's rail path 
  3474. 	Dlc2_m01_threads.rail_loop_process = thread_new("dlc2_m01_process_rail_loop", Dlc2_m01_rail_loops.nw_island) 
  3475. 	 
  3476. 	-- Setup the camera men 
  3477. 	while (group_create_check_done(Dlc2_m01_groups.nw_cameramen_01.name) == false) do 
  3478. 		thread_yield() 
  3479. 	end 
  3480. 	for i, npc in pairs(Dlc2_m01_groups.nw_cameramen_01.npcs) do 
  3481. 		dlc2_m01_helper_setup_camera_man(npc) 
  3482. 	end 
  3483. 	 
  3484. 	-- Setup the camera men 
  3485. 	while (group_create_check_done(Dlc2_m01_groups.nw_cameramen_02.name) == false) do 
  3486. 		thread_yield() 
  3487. 	end 
  3488. 	for i, npc in pairs(Dlc2_m01_groups.nw_cameramen_02.npcs) do 
  3489. 		dlc2_m01_helper_setup_camera_man(npc) 
  3490. 	end			 
  3491. 	 
  3492. 	-- Wait until the player has reached the end of the path 
  3493. 	while(thread_check_done(Dlc2_m01_threads.rail_loop_process) == false) do 
  3494. 		thread_yield() 
  3495. 	end 
  3496.  
  3497. 	-- Clean-up this section 
  3498. 	dlc_m01_rail_sequence_nw_loop_cleanup(false) 
  3499. end 
  3500.  
  3501. -- Clean-up the alien ambush 
  3502. -- 
  3503. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  3504. function dlc_m01_rail_sequence_nw_loop_cleanup(exiting) 
  3505. 	-- Disable the conversation trigger 
  3506. 	on_trigger("", Dlc2_m01_triggers.convo_assault_drive_03) 
  3507. 	trigger_enable(Dlc2_m01_triggers.convo_assault_drive_03, false)	 
  3508. end 
  3509.  
  3510. -- Callback for the assault drive convo trigger 03 
  3511. function dlc2_m01_assault_drive_03_cb() 
  3512. 	if (Dlc2_m01_runtime.assult_drive_convo_03_triggered == false) then 
  3513. 		Dlc2_m01_runtime.assult_drive_convo_03_triggered = true 
  3514. 		 
  3515. 		dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.humvee_driving_03, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  3516. 	end 
  3517. end 
  3518.  
  3519. -- Process the first attempt at the jump 
  3520. function dlc2_m01_jump_take1_process() 
  3521. 	objective_text_clear(0) 
  3522. 	 
  3523. 	-- Stop the player's vehicle and make it invulnerable 
  3524. 	vehicle_speed_cancel(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3525. 	vehicle_stop(Dlc2_m01_groups.armory_get_away_car.vehicle, true)	 
  3526. 	turn_invulnerable(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3527. 	 
  3528. 	-- vehicle audio is squealing while car is stopped.  Make sure vehicle is stopped with no acceleration. 
  3529. 	vehicle_freeze(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3530.  
  3531. 	-- Play some dialog (director yells cut) 
  3532. 	dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.jump_setup, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  3533.  
  3534. 	-- Unload the film grain 
  3535. 	delay(1.5) 
  3536. 	dlc_gis_film_grain_unload() 
  3537. 	 
  3538. 	delay(0.5) 
  3539. 	 
  3540. 	-- Update the music 
  3541. 	audio_object_post_event("Alien_Invasion_Cut")	 
  3542. 	 
  3543. 	-- Make all the alien VTOLs retreat 
  3544. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.nw_island) do 
  3545. 		for j, vehicle_table in pairs(ambush.group.chase_vehicles) do 
  3546. 			dlc2_m01_force_alien_ship_idle(vehicle_table) 
  3547. 		end 
  3548. 	end 
  3549. 	for i, vehicle_table in pairs(Dlc2_m01_groups.alien_bridge_ambush.vehicles) do 
  3550. 		dlc2_m01_force_alien_ship_idle(vehicle_table) 
  3551. 	end 
  3552. 	 
  3553. 	-- Update the objective text 
  3554. 	objective_text(0, Dlc2_m01_objectives.prepare_for_jump.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.prepare_for_jump.icon)		 
  3555. 	 
  3556. 	while(dlc2_m01_helper_dialog_check_done(Dlc2_m01_conversations.jump_setup) == false) do 
  3557. 		thread_yield() 
  3558. 	end 
  3559. 	 
  3560. 	-- Kick of a thread to process the player's rail path 
  3561. 	Dlc2_m01_threads.rail_loop_process = thread_new("dlc2_m01_process_rail_loop", Dlc2_m01_rail_loops.jump) 
  3562. 	 
  3563. 	-- Play some dialog (director yells action) 
  3564. 	delay(1.5) 
  3565. 	dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.jump_attempt, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  3566. 	delay(1.0) 
  3567. 	dlc2_m01_load_film_grain() 
  3568. 	 
  3569. 	delay(0.8) 
  3570. 	 
  3571. 	-- Update the music 
  3572. 	audio_object_post_event("Action_03_Fail_Jump")			 
  3573. 	 
  3574. 	-- Wait until the player has reached the end of the path 
  3575. 	while(thread_check_done(Dlc2_m01_threads.rail_loop_process) == false) do 
  3576. 		thread_yield() 
  3577. 	end 
  3578. 	 
  3579. 	-- Remove the on destroyed callback on the player's vehicle (since it will be destroyed by the water) 
  3580. 	on_vehicle_destroyed("", Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3581. 	 
  3582. 	-- Wait until the get away car lands into the water 
  3583. 	while(vehicle_in_water(Dlc2_m01_groups.armory_get_away_car.vehicle) == false) do 
  3584. 		thread_yield() 
  3585. 	end 
  3586. 	 
  3587. 	-- Play some dialog (director yells cut) 
  3588. 	dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.jump_fail, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  3589. 	 
  3590. 	-- Force Kwilanna out of the vehicle 
  3591. 	vehicle_suppress_npc_exit(Dlc2_m01_groups.armory_get_away_car.vehicle, false) 
  3592. 	vehicle_exit(Dlc2_m01_characters.kwilanna, true) 
  3593. 	 
  3594. 	-- Turn off warp to shore for the players 
  3595. 	for i, player in pairs(Dlc2_m01_player_list) do 
  3596. 		player_warp_to_shore_disable(player) 
  3597. 	end 
  3598. 	 
  3599. 	-- Unload the film grain 
  3600. 	delay(1.5) 
  3601. 	dlc_gis_film_grain_unload() 
  3602. 	 
  3603. 	delay(0.5) 
  3604. 	 
  3605. 	while(dlc2_m01_helper_dialog_check_done(Dlc2_m01_conversations.jump_fail) == false) do 
  3606. 		thread_yield() 
  3607. 	end	 
  3608. 	 
  3609. 	delay(2.0)	 
  3610. 	 
  3611. 	dlc2_m01_jump_take1_cleanup(false) 
  3612. end 
  3613.  
  3614. function dlc2_m01_jump_take1_cleanup(exiting) 
  3615. 	-- Clean-up all of the ambushes 
  3616. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.nw_island) do 
  3617. 		dlc2_m01_cleanup_rail_ambush(ambush) 
  3618. 	end 
  3619.  
  3620. 	-- Re-enable warp to shore for the players 
  3621. 	for i, player in pairs(Dlc2_m01_player_list) do 
  3622. 		player_warp_to_shore_enable(player) 
  3623. 	end 
  3624. 	 
  3625. 	-- Remove the NW cameramen 
  3626. 	if (group_is_loaded(Dlc2_m01_groups.nw_cameramen_01.name) == true) then 
  3627. 		for i, npc in pairs(Dlc2_m01_groups.nw_cameramen_01.npcs) do 
  3628. 			dlc2_m01_helper_cleanup_camera_man(npc) 
  3629. 		end 
  3630. 		 
  3631. 		group_destroy(Dlc2_m01_groups.nw_cameramen_01.name) 
  3632. 	end 
  3633. 	if (group_is_loaded(Dlc2_m01_groups.nw_cameramen_02.name) == true) then 
  3634. 		for i, npc in pairs(Dlc2_m01_groups.nw_cameramen_02.npcs) do 
  3635. 			dlc2_m01_helper_cleanup_camera_man(npc) 
  3636. 		end 
  3637. 		 
  3638. 		group_destroy(Dlc2_m01_groups.nw_cameramen_02.name) 
  3639. 	end	 
  3640. 	 
  3641. 	-- Remove the player's temp weapons 
  3642. 	dlc2_m01_helper_remove_temp_weapons(Dlc2_m01_tweak_values.armory_inventory_take2) 
  3643. end 
  3644.  
  3645. -- Make an alien ship go idle 
  3646. function dlc2_m01_force_alien_ship_idle(vehicle_table) 
  3647. 	if (vehicle_exists(vehicle_table.vehicle) == true and vehicle_is_destroyed(vehicle_table.vehicle) == false) then 
  3648. 		if (thread_check_done(vehicle_table.fire_thread_id) == false) then 
  3649. 			thread_kill(vehicle_table.fire_thread_id) 
  3650. 		end 
  3651. 		 
  3652. 		for i, npc in pairs(vehicle_table.npcs) do 
  3653. 			npc_combat_enable(npc, false) 
  3654. 			ai_clear_priority_target(npc) 
  3655. 			set_attack_player_flag(npc, false) 
  3656. 			set_attack_enemies_flag(npc, false) 
  3657. 		end	 
  3658.  
  3659. 		helicopter_enter_retreat(vehicle_table.vehicle) 
  3660. 		vehicle_set_weapons_disarmed(vehicle_table.vehicle, true) 
  3661. 	end 
  3662. end 
  3663.  
  3664.  
  3665. --[[ 
  3666. 	Checkpoint 06 - Jump Second Take 
  3667. 	--]] 
  3668. 	 
  3669. -- Initialize the second take of the jump 
  3670. function dlc2_m01_jump_take2_initialize() 
  3671. 	local veh_hitpoints = Dlc2_m01_tweak_values.player_veh_nw_hitpoints 
  3672. 	if (difficulty_get_level() == 2) then 
  3673. 		veh_hitpoints = Dlc2_m01_tweak_values.player_veh_nw_hitpoints_hc 
  3674. 	end	 
  3675.  
  3676. 	-- Do common rail setup 
  3677. 	dlc2_m01_setup_rail_common(Dlc2_m01_checkpoints.jump_take2.player_navs, Dlc2_m01_navpoints.player_vehicle_chk07, false, veh_hitpoints) 
  3678.  
  3679. 	-- Stop the player's vehicle and make it invulnerable 
  3680. 	vehicle_speed_cancel(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3681. 	vehicle_stop(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3682. 	 
  3683. 	-- because the player is not driving, vehicle_stop is not clearing the accelerator, 
  3684. 	-- causing audio squeals.  Make sure it is stopped. 
  3685. 	vehicle_freeze(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3686. end 
  3687.  
  3688. -- Process the second take of the jump 
  3689. function dlc2_m01_jump_take2_process() 
  3690. 	-- Setup all of the ambushes 
  3691. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.take2) do 
  3692. 		dlc2_m01_setup_rail_ambush(ambush) 
  3693. 	end 
  3694. 	 
  3695. 	-- Set the player attack multiplier 
  3696. 	for i, player in pairs(Dlc2_m01_player_list) do 
  3697. 		if (difficulty_get_level() == 2) then 
  3698. 			character_set_attack_multiplier(player, Dlc2_m01_tweak_values.rail_player_atk_mult_end_hc) 
  3699. 		else 
  3700. 			character_set_attack_multiplier(player, Dlc2_m01_tweak_values.rail_player_atk_mult_end) 
  3701. 		end 
  3702. 	end				 
  3703. 	 
  3704. 	-- Play some dialog (director yells action) and wait for it to finish 
  3705. 	dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.jump_take2_start, DLC2_M01_CONVO_PLAY_IMMEDIATE, 2.5) 
  3706. 	dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.jump_take2_skip, DLC2_M01_CONVO_PLAY_LAST, 1.0) 
  3707. 	dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.drive_to_tunnel, DLC2_M01_CONVO_PLAY_LAST, 1.0) 
  3708. 	 
  3709. 	delay(5.0) 
  3710. 	 
  3711. 	-- Kick of a thread to process the player's rail path 
  3712. 	Dlc2_m01_threads.rail_loop_process = thread_new("dlc2_m01_process_rail_loop", Dlc2_m01_rail_loops.rail_end) 
  3713.  
  3714. 	delay(1.0) 
  3715. 	dlc2_m01_load_film_grain() 
  3716. 	 
  3717. 	-- Change the objective text 
  3718. 	objective_text(0, Dlc2_m01_objectives.destroy_pursuers.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.destroy_pursuers.icon)			 
  3719. 	 
  3720. 	delay(0.8) 
  3721. 	 
  3722. 	-- Update the music 
  3723. 	audio_object_post_event("Final_Sequence")		 
  3724.  
  3725. 	-- Wait for the rail pathfind to finish 
  3726. 	while(thread_check_done(Dlc2_m01_threads.rail_loop_process) == false) do 
  3727. 		thread_yield() 
  3728. 	end 
  3729. 	 
  3730. 	dlc2_m01_jump_take2_cleanup(false) 
  3731. end 
  3732.  
  3733. -- Clean-up the second take of the jump  
  3734. -- 
  3735. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  3736. function dlc2_m01_jump_take2_cleanup(exiting) 
  3737. 	-- NOTHING TO DO HERE 
  3738. end 
  3739.  
  3740. -- Initialize the finale in the tunnel 
  3741. function dlc2_m01_finale_initialize() 
  3742. 	local veh_hitpoints = Dlc2_m01_tweak_values.player_veh_nw_hitpoints 
  3743. 	if (difficulty_get_level() == 2) then 
  3744. 		veh_hitpoints = Dlc2_m01_tweak_values.player_veh_nw_hitpoints_hc 
  3745. 	end	 
  3746.  
  3747. 	-- Do common rail setup 
  3748. 	dlc2_m01_setup_rail_common(Dlc2_m01_checkpoints.finale.player_navs, Dlc2_m01_navpoints.player_vehicle_chk08, true, veh_hitpoints) 
  3749. 	 
  3750. 	-- Setup all of the ambushes 
  3751. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.take2) do 
  3752. 		dlc2_m01_setup_rail_ambush(ambush) 
  3753. 	end 
  3754.  
  3755. 	-- Create the alien group (the player starts after the create trigger for this ambush) 
  3756. 	dlc2_m01_ambush_create_triggered_cb(LOCAL_PLAYER, Dlc2_m01_rail_ambushes.take2[2].create_trigger) 
  3757. end 
  3758.  
  3759. -- Process the alien finale 
  3760. function dlc2_m01_alien_finale_process() 
  3761. 	-- Kick of a thread to process the player's rail path 
  3762. 	Dlc2_m01_threads.rail_loop_process = thread_new("dlc2_m01_process_rail_loop", Dlc2_m01_rail_loops.finale) 
  3763.  
  3764. 	-- Setup the trigger for the tunnel conversation and explosions 
  3765. 	on_trigger("dlc2_m01_tunnel_entrace_triggered_cb", Dlc2_m01_triggers.convo_tunnel_entrance) 
  3766. 	trigger_enable(Dlc2_m01_triggers.convo_tunnel_entrance, true) 
  3767. 	on_trigger("dlc2_m01_tunnel_explosions_triggered_cb", Dlc2_m01_triggers.tunnel_explosions) 
  3768. 	trigger_enable(Dlc2_m01_triggers.tunnel_explosions, true) 
  3769. 	 
  3770. 	-- Disable ambient vehicles 
  3771. 	spawning_vehicles(false) 
  3772. 	 
  3773. 	-- Wait for the rail pathfind to finish 
  3774. 	while(thread_check_done(Dlc2_m01_threads.rail_loop_process) == false) do 
  3775. 		thread_yield() 
  3776. 	end	 
  3777. 	 
  3778. 	-- Stop the player's vehicle 
  3779. 	vehicle_speed_cancel(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3780. 	vehicle_stop(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3781. 	 
  3782. 	-- because the player is not driving, vehicle_stop is not clearing the accelerator, 
  3783. 	-- causing audio squeals.  Make sure it is stopped. 
  3784. 	vehicle_freeze(Dlc2_m01_groups.armory_get_away_car.vehicle)	 
  3785. 	 
  3786. 	-- Play the final dialog 
  3787. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.mission_end, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  3788. 	while(dlc2_m01_helper_dialog_check_done(Dlc2_m01_dialog_lines.mission_end) == false) do 
  3789. 		thread_yield() 
  3790. 	end 
  3791.  
  3792. 	dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.mission_end_02, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  3793. 	delay(0.5) 
  3794. 	dlc_gis_film_grain_unload() 
  3795. 	 
  3796. 	delay(0.5) 
  3797. 	 
  3798. 	--audio_object_post_event("GIS_M01_Stop_All")	 
  3799. 	 
  3800. 	while(dlc2_m01_helper_dialog_check_done(Dlc2_m01_dialog_lines.mission_end_02) == false) do 
  3801. 		thread_yield() 
  3802. 	end 
  3803.  
  3804. 	dlc2_m01_alien_finale_cleanup(false) 
  3805. end 
  3806.  
  3807. -- Clean-up the second take of the jump  
  3808. -- 
  3809. -- exiting:		TRUE if the cleanup is called as a result of mission exit, FALSE if the objective was completed 
  3810. function dlc2_m01_alien_finale_cleanup(exiting) 
  3811. 	-- Clean-up all of the ambushes 
  3812. 	for i, ambush in pairs(Dlc2_m01_rail_ambushes.take2) do 
  3813. 		dlc2_m01_cleanup_rail_ambush(ambush) 
  3814. 	end 
  3815. 	 
  3816. 	-- Re-enable ambient vehicles 
  3817. 	spawning_vehicles(true)	 
  3818. 	 
  3819. 	-- Clean-up the trigger for the tunnel explosions 
  3820. 	on_trigger("", Dlc2_m01_triggers.convo_tunnel_entrance) 
  3821. 	trigger_enable(Dlc2_m01_triggers.convo_tunnel_entrance, false)	 
  3822. 	on_trigger("", Dlc2_m01_triggers.tunnel_explosions) 
  3823. 	trigger_enable(Dlc2_m01_triggers.tunnel_explosions, false)	 
  3824. end 
  3825.  
  3826. function dlc2_m01_tunnel_entrace_triggered_cb() 
  3827. 	if (Dlc2_m01_runtime.tunnel_entrace_triggered == false) then 
  3828. 		Dlc2_m01_runtime.tunnel_explosions_triggered = true 
  3829. 		 
  3830. 		continuous_explosion_stop() 
  3831. 		 
  3832. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.reach_tunnel, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  3833. 	end 
  3834. end 
  3835.  
  3836. -- Callback when the player enters the trigger for the tunnel explosions 
  3837. function dlc2_m01_tunnel_explosions_triggered_cb() 
  3838. 	if (Dlc2_m01_runtime.tunnel_explosions_triggered == false) then 
  3839. 		Dlc2_m01_runtime.tunnel_explosions_triggered = true 
  3840. 		 
  3841. 		for i, vfx in pairs(Dlc2_m01_vfx.tunnel_smoke) do 
  3842. 			vfx.handle = effect_play(vfx.name, true) 
  3843. 		end 
  3844. 		 
  3845. 		for i, vfx in pairs(Dlc2_m01_vfx.tunnel_explosions) do 
  3846. 			vfx.handle = effect_play(vfx.name, false) 
  3847. 			delay(rand_float(0.2, 0.3)) 
  3848. 		end 
  3849. 		 
  3850. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.tunnel_ufo_crash_01, DLC2_M01_CONVO_PLAY_IMMEDIATE, 1.0) 
  3851. 		delay(0.6) 
  3852. 		vehicle_max_speed(Dlc2_m01_groups.armory_get_away_car.vehicle, 10.0) 
  3853. 		 
  3854. 		while(dlc2_m01_helper_dialog_check_done(Dlc2_m01_dialog_lines.tunnel_ufo_crash_01) == false) do 
  3855. 			thread_yield() 
  3856. 		end 
  3857. 		 
  3858. 		-- Activate the jet bikes 
  3859. 		dlc2_m01_ambush_activate_triggered_cb(LOCAL_PLAYER, Dlc2_m01_rail_ambushes.take2[3].activate_trigger) 
  3860. 		vehicle_max_speed(Dlc2_m01_groups.armory_get_away_car.vehicle, 60.0) 
  3861. 		delay(0.1) 
  3862. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.jet_bikes, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  3863. 		 
  3864. 	end 
  3865. end 
  3866.  
  3867.  
  3868. -- *************************************************** 
  3869. -- General Helper Functions 
  3870. -- *************************************************** 
  3871.  
  3872. -- Common initialization for the armory objective for both Take1 & Take2 
  3873. function dlc2_m01_go_to_armory_initialize_common() 
  3874. 	-- Setup the helicopter next to Kwilanna 
  3875. 	group_create(Dlc2_m01_groups.kwilanna_heli.name, true) -- wait for the group to load 
  3876. 	vehicle_enter_teleport(Dlc2_m01_groups.kwilanna_heli.heli.pilot, Dlc2_m01_groups.kwilanna_heli.heli.vehicle, 0, true) 
  3877. 	vehicle_suppress_npc_exit(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, true) 
  3878. 	vehicle_disable_chase(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, true) 
  3879. 	vehicle_disable_flee(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, true) 
  3880. 	set_unjackable_flag(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, true) 
  3881. 	set_unenterable_for_player(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, true) 
  3882. 	vehicle_prevent_explosion_fling(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, true) 
  3883. 	vehicle_set_keyframed_physics(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, true) 
  3884. 	turn_invulnerable(Dlc2_m01_groups.kwilanna_heli.heli.vehicle) 
  3885. 	 
  3886. 	-- Setup Kwilanna 
  3887. 	set_dont_attack_me_on_sight_flag(Dlc2_m01_characters.kwilanna, true) 
  3888. 	character_allow_ragdoll(Dlc2_m01_characters.kwilanna, false) 
  3889. 	character_prevent_flinching(Dlc2_m01_characters.kwilanna, true) 
  3890. 	character_prevent_bumping(Dlc2_m01_characters.kwilanna, true) 
  3891. 	set_ignore_ai_flag(Dlc2_m01_characters.kwilanna, true) 
  3892. 	set_current_hit_points(Dlc2_m01_characters.kwilanna, get_max_hit_points(Dlc2_m01_characters.kwilanna)) 
  3893. 	set_script_animation_state(Dlc2_m01_characters.kwilanna, "hostage idle") 
  3894. 	npc_suppress_persona(Dlc2_m01_characters.kwilanna, true) 
  3895. 	dlc2_m01_helper_set_kwilanna_invulnerable(true, true) 
  3896. 	 
  3897. 	-- Kick off a thread to process Kwilanna's position, and kill her if she moves too far away from her tied up position 
  3898. 	--Dlc2_m01_threads.kwilanna_pos_process = thread_new("dlc2_m01_process_kwilanna_pos_thread") 
  3899. 	 
  3900. 	-- Create the armory car husks 
  3901. 	group_create(Dlc2_m01_groups.armory_car_husks.name, true) 
  3902. 	for i, vehicle in pairs(Dlc2_m01_groups.armory_car_husks.vehicles) do 
  3903. 		turn_invulnerable(vehicle) 
  3904. 		set_unenterable_for_player(vehicle, false) 
  3905. 	end 
  3906. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.armory_car_husks.vehicles[1], true, true) 
  3907. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.armory_car_husks.vehicles[3], true, false) 
  3908. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.armory_car_husks.vehicles[4], true, true) 
  3909. 	vehicle_set_smoke_and_fire_state(Dlc2_m01_groups.armory_car_husks.vehicles[5], true, false)	 
  3910. 	 
  3911. 	-- Create the camera men 
  3912. 	group_create(Dlc2_m01_groups.armory_camera_men.name, true) 
  3913. 	for i, npc in pairs(Dlc2_m01_groups.armory_camera_men.npcs) do 
  3914. 		dlc2_m01_helper_setup_camera_man(npc) 
  3915. 	end 
  3916.  
  3917. 	-- Remove the movers for some fence around the armory helipad 
  3918. 	for i, mover in pairs(Dlc2_m01_movers.armory_fence_to_remove) do 
  3919. 		mesh_mover_hide(mover) 
  3920. 	end 
  3921. 	 
  3922. 	-- Enable the trigger at the Armory 
  3923. 	on_trigger("dlc2_m01_heli_pad_triggered_cb", Dlc2_m01_triggers.heli_pad_area) 
  3924. 	on_trigger_exit("dlc2_m01_heli_pad_exited_cb", Dlc2_m01_triggers.heli_pad_area) 
  3925. 	trigger_enable(Dlc2_m01_triggers.heli_pad_area, true) 
  3926. 	 
  3927. 	-- Play the VFX for the car husks 
  3928. 	--[[ 
  3929. 	for i, vfx in pairs(Dlc2_m01_vfx.car_husks) do 
  3930. 		if (vfx.handle == -1) then 
  3931. 			vfx.handle = effect_play(vfx.name, true) 
  3932. 		end 
  3933. 	end 
  3934. 	--]] 
  3935. end 
  3936.  
  3937. -- Common function for armory take 1 initialization 
  3938. function dlc2_m01_armory_take1_initialize_common() 
  3939. 	-- Create the script group for the first take 
  3940. 	group_create(Dlc2_m01_groups.armory_take_01.name, true) 
  3941. 	 
  3942. 	-- Lock all the helicopters 
  3943. 	for i, heli in pairs(Dlc2_m01_groups.armory_take_01.helis) do 
  3944. 		set_unjackable_flag(heli, true) 
  3945. 		set_unenterable_for_player(heli, false) 
  3946. 	end 
  3947. 	 
  3948. 	-- Register on_death callbacks for the tower guards (and get the num of guards) 
  3949. 	Dlc2_m01_runtime.num_tower_guards_alive = 0 
  3950. 	for i, guard in pairs(Dlc2_m01_groups.armory_take_01.tower_guards) do 
  3951. 		on_death("dlc2_m01_take1_tower_guard_killed_cb", guard) 
  3952. 		Dlc2_m01_runtime.num_tower_guards_alive = Dlc2_m01_runtime.num_tower_guards_alive + 1 
  3953. 	end 
  3954. 	 
  3955. 	-- Set the players weapon load-out 
  3956. 	dlc2_m01_helper_give_temp_weapons(Dlc2_m01_tweak_values.armory_inventory_take1) 
  3957. end 
  3958.  
  3959. -- Common function for creating and initializing the escape vehicle 
  3960. function dlc2_m01_setup_escape_vehicle(vehicle_hitpoints) 
  3961. 	group_create(Dlc2_m01_groups.armory_get_away_car, true) 
  3962.  
  3963. 	vehicle_disable_chase(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3964. 	vehicle_disable_flee(Dlc2_m01_groups.armory_get_away_car.vehicle, true)	 
  3965. 	vehicle_ignore_repulsors(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3966. 	vehicle_infinite_mass(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3967. 	vehicle_never_flatten_tires(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3968. 	vehicle_prevent_explosion_fling(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3969. 	vehicle_prevent_transition_to_ambient(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3970. 	vehicle_prevent_vehicle_collision_damage(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3971. 	vehicle_set_allow_ram_ped(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3972. 	vehicle_set_crazy(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3973. 	vehicle_set_ignore_rail_obstacles(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3974. 	vehicle_set_obey_traffic_lights(Dlc2_m01_groups.armory_get_away_car.vehicle, false) 
  3975. 	vehicle_set_script_hard_goto(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3976. 	vehicle_suppress_flipping(Dlc2_m01_groups.armory_get_away_car.vehicle, true) 
  3977. 	vehicle_suppress_npc_exit(Dlc2_m01_groups.armory_get_away_car.vehicle, true)	 
  3978.  
  3979. 	set_max_hit_points(Dlc2_m01_groups.armory_get_away_car.vehicle, vehicle_hitpoints, true) 
  3980. 	vehicle_speed_override(Dlc2_m01_groups.armory_get_away_car.vehicle, Dlc2_m01_tweak_values.player_veh_pathfind_speed) 
  3981. 	vehicle_max_speed(Dlc2_m01_groups.armory_get_away_car.vehicle, Dlc2_m01_tweak_values.player_veh_pathfind_speed) 
  3982. 	 
  3983. 	on_vehicle_destroyed("dlc2_m01_get_away_vehicle_destroyed_cb", Dlc2_m01_groups.armory_get_away_car.vehicle) 
  3984. end 
  3985.  
  3986. -- Setup the downtown camera men 
  3987. function dlc2_m01_setup_downtown_camera_men_01() 
  3988. 	-- Create the camera men 
  3989. 	group_create(Dlc2_m01_groups.dt_camera_men_01.name, true) 
  3990. 	for i, npc in pairs(Dlc2_m01_groups.dt_camera_men_01.npcs) do 
  3991. 		dlc2_m01_helper_setup_camera_man(npc) 
  3992. 	end 
  3993. end 
  3994.  
  3995. -- Common setup for the rail sequence checkpoints 
  3996. function dlc2_m01_setup_rail_common(player_navs, car_nav, load_film_grain, veh_hitpoints) 
  3997. 	if (load_film_grain == nil) then 
  3998. 		load_film_grain = true 
  3999. 	end 
  4000.  
  4001. 	-- Create the get away car 
  4002. 	dlc2_m01_setup_escape_vehicle(veh_hitpoints) 
  4003. 	 
  4004. 	-- Teleport the get away car to the navpoint for this checkpoint 
  4005. 	if (car_nav ~= nil) then 
  4006. 		teleport_vehicle(Dlc2_m01_groups.armory_get_away_car.vehicle, car_nav)	 
  4007. 	end 
  4008. 	 
  4009. 	-- Make Everyone in the car invulnerable 
  4010. 	dlc2_m01_helper_set_kwilanna_invulnerable(true, false) 
  4011. 	for i, player in pairs(Dlc2_m01_player_list) do 
  4012. 		turn_invulnerable(player) 
  4013. 	end	 
  4014. 	 
  4015. 	-- Teleport the player's to the start navs 
  4016. 	teleport_coop(player_navs[1], player_navs[2], true)		 
  4017.  
  4018. 	-- Put eveyone into the car 
  4019. 	vehicle_enter_teleport(Dlc2_m01_characters.kwilanna, Dlc2_m01_groups.armory_get_away_car.vehicle, 0, true) 
  4020. 	for i, player in pairs(Dlc2_m01_player_list) do 
  4021. 		-- i starts at index 1, which coincidently is the seat we want to put the first player in 
  4022. 		vehicle_enter_teleport(player, Dlc2_m01_groups.armory_get_away_car.vehicle, i, true)  
  4023. 		set_player_can_enter_exit_vehicles(player, false) 
  4024. 	end 
  4025. 	 
  4026. 	-- Make Kwilanna a homie 
  4027. 	party_add(Dlc2_m01_characters.kwilanna, LOCAL_PLAYER) 
  4028. 	on_dismiss("dlc2_m01_kwilanna_dismissed_cb", Dlc2_m01_characters.kwilanna)		 
  4029.  
  4030. 	-- Set fake notoriety 
  4031. 	hud_set_fake_notoriety("Police", true, Dlc2_m01_tweak_values.fake_notoriety_level) 
  4032. 	 
  4033. 	-- Load the film grain UI 
  4034. 	if (load_film_grain == true) then 
  4035. 		dlc2_m01_load_film_grain() 
  4036. 	end 
  4037. 	 
  4038. 	-- Give the players weapon load-out 
  4039. 	dlc2_m01_helper_give_temp_weapons(Dlc2_m01_tweak_values.armory_inventory_take2) 
  4040. 	 
  4041. 	-- Change the objective text 
  4042. 	objective_text(0, Dlc2_m01_objectives.destroy_pursuers.tag, nil, nil, SYNC_ALL, Dlc2_m01_objectives.destroy_pursuers.icon)		 
  4043. end 
  4044.  
  4045. -- Loop-up a rail ambush trigger Lua table by trigger name 
  4046. -- 
  4047. -- trigger_name:	Name of the trigger to look for in rail ambush Lua tables 
  4048. function dlc2_m01_find_rail_ambush_by_trigger(trigger_name) 
  4049. 	-- Look through all the ambush groups looking for any ambushes that use the specified trigger 
  4050. 	for i, ambush_group in pairs(Dlc2_m01_rail_ambushes) do 
  4051. 		for j, ambush in pairs(ambush_group) do 
  4052. 			if (ambush.create_trigger == trigger_name or ambush.activate_trigger == trigger_name) then 
  4053. 				-- Found it, return the ambush table 
  4054. 				return ambush 
  4055. 			end 
  4056. 		end 
  4057. 	end 
  4058. 	 
  4059. 	-- If we didn't already return an ambush, then we didn't find it... return nil 
  4060. 	return nil 
  4061. end 
  4062.  
  4063. -- Function to setup a rail sequence ambush 
  4064. -- 
  4065. -- ambush:		Lua table defining the ambush (see Dlc2_m01_rail_ambushes) 
  4066. function dlc2_m01_setup_rail_ambush(ambush) 
  4067. 	ambush.created = false 
  4068. 	ambush.activated = false 
  4069.  
  4070. 	-- If there's a create trigger, activate it.  Otherwise, create the group immediately 
  4071. 	if (ambush.create_trigger ~= nil) then 
  4072. 		trigger_enable(ambush.create_trigger, true) 
  4073. 		on_trigger("dlc2_m01_ambush_create_triggered_cb", ambush.create_trigger) 
  4074. 	else 
  4075. 		group_create(ambush.group.name, false) 
  4076. 		ambush.created = true 
  4077. 	end 
  4078. 	 
  4079. 	-- Enable the activate trigger 
  4080. 	trigger_enable(ambush.activate_trigger, true) 
  4081. 	on_trigger("dlc2_m01_ambush_activate_triggered_cb", ambush.activate_trigger) 
  4082. end 
  4083.  
  4084. -- Function to cleanup a rail sequence ambush 
  4085. -- 
  4086. -- ambush:		Lua table defining the ambush (see Dlc2_m01_rail_ambushes) 
  4087. function dlc2_m01_cleanup_rail_ambush(ambush) 
  4088. 	-- Cleanup the triggers 
  4089. 	if (ambush.create_trigger ~= nil) then 
  4090. 		on_trigger("", ambush.create_trigger) 
  4091. 		trigger_enable(ambush.create_trigger, false) 
  4092. 	end 
  4093. 	on_trigger("", ambush.activate_trigger) 
  4094. 	trigger_enable(ambush.activate_trigger, false) 
  4095. 	 
  4096. 	-- Remove any vehicle callbacks 
  4097. 	if (ambush.group.chase_vehicles ~= nil) then 
  4098. 		for i, vehicle_table in pairs(ambush.group.chase_vehicles) do 
  4099. 			on_take_damage("", vehicle_table.vehicle) 
  4100. 			 
  4101. 			-- Cleanup the on destroyed callbacks for the alien vehicles 
  4102. 			if (vehicle_table.is_alien == true) then 
  4103. 				on_vehicle_destroyed("", vehicle_table.vehicle) 
  4104. 			end 
  4105. 		end 
  4106. 	end 
  4107. 	 
  4108. 	-- Release the group to the world 
  4109. 	release_to_world(ambush.group.name) 
  4110. 	 
  4111. 	-- Clean-up any threads we spawned to process the scripted object 
  4112. 	for i, thread in pairs(ambush.group_threads) do 
  4113. 		if (thread_check_done(thread) == false) then 
  4114. 			thread_kill(thread) 
  4115. 		end 
  4116. 		 
  4117. 		thread = nil 
  4118. 	end 
  4119. end 
  4120.  
  4121. -- Callback for when an ambush create trigger is entered 
  4122. -- 
  4123. -- triggerer:	Name of the player that triggered this trigger 
  4124. -- trigger:		Name of the trigger 
  4125. function dlc2_m01_ambush_create_triggered_cb(triggerer, trigger) 
  4126. 	-- Find the ambush table from the trigger name 
  4127. 	local ambush = dlc2_m01_find_rail_ambush_by_trigger(trigger) 
  4128. 	if (ambush == nil) then 
  4129. 		-- Couldn't find it?  Just return 
  4130. 		return 
  4131. 	end 
  4132. 	 
  4133. 	-- Check if this ambush has already been created 
  4134. 	if (ambush.created == true) then 
  4135. 		return 
  4136. 	end 
  4137. 	ambush.created = true 
  4138. 	 
  4139. 	-- Create the script group for this ambush 
  4140. 	group_create_hidden(ambush.group.name, false) 
  4141. end 
  4142.  
  4143. -- Callback for when an ambush activate trigger is entered 
  4144. -- 
  4145. -- triggerer:	Name of the player that triggered this trigger 
  4146. -- trigger:		Name of the trigger 
  4147. function dlc2_m01_ambush_activate_triggered_cb(triggerer, trigger) 
  4148. 	-- Find the ambush table from the trigger name 
  4149. 	local ambush = dlc2_m01_find_rail_ambush_by_trigger(trigger) 
  4150. 	if (ambush == nil) then 
  4151. 		-- Couldn't find it?  Just return 
  4152. 		return 
  4153. 	end 
  4154. 	 
  4155. 	-- Check if this ambush has already been activated 
  4156. 	if (ambush.activated == true) then 
  4157. 		return 
  4158. 	end 
  4159. 	ambush.activated = true 
  4160. 	 
  4161. 	-- Make sure the group is loaded 
  4162. 	if (group_is_loaded(ambush.group.name) == false) then 
  4163. 		-- If the group failed to load, check to see if there were any Alien vehicles in it.  We want to still give the player credit for those 
  4164. 		for i, vehicle_table in pairs(ambush.group.chase_vehicles) do 
  4165. 			dlc2_m01_alien_spaceship_destroyed_cb(vehicle_table.vehicle) 
  4166. 		end 
  4167. 		 
  4168. 		return 
  4169. 	end 
  4170. 	 
  4171. 	-- Make sure the group has finished being created 
  4172. 	if (group_create_check_done(ambush.group.name) == false) then 
  4173. 		-- If it hasn't already loaded, we're going to bail on this ambush.  Destroy the group 
  4174. 		group_destroy(ambush.group.name) 
  4175. 		return 
  4176. 	end 
  4177. 	 
  4178. 	-- Setup any chase vehicles 
  4179. 	if (ambush.group.chase_vehicles ~= nil) then 
  4180. 		for i, vehicle in pairs(ambush.group.chase_vehicles) do 
  4181. 			ambush.group_threads[#ambush.group_threads + 1] = thread_new("dlc2_m01_process_ambush_vehicle_thread", vehicle, ambush.behavior, ambush.speed, ambush.invulnerable, ambush.hp_multiplier) 
  4182. 		end 
  4183. 	end 
  4184. 	 
  4185. 	-- Setup any chase NPCs 
  4186. 	if (ambush.group.chase_npcs ~= nil) then 
  4187. 		for i, npc in pairs(ambush.group.chase_npcs) do 
  4188. 			ambush.group_threads[#ambush.group_threads + 1] = thread_new("dlc2_m01_process_ambush_npc_thread", npc, ambush.behavior, ambush.invulnerable) 
  4189. 		end 
  4190. 	end 
  4191. end 
  4192.   
  4193.  -- Helper function to process Kwilanna and both players getting into a required vehicle 
  4194.  -- 
  4195.  -- vehicle_name:		Name of the vehicle 
  4196.  function dlc2_m01_helper_get_gang_into_vehicle(vehicle_name) 
  4197. 	-- Add a marker on the vehicle 
  4198. 	marker_add(vehicle_name, MINIMAP_ICON_USE, OI_ASSET_USE, OI_FLAGS_FULL, SYNC_ALL) 
  4199.  
  4200. 	-- Call out the player's seat 
  4201. 	for i, player in pairs(Dlc2_m01_player_list) do 
  4202. 		-- i starts at index 1, which coincidently is the seat we want to put the first player in 
  4203. 		player_force_vehicle_seat(player, i, vehicle_name)  
  4204. 	end 
  4205. 	 
  4206. 	-- Unlock the vehicle and register a callback for when it is entered 
  4207. 	set_unjackable_flag(vehicle_name, false) 
  4208. 	set_unenterable_for_player(vehicle_name, false) 
  4209. 	on_vehicle_enter("dlc2_m01_get_away_car_entered_cb", vehicle_name) 
  4210. 	on_vehicle_exit("dlc2_m01_get_away_car_exited_cb", vehicle_name) 
  4211. 	 
  4212. 	-- Make it so that AI cannot pull anyone out of the vehicle 
  4213. 	set_unjackable_by_ai_flag(vehicle_name, true) 
  4214. 	vehicle_suppress_npc_exit(vehicle_name, true) 
  4215. 	 
  4216. 	delay(0.5) 
  4217.  
  4218. 	Dlc2_m01_threads.kwilanna_vehicle_enter = thread_new("dlc2_m01_thread_kwilanna_get_in_vehicle", vehicle_name) 
  4219.  
  4220. 	-- Wait until all the players are in the get away car 
  4221. 	local ready = false 
  4222. 	while(ready == false) do 
  4223. 		ready = true 
  4224. 		 
  4225. 		-- Check if any players are not in the vehicle 
  4226. 		for i, player in pairs(Dlc2_m01_player_list) do 
  4227. 			if (character_is_in_vehicle(LOCAL_PLAYER, vehicle_name) == false) then 
  4228. 				ready = false 
  4229. 			end 
  4230. 		end 
  4231. 		 
  4232. 		-- If Kwilanna goes down, wait for her to be revived 
  4233. 		if (human_is_downed(Dlc2_m01_characters.kwilanna) == true) then 
  4234. 			ready = false 
  4235. 		end	 
  4236. 	 
  4237. 		thread_yield() 
  4238. 	end 
  4239. 	 
  4240. 	-- Make Kwilanna invulnerable 
  4241. 	dlc2_m01_helper_set_kwilanna_invulnerable(true, false) 
  4242. 	 
  4243. 	-- Lock the player's into the car 
  4244. 	for i, player in pairs(Dlc2_m01_player_list) do 
  4245. 		set_player_can_enter_exit_vehicles(player, false) 
  4246. 	end 
  4247. 	 
  4248. 	-- Update the music if this is the escape start checkpoing 
  4249. 	if (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.escape_start.name) then 
  4250. 		audio_object_post_event("To_The_Bridge") 
  4251. 	end	 
  4252. 	 
  4253. 	-- If Kwilanna isn't in the vehicle by now, teleport her in 
  4254. 	if (character_is_in_vehicle(Dlc2_m01_characters.kwilanna, vehicle_name) == false) then 
  4255. 		if (human_is_downed(Dlc2_m01_characters.kwilanna) == true) then 
  4256. 			npc_revive(Dlc2_m01_characters.kwilanna) 
  4257. 		end 
  4258. 		dlc2_m01_helper_set_kwilanna_invulnerable(true, false) 
  4259. 		 
  4260. 		delay(3.0) 
  4261. 	end 
  4262. 	 
  4263. 	-- Make sure eveyone's in the car 
  4264. 	for i, player in pairs(Dlc2_m01_player_list) do 
  4265. 		vehicle_enter_teleport(player, vehicle_name, i, true, true) 
  4266. 	end	 
  4267. 	vehicle_enter_teleport(Dlc2_m01_characters.kwilanna, vehicle_name, 0, true) 
  4268. 	 
  4269. 	-- Loop until everyone is actually in the car (fixes Bug #1949) 
  4270. 	ready = false 
  4271. 	while(ready == false) do 
  4272. 		ready = true 
  4273. 	 
  4274. 		-- Check if any players are not in the vehicle 
  4275. 		for i, player in pairs(Dlc2_m01_player_list) do 
  4276. 			if (character_is_in_vehicle(LOCAL_PLAYER, vehicle_name) == false) then 
  4277. 				ready = false 
  4278. 			end 
  4279. 		end 
  4280. 		 
  4281. 		-- Check if Kwilanna is not in the vehicle 
  4282. 		if (character_is_in_vehicle(Dlc2_m01_characters.kwilanna, vehicle_name) == false) then 
  4283. 			ready = false 
  4284. 		end 
  4285. 		 
  4286. 		thread_yield() 
  4287. 	end 
  4288. 	 
  4289. 	follower_make_independent(Dlc2_m01_characters.kwilanna, false) 
  4290. 	set_unjackable_flag(vehicle_name, true) 
  4291. 	 
  4292. 	on_vehicle_enter("", vehicle_name) 
  4293. 	on_vehicle_exit("", vehicle_name) 
  4294. 	marker_remove(vehicle_name) 
  4295. end 
  4296.  
  4297. -- Callback for when someone enter's the get-away car during the "get into the escape vehicle" objective 
  4298. -- 
  4299. -- human_name:		Name of the character entering the vehicle (not necessarily a player) 
  4300. -- vehicle_name:	Name of the vehicle entered 
  4301. -- seat:			Seat index (driver == 0, passenger1 == 1, etc.) 
  4302. function dlc2_m01_get_away_car_entered_cb(human_name, vehicle_name, seat) 
  4303. 	turn_invulnerable(human_name, false) 
  4304. end 
  4305.  
  4306. -- Callback for when someone enter's the get-away car during the "get into the escape vehicle" objective 
  4307. -- 
  4308. -- human_name:		Name of the character exiting the vehicle (not necessarily a player) 
  4309. -- vehicle_name:	Name of the vehicle exited 
  4310. -- seat:			Seat index (driver == 0, passenger1 == 1, etc.) 
  4311. function dlc2_m01_get_away_car_exited_cb(human_name, vehicle_name, seat) 
  4312. 	turn_vulnerable(human_name) 
  4313. end 
  4314.  
  4315. -- Thread to process Kwilanna getting into the vehicle 
  4316. function dlc2_m01_thread_kwilanna_get_in_vehicle(vehicle_name) 
  4317. 	-- Wait until the local player is close to the vehicle 
  4318. 	while(get_dist(Dlc2_m01_characters.kwilanna, vehicle_name) > 20.0) do 
  4319. 		thread_yield() 
  4320. 	end 
  4321.  
  4322. 	-- Tell Kwilanna to get into the vehicle 
  4323. 	follower_make_independent(Dlc2_m01_characters.kwilanna, true) 
  4324. 	vehicle_enter(Dlc2_m01_characters.kwilanna, vehicle_name, 0) 
  4325.  
  4326. 	-- Wait a bit for Kwilanna to get into the car (we'll teleport her into the car down below if she doesn't make it in there) 
  4327. 	while(true) do 
  4328. 		if (character_is_in_vehicle(Dlc2_m01_characters.kwilanna, vehicle_name) == true) then 
  4329. 			break 
  4330. 		else 
  4331. 			-- Check to see if Kwilanna aborted the vehicle enter 
  4332. 			if (vehicle_enter_check_done(Dlc2_m01_characters.kwilanna, false, vehicle_name) == 2) then 
  4333. 				-- Try restarting the vehicle enter 
  4334. 				vehicle_enter(Dlc2_m01_characters.kwilanna, vehicle_name, 0) 
  4335. 			end 
  4336. 		end 
  4337. 		 
  4338. 		-- If Kwilanna goes down, wait for her to be revived 
  4339. 		while(human_is_downed(Dlc2_m01_characters.kwilanna) == true) do 
  4340. 			thread_yield() 
  4341. 		end 
  4342. 		 
  4343. 		thread_yield() 
  4344. 	end	 
  4345. end 
  4346.  
  4347. -- Helper function for giving the players a temporary weapon loadout 
  4348. -- 
  4349. -- weapon_list:		List of weapons to give the player 
  4350. function dlc2_m01_helper_give_temp_weapons(weapon_list) 
  4351. 	-- Disable all slots but melee 
  4352. 	inv_weapon_disable_slot(WEAPON_SLOT_PISTOL, true, SYNC_ALL) 
  4353. 	inv_weapon_disable_slot(WEAPON_SLOT_SMG, true, SYNC_ALL) 
  4354. 	inv_weapon_disable_slot(WEAPON_SLOT_SHOTGUN, true, SYNC_ALL) 
  4355. 	inv_weapon_disable_slot(WEAPON_SLOT_RIFLE, true, SYNC_ALL) 
  4356. 	inv_weapon_disable_slot(WEAPON_SLOT_EXPLOSIVE, true, SYNC_ALL) 
  4357. 	inv_weapon_disable_slot(WEAPON_SLOT_SPECIAL, true, SYNC_ALL) 
  4358.  
  4359. 	for i, weapon_table in pairs(weapon_list) do 
  4360. 		if (weapon_table.is_grenade == nil or weapon_table.is_grenade == false) then 
  4361. 			-- Enable this weapon's slot for all players 
  4362. 			inv_weapon_disable_slot(inv_item_get_weapon_slot(weapon_table.weapon), false, SYNC_ALL) 
  4363. 		end 
  4364.  
  4365. 		-- If this is the last weapon in the list, it should be equipped now 
  4366. 		local equip_now = false 
  4367. 		if (i == #weapon_list) then 
  4368. 			equip_now = true 
  4369. 		end 
  4370.  
  4371. 		-- Add the weapon to each player's inventory 
  4372. 		for j, player in pairs(Dlc2_m01_player_list) do 
  4373. 			inv_weapon_add_temporary(player, weapon_table.weapon, 1, true, equip_now, false, true, weapon_table.upgrade_lvl) 
  4374. 		end 
  4375. 	end 
  4376. end 
  4377.  
  4378. -- Helper function for removing temporary weapons given to the players 
  4379. -- 
  4380. -- weapon_list:		List of weapons to give the player 
  4381. function dlc2_m01_helper_remove_temp_weapons(weapon_list) 
  4382. 	inv_weapon_disable_all_slots(false, SYNC_ALL)  
  4383.  
  4384. 	for i, weapon_table in pairs(weapon_list) do 
  4385. 		-- Add the weapon to each player's inventory 
  4386. 		for j, player in pairs(Dlc2_m01_player_list) do 
  4387. 			inv_weapon_remove_temporary(player, weapon_table.weapon) 
  4388. 		end 
  4389. 	end 
  4390. end 
  4391.  
  4392. -- Helper function to setup a camera man to bahave like a camera man 
  4393. -- 
  4394. -- npc:		Name of the NPC to setup as a camera man 
  4395. function dlc2_m01_helper_setup_camera_man(npc) 
  4396. 	ai_set_action_delay(npc, "melee", 99999) 
  4397. 	ai_set_action_delay(npc, "move rush to melee", 99999) 
  4398. 	set_team(npc, "Deckers") 
  4399. 	set_cant_cower_flag(npc, true) 
  4400. 	set_cant_flee_flag(npc, true)	 
  4401. 	set_always_sees_player_flag(npc, true) 
  4402. 	set_attack_player_flag(npc, true) 
  4403. 	inv_item_add("Special-CameraProp", 1, npc, true) 
  4404. 	npc_dont_drop_weapon_on_death(npc, true) 
  4405. 	npc_dont_auto_equip_or_unequip_weapons(npc, true) 
  4406. 	character_set_always_combat_ready(npc, true) 
  4407. 	 
  4408. 	-- Register an on-death callback 
  4409. 	on_death("dlc2_m01_camera_man_died_cb", npc) 
  4410. end 
  4411.  
  4412. -- Helper function to cleanup a camera man 
  4413. -- 
  4414. -- npc:		Name of the NPC to cleanup 
  4415. function dlc2_m01_helper_cleanup_camera_man(npc) 
  4416. 	on_death("", npc) 
  4417. end 
  4418.  
  4419. -- Callback for when a cameraman dies 
  4420. function dlc2_m01_camera_man_died_cb(victim, attacker) 
  4421. 	on_death("", victim) 
  4422. 	 
  4423. 	dlc2_m01_helper_achievement_increment(Dlc2_m01_acheivements.cameramen) 
  4424. 	 
  4425. 	if (thread_check_done(Dlc2_m01_dialog_queue.playing.thread_id) == true) then 
  4426. 		if (Dlc2_m01_runtime.played_cameraman_line == false or rand_int(1, 2) == 1) then 
  4427. 			dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.director_generic_camera, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  4428. 			Dlc2_m01_runtime.played_cameraman_line = true 
  4429. 		end 
  4430. 	end	 
  4431. end 
  4432.  
  4433. -- Setup rail explosions 
  4434. function dlc2_m01_helper_setup_rail_explosions() 
  4435. 	-- Start continuous explosion 
  4436. 	if (Dlc2_m01_threads.parked_car_explosions == INVALID_THREAD_HANDLE) then 
  4437. 		Dlc2_m01_threads.parked_car_explosions = thread_new("dlc2_m01_process_parked_car_explosions") 
  4438. 		 
  4439. 		-- Start continuous explosion 
  4440. 		continuous_explosion_start("Dlc2_m01_rail", Dlc2_m01_navpoints.armory_location) 
  4441. 		for i, player in pairs(Dlc2_m01_player_list) do 
  4442. 			continuous_explosion_follow_target_add(player) 
  4443. 			continuous_explosion_avoid_object_add(player) 
  4444. 		end 
  4445. 		 
  4446. 		--dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.car_chase_explosions, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  4447. 	end 
  4448. end 
  4449.  
  4450. -- Stop rail explosions 
  4451. function dlc2_m01_helper_stop_rail_explosions() 
  4452. 	-- Stop the park car explosions 
  4453. 	if (thread_check_done(Dlc2_m01_threads.parked_car_explosions) == false) then 
  4454. 		thread_kill(Dlc2_m01_threads.parked_car_explosions) 
  4455. 		Dlc2_m01_threads.parked_car_explosions = INVALID_THREAD_HANDLE 
  4456. 		 
  4457. 		continuous_explosion_stop() 
  4458. 	end 
  4459. end 
  4460.  
  4461. -- Set Kwilanna's invulnerability flag 
  4462. function dlc2_m01_helper_set_kwilanna_invulnerable(invulnerable, allow_player_dmg) 
  4463. 	if (allow_player_dmg == nil) then 
  4464. 		allow_player_dmg = false 
  4465. 	end 
  4466.  
  4467. 	if (invulnerable) then 
  4468. 		-- Make Kwilanna invulnerable 
  4469. 		if (human_is_downed(Dlc2_m01_characters.kwilanna) == true) then 
  4470. 			npc_revive(Dlc2_m01_characters.kwilanna) 
  4471. 		end 
  4472. 		turn_invulnerable(Dlc2_m01_characters.kwilanna, allow_player_dmg) 
  4473. 	else 
  4474. 		turn_vulnerable(Dlc2_m01_characters.kwilanna) 
  4475. 	end 
  4476. 	 
  4477. 	Dlc2_m01_runtime.kwilanna_invulnerable = invulnerable 
  4478. 	Dlc2_m01_runtime.kwilanna_damaged_by_player = allow_player_dmg 
  4479. end 
  4480.  
  4481. -- Process the film grain action 
  4482. function dlc2_m01_helper_start_film_grain_thread() 
  4483. 	-- Load the film grain UI 
  4484. 	dlc_gis_film_grain_load() 
  4485. 	 
  4486. 	audio_object_post_event("Action") 
  4487. 	delay(5.0) 
  4488. 	audio_object_post_event("Action_Fade") 
  4489. end 
  4490.  
  4491. -- Load the film grain 
  4492. function dlc2_m01_load_film_grain() 
  4493. 	if (thread_check_done(Dlc2_m01_threads.film_grain_load) == false) then 
  4494. 		thread_kill(Dlc2_m01_threads.film_grain_load) 
  4495. 	end 
  4496. 	 
  4497. 	Dlc2_m01_threads.film_grain_load = thread_new("dlc2_m01_helper_start_film_grain_thread") 
  4498. end 
  4499.  
  4500. -- Check if a particular conversation is done (Originally written by Matt Gawalek for Mission 02) 
  4501. -- 
  4502. -- dialog_table:		Conversation Lua table (see Dlc2_m01_conversations) 
  4503. function dlc2_m01_helper_dialog_check_done(dialog_table) 
  4504. 	if (dialog_table.queued == false and dialog_table.started == false) then 
  4505. 		return true 
  4506. 	else 
  4507. 		return dialog_table.ended 
  4508. 	end 
  4509. end 
  4510.  
  4511. -- Helper to play conversations, by adding them to the cue (Originally written by Matt Gawalek for Mission 02) 
  4512. -- 
  4513. -- dialog_table:	Conversation Lua table (see Dlc2_m01_conversations) 
  4514. -- priority:		Desired priority for the conversation 
  4515. -- delay:			Amonut of time to dalya after this conversation before playing the next conversation (in seconds) 
  4516. -- player:			Player to play the line on if in coop (if player speaks in dialog), or nil to play on the HOST (defaults to nil) 
  4517. function dlc2_m01_helper_dialog_play(dialog_table, priority, delay, player) 
  4518. 	dialog_table.queued = true 
  4519. 	dialog_table.delay = delay 
  4520. 	dialog_table.player = player 
  4521. 	 
  4522. 	if (priority == DLC2_M01_CONVO_PLAY_LAST) then 
  4523. 		-- Insert this entry at the end of hte lsit 
  4524. 		Dlc2_m01_dialog_queue.list[Dlc2_m01_dialog_queue.size] = dialog_table 
  4525. 		Dlc2_m01_dialog_queue.size = Dlc2_m01_dialog_queue.size + 1 
  4526. 	elseif (priority == DLC2_M01_CONVO_PLAY_NEXT) then 
  4527. 		-- Shift the list to the right 
  4528. 		for i = Dlc2_m01_dialog_queue.size - 1, 0, -1 do 
  4529. 			Dlc2_m01_dialog_queue.list[i + 1] = Dlc2_m01_dialog_queue.list[i] 
  4530. 		end 
  4531. 		Dlc2_m01_dialog_queue.list[0] = dialog_table 
  4532. 		Dlc2_m01_dialog_queue.size = Dlc2_m01_dialog_queue.size + 1 
  4533. 	elseif (priority == DLC2_M01_CONVO_PLAY_IMMEDIATE) then 
  4534. 		-- Stop any actively playing conversations, and start this one immediatly 
  4535. 		dlc2_m01_helper_dialog_cleanup_playing() 
  4536. 		Dlc2_m01_dialog_queue.playing.thread_id = thread_new("dlc2_m01_thread_play_dialog", dialog_table) 
  4537. 	end 
  4538. end 
  4539.  
  4540. -- Kill any active dialog, and clear out the dialog queue (Originally written by Matt Gawalek for Mission 02) 
  4541. function dlc2_m01_helper_dialog_kill_all() 
  4542. 	-- Stop any active conversation 
  4543. 	dlc2_m01_helper_dialog_cleanup_playing() 
  4544. 	 
  4545. 	-- Clear out the queue 
  4546. 	for i = 0, Dlc2_m01_dialog_queue.size - 1 do 
  4547. 		Dlc2_m01_dialog_queue.list[i].ended = true 
  4548. 	end 
  4549. 	Dlc2_m01_dialog_queue.size = 0 
  4550. end 
  4551.  
  4552. -- Cleanup any playing dialog (Originally written by Matt Gawalek for Mission 02) 
  4553. function dlc2_m01_helper_dialog_cleanup_playing() 
  4554. 	-- Stop the thread processing a playing dialog 
  4555. 	if (Dlc2_m01_dialog_queue.playing.thread_id ~= INVALID_THREAD_HANDLE) then 
  4556. 		thread_kill(Dlc2_m01_dialog_queue.playing.thread_id) 
  4557. 		Dlc2_m01_dialog_queue.playing.thread_id = INVALID_THREAD_HANDLE 
  4558. 	end 
  4559. 	-- Cleanup any dialog data for a playing dialog 
  4560. 	if (Dlc2_m01_dialog_queue.playing.dialog_handle ~= INVALID_CONVERSATION_HANDLE) then 
  4561. 		if (Dlc2_m01_dialog_queue.playing.dialog_table.is_convo == true) then 
  4562. 			audio_conversation_end(Dlc2_m01_dialog_queue.playing.dialog_handle) 
  4563. 		else 
  4564. 			audio_stop(Dlc2_m01_dialog_queue.playing.dialog_handle) 
  4565. 		end 
  4566. 		Dlc2_m01_dialog_queue.playing.dialog_handle = INVALID_CONVERSATION_HANDLE 
  4567. 	end 
  4568. 	-- Mark the playing dialog as ended 
  4569. 	if (Dlc2_m01_dialog_queue.playing.dialog_table ~= nil) then 
  4570. 		Dlc2_m01_dialog_queue.playing.dialog_table.ended = true 
  4571. 	end 
  4572. end 
  4573.  
  4574. -- Thread to process playing a single converation or dialog line (Originally written by Matt Gawalek for Mission 02) 
  4575. function dlc2_m01_thread_play_dialog(dialog_table) 
  4576. 	-- Add this conversatin to the playing dialog data 
  4577. 	Dlc2_m01_dialog_queue.playing.dialog_table = dialog_table 
  4578. 	 
  4579. 	dialog_table.started = true	-- it has now started 
  4580. 	dialog_table.queued = false 
  4581. 	 
  4582. 	-- Play the dialog 
  4583. 	if (dialog_table.is_convo == true) then 
  4584. 		-- Load the conversation data 
  4585. 		if (dialog_table.load_direct == false) then 
  4586. 			if (dialog_table.player ~= nil) then 
  4587. 				Dlc2_m01_dialog_queue.playing.dialog_handle = audio_conversation_load_player(dialog_table.name, dialog_table.player) 
  4588. 			else 
  4589. 				Dlc2_m01_dialog_queue.playing.dialog_handle = audio_conversation_load(dialog_table.name) 
  4590. 			end 
  4591. 		else 
  4592. 			Dlc2_m01_dialog_queue.playing.dialog_handle = audio_conversation_load_direct(dialog_table.name) 
  4593. 		end 
  4594. 	 
  4595. 		-- Play the conversation and wait for it to end 
  4596. 		audio_conversation_play(Dlc2_m01_dialog_queue.playing.dialog_handle) 
  4597. 		audio_conversation_wait_for_end(Dlc2_m01_dialog_queue.playing.dialog_handle) 
  4598. 		audio_conversation_end(Dlc2_m01_dialog_queue.playing.dialog_handle) 
  4599. 		 
  4600. 		Dlc2_m01_dialog_queue.playing.dialog_handle = INVALID_CONVERSATION_HANDLE 
  4601. 	else 
  4602. 		-- Find the persona ID for this line 
  4603. 		local persona_id = INVALID_PERSONA_HANDLE 
  4604. 		for i, persona in pairs (Dlc2_m01_personas) do 
  4605. 			if (persona.name == dialog_table.persona) then 
  4606. 				persona_id = persona.persona_id 
  4607. 				break 
  4608. 			end 
  4609. 		end 
  4610.  
  4611. 		if (persona_id ~= INVALID_PERSONA_HANDLE) then 
  4612. 			-- Play the line 
  4613. 			Dlc2_m01_dialog_queue.playing.dialog_handle = audio_play_persona_line_2d(persona_id, dialog_table.name) 
  4614. 		else 
  4615. 			-- Assume the persona listed is an actual character 
  4616. 			Dlc2_m01_dialog_queue.playing.dialog_handle = audio_play_persona_line(dialog_table.persona, dialog_table.name) 
  4617. 		end 
  4618.  
  4619. 		-- Wait for the line to end 
  4620. 		while(audio_is_playing(Dlc2_m01_dialog_queue.playing.dialog_handle) == true) do 
  4621. 			thread_yield() 
  4622. 		end		 
  4623. 	end 
  4624. 	 
  4625. 	delay(0.1) 
  4626. 	delay(dialog_table.delay) 
  4627. 	 
  4628. 	-- Do some book-keeping 
  4629. 	Dlc2_m01_dialog_queue.playing.dialog_handle = INVALID_CONVERSATION_HANDLE 
  4630. 	dialog_table.completed = true 
  4631. 	dialog_table.ended = true 
  4632. end 
  4633.  
  4634. -- Process the dialog queue (should be running the duration of the mission) (Originally written by Matt Gawalek for Mission 02) 
  4635. function dlc2_m01_thread_process_dialog() 
  4636. 	-- Loop forever 
  4637. 	while(true) do 
  4638. 		-- Wait until something is added to the queue 
  4639. 		while(Dlc2_m01_dialog_queue.size == 0 or thread_check_done(Dlc2_m01_dialog_queue.playing.thread_id) == false) do 
  4640. 			thread_yield() 
  4641. 		end 
  4642. 		 
  4643. 		-- Play the first dialog from the queue, and then remove it from the qeue 
  4644. 		Dlc2_m01_dialog_queue.playing.thread_id = thread_new("dlc2_m01_thread_play_dialog", Dlc2_m01_dialog_queue.list[0]) 
  4645. 		for i = 1, Dlc2_m01_dialog_queue.size do 
  4646. 			Dlc2_m01_dialog_queue.list[i - 1] = Dlc2_m01_dialog_queue.list[i] 
  4647. 		end 
  4648. 		Dlc2_m01_dialog_queue.size = Dlc2_m01_dialog_queue.size - 1 
  4649. 		 
  4650. 		-- Wait for the active dialog thread to end 
  4651. 		while(thread_check_done(Dlc2_m01_dialog_queue.playing.thread_id) == false) do 
  4652. 			thread_yield() 
  4653. 		end 
  4654. 		Dlc2_m01_dialog_queue.playing.thread_id = INVALID_THREAD_HANDLE 
  4655. 		 
  4656. 		delay(0.2) 
  4657. 	end 
  4658. end 
  4659.  
  4660.  
  4661. -- *************************************************** 
  4662. -- General Thread Functions 
  4663. -- *************************************************** 
  4664.  
  4665. -- Process vehicle pathfinds through a segment for the rail sequence 
  4666. -- 
  4667. -- segment:		segment of vehicle navs as defined in Dlc2_m01_rail_loops 
  4668. function dlc2_m01_process_rail_loop(loop) 
  4669. 	local max_pathfind_attempts = 2 
  4670.  
  4671. 	-- Process all of the segments in this loop 
  4672. 	local curr_segment_idx = 1 
  4673. 	while(curr_segment_idx <= #(loop.segments)) do 
  4674. 		local segment = loop.segments[curr_segment_idx] 
  4675. 	 
  4676. 		-- Loop over all the navs in the segment 
  4677. 		local curr_path_idx = 1 
  4678. 		while(curr_path_idx <= #(segment.navs)) do 
  4679. 			-- Do the vehicle pathfind 
  4680. 			local success = false 
  4681. 			local attempts = 0 
  4682. 			while (success == false and attempts < max_pathfind_attempts) do 
  4683. 				if (segment.navmesh == true) then 
  4684. 					vehicle_pathfind_navmesh_do(Dlc2_m01_groups.armory_get_away_car.vehicle, segment.navs[curr_path_idx], false, false, false, 0) 
  4685. 				else 
  4686. 					vehicle_pathfind_to_do(Dlc2_m01_groups.armory_get_away_car.vehicle, segment.navs[curr_path_idx], false, false) 
  4687. 				end 
  4688. 			 
  4689. 				-- Wait for the pathfind to complete 
  4690. 				while(true) do 
  4691. 					local pathfind_complete = vehicle_pathfind_check_done(Dlc2_m01_groups.armory_get_away_car.vehicle) 
  4692. 					if (pathfind_complete == 2) then 
  4693. 						success = false 
  4694. 						break 
  4695. 					elseif (pathfind_complete == 1) then 
  4696. 						success = true 
  4697. 						break 
  4698. 					end 
  4699. 					 
  4700. 					local dist_to_node = get_dist(Dlc2_m01_groups.armory_get_away_car.vehicle, segment.navs[curr_path_idx]) 
  4701. 					if (dist_to_node <= Dlc2_m01_tweak_values.player_veh_pathfind_dist) then 
  4702. 							 
  4703. 						success = true 
  4704. 						break 
  4705. 					end 
  4706. 					 
  4707. 					thread_yield() 
  4708. 				end 
  4709. 			 
  4710. 				-- If the pathfind failed, wait a second and try again 
  4711. 				if (success == false) then 
  4712. 					if (character_is_in_vehicle(Dlc2_m01_characters.kwilanna, Dlc2_m01_groups.armory_get_away_car.vehicle) == false) then 
  4713. 						vehicle_enter_teleport(Dlc2_m01_characters.kwilanna, Dlc2_m01_groups.armory_get_away_car.vehicle, 0, true, true) 
  4714. 						while(character_is_in_vehicle(Dlc2_m01_characters.kwilanna, Dlc2_m01_groups.armory_get_away_car.vehicle) == false) do 
  4715. 							thread_yield() 
  4716. 						end 
  4717. 					end 
  4718. 					 
  4719. 					delay(1.0) 
  4720. 				end 
  4721. 				 
  4722. 				attempts = attempts + 1 
  4723. 			end 
  4724. 			 
  4725. 			-- If the pathfind fails, teleport the vehicle to the destination navpoint 
  4726. 			if (attempts == max_pathfind_attempts) then 
  4727. 				teleport_vehicle(Dlc2_m01_groups.armory_get_away_car.vehicle, segment.navs[curr_path_idx]) 
  4728. 			end 
  4729. 			 
  4730. 			-- Move to the next path 
  4731. 			curr_path_idx = curr_path_idx + 1 
  4732. 			thread_yield() 
  4733. 		end 
  4734. 		 
  4735. 		-- Do any delay for the segment 
  4736. 		if (segment.delay ~= nil) then 
  4737. 			delay(segment.delay) 
  4738. 		end 
  4739. 		 
  4740. 		curr_segment_idx = curr_segment_idx + 1 
  4741. 	end 
  4742. end 
  4743.  
  4744. -- Thread to process an NPC doing a pathfind, and then chasing the LOCAL_PLAYER 
  4745. -- 
  4746. -- npc_table:		NPC table 
  4747. -- path:			Name of the path to follow 
  4748. function dlc2_m01_process_ambush_npc_thread(npc_table, behavior, invulnerable) 
  4749. 	if (npc_table.delay ~= nil) then 
  4750. 		delay(npc_table.delay) 
  4751. 	end 
  4752. 	 
  4753. 	if (invulnerable == true) then 
  4754. 		turn_invulnerable(npc_table.npc) 
  4755. 	end 
  4756.  
  4757. 	-- Show the character 
  4758. 	character_show(npc_table.npc) 
  4759.  
  4760. 	if (behavior == "attack_region") then 
  4761. 		-- Add the player as an attack target 
  4762. 		ai_add_enemy_target(npc_table.npc, CLOSEST_PLAYER, ATTACK_NOW_NEVER_LOSE, false) 
  4763.  
  4764. 		-- Move to the attack region 
  4765. 		ai_attack_region(npc_table.npc, npc_table.nav, npc_table.leash) 
  4766. 	elseif (behavior == "retreat") then 
  4767. 		-- Rush to the navpoint and leash them there 
  4768. 		npc_leash_to_nav(npc_table.npc, npc_table.nav, npc_table.leash) 
  4769. 		ai_do_scripted_rush(npc_table.npc, npc_table.nav) 
  4770. 	end 
  4771. 	 
  4772. 	while(true) do 
  4773. 		delay(1.5) 
  4774. 		 
  4775. 		-- Check if the npc has been killed or is too far away from the player 
  4776. 		local dist = get_dist_closest_player_to_object(npc_table.npc) 
  4777. 		if (character_is_dead(npc_table.npc) == true or dist > Dlc2_m01_chase_vehicle_cleanup_dist) then 
  4778. 			-- Release the NPC to the world 
  4779. 			release_to_world(npc_table.npc) 
  4780. 			 
  4781. 			-- We're done processing here 
  4782. 			return 
  4783. 		end 
  4784. 	end	 
  4785. end 
  4786.  
  4787. -- Thread to process a vehicle doing a pathfind, and then chasing the LOCAL_PLAYER 
  4788. -- 
  4789. -- vehicle_table:	Vehicle table 
  4790. -- path:			Name of the path to follow 
  4791. function dlc2_m01_process_ambush_vehicle_thread(vehicle_table, behavior, speed, invulnerable, hp_multiplier, no_entry, follow_target) 
  4792. 	if (speed == nil) then 
  4793. 		speed = -1 
  4794. 	end 
  4795. 	if (no_entry == nil) then 
  4796. 		no_entry = false 
  4797. 	end 
  4798. 	if (follow_target == nil) then 
  4799. 		follow_target = Dlc2_m01_groups.armory_get_away_car.vehicle 
  4800. 	end 
  4801. 	 
  4802. 	-- If this is an alien vehicle, register a callback for when it's destroyed so we can track the achievement 
  4803. 	if (vehicle_table.is_alien == true) then 
  4804. 		on_vehicle_destroyed("dlc2_m01_alien_spaceship_destroyed_cb", vehicle_table.vehicle) 
  4805. 	end 
  4806.  
  4807. 	-- Put all of the NPCs into the vehicle 
  4808. 	if (no_entry == false) then 
  4809. 		vehicle_enter_group_teleport(vehicle_table.npcs, vehicle_table.vehicle) 
  4810. 		vehicle_suppress_npc_exit(vehicle_table.vehicle, true) 
  4811. 	end 
  4812. 	 
  4813. 	if (vehicle_table.delay ~= nil) then 
  4814. 		delay(vehicle_table.delay) 
  4815. 	end 
  4816. 	 
  4817. 	if (vehicle_table.exp_factor ~= nil) then 
  4818. 		vehicle_set_explosion_damage_multiplier(vehicle_table.vehicle, vehicle_table.exp_factor) 
  4819. 	end 
  4820. 	 
  4821. 	if (invulnerable == true) then 
  4822. 		turn_invulnerable(vehicle_table.vehicle) 
  4823. 		for i, npc in pairs(vehicle_table.npcs) do 
  4824. 			turn_invulnerable(npc) 
  4825. 		end 
  4826. 	end 
  4827.  
  4828. 	-- Show the vehicle and all NPCs 
  4829. 	vehicle_show(vehicle_table.vehicle) 
  4830. 	for i, npc in pairs(vehicle_table.npcs) do 
  4831. 		character_show(npc) 
  4832. 	end 
  4833. 	 
  4834. 	-- Setup the vehicle 
  4835. 	local veh_type = get_vehicle_type(vehicle_table.vehicle) 
  4836. 	vehicle_suppress_npc_exit(vehicle_table.vehicle, true) 
  4837. 	if (veh_type == VT_AUTOMOBILE or veh_type == VT_MOTORCYCLE) then 
  4838. 		vehicle_ignore_repulsors(vehicle_table.vehicle, true) 
  4839. 		vehicle_set_ignore_rail_obstacles(vehicle_table.vehicle, true) 
  4840. 		vehicle_set_script_hard_goto(vehicle_table.vehicle, true) 
  4841. 	end 
  4842. 	 
  4843. 	if (speed ~= nil and speed ~= -1) then 
  4844. 		vehicle_max_speed(vehicle_table.vehicle, speed) 
  4845. 		vehicle_speed_override(vehicle_table.vehicle, speed)	 
  4846. 	end 
  4847. 	 
  4848. 	if (hp_multiplier ~= nil) then 
  4849. 		set_max_hit_points(vehicle_table.vehicle, hp_multiplier * get_max_hit_points(vehicle_table.vehicle)) 
  4850. 	end 
  4851. 	 
  4852. 	-- Add the player as an attack target 
  4853. 	for i, npc in pairs(vehicle_table.npcs) do 
  4854. 		ai_add_enemy_target(npc, CLOSEST_PLAYER, ATTACK_NOW_NEVER_LOSE, true) 
  4855. 	end 
  4856. 	 
  4857. 	if (vehicle_table.orient ~= nil) then 
  4858. 		helicopter_set_path_orientation(vehicle_table.vehicle, vehicle_table.orient, LOCAL_PLAYER) 
  4859. 	end 
  4860. 	 
  4861. 	-- Kick off a thread to force fire the lasers on the alien spaceships 
  4862. 	if (vehicle_table.is_alien == true) then 
  4863. 		vehicle_table.fire_thread_id = thread_new("dlc2_m01_alien_ambush_process_alien_fire", vehicle_table.vehicle, follow_target, 99999.0, 2.2, 0.0, 1.0, 0.5) 
  4864. 	end 
  4865.  
  4866. 	-- Do the requested behavior 
  4867. 	if (behavior == "chase") then 
  4868. 		-- Nothing to do up front, just do the chase setup below 
  4869. 		 
  4870. 	elseif (behavior == "path_navmesh") then 
  4871. 		-- Do the vehicle pathfind 
  4872. 		local path_idx = 1 
  4873. 		while(path_idx <= #vehicle_table.paths) do 
  4874. 			vehicle_pathfind_to(vehicle_table.vehicle, vehicle_table.paths[path_idx], true, false) -- navmesh pathfind, don't stop at goal 
  4875. 			path_idx = path_idx + 1 
  4876. 		end 
  4877. 		 
  4878. 	elseif (behavior == "path_navmesh_stop" or behavior == "path_navmesh_exit") then 
  4879. 		-- Do the vehicle pathfind 
  4880. 		local path_idx = 1 
  4881. 		while(path_idx <= #vehicle_table.paths) do 
  4882. 			local stop = false 
  4883. 			if (path_idx == #vehicle_table.paths) then 
  4884. 				stop = true 
  4885. 			end 
  4886. 			 
  4887. 			vehicle_pathfind_to(vehicle_table.vehicle, vehicle_table.paths[path_idx], true, stop) -- navmesh pathfind, stop at goal 
  4888. 			path_idx = path_idx + 1 
  4889. 		end 
  4890. 		 
  4891. 		-- If they should exit, do that now 
  4892. 		if (behavior == "path_navmesh_exit") then 
  4893. 			vehicle_exit_group(vehicle_table.npcs) 
  4894. 		end 
  4895. 	 
  4896. 	elseif (behavior == "heli_follow" or behavior == "heli_follow_explode") then 
  4897. 		local follow_above = false 
  4898. 		if (vehicle_table.above == true) then 
  4899. 			follow_above = true 
  4900. 		end 
  4901. 	 
  4902. 		-- Do heli pathfind 
  4903. 		local path_idx = 1 
  4904. 		while(path_idx <= #vehicle_table.paths) do 
  4905. 			helicopter_fly_to_internal(vehicle_table.vehicle, speed, true, follow_target, true, vehicle_table.paths[path_idx], vehicle_table.follow_dist, false, follow_above, true, false) 
  4906. 			path_idx = path_idx + 1 
  4907. 		end	 
  4908. 		 
  4909. 	elseif (behavior == "heli_path" or "heli_path_explode" or "heli_path_retreat") then 
  4910. 		-- Do heli pathfind 
  4911. 		local path_idx = 1 
  4912. 		while(path_idx <= #vehicle_table.paths) do 
  4913. 			helicopter_fly_to_internal(vehicle_table.vehicle, speed, true, "", true, vehicle_table.paths[path_idx], vehicle_table.follow_dist, false, false, true, false) 
  4914. 			path_idx = path_idx + 1 
  4915. 		end	 
  4916.  
  4917. 	elseif (behavior == "heli_path_stop") then 
  4918. 		local path_idx = 1 
  4919. 		while(path_idx <= #vehicle_table.paths) do 
  4920. 			local continue = (path_idx ~= #vehicle_table.paths) 
  4921. 			helicopter_fly_to_internal(vehicle_table.vehicle, speed, true, "", continue, vehicle_table.paths[path_idx], vehicle_table.follow_dist, false, false, true, false) 
  4922. 			path_idx = path_idx + 1 
  4923. 		end		 
  4924. 		 
  4925. 		--helicopter_fly_to_stop(vehicle_table.vehicle) 
  4926. 	end 
  4927. 	 
  4928. 	-- Now chase the local player 
  4929. 	if (behavior == "heli_follow_explode" or behavior == "heli_path_explode") then 
  4930. 		vehicle_set_smoke_and_fire_state(vehicle_table.vehicle, true, true) 
  4931. 		on_take_damage("dlc2_m01_destroy_vehicle_on_collision_cb", vehicle_table.vehicle) 
  4932. 	elseif (behavior == "heli_path_stop") then 
  4933. 		-- DO NOTHING 
  4934. 	elseif (behavior == "heli_path_retreat") then 
  4935. 		helicopter_enter_retreat(vehicle_table.vehicle) 
  4936. 	else 
  4937. 		vehicle_chase(vehicle_table.vehicle, CLOSEST_PLAYER) 
  4938. 		vehicle_max_speed(vehicle_table.vehicle, Dlc2_m01_tweak_values.ng_vehicle_chase_speed) 
  4939. 		vehicle_speed_override(vehicle_table.vehicle, Dlc2_m01_tweak_values.ng_vehicle_chase_speed)	 
  4940. 	end 
  4941. 		 
  4942. 	-- Process this vehicle until it is destroyed or gets too far from the player 
  4943. 	while(true) do 
  4944. 		delay(1.5) 
  4945. 		 
  4946. 		-- If this isn't an alien vehicle, then check the distance (we don't want aliens to be deactived by distance since they count towards an achievement) 
  4947. 		local dist = 0 
  4948. 		if (vehicle_table.is_alien == false) then 
  4949. 			dist = get_dist_closest_player_to_object(vehicle_table.vehicle) 
  4950. 		end 
  4951.  
  4952. 		-- Check if the vehicle has been destroyed or too far away from the player		 
  4953. 		if (vehicle_is_destroyed(vehicle_table.vehicle) == true or dist > Dlc2_m01_chase_vehicle_cleanup_dist) then 
  4954. 			-- If the vehicle was destroyed, maybe play a positive director voice line 
  4955. 			if (vehicle_is_destroyed(vehicle_table.vehicle) == true) then 
  4956. 				if (rand_int(1, 5) == 1 and thread_check_done(Dlc2_m01_dialog_queue.playing.thread_id) == true) then 
  4957. 					dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.director_generic_positive, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  4958. 				end 
  4959. 			end 
  4960. 		 
  4961. 			-- Release the vehicle and any NPCs to the world 
  4962. 			release_to_world(vehicle_table.vehicle) 
  4963. 			for i, npc in pairs(vehicle_table.npcs) do 
  4964. 				release_to_world(npc) 
  4965. 			end 
  4966. 			 
  4967. 			-- We're done processing here 
  4968. 			return 
  4969. 		end 
  4970. 	end 
  4971. end 
  4972.  
  4973. -- Thread to process a helicopter droping some soldier off 
  4974. function dlc2_m01_process_helicopter_drop_off_thread(heli_group) 
  4975. 	-- Create the group 
  4976. 	group_create_hidden(heli_group.name, true) 
  4977. 	 
  4978. 	-- Load up the pilots and soldiers into the helicopter 
  4979. 	local seat_idx = 0 
  4980. 	for i, pilot in pairs(heli_group.heli.pilots) do 
  4981. 		vehicle_enter_teleport(pilot, heli_group.heli.vehicle, seat_idx, true) 
  4982. 		seat_idx = seat_idx + 1 
  4983. 	end 
  4984. 	for i, soldier in pairs(heli_group.heli.soldiers) do 
  4985. 		vehicle_enter_teleport(soldier, heli_group.heli.vehicle, seat_idx, true) 
  4986. 		seat_idx = seat_idx + 1 
  4987. 	end 
  4988. 	 
  4989. 	-- Unhide the group and start following the path 
  4990. 	group_show(heli_group.name) 
  4991. 	helicopter_fly_to_direct(heli_group.heli.vehicle, heli_group.heli.speed, heli_group.heli.path) 
  4992. 	 
  4993. 	-- Wait a bit and then force the soldiers out 
  4994. 	delay(0.5) 
  4995. 	vehicle_exit_group(heli_group.heli.soldiers) 
  4996. 	 
  4997. 	-- Wait a bit and then make the helicopter retreat 
  4998. 	delay(2.0) 
  4999. 	helicopter_enter_retreat(heli_group.heli.vehicle) 
  5000. 	 
  5001. 	-- Release the helicopter and pilots to the world 
  5002. 	release_to_world(heli_group.heli.vehicle) 
  5003. 	for i, pilot in pairs(heli_group.heli.pilots) do 
  5004. 		release_to_world(pilot) 
  5005. 	end 
  5006. end 
  5007.  
  5008. -- Spin and randomly detonate parker cars 
  5009. function dlc2_m01_process_parked_car_explosions() 
  5010. 	while(true) do 
  5011. 		delay(rand_float(Dlc2_m01_tweak_values.parked_car_exp_cooldown_min, Dlc2_m01_tweak_values.parked_car_exp_cooldown_max)) 
  5012. 		vehicle_detonate_random_parked_car(Dlc2_m01_groups.armory_get_away_car.vehicle, 110, 180, 20, 80) 
  5013. 	end 
  5014. end 
  5015.  
  5016. --[[ 
  5017. -- Process Kwilanna's position to kill her if she gets pushed away from where she should be tied up 
  5018. function dlc2_m01_process_kwilanna_pos_thread() 
  5019. 	while(true) do 
  5020. 		delay(1.0) 
  5021. 		if (get_dist(Dlc2_m01_characters.kwilanna, Dlc2_m01_navpoints.kwilanna_rescue_orient) > 1.5) then 
  5022. 			character_kill(Dlc2_m01_characters.kwilanna, true) 
  5023. 			break 
  5024. 		end 
  5025. 	end 
  5026. end 
  5027. --]] 
  5028.  
  5029.  
  5030. -- *************************************************** 
  5031. -- General Script Callback Functions 
  5032. -- *************************************************** 
  5033.  
  5034. -- Callback for when a player enters the trigger surrounding the National Guard Island 
  5035. -- 
  5036. -- player_name:		Name of the player that entered the trigger 
  5037. -- trigger:			Name of the trigger volume 
  5038. function dlc2_m01_armory_island_entered_take1_cb(player_name, trigger) 
  5039. 	-- Disable Police notoriety 
  5040. 	notoriety_force_no_spawn("Police", true)	 
  5041. 	 
  5042. 	-- Disable parking spots (since we want to spawn our own vehicles) 
  5043. 	parking_spot_disable_all(true) 
  5044. 	 
  5045. 	if (Dlc2_m01_runtime.reached_armory_island == false) then 
  5046. 		Dlc2_m01_runtime.reached_armory_island = true 
  5047. 		 
  5048. 		-- Director yells action 
  5049. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.start_action, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  5050. 		while(dlc2_m01_helper_dialog_check_done(Dlc2_m01_dialog_lines.start_action) == false) do 
  5051. 			thread_yield() 
  5052. 		end 
  5053. 		 
  5054. 		-- Load the film grain UI 
  5055. 		dlc2_m01_load_film_grain() 
  5056. 		delay(0.8) 
  5057. 		audio_object_post_event("Action_01") 
  5058. 		 
  5059. 		delay(1.0) 
  5060. 		 
  5061. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.armory_drive_start, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  5062. 	end 
  5063. end 
  5064.  
  5065. -- Callback for when a player enters the trigger surrounding the National Guard Island (on the second take) 
  5066. -- 
  5067. -- player_name:		Name of the player that entered the trigger 
  5068. -- trigger:			Name of the trigger volume 
  5069. function dlc2_m01_armory_island_entered_take2_cb(player_name, trigger) 
  5070. 	-- Disable Police notoriety 
  5071. 	notoriety_force_no_spawn("Police", true) 
  5072. 	 
  5073. 	-- Disable parking spots (since we want to spawn our own vehicles) 
  5074. 	parking_spot_disable_all(true) 
  5075. end 
  5076.  
  5077. -- Callback for when a player exits the trigger surrounding the National Guard Island 
  5078. -- 
  5079. -- player_name:		Name of the player that entered the trigger 
  5080. -- trigger:			Name of the trigger volume 
  5081. function dlc2_m01_armory_island_exited_cb(player_name, trigger) 
  5082. 	-- If we're in coop, check to make sure the other player isn't still in the trigger before restoring the ambient spawning levels 
  5083. 	if (coop_is_active() == true) then 
  5084. 		for i, player in pairs(Dlc2_m01_player_list) do 
  5085. 			if (object_is_in_trigger(trigger, player) == true) then 
  5086. 				return 
  5087. 			end 
  5088. 		end 
  5089. 	end 
  5090. 	 
  5091. 	-- Re-enable parking spawns 
  5092. 	parking_spot_disable_all(false) 
  5093. end 
  5094.  
  5095. -- Callback for when a player enters the trigger volume at the parking area next to the heli pad 
  5096. -- 
  5097. -- player_name:		Name of the player that entered the trigger 
  5098. -- trigger:			Name of the trigger volume 
  5099. function dlc2_m01_armory_parking_triggered_cb(player_name, trigger) 
  5100. 	if (Dlc2_m01_runtime.reached_armory_parking_area_by == nil) then 
  5101. 		Dlc2_m01_runtime.reached_armory_parking_area_by = player_name 
  5102. 	end 
  5103. 	 
  5104. 	-- If the player's in a vehicle, stop the vehicle and force the player on foot 
  5105. 	if (Dlc2_m01_runtime.current_checkpoint ~= Dlc2_m01_checkpoints.armory_take2.name) then 
  5106. 		if (character_is_in_vehicle(player_name) == true) then 
  5107. 			if (character_is_in_a_driver_seat(player_name) == true) then 
  5108. 				vehicle_stop_do(player_name) 
  5109. 			end 
  5110.  
  5111. 			set_unenterable_for_player(player_name, true) 
  5112. 			vehicle_exit(player_name) 
  5113. 		end 
  5114. 	end 
  5115. end 
  5116.  
  5117. -- Callback for when a player enters the trigger volume around the Armory 
  5118. -- 
  5119. -- player_name:		Name of the player that entered the trigger 
  5120. -- trigger:			Name of the trigger volume 
  5121. function dlc2_m01_heli_pad_triggered_cb(player_name, trigger) 
  5122. 	if (Dlc2_m01_runtime.reached_armory_parking_area_by ~= nil) then 
  5123. 		Dlc2_m01_runtime.entered_heli_pad = true 
  5124. 	else 
  5125. 		if (Dlc2_m01_runtime.num_players_in_heli_pad == 0) then 
  5126. 			-- Disable the trigger for the parking area 
  5127. 			trigger_enable(Dlc2_m01_triggers.armory_parking_location, false) 
  5128. 			 
  5129. 			-- Put up a HUD critical timer 
  5130. 			hud_critical_timer_set(Dlc2_m01_tweak_values.heli_pad_evacuate_time, "DLC2_M01_HUD_LEAVE_HELI_AREA", "dlc2_m01_player_disobey_failure_cb", SYNC_ALL) 
  5131. 		end 
  5132. 		 
  5133. 		Dlc2_m01_runtime.num_players_in_heli_pad = Dlc2_m01_runtime.num_players_in_heli_pad + 1 
  5134. 	end 
  5135. end 
  5136.  
  5137. -- Callback for when a player exits the trigger volume around the Armory 
  5138. -- 
  5139. -- player_name:		Name of the player that entered the trigger 
  5140. -- trigger:			Name of the trigger volume 
  5141. function dlc2_m01_heli_pad_exited_cb(player_name, trigger) 
  5142. 	if (Dlc2_m01_runtime.reached_armory_parking_area_by == nil) then 
  5143. 		Dlc2_m01_runtime.num_players_in_heli_pad = Dlc2_m01_runtime.num_players_in_heli_pad - 1 
  5144. 		 
  5145. 		if (Dlc2_m01_runtime.num_players_in_heli_pad == 0) then 
  5146. 			-- Remove the HUD critical timer 
  5147. 			hud_critical_timer_stop() 
  5148. 			 
  5149. 			-- Enable the trigger for the parking area 
  5150. 			trigger_enable(Dlc2_m01_triggers.armory_parking_location, true) 
  5151. 		end 
  5152. 	end 
  5153. end 
  5154.  
  5155. -- Callback for when Kwilanna is killed 
  5156. function dlc2_m01_kwilanna_died_cb() 
  5157. 	-- Fail the mission 
  5158. 	mission_end_failure("dlc2_m01", "DLC2_M01_FAIL_KWILANNA_DIED") 
  5159. end 
  5160.  
  5161. -- Callback for when Kwilanna is dismissed 
  5162. function dlc2_m01_kwilanna_dismissed_cb() 
  5163. 	-- Fail the mission 
  5164. 	mission_end_failure("dlc2_m01", "DLC2_M01_FAIL_KWILANNA_DISMISSED") 
  5165. end 
  5166.  
  5167. -- Callback for when Kwilanna is revived 
  5168. function dlc2_m01_kwilanna_revived_cb() 
  5169. 	-- Hack to restore invulnerable flag, since human_revive is dumb and clears the flag 
  5170. 	if (Dlc2_m01_runtime.kwilanna_invulnerable == true) then 
  5171. 		turn_invulnerable(Dlc2_m01_characters.kwilanna, Dlc2_m01_runtime.kwilanna_damaged_by_player) 
  5172. 	end 
  5173. end 
  5174.  
  5175. -- Callback for when Kwilanna is downed 
  5176. function dlc2_m01_kwilanna_downed_cb() 
  5177. 	-- If Kwilanna is supposed to be invulnerable, then instantly revive her 
  5178. 	if (Dlc2_m01_runtime.kwilanna_invulnerable == true) then 
  5179. 		npc_revive(Dlc2_m01_characters.kwilanna) 
  5180. 	end 
  5181. end 
  5182.  
  5183. -- Callback for when the player doesn't follow the directors direction 
  5184. function dlc2_m01_player_disobey_failure_cb() 
  5185. 	mission_end_failure("dlc2_m01", "DLC2_M01_FAIL_DIRECTOR_UNHAPPY") 
  5186. end 
  5187.  
  5188. -- Callback for when player triggers the "rescue Kwilanna" trigger 
  5189. -- player_name:		Name of the player that activated the trigger 
  5190. -- trigger:			Name of the trigger 
  5191. function dlc2_m01_resuce_kwilanna_cb(player_name, trigger) 
  5192. 	-- Don't allow this to be triggered more than once 
  5193. 	if (Dlc2_m01_runtime.kwilanna_rescued_by ~= nil) then 
  5194. 		return 
  5195. 	end 
  5196. 	 
  5197. 	-- Mark the trigger as triggered, and store off the player that activated the trigger 
  5198. 	Dlc2_m01_runtime.kwilanna_rescued_by = player_name 
  5199. 	 
  5200. 	-- Disable the trigger to rescue Kwilanna 
  5201. 	on_trigger("", Dlc2_m01_triggers.rescue_kwilanna) 
  5202. 	trigger_enable(Dlc2_m01_triggers.rescue_kwilanna, false) 
  5203. 	 
  5204. 	-- Re-enable her persona lines 
  5205. 	npc_suppress_persona(Dlc2_m01_characters.kwilanna, false) 
  5206. 	 
  5207. 	--[[ 
  5208. 	-- Kill the thread that processes Kwilanna's position 
  5209. 	if (thread_check_done(Dlc2_m01_threads.kwilanna_pos_process) == false) then 
  5210. 		thread_kill(Dlc2_m01_threads.kwilanna_pos_process) 
  5211. 		Dlc2_m01_threads.kwilanna_pos_process = INVALID_THREAD_HANDLE 
  5212. 	end 
  5213. 	--]] 
  5214. 	 
  5215. 	if (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.armory_take1.name) then 
  5216. 		dlc2_m01_helper_dialog_play(Dlc2_m01_conversations.untie_kwilanna_take1, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0)	 
  5217. 	elseif (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.armory_take2.name) then 
  5218. 		Dlc2_m01_dialog_lines.untie_kwilanna_take2_01.persona = player_name 
  5219. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.untie_kwilanna_take2_01, DLC2_M01_CONVO_PLAY_IMMEDIATE, 0.0) 
  5220. 	end 
  5221. 	 
  5222. 	-- Play the synced animation 
  5223. 	set_script_animation_state(Dlc2_m01_characters.kwilanna, nil) 
  5224. 	action_play_synced(Dlc2_m01_runtime.kwilanna_rescued_by, Dlc2_m01_characters.kwilanna, "Hostage Release", Dlc2_m01_navpoints.kwilanna_rescue_anim_orient) 
  5225. 	set_ignore_ai_flag(Dlc2_m01_characters.kwilanna, false) -- clear the ignore AI flag	 
  5226. 	 
  5227. 	if (Dlc2_m01_runtime.current_checkpoint == Dlc2_m01_checkpoints.armory_take2.name) then 
  5228. 		notoriety_force_no_spawn("Police", false) 
  5229. 		notoriety_force_no_air_spawn(true)		 
  5230. 		notoriety_set_min_and_max("Police", Dlc2_m01_tweak_values.armory_notoriety_rescue_kwilanna, Dlc2_m01_tweak_values.armory_notoriety_rescue_kwilanna) 
  5231. 		 
  5232. 		Dlc2_m01_dialog_lines.untie_kwilanna_take2_01.persona = player_name 
  5233. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.untie_kwilanna_take2_03, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  5234. 		Dlc2_m01_dialog_lines.untie_kwilanna_take2_01.persona = player_name 
  5235. 		dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.untie_kwilanna_take2_02, DLC2_M01_CONVO_PLAY_NEXT, 0.0)		 
  5236. 	end	 
  5237.  
  5238. 	-- Make Kwilanna a homie 
  5239. 	party_add(Dlc2_m01_characters.kwilanna, LOCAL_PLAYER) 
  5240. 	follower_make_independent(Dlc2_m01_characters.kwilanna, true)	 
  5241. 	on_dismiss("dlc2_m01_kwilanna_dismissed_cb", Dlc2_m01_characters.kwilanna) 
  5242. 	npc_combat_enable(Dlc2_m01_characters.kwilanna, true) 
  5243. 	dlc2_m01_helper_set_kwilanna_invulnerable(false) -- no longer invulnerable 
  5244. 	 
  5245. 	Dlc2_m01_runtime.rescued_kwilanna = true	 
  5246. end 
  5247.  
  5248. -- Callback when the player enters the radius near Kwilanna's helicopter 
  5249. function dlc2_m01_kwilanna_heli_radius_cb() 
  5250. 	if (Dlc2_m01_runtime.kwilanna_heli_radius_triggered == false) then 
  5251. 		Dlc2_m01_runtime.kwilanna_heli_radius_triggered = true 
  5252. 		 
  5253. 		-- Make the pilot leave the helicopter 
  5254. 		local dist, closest_player = get_dist_closest_player_to_object(Dlc2_m01_groups.kwilanna_heli.heli.pilot) 
  5255. 		vehicle_suppress_npc_exit(Dlc2_m01_groups.kwilanna_heli.heli.vehicle, false) 
  5256. 		vehicle_exit(Dlc2_m01_groups.kwilanna_heli.heli.pilot, true) 
  5257. 	end 
  5258. end 
  5259.  
  5260.  
  5261. -- Callback for when one of the tower guards at the armory (take1) is killed 
  5262. -- 
  5263. -- victim:		Name of the guard that was killed 
  5264. -- attacker:	Name of the person who killed the guard 
  5265. function dlc2_m01_take1_tower_guard_killed_cb(victim, attacker) 
  5266. 	Dlc2_m01_runtime.num_tower_guards_alive = Dlc2_m01_runtime.num_tower_guards_alive - 1 
  5267. 	on_death("", victim) 
  5268. 	 
  5269. 	-- Check if enough tower guards have been killed to trigger the gate guards to move up 
  5270. 	if (Dlc2_m01_runtime.num_tower_guards_alive <= Dlc2_m01_tweak_values.num_tower_guards_to_trigger_gate) then 
  5271. 		dlc2_m01_ambush_activate_triggered_cb(LOCAL_PLAYER, Dlc2_m01_rail_ambushes.helipad_take1[1].activate_trigger) 
  5272. 	end 
  5273. end 
  5274.  
  5275. -- Callback when an alien spaceship is destroyed 
  5276. function dlc2_m01_alien_spaceship_destroyed_cb(victim) 
  5277. 	on_vehicle_destroyed("",  victim) 
  5278. 	 
  5279. 	local num_jetbikes_alive = 0 
  5280. 	local victim_is_jetbike = false 
  5281. 	for i, vehicle_table in pairs(Dlc2_m01_groups.alien_tunnel_ambush.chase_vehicles) do 
  5282. 		if (vehicle_exists(vehicle_table.vehicle) == true and vehicle_is_destroyed(vehicle_table.vehicle) == false) then 
  5283. 			num_jetbikes_alive = num_jetbikes_alive + 1 
  5284. 		end 
  5285. 		 
  5286. 		if (victim == vehicle_table.vehicle) then 
  5287. 			victim_is_jetbike = true 
  5288. 		end 
  5289. 	end 
  5290. 	 
  5291. 	local show_progress = true 
  5292. 	if (victim_is_jetbike == true and num_jetbikes_alive > 0) then 
  5293. 		show_progress = false 
  5294. 	end 
  5295. 	 
  5296. 	dlc2_m01_helper_achievement_increment(Dlc2_m01_acheivements.alien_ships, show_progress) 
  5297. end 
  5298.  
  5299. -- Callback for a vehicle to explode when it takes damage from the world 
  5300. -- 
  5301. -- victim:		The vehicle that was damaged 
  5302. -- attacker:	The character that caused the damage 
  5303. function dlc2_m01_destroy_vehicle_on_collision_cb(victim, attacker) 
  5304. 	if (attacker == nil) then 
  5305. 		vehicle_detonate(victim) 
  5306. 		 
  5307. 		delay(1.0) 
  5308. 		if (rand_int(1, 3) == 1 and thread_check_done(Dlc2_m01_dialog_queue.playing.thread_id) == true) then 
  5309. 			dlc2_m01_helper_dialog_play(Dlc2_m01_dialog_lines.car_chase_explosions, DLC2_M01_CONVO_PLAY_NEXT, 0.0) 
  5310. 		end 
  5311. 	end 
  5312. end 
  5313.  
  5314. function dlc2_m01_setup_heli_cameramen() 
  5315. 	group_create_hidden(Dlc2_m01_groups.armory_camera_persue_heli.name, true) 
  5316. 	vehicle_enter_teleport(Dlc2_m01_groups.armory_camera_persue_heli.heli.npcs[1], Dlc2_m01_groups.armory_camera_persue_heli.heli.vehicle, 0, true) 
  5317. 	vehicle_enter_teleport(Dlc2_m01_groups.armory_camera_persue_heli.heli.npcs[2], Dlc2_m01_groups.armory_camera_persue_heli.heli.vehicle, 5, true) 
  5318. 	dlc2_m01_helper_setup_camera_man(Dlc2_m01_groups.armory_camera_persue_heli.heli.npcs[2]) 
  5319. end 
  5320.  
  5321. -- Callback when the player's get away vehicle is destroyed 
  5322. function dlc2_m01_get_away_vehicle_destroyed_cb() 
  5323. 	mission_end_failure("dlc2_m01", "DLC2_M01_FAIL_ESCAPE_CAR_DESTROYED") 
  5324. end 
  5325.  
  5326. -- Reset the acheivement count for mission start 
  5327. function dlc2_m01_helper_achievement_reset(achievement_table) 
  5328. 	dlc_achievement_counter_set(achievement_table.slot_idx, 0) 
  5329. 	achievement_table.current_count = 0 
  5330. end 
  5331.  
  5332. -- Read the stored achievement counter from the previous checkpoint 
  5333. function dlc2_m01_helper_achievement_read_checkpoint(achievement_table) 
  5334. 	achievement_table.current_count = dlc_achievement_counter_get(achievement_table.slot_idx) 
  5335. end 
  5336.  
  5337. -- Store the current achievement counter for when a checkpoint is reached 
  5338. function dlc2_m01_helper_achievement_write_checkpoint(achievement_table) 
  5339. 	dlc_achievement_counter_set(achievement_table.slot_idx, achievement_table.current_count) 
  5340. end 
  5341.  
  5342. -- Increment an acheivement counter 
  5343. function dlc2_m01_helper_achievement_increment(achievement_table, show_progress) 
  5344. 	if (show_progress == nil) then 
  5345. 		show_progress = true 
  5346. 	end 
  5347.  
  5348. 	-- Check if the target goal has already been reached 
  5349. 	if (achievement_table.current_count >= achievement_table.target_goal) then 
  5350. 		return 
  5351. 	end 
  5352. 	 
  5353. 	-- Increment the counter 
  5354. 	achievement_table.current_count = achievement_table.current_count + 1 
  5355.  
  5356. 	-- Show the progress HUD 
  5357. 	if (show_progress == true) then 
  5358. 		hud_achievement_show_progress(achievement_table.name, achievement_table.current_count, achievement_table.target_goal) 
  5359. 	end 
  5360. end 
  5361.