./dlc2_m03.lua

  1. --[[ 
  2. 	dlc2_m03.lua 
  3. 	SR3 Mission Script 
  4. 	DATE: September 2011 
  5. 	AUTHOR:	John Karczewski 
  6. ]]-- 
  7.  
  8.  
  9. -- Debug flags -- 
  10.  
  11. -- Tweakable Parameters -- 
  12. 	DLC2_M03_AIRCRAFT_HITPOINTS = 9000 
  13. 	DLC2_M03_AIRCRAFT_RESTORE_PERCENT = 50 -- Percent to restore the aircraft by every transmitter 
  14. 	 
  15. 	DLC2_M03_NEAR_CRASH_LENGTH = 100 -- ft 
  16.  
  17. -- Groups -- 
  18. 	DLC2_M03_group = { 
  19. 		actress = { 
  20. 			name = "actress_group", 
  21. 			members = { "Actress" }, 
  22. 		}, 
  23. 	 
  24. 		starting_vehicle = { 
  25. 			name = "starting_vehicle_group", 
  26. 			members = { "Player_starting_vehicle<001>" }, 
  27. 			vehicle = "Player_starting_vehicle<001>", 
  28. 			nav = { "Start_player_nav<001>", "Start_player_nav<002>" }, 
  29. 		}, 
  30. 		 
  31. 		starting_camera = { 
  32. 			name = "start_camera_group", 
  33. 			members = { "npc_start_init 001", "npc_start_init 002" }, 
  34. 			vehicle = { "veh_start_init 001", "veh_start_init 002" }, 
  35. 		}, 
  36. 		 
  37. 		checkpoint_one_vehicle = { 
  38. 			name = "checkpoint1_veh_group", 
  39. 			vehicle = "Veh_checkpoint<001>", 
  40. 			nav = { "nav_check_local 001", "nav_check_remote 001" }, 
  41. 		}, 
  42. 		 
  43. 		checkpoint_two_vehicle = { 
  44. 			name = "checkpoint2_veh_group", 
  45. 			vehicle = "Veh_checkpoint<002>", 
  46. 			nav = { "nav_check_local 002", "nav_check_remote 002" }, 
  47. 		}, 
  48. 		 
  49. 		checkpoint_three_vehicle = { 
  50. 			name = "checkpoint3_veh_group", 
  51. 			vehicle = "Veh_checkpoint<003>", 
  52. 			nav = { "nav_check_local 003", "nav_check_remote 003" }, 
  53. 		}, 
  54. 		 
  55. 		checkpoint_four_vehicle = { 
  56. 			name = "checkpoint4_veh_group", 
  57. 			vehicle = "Veh_checkpoint<004>", 
  58. 			nav = { "nav_check_local 004", "nav_check_remote 004" }, 
  59. 		}, 
  60. 		 
  61. 		checkpoint_five_vehicle = { 
  62. 			name = "checkpoint5_veh_group", 
  63. 			vehicle = "Veh_checkpoint<005>", 
  64. 			nav = { "nav_check_local 005", "nav_check_remote 005" }, 
  65. 		}, 
  66. 		 
  67. 		checkpoint_six_vehicle = { 
  68. 			name = "checkpoint6_veh_group", 
  69. 			vehicle = "Veh_checkpoint<006>", 
  70. 			nav = { "Start_player_nav<001>", "Start_player_nav<002>" }, 
  71. 		}, 
  72. 		--------------------- 
  73. 		-- Transmitter One -- 
  74. 		--------------------- 
  75. 		 
  76. 		trans_one_initial = { 
  77. 			name = "trans_one_init_group", 
  78. 			members = { "Npc_trans_one_init<001>", "Npc_trans_one_init<002>", "Npc_trans_one_init<003>", "Npc_trans_one_init<004>", 
  79. 						"Npc_trans_one_init<005>", "Npc_trans_one_init<006>" }, 
  80. 			vehicles = { "Veh_trans_one_init<001>", }, 
  81. 			pilots = { "Npc_trans_one_air_init<001>" }, 
  82. 			passengers = { "Npc_trans_one_air_init<002>" }, 
  83. 			is_hostile = { true, --[[true]] }, 
  84. 			explode_on_transmit = { false }, 
  85. 		}, 
  86. 		 
  87. 		trans_one_air_wave1 = { 
  88. 			name = "trans_one_wave1_group", 
  89. 			pilots = { "Npc_trans_one_wave1<001>", "Npc_trans_one_wave1<002>" }, 
  90. 			passengers = { nil, nil }, 
  91. 			vehicles = { "Veh_trans_one_wave1<001>", "Veh_trans_one_wave1<002>" }, 
  92. 			is_hostile = { true, true }, 
  93. 			explode_on_transmit = { false, true }, 
  94. 		}, 
  95. 		 
  96. 		trans_one_air_wave2 = { 
  97. 			name = "trans_one_wave2_group", 
  98. 			pilots = { "Npc_trans_one_wave2<001>", "Npc_trans_one_wave2<002>", "Npc_trans_one_wave2<003>" }, 
  99. 			passengers = { nil, nil, nil }, 
  100. 			vehicles = { "Veh_trans_one_wave2<001>", "Veh_trans_one_wave2<002>", "Veh_trans_one_wave2<003>" }, 
  101. 			is_hostile = { true, true, true }, 
  102. 			explode_on_transmit = { false, true, true }, 
  103. 		}, 
  104. 		 
  105. 		--------------------- 
  106. 		-- Transmitter Two -- 
  107. 		--------------------- 
  108. 		 
  109. 		trans_two_initial = { 
  110. 			name = "trans_two_init_group", 
  111. 			members = { "Npc_trans_two_init<001>", "Npc_trans_two_init<002>", "Npc_trans_two_init<003>", "Npc_trans_two_init<004>", 
  112. 						--[["Npc_trans_two_init<005>", "Npc_trans_two_init<006>"]] }, 
  113. 			vehicles = { "Veh_trans_two_init<001>", "Veh_trans_two_init<002>" }, 
  114. 			pilots = { "Npc_trans_two_air_init<001>", "Npc_trans_two_air_init<002>" }, 
  115. 			passengers = { nil, nil }, 
  116. 			is_hostile = { true, true }, 
  117. 			explode_on_transmit = { false, false }, 
  118. 		}, 
  119. 		 
  120. 		trans_two_air_wave1 = { 
  121. 			name = "trans_two_wave1_group", 
  122. 			pilots = { "Npc_trans_two_wave1<001>", "Npc_trans_two_wave1<002>", "Npc_trans_two_wave1<003>" }, 
  123. 			passengers = { nil, nil, nil }, 
  124. 			vehicles = { "Veh_trans_two_wave1<001>", "Veh_trans_two_wave1<002>", "Veh_trans_two_wave1<003>" }, 
  125. 			is_hostile = { true, true, false }, 
  126. 			explode_on_transmit = { false, true, false }, 
  127. 		}, 
  128. 		 
  129. 		trans_two_air_wave2 = { 
  130. 			name = "trans_two_wave2_group", 
  131. 			pilots = { "Npc_trans_two_wave2<001>", "Npc_trans_two_wave2<002>", "Npc_trans_two_wave2<003>" }, 
  132. 			passengers = { nil, nil, nil }, 
  133. 			vehicles = { "Veh_trans_two_wave2<001>", "Veh_trans_two_wave2<002>", "Veh_trans_two_wave2<003>" }, 
  134. 			is_hostile = { true, true, true }, 
  135. 			explode_on_transmit = { false, false, true }, 
  136. 		}, 
  137. 		 
  138. 		--[[trans_two_shield1 = { 
  139. 			name = "trans_two_shield1_group", 
  140. 			members = { "Npc_trans_two_shield<001>", }, 
  141. 			vehicles = { "Veh_trans_two_shield<001>", }, 
  142. 			is_hostile = { true }, 
  143. 			explode_on_transmit = { true  },		 
  144. 		}, 
  145. 		 
  146. 		trans_two_shield2 = { 
  147. 			name = "trans_two_shield2_group", 
  148. 			members = { "Npc_trans_two_shield<002>", "Npc_trans_two_shield<003>", }, 
  149. 			vehicles = {  "Veh_trans_two_shield<002>", "Veh_trans_two_shield<003>", }, 
  150. 			is_hostile = { true, true }, 
  151. 			explode_on_transmit = { false, false },		 
  152. 		},]] 
  153. 		 
  154. 		----------------------- 
  155. 		-- Transmitter Three -- 
  156. 		----------------------- 
  157. 		 
  158. 		trans_three_initial = { 
  159. 			name = "trans_three_init_group", 
  160. 			members = { "Npc_trans_three_init<001>", "Npc_trans_three_init<002>", "Npc_trans_three_init<003>", "Npc_trans_three_init<004>", 
  161. 						"Npc_trans_three_init<005>", "Npc_trans_three_init<006>" }, 
  162. 			vehicles = { "Veh_trans_three_init<001>", "Veh_trans_three_init<002>" }, 
  163. 			pilots = { "Npc_trans_three_air_init<001>", "Npc_trans_three_air_init<002>" }, 
  164. 			passengers = { nil, nil }, 
  165. 			is_hostile = { true, true }, 
  166. 			explode_on_transmit = { false, false }, 
  167. 		}, 
  168. 		 
  169. 		trans_three_air_wave1 = { 
  170. 			name = "trans_three_wave1_group", 
  171. 			pilots = { "Npc_trans_three_wave1<001>", "Npc_trans_three_wave1<002>", "Npc_trans_three_wave1<003>" }, 
  172. 			passengers = { nil, nil, nil }, 
  173. 			vehicles = {  "Veh_trans_three_wave1<001>", "Veh_trans_three_wave1<002>", "Veh_trans_three_wave1<003>" }, 
  174. 			is_hostile = { true, true, false }, 
  175. 			explode_on_transmit = { false, false, false }, 
  176. 		}, 
  177. 		 
  178. 		trans_three_air_wave2 = { 
  179. 			name = "trans_three_wave2_group", 
  180. 			pilots = { "Npc_trans_three_wave2<001>", "Npc_trans_three_wave2<002>", "Npc_trans_three_wave2<003>" }, 
  181. 			passengers = { nil, nil, nil }, 
  182. 			vehicles = { "Veh_trans_three_wave2<001>", "Veh_trans_three_wave2<002>", "Veh_trans_three_wave2<003>" }, 
  183. 			is_hostile = { true, true }, 
  184. 			explode_on_transmit = { false, false, false }, 
  185. 		}, 
  186. 		 
  187. 		trans_three_air_wave3 = { 
  188. 			name = "trans_three_wave3_group", 
  189. 			pilots = {  "Npc_trans_three_wave3<001>", "Npc_trans_three_wave3<002>" }, 
  190. 			passengers = { nil, nil }, 
  191. 			vehicles = { "Veh_trans_three_wave3<001>", "Veh_trans_three_wave3<002>" }, 
  192. 			is_hostile = { true, true }, 
  193. 			explode_on_transmit = { false, false }, 
  194. 		}, 
  195. 		 
  196. 		trans_three_ground_wave1 = { 
  197. 			name = "trans_three_waveNG_group", 
  198. 			pilots = {  "Npc_trans_three_waveNG<001>", "Npc_trans_three_waveNG<002>" }, 
  199. 			passengers = { nil, nil }, 
  200. 			vehicles = { "Veh_trans_three_waveNG<001>", "Veh_trans_three_waveNG<002>" }, 
  201. 			is_hostile = { true, true }, 
  202. 			explode_on_transmit = { false, false }, 
  203. 		}, 
  204. 		 
  205. 		--------------------------- 
  206. 		--    Nation Guard Trap  -- 
  207. 		--------------------------- 
  208. 		 
  209. 		trap = { 
  210. 			name = "trap_group", 
  211. 			members = { "Npc_trap<001>", "Npc_trap<002>", "Npc_trap<003>", "Npc_trap<004>", 
  212. 						"Npc_trap<005>", "Npc_trap<006>", "Npc_trap<007>", "Npc_trap<008>" }, 
  213. 			pilots = { "Npc_trap_pilot<001>", "Npc_trap_pilot<002>"}, 
  214. 			vehicles = { "Veh_trap<001>", "Veh_trap<002>" }, 
  215. 		}, 
  216. 		 
  217. 		escape1 = { 
  218. 			name = "escape1_group", 
  219. 			members = { "Npc_escape<001>" }, 
  220. 			vehicles = { "Veh_escape<001>" }, 
  221. 			navpoint = "Nav_escape_spawn<001>", 
  222. 			spawned = false, 
  223. 		}, 
  224. 		 
  225. 		escape2 = { 
  226. 			name = "escape2_group", 
  227. 			members = { "Npc_escape<002>" }, 
  228. 			vehicles = { "Veh_escape<002>" }, 
  229. 			navpoint = "Nav_escape_spawn<002>", 
  230. 			spawned = false, 
  231. 		}, 
  232. 		 
  233. 		escape3 = { 
  234. 			name = "escape3_group", 
  235. 			members = { "Npc_escape<003>" }, 
  236. 			vehicles = { "Veh_escape<003>" }, 
  237. 			navpoint = "Nav_escape_spawn<003>", 
  238. 			spawned = false, 
  239. 		}, 
  240. 		 
  241. 		escape4 = { 
  242. 			name = "escape4_group", 
  243. 			members = { "Npc_escape<004>" }, 
  244. 			vehicles = { "Veh_escape<004>" }, 
  245. 			navpoint = "Nav_escape_spawn<004>", 
  246. 			spawned = false, 
  247. 		}, 
  248. 	} 
  249. 	 
  250. -- Vehicles -- 
  251. 	DLC2_M03_vehicle = { 
  252. 		starting = DLC2_M03_group.starting_vehicle.vehicle, 
  253. 		checkpoint_one = DLC2_M03_group.checkpoint_one_vehicle.vehicle, 
  254. 		checkpoint_two = DLC2_M03_group.checkpoint_two_vehicle.vehicle, 
  255. 		checkpoint_three = DLC2_M03_group.checkpoint_three_vehicle.vehicle, 
  256. 		checkpoint_four = DLC2_M03_group.checkpoint_four_vehicle.vehicle, 
  257. 		checkpoint_five = DLC2_M03_group.checkpoint_five_vehicle.vehicle, 
  258. 		checkpoint_six = DLC2_M03_group.checkpoint_six_vehicle.vehicle, 
  259. 	} 
  260. 	 
  261. 	DLC2_M03_vehicle_cb_list = { 
  262. 		"Veh_trans_one_init<001>", "Veh_trans_one_wave1<001>", "Veh_trans_one_wave1<002>", "Veh_trans_one_wave2<001>", 
  263. 		"Veh_trans_one_wave2<002>", "Veh_trans_one_wave2<003>", "Veh_trans_three_init<001>", "Veh_trans_three_init<002>", 
  264. 		"Veh_trans_three_wave1<001>", "Veh_trans_three_wave1<002>", "Veh_trans_three_wave1<003>", "Veh_trans_three_wave2<001>", 
  265. 		"Veh_trans_three_wave2<002>", "Veh_trans_three_wave2<003>", "Veh_trans_three_wave3<001>", "Veh_trans_three_wave3<002>", 
  266. 		"Veh_trans_two_init<001>", "Veh_trans_two_init<002>", "Veh_trans_two_wave1<001>", "Veh_trans_two_wave1<002>", 
  267. 		"Veh_trans_two_wave1<003>", "Veh_trans_two_wave2<001>", "Veh_trans_two_wave2<002>", "Veh_trans_two_wave2<003>", 
  268. 	} 
  269.  
  270. -- Navpoints -- 
  271. 	DLC2_M03_navpoint = { 
  272. 		host_start = "Start_player_nav<001>", 
  273. 		client_start = "Start_player_nav<002>", 
  274. 		transmitter_one_spawns = {  
  275. 			air = { "Nav_one_wave_spawn<001>", "Nav_one_wave_spawn<002>", "Nav_one_wave_spawn<003>", "Nav_one_wave_spawn<004>" }, 
  276. 			ground = { }, 
  277. 			shield = { }, 
  278. 		}, 
  279. 		transmitter_two_spawns = {  
  280. 			air = { "Nav_two_wave_spawn<001>", "Nav_two_wave_spawn<002>", "Nav_two_wave_spawn<003>", "Nav_two_wave_spawn<004>"}, 
  281. 			ground = { }, 
  282. 			shield = { --[["Nav_two_wave_spawn<001>", "Nav_two_wave_spawn<002>", "Nav_two_wave_spawn<003>", "Nav_two_wave_spawn<004>" --]] }, 
  283. 		}, 
  284. 		transmitter_three_spawns = {  
  285. 			air = { "Nav_three_wave_spawn<001>", "Nav_three_wave_spawn<002>", "Nav_three_wave_spawn<003>", "Nav_three_wave_spawn<004>"}, 
  286. 			ground = { "Nav_three_wave_spawn<005>", "Nav_three_wave_spawn<006>", "Nav_three_wave_spawn<007>", "Nav_three_wave_spawn<008>"}, 
  287. 			shield = { }, 
  288. 		}, 
  289. 	} 
  290.  
  291. -- Threads -- 
  292. 	DLC2_M03_thread = { 
  293. 		virus_transfer = INVALID_THREAD_HANDLE, 
  294. 		air_wave_spawn = INVALID_THREAD_HANDLE, 
  295. 		ground_wave_spawn = INVALID_THREAD_HANDLE, 
  296. 		shield_destroyed_spawn = INVALID_THREAD_HANDLE, 
  297. 		escape_spawn = INVALID_THREAD_HANDLE, 
  298. 	} 
  299. 	 
  300. -- Achievement Data -- 
  301. 	DLC2_M03_acheivements = { 
  302. 		alien_ships = { 
  303. 			name = "Shoot that Green Stuff", 
  304. 			slot_idx = 0, 
  305. 			current_count = 0, 
  306. 			target_goal = 10, 
  307. 		}, 
  308. 		stunts = { 
  309. 			name = "MDK3000", 
  310. 			slot_idx = 1, 
  311. 			current_count = 0, 
  312. 			target_goal = 3, 
  313. 		}, 
  314. 	} 
  315.  
  316. -- Checkpoints --	 
  317. 	DLC2_M03_checkpoint = { 
  318. 		start = { 
  319. 			name = MISSION_START_CHECKPOINT, 
  320. 			host_start = DLC2_M03_navpoint.host_start, 
  321. 			client_start = DLC2_M03_navpoint.client_start, 
  322. 			vehicle = DLC2_M03_vehicle.starting, 
  323. 		}, 
  324. 		 
  325. 		transmitter_one_infected = { 
  326. 			name = "dlc2_m03_transmitter_one_infected", 
  327. 			host_start = DLC2_M03_navpoint.host_start, 
  328. 			client_start = DLC2_M03_navpoint.client_start, 
  329. 			vehicle = DLC2_M03_vehicle.checkpoint_one, 
  330. 		}, 
  331. 		 
  332. 		stunt_sequence_complete = { 
  333. 			name = "dlc2_m03_stunt_sequence_complete", 
  334. 			host_start = DLC2_M03_navpoint.host_start, 
  335. 			client_start = DLC2_M03_navpoint.client_start, 
  336. 			vehicle = DLC2_M03_vehicle.checkpoint_one,	 
  337. 		}, 
  338. 		 
  339. 		transmitter_two_infected = { 
  340. 			name = "dlc2_m03_transmitter_two_infected", 
  341. 			host_start = DLC2_M03_navpoint.host_start, 
  342. 			client_start = DLC2_M03_navpoint.client_start, 
  343. 			vehicle = DLC2_M03_vehicle.checkpoint_two, 
  344. 		}, 
  345. 		 
  346. 		national_guard_trap_destroyed = { 
  347. 			name = "dlc2_m03_national_guard_trap_destroyed", 
  348. 			host_start = DLC2_M03_navpoint.host_start, 
  349. 			client_start = DLC2_M03_navpoint.client_start, 
  350. 			vehicle = DLC2_M03_vehicle.checkpoint_three,		 
  351. 		}, 
  352. 		 
  353. 		transmitter_three_infected = { 
  354. 			name = "dlc2_m03_transmitter_three_infected", 
  355. 			host_start = DLC2_M03_navpoint.host_start, 
  356. 			client_start = DLC2_M03_navpoint.client_start, 
  357. 			vehicle = DLC2_M03_vehicle.checkpoint_four, 
  358. 		}, 
  359. 		 
  360. 		virus_executed = { 
  361. 			name = "dlc2_m03_virus_executed", 
  362. 			host_start = DLC2_M03_navpoint.host_start, 
  363. 			client_start = DLC2_M03_navpoint.client_start, 
  364. 			vehicle = DLC2_M03_vehicle.checkpoint_five, 
  365. 		}, 
  366. 	} 
  367. 	 
  368. -- Cutscenes -- 
  369. 	DLC2_M03_scene = { 
  370. 		intro = "", 
  371. 		outro = "DLC2_GIS_Outro" 
  372. 	} 
  373.  
  374. -- Conversations -- 
  375. 	DLC2_M03_personas = { 
  376. 		{ name = "PAK2_Director", handle = INVALID_PERSONA_HANDLE }, 
  377. 		{ name = "PAK2_Kwilanna", handle = INVALID_PERSONA_HANDLE }, 
  378. 	} 
  379. 	 
  380. 	DLC2_M03_convo_playing = ""	-- name of currently playing conversation 
  381. 	DLC2_M03_convo_phone_complete = false 
  382. 	DLC2_M03_convo_priority_high = 1 
  383. 	DLC2_M03_convo_priority_normal = 2 
  384. 	DLC2_M03_convo_priority_optional = 3 
  385. 	DLC2_M03_convo = { 
  386. 		--[[ = { 
  387. 			name = "file_name without voice (_bm, _wm, _bf...", 
  388. 			player_talks = true or false, 
  389. 			handle = INVALID_CONVERSATION_HANDLE, 
  390. 			convo_thread = INVALID_THREAD_HANDLE, 
  391. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  392. 			timer_thread = INVALID_THREAD_HANDLE, 
  393. 			priority = DLC2_M03_convo_priority_high or DLC2_M03_convo_priority_normal or DLC2_M03_convo_priority_optional 
  394. 			played = false, 
  395. 			(optional) persona_line = true,	-- this is a single line 
  396. 			(required if persona_line) speaker_name = "name of speaker",	-- single line speaker (might be set before call to play is made?) 
  397. 			(optional)phone_call = true,  -- this is a phone conversation (phone persona must be preloaded) 
  398. 			(required if phone_call) receiving_call = true or false  -- auto-answer is always true in missions (until proven otherwise) 
  399. 			 
  400. 		},]] 
  401. 		 
  402. 		generic_action = { 
  403. 			name = "pak2_generic_actions", 
  404. 			player_talks = true, 
  405. 			handle = INVALID_CONVERSATION_HANDLE, 
  406. 			convo_thread = INVALID_THREAD_HANDLE, 
  407. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  408. 			timer_thread = INVALID_THREAD_HANDLE, 
  409. 			priority = DLC2_M03_convo_priority_high, 
  410. 			played = false, 
  411. 			persona_line = true,	-- this is a single line 
  412. 			speaker_name = "PAK2_Director",	-- single line speaker (might be set before call to play is made?) 
  413. 		}, 
  414. 		 
  415. 		generic_cut = { 
  416. 			name = "pak2_generic_cuts", 
  417. 			player_talks = true, 
  418. 			handle = INVALID_CONVERSATION_HANDLE, 
  419. 			convo_thread = INVALID_THREAD_HANDLE, 
  420. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  421. 			timer_thread = INVALID_THREAD_HANDLE, 
  422. 			priority = DLC2_M03_convo_priority_high, 
  423. 			played = false, 
  424. 			persona_line = true,	-- this is a single line 
  425. 			speaker_name = "PAK2_Director",	-- single line speaker (might be set before call to play is made?) 
  426. 		}, 
  427. 		 
  428. 		mission_start_01 = { 
  429. 			name = "dlc2_m03_mission_start", 
  430. 			player_talks = true, 
  431. 			handle = INVALID_CONVERSATION_HANDLE, 
  432. 			convo_thread = INVALID_THREAD_HANDLE, 
  433. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  434. 			timer_thread = INVALID_THREAD_HANDLE, 
  435. 			priority = DLC2_M03_convo_priority_normal, 
  436. 			played = false, 
  437. 		}, 
  438. 		 
  439. 		and_action_01 = { 
  440. 			name = "pak2_m03_trans1_start_movie_01", 
  441. 			player_talks = true, 
  442. 			handle = INVALID_CONVERSATION_HANDLE, 
  443. 			convo_thread = INVALID_THREAD_HANDLE, 
  444. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  445. 			timer_thread = INVALID_THREAD_HANDLE, 
  446. 			priority = DLC2_M03_convo_priority_high, 
  447. 			played = false, 
  448. 			persona_line = true,	-- this is a single line 
  449. 			speaker_name = "PAK2_Director",	-- single line speaker (might be set before call to play is made?) 
  450. 		}, 
  451. 		 
  452. 		arrive_trans_01 = { 
  453. 			name = "dlc2_m03_arrive_trans1", 
  454. 			player_talks = true, 
  455. 			handle = INVALID_CONVERSATION_HANDLE, 
  456. 			convo_thread = INVALID_THREAD_HANDLE, 
  457. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  458. 			timer_thread = INVALID_THREAD_HANDLE, 
  459. 			priority = DLC2_M03_convo_priority_normal, 
  460. 			played = false, 
  461. 		}, 
  462. 		 
  463. 		upload_start_01 = { 
  464. 			name = "dlc2_m03_upload_1_start", 
  465. 			player_talks = true, 
  466. 			handle = INVALID_CONVERSATION_HANDLE, 
  467. 			convo_thread = INVALID_THREAD_HANDLE, 
  468. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  469. 			timer_thread = INVALID_THREAD_HANDLE, 
  470. 			priority = DLC2_M03_convo_priority_normal, 
  471. 			played = false, 
  472. 		}, 
  473. 		 
  474. 		upload_done_01 = { 
  475. 			name = "dlc2_m03_upload_1_done", 
  476. 			player_talks = true, 
  477. 			handle = INVALID_CONVERSATION_HANDLE, 
  478. 			convo_thread = INVALID_THREAD_HANDLE, 
  479. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  480. 			timer_thread = INVALID_THREAD_HANDLE, 
  481. 			priority = DLC2_M03_convo_priority_normal, 
  482. 			played = false, 
  483. 		}, 
  484. 		 
  485. 		end_trans_01 = { 
  486. 			name = "dlc2_m03_end_trans1", 
  487. 			player_talks = true, 
  488. 			handle = INVALID_CONVERSATION_HANDLE, 
  489. 			convo_thread = INVALID_THREAD_HANDLE, 
  490. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  491. 			timer_thread = INVALID_THREAD_HANDLE, 
  492. 			priority = DLC2_M03_convo_priority_normal, 
  493. 			played = false, 
  494. 		}, 
  495. 		 
  496. 		stunt_flying_01 = { 
  497. 			name = "dlc2_m03_stunt_flying", 
  498. 			player_talks = true, 
  499. 			handle = INVALID_CONVERSATION_HANDLE, 
  500. 			convo_thread = INVALID_THREAD_HANDLE, 
  501. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  502. 			timer_thread = INVALID_THREAD_HANDLE, 
  503. 			priority = DLC2_M03_convo_priority_normal, 
  504. 			played = false, 
  505. 		}, 
  506. 		 
  507. 		stunt_reaction_01 = { 
  508. 			name = "pak2_m03_stunt_reaction_01", 
  509. 			player_talks = true, 
  510. 			handle = INVALID_CONVERSATION_HANDLE, 
  511. 			convo_thread = INVALID_THREAD_HANDLE, 
  512. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  513. 			timer_thread = INVALID_THREAD_HANDLE, 
  514. 			priority = DLC2_M03_convo_priority_high, 
  515. 			played = false, 
  516. 			persona_line = true,	-- this is a single line 
  517. 			speaker_name = "PAK2_Director",	-- single line speaker (might be set before call to play is made?) 
  518. 		}, 
  519. 		 
  520. 		stunt_reaction_02 = { 
  521. 			name = "pak2_m03_stunt_reaction_02", 
  522. 			player_talks = true, 
  523. 			handle = INVALID_CONVERSATION_HANDLE, 
  524. 			convo_thread = INVALID_THREAD_HANDLE, 
  525. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  526. 			timer_thread = INVALID_THREAD_HANDLE, 
  527. 			priority = DLC2_M03_convo_priority_high, 
  528. 			played = false, 
  529. 			persona_line = true,	-- this is a single line 
  530. 			speaker_name = "PAK2_Director",	-- single line speaker (might be set before call to play is made?) 
  531. 		}, 
  532. 		 
  533. 		and_action_02 = { 
  534. 			name = "pak2_m03_trans2_start_movie_01", 
  535. 			player_talks = true, 
  536. 			handle = INVALID_CONVERSATION_HANDLE, 
  537. 			convo_thread = INVALID_THREAD_HANDLE, 
  538. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  539. 			timer_thread = INVALID_THREAD_HANDLE, 
  540. 			priority = DLC2_M03_convo_priority_high, 
  541. 			played = false, 
  542. 			persona_line = true,	-- this is a single line 
  543. 			speaker_name = "PAK2_Director",	-- single line speaker (might be set before call to play is made?) 
  544. 		}, 
  545. 		 
  546. 		arrive_trans_02 = { 
  547. 			name = "dlc2_m03_arrive_trans2", 
  548. 			player_talks = true, 
  549. 			handle = INVALID_CONVERSATION_HANDLE, 
  550. 			convo_thread = INVALID_THREAD_HANDLE, 
  551. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  552. 			timer_thread = INVALID_THREAD_HANDLE, 
  553. 			priority = DLC2_M03_convo_priority_normal, 
  554. 			played = false, 
  555. 		}, 
  556. 		 
  557. 		upload_start_02 = { 
  558. 			name = "dlc2_m03_upload_2_start", 
  559. 			player_talks = false, 
  560. 			handle = INVALID_CONVERSATION_HANDLE, 
  561. 			convo_thread = INVALID_THREAD_HANDLE, 
  562. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  563. 			timer_thread = INVALID_THREAD_HANDLE, 
  564. 			priority = DLC2_M03_convo_priority_normal, 
  565. 			played = false, 
  566. 		}, 
  567. 		 
  568. 		upload_done_02 = { 
  569. 			name = "dlc2_m03_upload_2_done", 
  570. 			player_talks = true, 
  571. 			handle = INVALID_CONVERSATION_HANDLE, 
  572. 			convo_thread = INVALID_THREAD_HANDLE, 
  573. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  574. 			timer_thread = INVALID_THREAD_HANDLE, 
  575. 			priority = DLC2_M03_convo_priority_normal, 
  576. 			played = false, 
  577. 		}, 
  578. 		 
  579. 		end_trans_02 = { 
  580. 			name = "dlc2_m03_end_trans2", 
  581. 			player_talks = true, 
  582. 			handle = INVALID_CONVERSATION_HANDLE, 
  583. 			convo_thread = INVALID_THREAD_HANDLE, 
  584. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  585. 			timer_thread = INVALID_THREAD_HANDLE, 
  586. 			priority = DLC2_M03_convo_priority_normal, 
  587. 			played = false, 
  588. 		}, 
  589. 		 
  590. 		guard_trap_01 = { 
  591. 			name = "dlc2_m03_ng_ambush", 
  592. 			player_talks = true, 
  593. 			handle = INVALID_CONVERSATION_HANDLE, 
  594. 			convo_thread = INVALID_THREAD_HANDLE, 
  595. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  596. 			timer_thread = INVALID_THREAD_HANDLE, 
  597. 			priority = DLC2_M03_convo_priority_normal, 
  598. 			played = false, 
  599. 		}, 
  600. 		 
  601. 		guard_trap_02 = { 
  602. 			name = "dlc2_m03_after_ng_ambush", 
  603. 			player_talks = true, 
  604. 			handle = INVALID_CONVERSATION_HANDLE, 
  605. 			convo_thread = INVALID_THREAD_HANDLE, 
  606. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  607. 			timer_thread = INVALID_THREAD_HANDLE, 
  608. 			priority = DLC2_M03_convo_priority_normal, 
  609. 			played = false, 
  610. 		}, 
  611. 	 
  612. 		and_action_03 = { 
  613. 			name = "pak2_m03_trans3_start_movie_01", 
  614. 			player_talks = true, 
  615. 			handle = INVALID_CONVERSATION_HANDLE, 
  616. 			convo_thread = INVALID_THREAD_HANDLE, 
  617. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  618. 			timer_thread = INVALID_THREAD_HANDLE, 
  619. 			priority = DLC2_M03_convo_priority_high, 
  620. 			played = false, 
  621. 			persona_line = true,	-- this is a single line 
  622. 			speaker_name = "PAK2_Director",	-- single line speaker (might be set before call to play is made?) 
  623. 		}, 
  624. 		 
  625. 		arrive_trans_03 = { 
  626. 			name = "dlc2_m03_arrive_trans3", 
  627. 			player_talks = true, 
  628. 			handle = INVALID_CONVERSATION_HANDLE, 
  629. 			convo_thread = INVALID_THREAD_HANDLE, 
  630. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  631. 			timer_thread = INVALID_THREAD_HANDLE, 
  632. 			priority = DLC2_M03_convo_priority_normal, 
  633. 			played = false, 
  634. 		}, 
  635. 		 
  636. 		upload_start_03 = { 
  637. 			name = "dlc2_m03_upload_3_start", 
  638. 			player_talks = true, 
  639. 			handle = INVALID_CONVERSATION_HANDLE, 
  640. 			convo_thread = INVALID_THREAD_HANDLE, 
  641. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  642. 			timer_thread = INVALID_THREAD_HANDLE, 
  643. 			priority = DLC2_M03_convo_priority_normal, 
  644. 			played = false, 
  645. 		}, 
  646. 		 
  647. 		ng_attack_01 = { 
  648. 			name = "dlc2_m03_trans3_ng_attack", 
  649. 			player_talks = true, 
  650. 			handle = INVALID_CONVERSATION_HANDLE, 
  651. 			convo_thread = INVALID_THREAD_HANDLE, 
  652. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  653. 			timer_thread = INVALID_THREAD_HANDLE, 
  654. 			priority = DLC2_M03_convo_priority_normal, 
  655. 			played = false, 
  656. 		}, 
  657. 		 
  658. 		trans3_berating = { 
  659. 			name = "dlc2_m03_trans3_berating", 
  660. 			player_talks = true, 
  661. 			handle = INVALID_CONVERSATION_HANDLE, 
  662. 			convo_thread = INVALID_THREAD_HANDLE, 
  663. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  664. 			timer_thread = INVALID_THREAD_HANDLE, 
  665. 			priority = DLC2_M03_convo_priority_normal, 
  666. 			played = false, 
  667. 		}, 
  668. 		 
  669. 		end_trans_03 = { 
  670. 			name = "pak2_m03_end_trans3_01", 
  671. 			player_talks = false, 
  672. 			handle = INVALID_CONVERSATION_HANDLE, 
  673. 			convo_thread = INVALID_THREAD_HANDLE, 
  674. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  675. 			timer_thread = INVALID_THREAD_HANDLE, 
  676. 			priority = DLC2_M03_convo_priority_normal, 
  677. 			played = false, 
  678. 			persona_line = true, 
  679. 			speaker_name = "PAK2_Director", 
  680. 		}, 
  681. 		 
  682. 		fly_to_center_01 = { 
  683. 			name = "dlc2_m03_flying_to_center", 
  684. 			player_talks = true, 
  685. 			handle = INVALID_CONVERSATION_HANDLE, 
  686. 			convo_thread = INVALID_THREAD_HANDLE, 
  687. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  688. 			timer_thread = INVALID_THREAD_HANDLE, 
  689. 			priority = DLC2_M03_convo_priority_normal, 
  690. 			played = false, 
  691. 		}, 
  692. 		 
  693. 		arrive_at_center_01 = { 
  694. 			name = "dlc2_m03_arrive_at_center", 
  695. 			player_talks = true, 
  696. 			handle = INVALID_CONVERSATION_HANDLE, 
  697. 			convo_thread = INVALID_THREAD_HANDLE, 
  698. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  699. 			timer_thread = INVALID_THREAD_HANDLE, 
  700. 			priority = DLC2_M03_convo_priority_normal, 
  701. 			played = false, 
  702. 		}, 
  703. 		 
  704. 		ship_shutdown_01 = { 
  705. 			name = "dlc2_m03_ship_shutdown", 
  706. 			player_talks = true, 
  707. 			handle = INVALID_CONVERSATION_HANDLE, 
  708. 			convo_thread = INVALID_THREAD_HANDLE, 
  709. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  710. 			timer_thread = INVALID_THREAD_HANDLE, 
  711. 			priority = DLC2_M03_convo_priority_normal, 
  712. 			played = false, 
  713. 		}, 
  714. 		 
  715. 		outrun_virus_01 = { 
  716. 			name = "dlc2_m03_outrun_virus", 
  717. 			player_talks = true, 
  718. 			handle = INVALID_CONVERSATION_HANDLE, 
  719. 			convo_thread = INVALID_THREAD_HANDLE, 
  720. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  721. 			timer_thread = INVALID_THREAD_HANDLE, 
  722. 			priority = DLC2_M03_convo_priority_normal, 
  723. 			played = false, 
  724. 		}, 
  725. 		 
  726. 		end_of_scene_01 = { 
  727. 			name = "dlc2_m03_end_of_scene", 
  728. 			player_talks = true, 
  729. 			handle = INVALID_CONVERSATION_HANDLE, 
  730. 			convo_thread = INVALID_THREAD_HANDLE, 
  731. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  732. 			timer_thread = INVALID_THREAD_HANDLE, 
  733. 			priority = DLC2_M03_convo_priority_normal, 
  734. 			played = false, 
  735. 		}, 
  736. 		 
  737. 		dir_heli_01 = { 
  738. 			name = "PAK2_M03_Killing_Helicopters_01", 
  739. 			player_talks = false, 
  740. 			handle = INVALID_CONVERSATION_HANDLE, 
  741. 			convo_thread = INVALID_THREAD_HANDLE, 
  742. 			max_wait_seconds = 10, 
  743. 			timer_thread = INVALID_THREAD_HANDLE, 
  744. 			priority = DLC2_M03_convo_priority_optional, 
  745. 			played = false, 
  746. 			persona_line = true, 
  747. 			speaker_name = "PAK2_Director", 
  748. 		}, 
  749. 		 
  750. 		dir_heli_02 = { 
  751. 			name = "PAK2_M03_Killing_Helicopters_02", 
  752. 			player_talks = false, 
  753. 			handle = INVALID_CONVERSATION_HANDLE, 
  754. 			convo_thread = INVALID_THREAD_HANDLE, 
  755. 			max_wait_seconds = 10, 
  756. 			timer_thread = INVALID_THREAD_HANDLE, 
  757. 			priority = DLC2_M03_convo_priority_optional, 
  758. 			played = false, 
  759. 			persona_line = true, 
  760. 			speaker_name = "PAK2_Director", 
  761. 		}, 
  762. 		 
  763. 		dir_heli_03 = { 
  764. 			name = "PAK2_M03_Killing_Helicopters_03", 
  765. 			player_talks = false, 
  766. 			handle = INVALID_CONVERSATION_HANDLE, 
  767. 			convo_thread = INVALID_THREAD_HANDLE, 
  768. 			max_wait_seconds = 10, 
  769. 			timer_thread = INVALID_THREAD_HANDLE, 
  770. 			priority = DLC2_M03_convo_priority_optional, 
  771. 			played = false, 
  772. 			persona_line = true, 
  773. 			speaker_name = "PAK2_Director", 
  774. 		}, 
  775. 		 
  776. 		dir_heli_04 = { 
  777. 			name = "PAK2_M03_Killing_Helicopters_04", 
  778. 			player_talks = false, 
  779. 			handle = INVALID_CONVERSATION_HANDLE, 
  780. 			convo_thread = INVALID_THREAD_HANDLE, 
  781. 			max_wait_seconds = 10, 
  782. 			timer_thread = INVALID_THREAD_HANDLE, 
  783. 			priority = DLC2_M03_convo_priority_optional, 
  784. 			played = false, 
  785. 			persona_line = true, 
  786. 			speaker_name = "PAK2_Director", 
  787. 		}, 
  788. 		 
  789. 		dir_heli_05 = { 
  790. 			name = "PAK2_M03_Killing_Helicopters_05", 
  791. 			player_talks = false, 
  792. 			handle = INVALID_CONVERSATION_HANDLE, 
  793. 			convo_thread = INVALID_THREAD_HANDLE, 
  794. 			max_wait_seconds = 10, 
  795. 			timer_thread = INVALID_THREAD_HANDLE, 
  796. 			priority = DLC2_M03_convo_priority_optional, 
  797. 			played = false, 
  798. 			persona_line = true, 
  799. 			speaker_name = "PAK2_Director", 
  800. 		}, 
  801. 	} 
  802. 	 
  803. 	DLC2_M03_convo_tables = { 
  804. 		dir_heli = { 
  805. 				DLC2_M03_convo.dir_heli_01, 
  806. 				DLC2_M03_convo.dir_heli_02, 
  807. 				DLC2_M03_convo.dir_heli_03, 
  808. 				DLC2_M03_convo.dir_heli_04, 
  809. 				DLC2_M03_convo.dir_heli_05 
  810. 		}, 
  811. 	} 
  812. 	 
  813. 	DLC2_M03_audio_events = { 
  814. 		upload_01 = 		"M03_mus_upload_1", 
  815. 		upload_01_chk = 	"M03_mus_upload_1_checkpoint", 
  816. 		upload_01_end = 	"M03_mus_upload_1_end", 
  817. 		 
  818. 		upload_02 = 		"M03_mus_upload_2", 
  819. 		upload_02_chk = 	"M03_mus_upload_2_checkpoint", 
  820. 		upload_02_end = 	"M03_mus_upload_2_end", 
  821. 		 
  822. 		upload_03 = 		"M03_mus_upload_3", 
  823. 		upload_03_chk = 	"M03_mus_upload_3_checkpoint", 
  824. 		upload_03_end = 	"M03_mus_upload_3_end", 
  825. 		 
  826. 		stunts =				"M03_mus_stunts", 
  827. 		stunts_chk =		"M03_mus_stunts_checkpoint", 
  828. 		stunts_end =		"M03_mus_stunts_end", 
  829. 		 
  830. 		all_down = 			"M03_transmitter_shutdown", 
  831. 		 
  832. 		malfunction =		"M03_mus_malfunction", 
  833. 		malfunction_chk =	"M03_mus_malfunction_checkpoint", 
  834. 		malfunction_end =	"M03_mus_malfunction_end", 
  835. 		 
  836. 		virus_sound =		"M03_virus_upload_start", 
  837. 		virus_sound_end =	"M03_virus_upload_complete", 
  838. 		 
  839. 		stop =				"M03_mus_STOP", 
  840. 	} 
  841. 	 
  842. 	DLC2_M03_audio_emitters = {	"dlc_m03_transmitter<001>", "dlc_m03_transmitter<002>", "dlc_m03_transmitter<003>", 
  843. 											"dlc_m03_transmitter<004>", "dlc_m03_transmitter<005>", "dlc_m03_transmitter<006>",  
  844. 											"dlc_m03_transmitter<007>", "dlc_m03_transmitter<008>" } 
  845.  
  846. 	 
  847. -- Triggers -- 
  848. 	DLC2_M03_trigger_location = {  
  849. 		minimap_icon_name = MINIMAP_ICON_LOCATION, 
  850. 		ingame_effect_name = INGAME_EFFECT_LOCATION, 
  851. 		object_indicator_id = OI_ASSET_LOCATION, 
  852. 		object_indicator_flags = OI_FLAGS_LOCATION, 
  853. 		sync_type = SYNC_ALL, 
  854. 		-- (nil for default) fade_dist 
  855. 	} 
  856. 	DLC2_M03_trigger_use = {  
  857. 		minimap_icon_name = MINIMAP_ICON_USE, 
  858. 		ingame_effect_name = INGAME_EFFECT_CHECKPOINT, 
  859. 		object_indicator_id = OI_ASSET_USE, 
  860. 		object_indicator_flags = OI_FLAGS_FULL, 
  861. 		sync_type = SYNC_ALL, 
  862. 		-- (nil for default) fade_dist 
  863. 	} 
  864. 	 
  865. 	DLC2_M03_trigger = { 
  866. 		-- = { 
  867. 		--	name = "_trigger", 
  868. 		--	hit = false, 
  869. 		--  (optional)callback = "dlc2_m03_function_name_cb" 
  870. 		--	(optional)marker = DLC2_M03_trigger_location or DLC2_M03_trigger_use or custom or don't include for no marker 
  871. 		--  (optional)waypoint = true, 
  872. 		--  (optional)teleport_to = { 
  873. 		--						host = "host_nav", 
  874. 		--						client = "client_nav"  
  875. 		--					},		 
  876. 		--	(optional)conversation = DLC2_M03_convo.convo_name  -- play a conversation 
  877. 		--}, 
  878. 		 
  879. 		barnstorm_trigger_01 = { 
  880. 			name = "Trigger_Barnstorm 001", 
  881. 			hit = false, 
  882. 			marker = DLC2_M03_trigger_location, 
  883. 			waypoint = false, 
  884. 			vfx = { 	"nav_exp_stunt 001", "nav_exp_stunt 002", "nav_exp_stunt 003", "nav_exp_stunt 004", 
  885. 						"nav_exp_stunt 005", "nav_exp_stunt 006", "nav_exp_stunt 007", "nav_exp_stunt 008", }, 
  886. 		}, 
  887. 		 
  888. 		barnstorm_trigger_02 = { 
  889. 			name = "Trigger_Barnstorm 002", 
  890. 			hit = false, 
  891. 			marker = DLC2_M03_trigger_location, 
  892. 			waypoint = false, 
  893. 			vfx = {	"nav_exp_stunt 009", "nav_exp_stunt 010", "nav_exp_stunt 011", "nav_exp_stunt 012" }, 
  894. 		}, 
  895.  
  896. 		transmitter_one = { 
  897. 			name = "Trigger_transmitter<001>", 
  898. 			hit = false, 
  899. 			marker = DLC2_M03_trigger_location, 
  900. 			waypoint = false, 
  901. 		}, 
  902. 		 
  903. 		transmitter_one_virus_region = { 
  904. 			name = "Trigger_transmit_region<001>", 
  905. 			hit = false, 
  906. 		}, 
  907. 		 
  908. 		transmitter_two = { 
  909. 			name = "Trigger_transmitter<002>", 
  910. 			hit = false, 
  911. 			marker = DLC2_M03_trigger_location, 
  912. 			waypoint = false, 
  913. 		}, 
  914.  
  915. 		transmitter_two_virus_region = { 
  916. 			name = "Trigger_transmit_region<002>", 
  917. 			hit = false, 
  918. 		}, 
  919. 		 
  920. 		transmitter_three = { 
  921. 			name = "Trigger_transmitter<003>", 
  922. 			hit = false, 
  923. 			marker = DLC2_M03_trigger_location, 
  924. 			waypoint = false, 
  925. 		}, 
  926. 		 
  927. 		transmitter_three_virus_region = { 
  928. 			name = "Trigger_transmit_region<003>", 
  929. 			hit = false, 
  930. 		}, 
  931. 		 
  932. 		trap_region_spawn = { 
  933. 			name = "Trigger_trap_spawn", 
  934. 			hit = false,		 
  935. 		}, 
  936. 		 
  937. 		trap_region = { 
  938. 			name = "Trigger_trap_region", 
  939. 			hit = false, 
  940. 			marker = DLC2_M03_trigger_location, 
  941. 			waypoint = false,		 
  942. 		}, 
  943. 		 
  944. 		execute_region = { 
  945. 			name = "Trigger_execute_region", 
  946. 			hit = false, 
  947. 			marker = DLC2_M03_trigger_location, 
  948. 			waypoint = false, 
  949. 		}, 
  950. 		 
  951. 		escape_region = { 
  952. 			name = "Trigger_escape_region", 
  953. 			hit = false, 
  954. 			marker = DLC2_M03_trigger_location, 
  955. 			waypoint = false, 
  956. 		}, 
  957. 	} 
  958. 	 
  959. -- NPCs -- 
  960. 	DLC2_M03_character = { 
  961. 		actress = DLC2_M03_group.actress.members[1], 
  962. 	} 
  963.  
  964. 		 
  965. -- Other -- 
  966. 	DLC2_M03_transmitter_groups = { 
  967. 		one = {  
  968. 			initial = { DLC2_M03_group.trans_one_initial }, 
  969. 			air = { DLC2_M03_group.trans_one_air_wave1, DLC2_M03_group.trans_one_air_wave2 }, 
  970. 			ground = { }, 
  971. 			shield = { }, 
  972. 		}, 
  973. 		two = {  
  974. 			initial = { DLC2_M03_group.trans_two_initial }, 
  975. 			air = {  DLC2_M03_group.trans_two_air_wave1, DLC2_M03_group.trans_two_air_wave2 }, 
  976. 			ground = { }, 
  977. 			shield = {--[[ DLC2_M03_group.trans_two_shield1, DLC2_M03_group.trans_two_shield2 ]]}, 
  978. 		}, 
  979. 		three = {  
  980. 			initial = { DLC2_M03_group.trans_three_initial }, 
  981. 			air = { DLC2_M03_group.trans_three_air_wave1, DLC2_M03_group.trans_three_air_wave2, DLC2_M03_group.trans_three_air_wave3 }, 
  982. 			ground = { DLC2_M03_group.trans_three_ground_wave1 }, 
  983. 			shield = { }, 
  984. 		}, 
  985. 	} 
  986. 	 
  987. 	DLC2_M03_escape_groups = { DLC2_M03_group.escape1, DLC2_M03_group.escape2, DLC2_M03_group.escape3, DLC2_M03_group.escape4, } 
  988.  
  989. 	DLC2_M03_transmitter_regions = { 
  990. 		one = { 
  991. 			trigger = DLC2_M03_trigger.transmitter_one, 
  992. 			virus_region = DLC2_M03_trigger.transmitter_one_virus_region, 
  993. 			 
  994. 			shields = { "Transmitter_shield_mover<001>", "Transmitter_shield_mover<004>" }, 
  995. 			transmitters = { "Transmitter_mover<001>", "Transmitter_mover<002>" },  
  996. 			vfx = { 	"nav_one_explos 001", "nav_one_explos 002", "nav_one_explos 003", "nav_one_explos 004", 
  997. 						"nav_one_explos 005", "nav_one_explos 006", "nav_one_explos 007", "nav_one_explos 008"	}, 
  998. 			 
  999. 			groups = DLC2_M03_transmitter_groups.one, 
  1000. 			duration = 45, -- virus implant, seconds 
  1001. 			 
  1002. 			additional_waves = { -- determines when additional waves are spawned 
  1003. 				air = { 5, 50 }, -- transmit percent 
  1004. 				ground = { }, -- transmit percent 
  1005. 				shield = { }, -- number of shields destroyed 
  1006. 			}, 
  1007. 			wave_spawn_navs = DLC2_M03_navpoint.transmitter_one_spawns, 
  1008. 			 
  1009. 			dialog = { 
  1010. 				action = DLC2_M03_convo.and_action_01, 
  1011. 				initial = DLC2_M03_convo.arrive_trans_01, -- DLC2_M03_convo. 
  1012. 				uploading = { convo = DLC2_M03_convo.upload_start_01, percent = 5 }, -- Convo name, percent at which to play 
  1013. 				completed = DLC2_M03_convo.upload_done_01, 
  1014. 				end_trans = DLC2_M03_convo.end_trans_01, 
  1015. 			}, 
  1016. 			 
  1017. 			music = { 
  1018. 				start = DLC2_M03_audio_events.upload_01, 
  1019. 				checkpoint = DLC2_M03_audio_events.upload_01_chk, 
  1020. 				stop = DLC2_M03_audio_events.upload_01_end, 
  1021. 			}, 
  1022. 		}, 
  1023. 		 
  1024. 		two = { 
  1025. 			trigger = DLC2_M03_trigger.transmitter_two, 
  1026. 			virus_region = DLC2_M03_trigger.transmitter_two_virus_region, 
  1027. 			 
  1028. 			shields = { "Transmitter_shield_mover<002>", "Transmitter_shield_mover<005>", "Transmitter_shield_mover<006>" }, 
  1029. 			transmitters = { "Transmitter_mover<003>", "Transmitter_mover<004>", "Transmitter_mover<005>" },  
  1030. 			vfx = { 	"nav_two_explos 001", "nav_two_explos 002", "nav_two_explos 003", "nav_two_explos 004", 
  1031. 						"nav_two_explos 005", "nav_two_explos 006", "nav_two_explos 007", "nav_two_explos 008"}, 
  1032. 			 
  1033. 			groups = DLC2_M03_transmitter_groups.two, 
  1034. 			duration = 60, -- virus implant, seconds 
  1035. 			 
  1036. 			additional_waves = { -- determines when additional waves are spawned 
  1037. 				air = { 5, 50 }, -- transmit percent 
  1038. 				ground = { }, -- transmit percent 
  1039. 				shield = {--[[ 1, 2 ]] }, -- number of shields destroyed 
  1040. 			}, 
  1041. 			wave_spawn_navs = DLC2_M03_navpoint.transmitter_two_spawns, 
  1042. 			 
  1043. 			dialog = { 
  1044. 				action = DLC2_M03_convo.and_action_02, 
  1045. 				initial = DLC2_M03_convo.arrive_trans_02, -- DLC2_M03_convo. 
  1046. 				uploading = { convo = DLC2_M03_convo.upload_start_02, percent = 5 }, -- Convo name, percent at which to play 
  1047. 				completed = DLC2_M03_convo.upload_done_02, 
  1048. 				end_trans = DLC2_M03_convo.generic_cut, 
  1049. 			}, 
  1050. 			 
  1051. 			music = { 
  1052. 				start = DLC2_M03_audio_events.upload_02, 
  1053. 				checkpoint = DLC2_M03_audio_events.upload_02_chk, 
  1054. 				stop = DLC2_M03_audio_events.upload_02_end, 
  1055. 			}, 
  1056. 		}, 
  1057. 		 
  1058. 		three = { 
  1059. 			trigger = DLC2_M03_trigger.transmitter_three, 
  1060. 			virus_region = DLC2_M03_trigger.transmitter_three_virus_region, 
  1061. 			 
  1062. 			shields = { "Transmitter_shield_mover<003>", "Transmitter_shield_mover<007>", "Transmitter_shield_mover<008>",  
  1063. 							"Transmitter_shield_mover<009>" }, 
  1064. 			transmitters = { "Transmitter_mover<006>", "Transmitter_mover<007>", "Transmitter_mover<008>", 
  1065. 									"Transmitter_mover<009>" },  
  1066. 			vfx = { "nav_three_explos 001", "nav_three_explos 002", "nav_three_explos 003", "nav_three_explos 004" }, 
  1067. 			 
  1068. 			groups = DLC2_M03_transmitter_groups.three, 
  1069. 			duration = 90, -- virus implant, seconds 
  1070. 			 
  1071. 			additional_waves = {  -- determines when additional waves are spawned 
  1072. 				air = { 5, 25, 50 }, -- transmit percent 
  1073. 				ground = { 35 }, -- transmit percent 
  1074. 				shield = { }, -- number of shields destroyed 
  1075. 			}, 
  1076. 			wave_spawn_navs = DLC2_M03_navpoint.transmitter_three_spawns, 
  1077. 			 
  1078. 			dialog = { 
  1079. 				action = DLC2_M03_convo.and_action_03, 
  1080. 				initial = DLC2_M03_convo.arrive_trans_03, -- DLC2_M03_convo. 
  1081. 				uploading = { convo = DLC2_M03_convo.upload_start_03, percent = 5 }, -- Convo name, percent at which to play 
  1082. 				completed = nil, 
  1083. 				end_trans = DLC2_M03_convo.generic_cut, 
  1084. 			}, 
  1085. 			 
  1086. 			music = { 
  1087. 				start = DLC2_M03_audio_events.upload_03, 
  1088. 				checkpoint = DLC2_M03_audio_events.upload_03_chk, 
  1089. 				stop = DLC2_M03_audio_events.upload_03_end, 
  1090. 			}, 
  1091. 		}, 
  1092. 	} 
  1093.  
  1094. 	DLC2_M03_global = { 
  1095. 		aircraft_entered = false, 
  1096. 		current_transmitter_sequence = nil, 
  1097. 		current_virus_progress = 0, 
  1098. 		near_crash_completed = false, 
  1099. 		num_shields_destroyed = 0, 
  1100. 		music_flagged = false 
  1101. 	} 
  1102. 	DLC2_M03_kill_list = { } 
  1103. 	in_coop = false 
  1104. 	DLC2_M03_current_vehicle_name = DLC2_M03_vehicle.starting 
  1105. 	 
  1106. 	DLC2_M03_FEET_PER_METER = 3.2808399 
  1107. 	 
  1108. 	-- HUD indices 
  1109. 	DLC2_M03_GSI_OBJECTIVE_INDEX				= 0 
  1110. 	DLC2_M03_GSI_INFECT_INDEX					= 1 
  1111.  
  1112. -------------------------------------------------------------------------------------------------- 
  1113. 								--[[**********************]]-- 
  1114. 								--[[                      ]]-- 
  1115. 								--[[  Standard functions  ]]-- 
  1116. 								--[[                      ]]-- 
  1117. 								--[[**********************]]-- 
  1118.  
  1119. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  1120. -- at the specified checkpoint. 
  1121. -- CALLED FROM CODE 
  1122. -- 
  1123. -- dlc2_m03_checkpoint:	The checkpoint the mission should begin at 
  1124. -- is_restart:					TRUE if the mission is restarting, FALSE otherwise 
  1125. -- 
  1126. function dlc2_m03_start(dlc2_m03_checkpoint, is_restart) 
  1127. 	in_coop = coop_is_active() 
  1128. 	 
  1129. 	-- Dismiss the players' party 
  1130. 	party_dismiss_all() 
  1131.  
  1132. 	-- Check if this mission starting from the beginning 
  1133. 	if (dlc2_m03_checkpoint == DLC2_M03_checkpoint.start.name) then 
  1134. 		-- Clear all of the acievement counters 
  1135. 		for i, achievement in pairs(DLC2_M03_acheivements) do 
  1136. 			dlc2_m03_helper_achievement_reset(achievement) 
  1137. 		end 
  1138. 		 
  1139. 		if (is_restart == false) then 
  1140. 			-- First time playing mission 
  1141. 			local fade_in_after = false 
  1142. 			-- Play an intro cutscene??? 
  1143. 			if (DLC2_M03_scene.intro ~= "") then 
  1144. 				cutscene_play(DLC2_M03_scene.intro, nil, {DLC2_M03_checkpoint.start.host_start, DLC2_M03_checkpoint.start.client_start}, fade_in_after) 
  1145. 			end 
  1146. 		else 
  1147. 			teleport_coop(DLC2_M03_checkpoint.start.host_start, DLC2_M03_checkpoint.start.client_start, true) 
  1148. 		end 
  1149. 		fade_out(0) 
  1150. 	end 
  1151.  
  1152. 	-- Handle mission initialization for the current checkpoint 
  1153. 	dlc2_m03_initialize(dlc2_m03_checkpoint) 
  1154.  
  1155. 	-- Run the mission from the current checkpoint 
  1156. 	dlc2_m03_run(dlc2_m03_checkpoint) 
  1157. 	 
  1158. end 
  1159.  
  1160. -- This is the primary function responsible for running the entire mission from start to finish. 
  1161. -- 
  1162. -- first_checkpoint:	The first checkpoint to begin running the mission at 
  1163. -- 
  1164. function dlc2_m03_run(first_checkpoint) 
  1165. 	local current_checkpoint = first_checkpoint 
  1166. 	local ignore_vehicles = true 
  1167. 	local ignore_notoriety = true 
  1168.  
  1169. 	-- make sure player personas are set to dlc2 
  1170. 	persona_set_dlc_bundle(2) 
  1171. 	 
  1172. 	mission_set_cancel_warp_location(DLC2_M03_navpoint.host_start, DLC2_M03_navpoint.client_start) 
  1173.  
  1174. 	-- Run the mission from the beginning 
  1175. 	if current_checkpoint == MISSION_START_CHECKPOINT then 
  1176. 		dlc2_m03_first_transmitter() 
  1177. 		 
  1178. 		current_checkpoint = DLC2_M03_checkpoint.transmitter_one_infected.name 
  1179. 		mission_set_checkpoint(DLC2_M03_checkpoint.transmitter_one_infected.name, true) 
  1180. 		 
  1181. 		-- Write the achievement data for the checkpoint 
  1182. 		for i, achievement in pairs(DLC2_M03_acheivements) do 
  1183. 			dlc2_m03_helper_achievement_write_checkpoint(achievement) 
  1184. 		end	 
  1185. 	end 
  1186. 	 
  1187. 	if current_checkpoint == DLC2_M03_checkpoint.transmitter_one_infected.name then 
  1188. 		-- dlc_gis_film_grain_load() 
  1189. 		dlc2_m03_stunt_sequence() 
  1190. 		 
  1191. 		current_checkpoint = DLC2_M03_checkpoint.stunt_sequence_complete.name 
  1192. 		mission_set_checkpoint(DLC2_M03_checkpoint.stunt_sequence_complete.name, true) 
  1193. 		 
  1194. 		-- Write the achievement data for the checkpoint 
  1195. 		for i, achievement in pairs(DLC2_M03_acheivements) do 
  1196. 			dlc2_m03_helper_achievement_write_checkpoint(achievement) 
  1197. 		end	 
  1198. 	end 
  1199. 	 
  1200. 	if current_checkpoint == DLC2_M03_checkpoint.stunt_sequence_complete.name then 
  1201. 		dlc2_m03_second_transmitter() 
  1202. 		 
  1203. 		current_checkpoint = DLC2_M03_checkpoint.transmitter_two_infected.name 
  1204. 		mission_set_checkpoint(DLC2_M03_checkpoint.transmitter_two_infected.name, true) 
  1205. 		 
  1206. 		-- Write the achievement data for the checkpoint 
  1207. 		for i, achievement in pairs(DLC2_M03_acheivements) do 
  1208. 			dlc2_m03_helper_achievement_write_checkpoint(achievement) 
  1209. 		end	 
  1210. 	end 
  1211. 	 
  1212. 	if current_checkpoint == DLC2_M03_checkpoint.transmitter_two_infected.name then 
  1213. 		dlc2_m03_national_guard_trap() 
  1214. 		 
  1215. 		current_checkpoint = DLC2_M03_checkpoint.national_guard_trap_destroyed.name 
  1216. 		mission_set_checkpoint(DLC2_M03_checkpoint.national_guard_trap_destroyed.name, true) 
  1217. 		 
  1218. 		-- Write the achievement data for the checkpoint 
  1219. 		for i, achievement in pairs(DLC2_M03_acheivements) do 
  1220. 			dlc2_m03_helper_achievement_write_checkpoint(achievement) 
  1221. 		end	 
  1222. 	end 
  1223. 	 
  1224. 	if current_checkpoint == DLC2_M03_checkpoint.national_guard_trap_destroyed.name then 
  1225. 		if (DLC2_M03_global.music_flagged ~= true) then 
  1226. 			audio_object_post_event( DLC2_M03_audio_events.upload_03_chk, nil, nil, LOCAL_PLAYER ) 
  1227. 		end 
  1228. 		dlc2_m03_third_transmitter() 
  1229. 		 
  1230. 		current_checkpoint = DLC2_M03_checkpoint.transmitter_three_infected.name 
  1231. 		mission_set_checkpoint(DLC2_M03_checkpoint.transmitter_three_infected.name, true) 
  1232. 		 
  1233. 		-- Write the achievement data for the checkpoint 
  1234. 		for i, achievement in pairs(DLC2_M03_acheivements) do 
  1235. 			dlc2_m03_helper_achievement_write_checkpoint(achievement) 
  1236. 		end	 
  1237. 	end 
  1238. 	 
  1239. 	if current_checkpoint == DLC2_M03_checkpoint.transmitter_three_infected.name then 
  1240. 		dlc2_m03_execute_the_virus() 
  1241. 		 
  1242. 		current_checkpoint = DLC2_M03_checkpoint.virus_executed.name 
  1243. 		mission_set_checkpoint(DLC2_M03_checkpoint.virus_executed.name, true) 
  1244. 		 
  1245. 		-- Write the achievement data for the checkpoint 
  1246. 		for i, achievement in pairs(DLC2_M03_acheivements) do 
  1247. 			dlc2_m03_helper_achievement_write_checkpoint(achievement) 
  1248. 		end	 
  1249. 	end 
  1250.  
  1251. 	if current_checkpoint == DLC2_M03_checkpoint.virus_executed.name then 
  1252. 		dlc2_m03_escape_the_virus() 
  1253. 	end 
  1254. 	 
  1255. 	-- Call mission success 
  1256. 	dlc_gis_film_grain_unload() 
  1257. 	audio_object_post_event( DLC2_M03_audio_events.stop, nil, nil, LOCAL_PLAYER ) 
  1258. 	persona_set_dlc_bundle(-1) 
  1259. 	mission_end_success("dlc2_m03", DLC2_M03_scene.outro, {DLC2_M03_checkpoint.start.host_start, DLC2_M03_checkpoint.start.client_start}) 
  1260. 	 
  1261. end 
  1262.  
  1263. -- This is the primary function responsible for cleaning up the entire mission 
  1264. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  1265. -- 
  1266. function dlc2_m03_cleanup() 
  1267. 	-- cleanup all threads 
  1268. 	cleanup_threads(DLC2_M03_thread) 
  1269. 	 
  1270. 	-- cleanup all conversations 
  1271. 	dlc2_m03_convo_end_all() 
  1272. 	 
  1273. 	-- cleanup all triggers 
  1274. 	dlc2_m03_trigger_clear_all() 
  1275. 	 
  1276. 	-- cleanup kill list 
  1277. 	dlc2_m03_kill_list_clear_all() 
  1278. 	 
  1279. 	-- unload personas 
  1280. 	dlc2_m03_unload_personas() 
  1281. 	 
  1282. 	-- Ambient audio emitters 
  1283. 	for i, emitter in pairs(DLC2_M03_audio_emitters) do 
  1284. 		audio_ambient_emitter_stop(emitter) 
  1285. 	end 
  1286. 	 
  1287. 	-- Remove costumes 
  1288. 	customization_item_revert() 
  1289. 	 
  1290. 	-- clean up checkpoint vehicle callbacks 
  1291. 	for i, group in pairs(DLC2_M03_group) do 
  1292. 		if group.vehicle ~= nil then 
  1293. 			if type(group.vehicle) == "string" then 
  1294. 				on_vehicle_destroyed("", group.vehicle) 
  1295. 				on_vehicle_enter_water("", group.vehicle) 
  1296. 			else 
  1297. 				for j, vehicle in pairs(group.vehicle) do 
  1298. 					on_vehicle_destroyed("", vehicle) 
  1299. 					on_vehicle_enter_water("", vehicle) 
  1300. 				end 
  1301. 			end 
  1302. 		end 
  1303. 	end 
  1304. 	 
  1305. 	-- clean up enemy vehicle callbacks 
  1306. 	for i, vehicle in pairs(DLC2_M03_vehicle_cb_list) do 
  1307. 		on_vehicle_destroyed("", vehicle) 
  1308. 	end 
  1309. 	 
  1310. 	for i, pilot in pairs(DLC2_M03_group.starting_camera.vehicle) do 
  1311. 		on_vehicle_destroyed("", DLC2_M03_group.starting_camera.vehicle[i]) 
  1312. 	end 
  1313. 	 
  1314. 	on_vehicle_enter("", DLC2_M03_vehicle.starting) 
  1315. 	vehicle_set_malfunctioning(DLC2_M03_current_vehicle_name, false) 
  1316. 	set_player_can_enter_exit_vehicles(LOCAL_PLAYER, true) 
  1317. 	if in_coop then 
  1318. 		set_player_can_enter_exit_vehicles(REMOTE_PLAYER, true) 
  1319. 	end 
  1320. 	 
  1321. 	on_near_crash("", LOCAL_PLAYER) 
  1322. 	if in_coop then 
  1323. 		on_near_crash("", REMOTE_PLAYER) 
  1324. 	end 
  1325. 	 
  1326. 	if DLC2_M03_global.current_transmitter_sequence ~= nil then 
  1327. 		-- Cleanup current transmitter sequence	 
  1328. 		for i, shield in pairs(DLC2_M03_global.current_transmitter_sequence.shields) do 
  1329. 			on_mover_destroyed("", shield) 
  1330. 		end 
  1331. 	end 
  1332. 	 
  1333. 	on_death("", DLC2_M03_character.actress) 
  1334. 	on_dismiss("", DLC2_M03_character.actress) 
  1335. 	cleanup_groups(DLC2_M03_group) 
  1336. 	 
  1337. 	party_set_dismissable(true) 
  1338. 	 
  1339. 	-- Turn off film grain 
  1340. 	dlc_gis_film_grain_unload() 
  1341. 	audio_object_post_event( DLC2_M03_audio_events.stop, nil, nil, LOCAL_PLAYER ) 
  1342. 	DLC2_M03_global.music_flagged = false 
  1343. 	 
  1344. 	-- TEMP: Renable stag 
  1345. 	notoriety_force_no_spawn("police", false) 
  1346. 	notoriety_set_max("police", 5) 
  1347. 	tutorial_unlock("vtol_control", false) 
  1348.  
  1349. 	-- Clear the global persona override 
  1350. 	persona_clear_global_situation_override()	 
  1351. end 
  1352.  
  1353. -- Called when the mission has ended with success 
  1354. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  1355. -- 
  1356. function dlc2_m03_success() 
  1357. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
  1358. 	 
  1359. end 
  1360.  
  1361. -------------------------------------------------------------------------------------------------- 
  1362. 								--[[**********************]]-- 
  1363. 								--[[                      ]]-- 
  1364. 								--[[ Initialize functions ]]-- 
  1365. 								--[[                      ]]-- 
  1366. 								--[[**********************]]-- 
  1367.  
  1368. -- Initialize the mission for the specified checkpoint 
  1369. -- 
  1370. -- checkpoint:		Checkpoint to initialize the mission to 
  1371. -- 
  1372. function dlc2_m03_initialize(checkpoint) 
  1373. 	-- Make sure the screen is completly faded out 
  1374. 	mission_start_fade_out(0.0) 
  1375. 	 
  1376. 	customization_outfit_wear("GiS Space Suit") 
  1377.  
  1378. 	-- Set the mission author 
  1379. 	set_mission_author("John Karczewski") 
  1380.  
  1381. 	-- Common initialization 
  1382. 	dlc2_m03_initialize_common() 
  1383.  
  1384. 	-- Checkpoint specific initialization 
  1385. 	dlc2_m03_initialize_checkpoint(checkpoint) 
  1386.  
  1387. 	-- Start fading in  
  1388. 	mission_start_fade_in() 
  1389.  
  1390. end 
  1391.  
  1392. -- Handle any common initialization 
  1393. -- 
  1394. function dlc2_m03_initialize_common() 
  1395. 	-- TEMP: Shut off stag notoriety since we don't have aliens yet 
  1396. 	notoriety_force_no_spawn("police", true) 
  1397. 	notoriety_set_max("police", 0) 
  1398. 	-- set_time_of_day(12, 0) 
  1399. 	tutorial_lock("vtol_control") 
  1400. 	 
  1401. 	-- Create the actress and setup callbacks 
  1402. 	group_create(DLC2_M03_group.actress.name, true) 
  1403. 	party_add(DLC2_M03_character.actress, LOCAL_PLAYER) 
  1404. 	party_set_dismissable(false) 
  1405. 	on_death("dlc2_m03_actress_died_cb", DLC2_M03_character.actress) 
  1406. 	on_dismiss("dlc2_m03_actress_abandoned_cb", DLC2_M03_character.actress) 
  1407. 	turn_invulnerable(DLC2_M03_character.actress) 
  1408. 	follower_set_can_abandon(DLC2_M03_character.actress, ENABLE) 
  1409. 	 
  1410. 	set_player_can_enter_exit_vehicles(LOCAL_PLAYER, false) 
  1411. 	 
  1412. 	dlc2_m03_load_personas() 
  1413. 	 
  1414. 	-- Ambient audio emitters 
  1415. 	for i, emitter in pairs(DLC2_M03_audio_emitters) do 
  1416. 		audio_ambient_emitter_start(emitter) 
  1417. 	end 
  1418. 	 
  1419. 	if in_coop then 
  1420. 		set_player_can_enter_exit_vehicles(REMOTE_PLAYER, false) 
  1421. 	end 
  1422. 	 
  1423. 	-- Read the achievement data from the checkpoint 
  1424. 	for i, achievement in pairs(DLC2_M03_acheivements) do 
  1425. 		dlc2_m03_helper_achievement_read_checkpoint(achievement) 
  1426. 	end	 
  1427. 	 
  1428. 	-- Setup a global persona situation override to disable some of Kwilanna's ambient persona lines 
  1429. 	persona_set_global_situation_override(9)	 
  1430. end 
  1431.  
  1432. -- Checkpoint specific initialization 
  1433. -- 
  1434. -- checkpoint:		The checkpoint to be initialized 
  1435. function dlc2_m03_initialize_checkpoint(checkpoint) 
  1436.  
  1437. 	if (checkpoint == MISSION_START_CHECKPOINT) then 
  1438. 		dlc2_m03_setup_checkpoint_vehicle(DLC2_M03_group.starting_vehicle) 
  1439. 	end 
  1440. 	 
  1441. 	if (checkpoint == DLC2_M03_checkpoint.transmitter_one_infected.name) then 
  1442. 		dlc_gis_film_grain_load() 
  1443. 		dlc2_m03_setup_checkpoint_vehicle(DLC2_M03_group.checkpoint_one_vehicle) 
  1444. 	end 
  1445. 	 
  1446. 	if (checkpoint == DLC2_M03_checkpoint.stunt_sequence_complete.name) then 
  1447. 		dlc2_m03_setup_checkpoint_vehicle(DLC2_M03_group.checkpoint_two_vehicle) 
  1448. 	end 
  1449. 	 
  1450. 	if (checkpoint == DLC2_M03_checkpoint.transmitter_two_infected.name) then 
  1451. 		dlc2_m03_setup_checkpoint_vehicle(DLC2_M03_group.checkpoint_three_vehicle) 
  1452. 	end 
  1453. 	 
  1454. 	if (checkpoint == DLC2_M03_checkpoint.national_guard_trap_destroyed.name) then 
  1455. 		dlc2_m03_setup_checkpoint_vehicle(DLC2_M03_group.checkpoint_four_vehicle) 
  1456. 	end 
  1457. 	 
  1458. 	if (checkpoint == DLC2_M03_checkpoint.transmitter_three_infected.name) then 
  1459. 		dlc2_m03_setup_checkpoint_vehicle(DLC2_M03_group.checkpoint_five_vehicle) 
  1460. 	end 
  1461. 	 
  1462. 	if (checkpoint == DLC2_M03_checkpoint.virus_executed.name) then 
  1463. 		dlc2_m03_setup_checkpoint_vehicle(DLC2_M03_group.checkpoint_six_vehicle) 
  1464. 	end 
  1465. 	 
  1466. 	audio_object_post_event("PAK2_UFO_Alarm_Mute", nil, nil, DLC2_M03_current_vehicle_name ) 
  1467. end 
  1468.  
  1469.  
  1470. -------------------------------------------------------------------------------------------------- 
  1471. 								--[[**********************]]-- 
  1472. 								--[[                      ]]-- 
  1473. 								--[[ Checkpoint functions ]]-- 
  1474. 								--[[                      ]]-- 
  1475. 								--[[**********************]]-- 
  1476.  
  1477. -- The first transmitter objective 
  1478. function dlc2_m03_first_transmitter() 
  1479. 	group_create(DLC2_M03_group.starting_camera.name) 
  1480. 	for i, pilot in pairs(DLC2_M03_group.starting_camera.members) do 
  1481. 		vehicle_enter_teleport(pilot, DLC2_M03_group.starting_camera.vehicle[i], 0, true, true) 
  1482. 		vehicle_chase(DLC2_M03_group.starting_camera.vehicle[i], CLOSEST_PLAYER, false) 
  1483. 		ai_add_enemy_target(pilot, CLOSEST_PLAYER, ATTACK_ON_SIGHT) 
  1484. 		on_vehicle_destroyed("dlc2_m03_heli_destroyed_cb", DLC2_M03_group.starting_camera.vehicle[i]) 
  1485. 	end 
  1486. 	 
  1487. 	-- play a conversation 
  1488. 	dlc2_m03_convo_start(DLC2_M03_convo.mission_start_01) 
  1489. 	 
  1490. 	tutorial_start("dlc2_alien_aircraft", 0) 
  1491.  
  1492. 	objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_GOTO_FIRST_TRANSMITTER", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  1493. 	 
  1494. 	local transmitter_one = DLC2_M03_transmitter_regions.one 
  1495. 	dlc2_m03_trigger_setup(transmitter_one.trigger) 
  1496. 	 
  1497. 	-- Setup the transmitter sequence 
  1498. 	dlc2_m03_setup_transmitter_sequence(transmitter_one) 
  1499. 	 
  1500. 	while not transmitter_one.trigger.hit do 
  1501. 		thread_yield() 
  1502. 	end 
  1503. 	 
  1504. 	for i, pilot in pairs(DLC2_M03_group.starting_camera.members) do 
  1505. 		if not character_is_dead(pilot) then 
  1506. 			on_vehicle_destroyed("", DLC2_M03_group.starting_camera.vehicle[i]) 
  1507. 		end 
  1508. 	end 
  1509. 	 
  1510. 	release_to_world(DLC2_M03_group.starting_camera.name) 
  1511. 	group_destroy(DLC2_M03_group.starting_camera.name) 
  1512. 	 
  1513. 	audio_object_post_event( DLC2_M03_audio_events.upload_01, nil, nil, LOCAL_PLAYER ) 
  1514. 	dlc2_m03_process_transmitter_sequence() 
  1515. 	 
  1516. 	-- Cleanup 
  1517. 	audio_object_post_event( DLC2_M03_audio_events.upload_01_end, nil, nil, LOCAL_PLAYER ) 
  1518. 	dlc2_m03_cleanup_transmitter_sequence() 
  1519. 		 
  1520. 	objective_text_clear(DLC2_M03_GSI_OBJECTIVE_INDEX) 
  1521. 	 
  1522. 	delay(25.0) 
  1523. 	 
  1524. 	dlc2_m03_restore_aircraft_health() 
  1525. end 
  1526.  
  1527. -- Stunt sequence involving a near crash event and barnstorm objective 
  1528. function dlc2_m03_stunt_sequence() 
  1529.  
  1530. 	audio_object_post_event( DLC2_M03_audio_events.stunts, nil, nil, LOCAL_PLAYER ) 
  1531. 	-- Near crash objective -- 
  1532. 	objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_PERFORM_NEAR_CRASH", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  1533. 	 
  1534. 	tutorial_start("dlc2_near_crash", 0, false, false, true) 
  1535.  
  1536. 	on_near_crash("dlc2_m03_on_near_crash_cb", LOCAL_PLAYER) 
  1537. 	if in_coop then 
  1538. 		on_near_crash("dlc2_m03_on_near_crash_cb", REMOTE_PLAYER) 
  1539. 	end 
  1540.  
  1541. 	while not DLC2_M03_global.near_crash_completed do 
  1542. 		thread_yield() 
  1543. 	end 
  1544. 	 
  1545. 	tutorial_stop("dlc2_near_crash") 
  1546. 	 
  1547. 	on_near_crash("", LOCAL_PLAYER) 
  1548. 	if in_coop then 
  1549. 		on_near_crash("", REMOTE_PLAYER) 
  1550. 	end 
  1551. 	 
  1552. 	-- Barnstorm objective -- 
  1553. 	 
  1554. 	objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_BARNSTORM_THROUGH_BRIDGE", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  1555. 	 
  1556. 	dlc2_m03_trigger_setup(DLC2_M03_trigger.barnstorm_trigger_01) 
  1557. 	 
  1558. 	while not DLC2_M03_trigger.barnstorm_trigger_01.hit do 
  1559. 		thread_yield() 
  1560. 	end 
  1561. 	 
  1562. 	for i, explosion in pairs(DLC2_M03_trigger.barnstorm_trigger_01.vfx) do 
  1563. 		explosion_create("Plane", explosion) 
  1564. 	end 
  1565. 	 
  1566. 	dlc_gis_film_grain_unload() 
  1567. 	dlc2_m03_convo_start(DLC2_M03_convo.generic_cut) 
  1568. 	dlc2_m03_helper_achievement_increment(DLC2_M03_acheivements.stunts) 
  1569. 	delay(3.0) 
  1570. 	dlc2_m03_convo_start(DLC2_M03_convo.stunt_reaction_02) 
  1571. 	audio_object_post_event( DLC2_M03_audio_events.stunts_end, nil, nil, LOCAL_PLAYER ) 
  1572. 	delay(3.0) 
  1573. end 
  1574.  
  1575. -- The second transmitter objective 
  1576. function dlc2_m03_second_transmitter() 
  1577. 	objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_GOTO_SECOND_TRANSMITTER", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  1578.  
  1579. 	local transmitter_two = DLC2_M03_transmitter_regions.two 
  1580. 	dlc2_m03_trigger_setup(transmitter_two.trigger) 
  1581. 	 
  1582. 	-- Setup the transmitter sequence 
  1583. 	dlc2_m03_setup_transmitter_sequence(transmitter_two) 
  1584. 	 
  1585. 	dlc2_m03_convo_start(DLC2_M03_convo.stunt_flying_01) 
  1586. 	 
  1587. 	while not transmitter_two.trigger.hit do 
  1588. 		thread_yield() 
  1589. 	end 
  1590. 	 
  1591. 	audio_object_post_event( DLC2_M03_audio_events.upload_02, nil, nil, LOCAL_PLAYER ) 
  1592. 	dlc2_m03_process_transmitter_sequence() 
  1593. 	 
  1594. 	-- Cleanup 
  1595. 	audio_object_post_event( DLC2_M03_audio_events.upload_02_end, nil, nil, LOCAL_PLAYER ) 
  1596. 	dlc2_m03_cleanup_transmitter_sequence() 
  1597.  
  1598. 	dlc2_m03_restore_aircraft_health() 
  1599. 	 
  1600. 	delay(2.0) 
  1601. 	dlc2_m03_convo_start(DLC2_M03_convo.end_trans_02) 
  1602. end 
  1603.  
  1604. -- National Guard trap objective 
  1605. function dlc2_m03_national_guard_trap() 
  1606. 	objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_GOTO_THIRD_TRANSMITTER", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  1607.  
  1608. 	dlc2_m03_trigger_setup(DLC2_M03_trigger.trap_region_spawn) 
  1609. 	dlc2_m03_trigger_setup(DLC2_M03_trigger.trap_region) 
  1610. 	 
  1611. 	while not DLC2_M03_trigger.trap_region_spawn.hit do 
  1612. 		thread_yield() 
  1613. 	end 
  1614.  
  1615. 	-- Set up the trap group 
  1616. 	group_create(DLC2_M03_group.trap.name, true) 
  1617. 	 
  1618. 	-- Put Pilots into their vehicles 
  1619. 	for i, pilot in pairs(DLC2_M03_group.trap.pilots) do 
  1620. 		vehicle_enter_teleport(pilot, DLC2_M03_group.trap.vehicles[i], 0, true, true) 
  1621. 	end 
  1622. 	 
  1623. 	while not DLC2_M03_trigger.trap_region.hit do 
  1624. 		thread_yield() 
  1625. 	end 
  1626. 	 
  1627. 	dlc2_m03_convo_start(DLC2_M03_convo.generic_action) 
  1628. 	dlc_gis_film_grain_load() 
  1629. 	audio_object_post_event( DLC2_M03_audio_events.upload_03, nil, nil, LOCAL_PLAYER ) 
  1630. 	DLC2_M03_global.music_flagged = true 
  1631. 	delay(2.0) 
  1632. 	 
  1633. 	dlc2_m03_convo_start(DLC2_M03_convo.guard_trap_01) 
  1634. 	 
  1635. 	objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_KILL_NATIONAL_GUARD", "", "", SYNC_ALL, OI_ASSET_KILL ) 
  1636. 	 
  1637. 	-- Have helicopters take off 
  1638. 	-- Put Pilots into their vehicles 
  1639. 	for i, pilot in pairs(DLC2_M03_group.trap.pilots) do 
  1640. 		vehicle_chase(DLC2_M03_group.trap.vehicles[i], CLOSEST_PLAYER, false) 
  1641. 	end 
  1642. 	 
  1643. 	-- Eliminate the National Guard 
  1644. 	dlc2_m03_kill_list_add( DLC2_M03_group.trap.members, OI_ASSET_KILL ) 
  1645. 	dlc2_m03_kill_list_add( DLC2_M03_group.trap.pilots, OI_ASSET_KILL_FULL ) 
  1646.  
  1647. 	-- wait until everyone is dead 
  1648. 	dlc2_m03_kill_list_wait_for_complete() 
  1649. 	 
  1650. 	-- Cleanup 
  1651. 	release_to_world(DLC2_M03_group.trap.name) 
  1652. 	group_destroy(DLC2_M03_group.trap.name) 
  1653. 	delay(1.0) 
  1654. 	dlc_gis_film_grain_unload() 
  1655. 	dlc2_m03_convo_start(DLC2_M03_convo.generic_cut) 
  1656. 	delay(2.0) 
  1657. 	 
  1658. 	dlc2_m03_convo_start(DLC2_M03_convo.guard_trap_02) 
  1659. 	 
  1660. 	dlc2_m03_restore_aircraft_health() 
  1661. end 
  1662.  
  1663. -- The third transmitter objective 
  1664. function dlc2_m03_third_transmitter() 
  1665. 	objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_GOTO_THIRD_TRANSMITTER", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  1666.  
  1667. 	local transmitter_three = DLC2_M03_transmitter_regions.three 
  1668. 	dlc2_m03_trigger_setup(transmitter_three.trigger) 
  1669. 	 
  1670. 	-- Setup the transmitter sequence 
  1671. 	dlc2_m03_setup_transmitter_sequence(transmitter_three) 
  1672. 	 
  1673. 	while not transmitter_three.trigger.hit do 
  1674. 		thread_yield() 
  1675. 	end 
  1676. 	 
  1677. 	dlc2_m03_process_transmitter_sequence() 
  1678. 	 
  1679. 	-- Cleanup 
  1680. 	audio_object_post_event( DLC2_M03_audio_events.upload_03_end, nil, nil, LOCAL_PLAYER ) 
  1681. 	dlc2_m03_cleanup_transmitter_sequence() 
  1682.  
  1683. 	dlc2_m03_restore_aircraft_health() 
  1684. end 
  1685.  
  1686. -- Execute the virus 
  1687. function dlc2_m03_execute_the_virus() 
  1688. 	delay(2.0) 
  1689. 	 
  1690. 	dlc2_m03_convo_start(DLC2_M03_convo.end_trans_03) 
  1691. 	objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_GOTO_VIRUS_LOCATION", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  1692. 	dlc2_m03_trigger_setup(DLC2_M03_trigger.execute_region) 
  1693. 	delay(9.0) 
  1694. 	 
  1695. 	dlc2_m03_convo_start(DLC2_M03_convo.fly_to_center_01) 
  1696. 	while not DLC2_M03_trigger.execute_region.hit do 
  1697. 		thread_yield() 
  1698. 	end 
  1699. 	 
  1700. 	objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_EXECUTE_VIRUS", "", "", SYNC_ALL, OI_ASSET_KILL ) 
  1701. 	dlc2_m03_convo_start(DLC2_M03_convo.arrive_at_center_01) 
  1702. 	 
  1703. 	delay(6.0) 
  1704. end 
  1705.  
  1706. -- Escape the virus radius 
  1707. function dlc2_m03_escape_the_virus() 
  1708. 	objective_text_clear(DLC2_M03_GSI_OBJECTIVE_INDEX) 
  1709. 	dlc_gis_film_grain_load() 
  1710. 	dlc2_m03_convo_start(DLC2_M03_convo.generic_action) 
  1711. 	DLC2_M03_thread.escape_spawn = thread_new("dlc2_m03_escape_npc_spawn_thread") 
  1712. 	audio_object_post_event( DLC2_M03_audio_events.malfunction, nil, nil, LOCAL_PLAYER ) 
  1713. 	vehicle_set_malfunctioning(DLC2_M03_current_vehicle_name) 
  1714. 	vehicle_speed_override(DLC2_M03_current_vehicle_name, 10) 
  1715. 	delay(2.0) 
  1716. 	dlc2_m03_convo_start(DLC2_M03_convo.ship_shutdown_01) 
  1717. 	delay(5.0) 
  1718. 	objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_BARNSTORM_UNDER_BRIDGE", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  1719. 	 
  1720. 	-- Barnstorm objective -- 
  1721. 	dlc2_m03_trigger_setup(DLC2_M03_trigger.barnstorm_trigger_02) 
  1722. 	 
  1723. 	while not DLC2_M03_trigger.barnstorm_trigger_02.hit do 
  1724. 		thread_yield() 
  1725. 	end 
  1726. 	 
  1727. 	for i, explosion in pairs(DLC2_M03_trigger.barnstorm_trigger_02.vfx) do 
  1728. 		explosion_create("Plane", explosion) 
  1729. 	end 
  1730. 	 
  1731. 	dlc2_m03_helper_achievement_increment(DLC2_M03_acheivements.stunts) 
  1732. 	 
  1733. 	dlc2_m03_convo_start(DLC2_M03_convo.outrun_virus_01) 
  1734. 	 
  1735. 	vehicle_set_weapons_disarmed(DLC2_M03_current_vehicle_name, true) 
  1736. 	objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_ESCAPE", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  1737. 	 
  1738. 	dlc2_m03_trigger_setup(DLC2_M03_trigger.escape_region) 
  1739. 	 
  1740. 	while not DLC2_M03_trigger.escape_region.hit do 
  1741. 		thread_yield() 
  1742. 	end 
  1743. 	 
  1744. 	dlc2_m03_convo_start(DLC2_M03_convo.end_of_scene_01) 
  1745. 	audio_object_post_event( DLC2_M03_audio_events.malfunction_end, nil, nil, LOCAL_PLAYER ) 
  1746. 	delay(4.0) 
  1747. 	vehicle_set_malfunctioning(DLC2_M03_current_vehicle_name, false) 
  1748. 	 
  1749. 	thread_kill(DLC2_M03_thread.escape_spawn) 
  1750. 	DLC2_M03_thread.escape_spawn = INVALID_THREAD_HANDLE 
  1751. end 
  1752.  
  1753. -------------------------------------------------------------------------------------------------- 
  1754. 								--[[**********************]]-- 
  1755. 								--[[                      ]]-- 
  1756. 								--[[  Trigger functions   ]]-- 
  1757. 								--[[                      ]]-- 
  1758. 								--[[**********************]]-- 
  1759.  
  1760. -- Enable a trigger and set any markers/waypoints needed 
  1761. -- 
  1762. -- trigger_table:		(table) information about how to setup this trigger 
  1763. --							 
  1764. function dlc2_m03_trigger_setup( trigger_table ) 
  1765.  
  1766. 	-- clear hit flag 
  1767. 	trigger_table.hit = false 
  1768. 	 
  1769. 	-- set callback 
  1770. 	if trigger_table.callback ~= nil and trigger_table.callback ~= "" then 
  1771. 		on_trigger(trigger_table.callback, trigger_table.name) 
  1772. 	else 
  1773. 		on_trigger("dlc2_m03_trigger_cb", trigger_table.name)	 
  1774. 	end 
  1775. 	 
  1776. 	-- enable the trigger 
  1777. 	trigger_enable(trigger_table.name, true) 
  1778. 	 
  1779. 	-- set marker information 
  1780. 	if trigger_table.marker ~= nil then 
  1781. 		marker_add_trigger(trigger_table.name, trigger_table.marker.minimap_icon_name, trigger_table.marker.ingame_effect_name, trigger_table.marker.object_indicator_id, trigger_table.marker.object_indicator_flags, trigger_table.marker.sync_type, trigger_table.marker.fade_dist) 
  1782. 	end 
  1783. 	 
  1784. 	-- set a waypoint 
  1785. 	if trigger_table.waypoint == true then 
  1786. 		mission_waypoint_add(trigger_table.name) 
  1787. 	end 
  1788. end 
  1789.  
  1790. -- Disable trigger and cleanup any markers on the trigger 
  1791. -- 
  1792. -- trigger:		(string) name of trigger to cleanup 
  1793. -- 
  1794. function dlc2_m03_trigger_clear(trigger) 
  1795. 	on_trigger("", trigger) 
  1796. 	trigger_enable(trigger, false) 
  1797. 	marker_remove_trigger(trigger, SYNC_ALL) 
  1798. end 
  1799.  
  1800. -- clear all triggers 
  1801. function dlc2_m03_trigger_clear_all() 
  1802. 	for i,trigger_table in pairs(DLC2_M03_trigger) do 
  1803. 		dlc2_m03_trigger_clear(trigger_table.name) 
  1804. 	end 
  1805. 	mission_waypoint_remove() 
  1806. end 
  1807.  
  1808. -- get the trigger table from the trigger name 
  1809. -- 
  1810. -- trigger:		(string) trigger name 
  1811. -- 
  1812. function dlc2_m03_trigger_get_table(trigger) 
  1813. 	local trigger_table 
  1814. 	for i,trig in pairs(DLC2_M03_trigger) do 
  1815. 		if trig.name == trigger then 
  1816. 			trigger_table = trig 
  1817. 		end 
  1818. 	end 
  1819. 	return trigger_table 
  1820. end 
  1821.  
  1822. -- basic trigger callback 
  1823. -- 
  1824. -- human:		(string) name of human that tripped the trigger 
  1825. -- trigger:		(string) name of the trigger 
  1826. -- 
  1827. function dlc2_m03_trigger_cb(human, trigger) 
  1828. 	-- This may be called multiple times in the same frame.  Never create groups in a trigger callback.  Use show group instead. 
  1829. 	 
  1830. 	-- find this trigger 
  1831. 	local trigger_table = dlc2_m03_trigger_get_table(trigger) 
  1832. 	 
  1833. 	if trigger_table ~= nil then 
  1834. 		if trigger_table.hit == true then 
  1835. 			return 
  1836. 		end 
  1837. 		trigger_table.hit = true 
  1838. 		dlc2_m03_trigger_clear(trigger_table.name) 
  1839. 		 
  1840. 		if trigger_table.teleport_to ~= nil then 
  1841. 			mission_start_fade_out() 
  1842. 			teleport_coop( trigger_table.teleport_to.host, trigger_table.teleport_to.client, true )	 
  1843. 			mission_start_fade_in()			 
  1844. 		end 
  1845. 		 
  1846. 		if trigger_table.waypoint == true then 
  1847. 			mission_waypoint_remove() 
  1848. 		end 
  1849. 		 
  1850. 		if trigger_table.conversation ~= nil and trigger_table.conversation ~= "" then 
  1851. 			dlc2_m03_convo_start(trigger_table.conversation) 
  1852. 		end 
  1853. 	end 
  1854. end 
  1855.  
  1856. -------------------------------------------------------------------------------------------------- 
  1857. 								--[[**********************]]-- 
  1858. 								--[[                      ]]-- 
  1859. 								--[[Conversation functions]]-- 
  1860. 								--[[                      ]]-- 
  1861. 								--[[**********************]]-- 
  1862. 								 
  1863. -- spawn the convo play thread for this conversation 
  1864. -- 
  1865. -- convo_table:		(table) conversation information 
  1866. -- 
  1867. function dlc2_m03_convo_start(convo_table) 
  1868. 	convo_table.convo_thread = thread_new("dlc2_m03_convo_play_thread", convo_table) 
  1869. end 
  1870.  
  1871. -- end the conversation and kill any threads playing the conversation 
  1872. -- 
  1873. -- convo_table:		(table) conversation information 
  1874. -- 
  1875. function dlc2_m03_convo_end(convo_table) 
  1876. 	-- kill any threads that might be running 
  1877. 	thread_kill(convo_table.convo_thread) 
  1878. 	thread_kill(convo_table.timer_thread) 
  1879. 	 
  1880. 	if convo_table.handle ~= INVALID_CONVERSATION_HANDLE then 
  1881. 		audio_conversation_end(convo_table.handle) 
  1882. 		convo_table.handle = INVALID_CONVERSATION_HANDLE 
  1883. 	end 
  1884. 	 
  1885. 	if convo_table.phone_call == true then 
  1886. 		audio_remove_mission_cellphone(convo_table.name) 
  1887. 	end 
  1888. end 
  1889.  
  1890. -- end all of the conversations 
  1891. function dlc2_m03_convo_end_all() 
  1892. 	for i,convo_table in pairs(DLC2_M03_convo) do 
  1893. 		dlc2_m03_convo_end(convo_table) 
  1894. 	end 
  1895. 	DLC2_M03_convo_phone_complete = false 
  1896. end 
  1897.  
  1898. -- callback for when a phone call conversation is complete 
  1899. function dlc2_m03_call_ended_cb() 
  1900. 	DLC2_M03_convo_phone_complete = true 
  1901. end 
  1902.  
  1903. -- Determine if a conversation is playing 
  1904. -- 
  1905. -- returns:		true if playing or false if not 
  1906. -- 
  1907. function dlc2_m03_convo_is_playing() 
  1908. 	local convo_playing = false 
  1909. 	if DLC2_M03_convo_playing ~= nil and DLC2_M03_convo_playing ~= "" then 
  1910. 		convo_playing = true 
  1911. 	end 
  1912. 	return convo_playing 
  1913. end 
  1914.  
  1915. -- Wait for conversation to complete 
  1916. -- (this may not work as desired with multiple conversations queued) 
  1917. -- 
  1918. function dlc2_m03_convo_wait_for_end() 
  1919. 	while dlc2_m03_convo_is_playing() do 
  1920. 		delay(1.0) 
  1921. 	end 
  1922. end 
  1923.  
  1924. -- Thread to play the conversation with emergency kill timer 
  1925. -- 
  1926. -- convo_table:		(table) conversation information 
  1927. -- 
  1928. function dlc2_m03_convo_play_thread(convo_table) 
  1929. 	-- determine priority 
  1930. 	if convo_table.priority == DLC2_M03_convo_priority_high then 
  1931. 		-- priority conversation 
  1932. 		-- kill any running conversation 
  1933. 		if dlc2_m03_convo_is_playing() then 
  1934. 			dlc2_m03_convo_end(DLC2_M03_convo_playing) 
  1935. 		end 
  1936. 	elseif convo_table.priority == DLC2_M03_convo_priority_normal then 
  1937. 		-- normal conversation 
  1938. 		-- wait for currently playing conversation 
  1939. 		while dlc2_m03_convo_is_playing() do 
  1940. 			thread_yield() 
  1941. 		end 
  1942. 	else -- optional conversation 
  1943. 		-- if another conversation is playing, exit 
  1944. 		if dlc2_m03_convo_is_playing() then 
  1945. 			return 
  1946. 		end 
  1947. 	end 
  1948. 	 
  1949. 	-- Set conversation as playing 
  1950. 	DLC2_M03_convo_playing = convo_table 
  1951. 	 
  1952. 	-- start the backup timer thread 
  1953. 	convo_table.timer_thread = thread_new("delay", convo_table.max_wait_seconds) 
  1954. 	 
  1955. 	if convo_table.persona_line == true then 
  1956. 		-- play the line 
  1957. 		audio_play_persona_line_2d(dlc2_m03_get_persona_handle(convo_table), convo_table.name) 
  1958. 		thread_yield() 
  1959. 		-- while audio_persona_line_playing(convo_table.speaker_name) and (not thread_check_done(convo_table.timer_thread)) do 
  1960. 		-- 	thread_yield() 
  1961. 		-- end 
  1962. 	elseif convo_table.phone_call == true then 
  1963. 		-- do a phone call 
  1964. 		local auto_answer = true  -- missions always auto-answer 
  1965. 		DLC2_M03_convo_phone_complete = false 
  1966. 		audio_play_for_mission_cellphone(convo_table.name, convo_table.receiving_call, auto_answer, "", "dlc2_m03_call_ended_cb") 
  1967. 		 
  1968. 		while not DLC2_M03_convo_phone_complete and (not thread_check_done(convo_table.timer_thread)) do 
  1969. 			thread_yield() 
  1970. 		end 
  1971. 		 
  1972. 		audio_remove_mission_cellphone(convo_table.name) 
  1973. 	else -- conversation 
  1974. 		if (convo_table.player_talks) then 
  1975. 			convo_table.handle = audio_conversation_load(convo_table.name) 
  1976. 		else 
  1977. 			convo_table.handle = audio_conversation_load_direct(convo_table.name) 
  1978. 		end 
  1979. 		 
  1980. 		audio_conversation_play(convo_table.handle) 
  1981. 		thread_yield() 
  1982. 		 
  1983. 		-- Wait for the conversation to end 
  1984. 		while audio_conversation_playing(convo_table.handle) and (not thread_check_done(convo_table.timer_thread)) do 
  1985. 			thread_yield() 
  1986. 		end 
  1987. 		audio_conversation_end(convo_table.handle) 
  1988. 		convo_table.handle = INVALID_CONVERSATION_HANDLE 
  1989. 	end 
  1990. 	 
  1991. 	-- clear the playing conversation 
  1992. 	convo_table.played = true 
  1993. 	DLC2_M03_convo_playing = "" 
  1994. end 
  1995.  
  1996. -------------------------------------------------------------------------------------------------- 
  1997. 								--[[**********************]]-- 
  1998. 								--[[                      ]]-- 
  1999. 								--[[ Kill List functions  ]]-- 
  2000. 								--[[                      ]]-- 
  2001. 								--[[**********************]]-- 
  2002.  
  2003. -- Add a single person or a table of people to list to be killed 
  2004. -- 
  2005. -- npc_name:		(table or string) table of names or single name of character to add to the kill_list 
  2006. -- icon_type:		(string) OI_ASSET_KILL or OI_ASSET_KILL_FULL 
  2007. -- 
  2008. function dlc2_m03_kill_list_add( npc_name, icon_type ) 
  2009. 	-- Recursive call to add individual members 
  2010. 	if (type(npc_name) == "table") then 
  2011. 		for i,member in pairs(npc_name) do 
  2012. 			dlc2_m03_kill_list_add( member, icon_type ) 
  2013. 		end 
  2014. 		return 
  2015. 	end 
  2016. 	 
  2017. 	-- make sure it is still alive 
  2018. 	if character_is_dead(npc_name) then 
  2019. 		return 
  2020. 	end 
  2021. 		 
  2022. 	if icon_type == OI_ASSET_KILL then 
  2023. 		marker_add(npc_name, MINIMAP_ICON_KILL, OI_ASSET_KILL, OI_FLAGS_DEFAULT, SYNC_ALL) 
  2024. 	elseif icon_type == OI_ASSET_KILL_FULL then 
  2025. 		marker_add(npc_name, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_FULL, SYNC_ALL) 
  2026. 	else 
  2027. 		-- FAIL!  We won't know which guy to kill 
  2028. 		return 
  2029. 	end 
  2030. 	on_death("dlc2_m03_kill_list_member_dead_cb", npc_name) 
  2031. 	 
  2032. 	-- add the name to the kill_list 
  2033. 	DLC2_M03_kill_list[ npc_name ] = npc_name 
  2034. end 
  2035.  
  2036. -- remove an npc from the kill list and make sure it has markers and callbacks cleaned up 
  2037. -- 
  2038. -- npc_name:		(string) name of npc to remove from the kill_list 
  2039. -- 
  2040. function dlc2_m03_kill_list_clear(npc_name) 
  2041. 	marker_remove(npc_name) 
  2042. 	on_death("", npc_name) 
  2043. 	DLC2_M03_kill_list[ npc_name ] = nil 
  2044. end 
  2045.  
  2046. -- remove all entries in the kill list and make sure all markers/callbacks are cleaned up 
  2047. function dlc2_m03_kill_list_clear_all() 
  2048. 	for i, npc_name in pairs( DLC2_M03_kill_list ) do 
  2049. 		dlc2_m03_kill_list_clear(npc_name) 
  2050. 	end 
  2051. end 
  2052.  
  2053. -- Return number of npcs in the kill list 
  2054. function dlc2_m03_kill_list_get_count() 
  2055. 	local kill_list_size = sizeof_table(DLC2_M03_kill_list) 
  2056. 	return kill_list_size  
  2057. end 
  2058.  
  2059. -- wait for everyone in the kill list to be killed (don't call this until everyone you want to include has been spawned and added) 
  2060. function dlc2_m03_kill_list_wait_for_complete() 
  2061. 	local npcs_alive = true 
  2062. 	 
  2063. 	while npcs_alive do 
  2064. 		npcs_alive = false 
  2065. 		for i, npc_name in pairs( DLC2_M03_kill_list ) do 
  2066. 			if character_is_dead(npc_name) then 
  2067. 				-- remove it 
  2068. 				dlc2_m03_kill_list_clear(npc_name) 
  2069. 			else 
  2070. 				npcs_alive = true 
  2071. 				thread_yield() 
  2072. 			end 
  2073. 		end 
  2074. 		thread_yield() 
  2075. 	end 
  2076. 	 
  2077. end 
  2078.  
  2079. -- callback for kill_list member 
  2080. -- 
  2081. -- npc_killed:	(string) name of killed NPC 
  2082. -- 
  2083. function dlc2_m03_kill_list_member_dead_cb(npc_killed) 
  2084. 	dlc2_m03_kill_list_clear(npc_killed) 
  2085. end 
  2086. 								 
  2087. -------------------------------------------------------------------------------------------------- 
  2088. 								--[[**********************]]-- 
  2089. 								--[[                      ]]-- 
  2090. 								--[[   Common functions   ]]-- 
  2091. 								--[[                      ]]-- 
  2092. 								--[[**********************]]-- 
  2093. 								 
  2094. function dlc2_m03_setup_transmitter_sequence(sequence) 
  2095. 	 
  2096. 	DLC2_M03_global.current_transmitter_sequence = sequence 
  2097. 	 
  2098. 	for i, shield in pairs(sequence.shields) do 
  2099. 		mesh_mover_show(shield) 
  2100. 		mesh_mover_set_invulnerable(shield, ENABLE) 
  2101. 	end 
  2102. 	 
  2103. 	for i, transmitter in pairs(sequence.transmitters) do 
  2104. 		mesh_mover_show(transmitter) 
  2105. 	end 
  2106. 	 
  2107. 	local initial_group = sequence.groups.initial[1] 
  2108. 	 
  2109. 	-- Spawn the initial npcs and vehicles 
  2110. 	group_create(initial_group, true) 
  2111. 	 
  2112. 	-- Place pilots into aircrafts 
  2113. 	for i, pilot in pairs(initial_group.pilots) do 
  2114. 		vehicle_enter_teleport(pilot, initial_group.vehicles[i], 0, true, true) 
  2115. 		vehicle_chase(initial_group.vehicles[i], CLOSEST_PLAYER, false) 
  2116. 		ai_add_enemy_target(pilot, CLOSEST_PLAYER, ATTACK_ON_SIGHT) 
  2117. 		on_vehicle_destroyed("dlc2_m03_ach_veh_destroyed_cb", initial_group.vehicles[i]) 
  2118. 	end 
  2119. 	 
  2120. 	for i, passenger in pairs(initial_group.passengers) do 
  2121. 		if passenger ~= nil then 
  2122. 			vehicle_enter_teleport(passenger, initial_group.vehicles[i], 1, true, true) 
  2123. 			ai_add_enemy_target(passenger, CLOSEST_PLAYER, ATTACK_ON_SIGHT) 
  2124. 		end 
  2125. 	end 
  2126. 	 
  2127. 	-- Have the rooftop enemies target the player 
  2128. 	for i, member in pairs(initial_group.members) do 
  2129. 		ai_add_enemy_target(member, CLOSEST_PLAYER, ATTACK_ON_SIGHT) 
  2130. 	end 
  2131. end 
  2132.  
  2133. function dlc2_m03_process_transmitter_sequence() 
  2134. 	dlc_gis_film_grain_load() 
  2135.  
  2136. 	local sequence = DLC2_M03_global.current_transmitter_sequence 
  2137. 	local num_shields = sizeof_table(sequence.shields) 
  2138. 	 
  2139. 	if num_shields == 1 then 
  2140. 		objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_DESTROY_SHIELD", "", "", SYNC_ALL, OI_ASSET_KILL ) 
  2141. 	else 
  2142. 		objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_DESTROY_SHIELDS", "", "", SYNC_ALL, OI_ASSET_KILL ) 
  2143. 	end 
  2144. 	 
  2145. 	for i, shield in pairs(sequence.shields) do 
  2146. 		marker_add(shield, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_DEFAULT, SYNC_ALL) 
  2147. 		mesh_mover_set_invulnerable(shield, DISABLE) 
  2148. 		on_mover_destroyed("dlc2_m03_shield_destroyed_cb", shield) 
  2149. 	end 
  2150. 	 
  2151. 	-- Queue up the initial dialog 
  2152. 	if sequence.dialog.action ~= nil then 
  2153. 		dlc2_m03_convo_start(sequence.dialog.action) 
  2154. 		delay(3.0) 
  2155. 	end 
  2156. 	 
  2157. 	-- Queue up the initial dialog 
  2158. 	if sequence.dialog.initial ~= nil then 
  2159. 		dlc2_m03_convo_start(sequence.dialog.initial) 
  2160. 	end 
  2161. 	 
  2162. 	-- Start up a thread to spawn enemies when the player kills shields.  Will exit if no enemies are set up 
  2163. 	DLC2_M03_thread.shield_destroyed_spawn = thread_new("dlc2_m03_shield_destroyed_spawn_thread") 
  2164. 	 
  2165. 	-- Wait until all shields are destroyed 
  2166. 	while DLC2_M03_global.num_shields_destroyed < num_shields do 
  2167. 		thread_yield() 
  2168. 	end 
  2169. 	 
  2170. 	audio_object_post_event(DLC2_M03_audio_events.all_down) 
  2171. 	 
  2172. 	for i, explosion in pairs(sequence.vfx) do 
  2173. 		explosion_create("RPG-NPC", explosion) 
  2174. 		delay(0.1) 
  2175. 	end 
  2176.  
  2177. 	trigger_enable(sequence.virus_region.name) 
  2178. 	 
  2179. 	audio_object_post_event( DLC2_M03_audio_events.virus_sound, nil, nil, LOCAL_PLAYER ) 
  2180. 	 
  2181. 	-- Spawn a thread to monitor implanting the virus 
  2182. 	DLC2_M03_thread.virus_transfer = thread_new("dlc2_m03_virus_transfer_thread") 
  2183. 	 
  2184. 	-- Need to handle reinforcements as well 
  2185. 	DLC2_M03_thread.air_wave_spawn = thread_new("dlc2_m03_virus_air_wave_spawn_thread") 
  2186. 	DLC2_M03_thread.ground_wave_spawn = thread_new("dlc2_m03_virus_ground_wave_spawn_thread") 
  2187. 	 
  2188. 	local uploading_convo_queued = false 
  2189. 	local uploading_convo_info = sequence.dialog.uploading 
  2190. 	 
  2191. 	while DLC2_M03_global.current_virus_progress < sequence.duration do 
  2192. 	 
  2193. 		-- Perhaps we should play the transmitting conversation 
  2194. 		if uploading_convo_info.convo ~= nil and not uploading_convo_queued then 
  2195. 			-- if we have an uploading conversation that hasn't been played 
  2196. 			if uploading_convo_info.percent >= DLC2_M03_global.current_virus_progress then 
  2197. 				-- if there isn't a conversation currently playing,  
  2198. 				dlc2_m03_convo_start(uploading_convo_info.convo) 
  2199. 				uploading_convo_queued = true 
  2200. 			end 
  2201. 		end 
  2202. 		 
  2203. 		thread_yield() 
  2204. 	end 
  2205. 	 
  2206. 	audio_object_post_event( DLC2_M03_audio_events.virus_sound_end, nil, nil, LOCAL_PLAYER ) 
  2207. end 
  2208.  
  2209. function dlc2_m03_cleanup_transmitter_sequence() 
  2210. 	local sequence = DLC2_M03_global.current_transmitter_sequence 
  2211. 	 
  2212. 	trigger_enable(sequence.virus_region.name, false) 
  2213. 	 
  2214. 	thread_kill(DLC2_M03_thread.virus_transfer) 
  2215. 	DLC2_M03_thread.virus_transfer = INVALID_THREAD_HANDLE 
  2216. 	 
  2217. 	thread_kill(DLC2_M03_thread.air_wave_spawn) 
  2218. 	DLC2_M03_thread.air_wave_spawn = INVALID_THREAD_HANDLE 
  2219. 	 
  2220. 	thread_kill(DLC2_M03_thread.ground_wave_spawn) 
  2221. 	DLC2_M03_thread.ground_wave_spawn = INVALID_THREAD_HANDLE 
  2222. 	 
  2223. 	thread_kill(DLC2_M03_thread.shield_destroyed_spawn) 
  2224. 	DLC2_M03_thread.shield_destroyed_spawn = INVALID_THREAD_HANDLE 
  2225. 	 
  2226. 	-- Queue up the completed dialog 
  2227. 	if sequence.dialog.completed ~= nil then 
  2228. 		dlc2_m03_convo_start(sequence.dialog.completed) 
  2229. 		delay(3.0) 
  2230. 	end 
  2231. 	 
  2232. 	dlc2_m03_cleanup_transmitter_groups(sequence.groups) 
  2233.  
  2234. 	hud_bar_off(DLC2_M03_GSI_INFECT_INDEX) 
  2235. 	DLC2_M03_global.current_virus_progress = 0	 
  2236. 	DLC2_M03_global.current_transmitter_sequence = nil 
  2237. 	DLC2_M03_global.num_shields_destroyed = 0 
  2238. 	 
  2239. 	delay(1.0) 
  2240. 	if	(sequence.virus_region.name ~= "Trigger_transmit_region<001>") then 
  2241. 		dlc_gis_film_grain_unload() 
  2242. 	end 
  2243. 	 
  2244. 	-- Queue up the end dialog 
  2245. 	if sequence.dialog.end_trans ~= nil then 
  2246. 		dlc2_m03_convo_start(sequence.dialog.end_trans) 
  2247. 	end 
  2248.  
  2249. end 
  2250.  
  2251. function dlc2_m03_cleanup_transmitter_groups(group_table) 
  2252. 	for i, group_set in pairs (group_table) do 
  2253. 		for j, group in pairs(group_set) do 
  2254. 			-- Kill the pilots to cause death spirals on hostile planes 
  2255. 			for j, pilot in pairs(group.pilots) do 
  2256. 				if not character_is_dead(pilot) and group.is_hostile[j] then 
  2257. 					on_vehicle_destroyed("", group.vehicles[j]) 
  2258. 					if (group.explode_on_transmit[j]) then 
  2259. 						vehicle_detonate(group.vehicles[j]) 
  2260. 					end 
  2261. 					character_kill(pilot) 
  2262. 				elseif not group.is_hostile[j] then 
  2263. 					on_vehicle_destroyed("", group.vehicles[j]) 
  2264. 				end 
  2265. 			end 
  2266. 		 
  2267. 			release_to_world(group.name) 
  2268. 			group_destroy(group.name) 
  2269. 		end 
  2270. 	end 
  2271. end 
  2272.  
  2273. function dlc2_m03_setup_checkpoint_vehicle(group) 
  2274. 	group_create_hidden(group.name, true) 
  2275. 	character_hide(DLC2_M03_character.actress) 
  2276. 	teleport_coop(group.nav[1], group.nav[2], true) 
  2277. 	teleport(DLC2_M03_character.actress, group.nav[1]) 
  2278. 	DLC2_M03_current_vehicle_name = group.vehicle 
  2279. 	on_vehicle_destroyed("dlc2_m03_alien_aircraft_destroyed", group.vehicle) 
  2280. 	on_vehicle_enter_water("dlc2_m03_alien_aircraft_destroyed", group.vehicle) 
  2281. 	radio_block(group.vehicle) 
  2282. 	vehicle_enter_teleport(LOCAL_PLAYER, group.vehicle, 0, true, true) 
  2283. 	set_max_hit_points(DLC2_M03_current_vehicle_name, DLC2_M03_AIRCRAFT_HITPOINTS) 
  2284. 	 
  2285. 	if in_coop then 
  2286. 		vehicle_enter_teleport(REMOTE_PLAYER, group.vehicle, 1, true, true) 
  2287. 		vehicle_enter_teleport(DLC2_M03_character.actress, group.vehicle, 2, true, true) 
  2288. 	else 
  2289. 		vehicle_enter_teleport(DLC2_M03_character.actress, group.vehicle, 1, true, true) 
  2290. 	end 
  2291. 	 
  2292. 	group_show(group.name) 
  2293. 	character_show(DLC2_M03_character.actress) 
  2294. end 
  2295.  
  2296. function dlc2_m03_restore_aircraft_health() 
  2297. 	local hit_point_percent = (get_current_hit_points(DLC2_M03_current_vehicle_name)/DLC2_M03_AIRCRAFT_HITPOINTS) * 100 
  2298. 	hit_point_percent =  hit_point_percent + DLC2_M03_AIRCRAFT_RESTORE_PERCENT 
  2299. 	 
  2300. 	if (hit_point_percent >= 100) then 
  2301. 		hit_point_percent = 1 
  2302. 	else 
  2303. 		hit_point_percent = hit_point_percent / 100 
  2304. 	end 
  2305. 	 
  2306. 	set_current_hit_points(DLC2_M03_current_vehicle_name, hit_point_percent * DLC2_M03_AIRCRAFT_HITPOINTS) 
  2307. 	if (vehicle_get_smoke_and_fire_state(DLC2_M03_current_vehicle_name)) then 
  2308. 		vehicle_set_smoke_and_fire_state(DLC2_M03_current_vehicle_name, false, false) 
  2309. 	end 
  2310. 	audio_object_post_event("PAK2_UFO_Alarm_Mute", nil, nil, DLC2_M03_current_vehicle_name ) 
  2311. end 
  2312.  
  2313. -- Loads the necessary 2D personas  
  2314. -- 
  2315. function dlc2_m03_load_personas() 
  2316. 	for key, persona in pairs(DLC2_M03_personas) do 
  2317. 		persona.handle = audio_persona_load_2d(persona.name) 
  2318. 	end 
  2319. end 
  2320.  
  2321. -- Unloads all 2d personas 
  2322. -- 
  2323. function dlc2_m03_unload_personas() 
  2324. 	for key, persona in pairs(DLC2_M03_personas) do 
  2325. 		if persona.handle ~= INVALID_PERSONA_HANDLE then 
  2326. 			audio_persona_remove_2d(persona.handle) 
  2327. 			persona.handle = INVALID_PERSONA_HANDLE 
  2328. 		end 
  2329. 	end 
  2330. end 
  2331.  
  2332. -- Gets the 2d persona handle from a character name 
  2333. -- 
  2334. function dlc2_m03_get_persona_handle(convo) 
  2335. 	for key, persona in pairs(DLC2_M03_personas) do 
  2336. 		if persona.name == convo.speaker_name then 
  2337. 			return persona.handle 
  2338. 		end 
  2339. 	end 
  2340.  
  2341. 	return nil 
  2342. end 
  2343.  
  2344. -- Reset the acheivement count for mission start 
  2345. function dlc2_m03_helper_achievement_reset(achievement_table) 
  2346. 	dlc_achievement_counter_set(achievement_table.slot_idx, 0) 
  2347. 	achievement_table.current_count = 0 
  2348. end 
  2349.  
  2350. -- Read the stored achievement counter from the previous checkpoint 
  2351. function dlc2_m03_helper_achievement_read_checkpoint(achievement_table) 
  2352. 	achievement_table.current_count = dlc_achievement_counter_get(achievement_table.slot_idx) 
  2353. end 
  2354.  
  2355. -- Store the current achievement counter for when a checkpoint is reached 
  2356. function dlc2_m03_helper_achievement_write_checkpoint(achievement_table) 
  2357. 	dlc_achievement_counter_set(achievement_table.slot_idx, achievement_table.current_count) 
  2358. end 
  2359.  
  2360. -- Increment an acheivement counter 
  2361. function dlc2_m03_helper_achievement_increment(achievement_table) 
  2362. 	-- Check if the target goal has already been reached 
  2363. 	if (achievement_table.current_count >= achievement_table.target_goal) then 
  2364. 		return 
  2365. 	end 
  2366. 	 
  2367. 	-- Increment the counter 
  2368. 	achievement_table.current_count = achievement_table.current_count + 1 
  2369.  
  2370. 	-- Show the progress HUD 
  2371. 	hud_achievement_show_progress(achievement_table.name, achievement_table.current_count, achievement_table.target_goal) 
  2372. end 
  2373.  
  2374. -------------------------------------------------------------------------------------------------- 
  2375. 								--[[**********************]]-- 
  2376. 								--[[                      ]]-- 
  2377. 								--[[  Callback functions  ]]-- 
  2378. 								--[[                      ]]-- 
  2379. 								--[[**********************]]-- 
  2380. 								 
  2381. function dlc2_m03_actress_died_cb() 
  2382. 	mission_end_failure("dlc2_m03", "DLC2_M03_FAIL_AIRCRAFT_DESTROYED") 
  2383. end 
  2384.  
  2385. function dlc2_m03_actress_abandoned_cb() 
  2386. 	mission_end_failure("dlc2_m03", "DLC2_M03_FAIL_AIRCRAFT_DESTROYED") 
  2387. end 
  2388.  
  2389. function dlc2_m03_alien_aircraft_destroyed(vehicle_name) 
  2390. 	on_vehicle_destroyed("", vehicle_name) 
  2391. 	on_vehicle_enter_water("", vehicle_name) 
  2392. 	radio_unblock(vehicle_name) 
  2393. 	mission_end_failure("dlc2_m03", "DLC2_M03_FAIL_AIRCRAFT_DESTROYED") 
  2394. end 
  2395.  
  2396. function dlc2_m03_shield_destroyed_cb(mover_name, attacker_name) 
  2397. 	DLC2_M03_global.num_shields_destroyed = DLC2_M03_global.num_shields_destroyed + 1 
  2398. 	marker_remove(mover_name) 
  2399. 	mesh_mover_hide(mover_name) 
  2400. 	on_mover_destroyed("", mover_name) 
  2401. end 
  2402.  
  2403. function dlc2_m03_heli_destroyed_cb(vehicle_name) 
  2404. 	on_vehicle_destroyed("", vehicle_name) 
  2405. 	for i, convo in pairs(DLC2_M03_convo_tables.dir_heli) do 
  2406. 		if not convo.played then 
  2407. 			dlc2_m03_convo_start(convo) 
  2408. 			break 
  2409. 		end 
  2410. 	end 
  2411. end 
  2412.  
  2413. function dlc2_m03_on_near_crash_cb(distance) 
  2414. 	if (distance*DLC2_M03_FEET_PER_METER) >= DLC2_M03_NEAR_CRASH_LENGTH then 
  2415. 		dlc2_m03_helper_achievement_increment(DLC2_M03_acheivements.stunts) 
  2416. 		dlc2_m03_convo_start(DLC2_M03_convo.stunt_reaction_01) 
  2417. 		DLC2_M03_global.near_crash_completed = true 
  2418. 	end 
  2419. end 
  2420.  
  2421. -- Callback for when an achievement vehicle dies 
  2422. function dlc2_m03_ach_veh_destroyed_cb(vehicle, attacker) 
  2423. 	on_vehicle_destroyed("", vehicle) 
  2424. 	 
  2425. 	dlc2_m03_helper_achievement_increment(DLC2_M03_acheivements.alien_ships) 
  2426. end 
  2427.  
  2428. -------------------------------------------------------------------------------------------------- 
  2429. 								--[[**********************]]-- 
  2430. 								--[[                      ]]-- 
  2431. 								--[[   Thread functions   ]]-- 
  2432. 								--[[                      ]]-- 
  2433. 								--[[**********************]]-- 
  2434.  
  2435. function dlc2_m03_virus_transfer_thread() 
  2436. 	local current_virus_region = DLC2_M03_global.current_transmitter_sequence.virus_region 
  2437. 	local in_upload_region = false 
  2438. 	local initial_check = true 
  2439. 	 
  2440. 	while true do 
  2441. 		if object_is_in_trigger(current_virus_region.name, DLC2_M03_current_vehicle_name) then 
  2442. 			if not in_upload_region or initial_check then 
  2443. 				-- Update UI 
  2444. 				marker_remove(current_virus_region.name) 
  2445. 				objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_UPLOAD_VIRUS", "", "", SYNC_ALL, OI_ASSET_INVALID ) 
  2446. 				hud_bar_on(DLC2_M03_GSI_INFECT_INDEX, "Radioactivity", "", DLC2_M03_global.current_transmitter_sequence.duration)		 
  2447. 				in_upload_region = true 
  2448. 			end 
  2449. 		 
  2450. 			DLC2_M03_global.current_virus_progress = DLC2_M03_global.current_virus_progress + 1 
  2451. 			hud_bar_set_value(DLC2_M03_GSI_INFECT_INDEX, DLC2_M03_global.current_virus_progress) 
  2452. 		else 
  2453. 			if in_upload_region or initial_check then 
  2454. 				objective_text( DLC2_M03_GSI_OBJECTIVE_INDEX, "DLC2_M03_GET_IN_RANGE", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  2455. 				hud_bar_off(DLC2_M03_GSI_INFECT_INDEX) 
  2456. 				marker_add_trigger(current_virus_region.name, MINIMAP_ICON_LOCATION, nil, OI_ASSET_LOCATION) 
  2457. 				in_upload_region = false 
  2458. 			end 
  2459. 		end 
  2460. 		initial_check = false 
  2461. 		delay(1) 
  2462. 	end 
  2463. end 
  2464.  
  2465. function dlc2_m03_virus_air_wave_spawn_thread() 
  2466. 	local transmitter_info = DLC2_M03_global.current_transmitter_sequence 
  2467. 	local wave_number = 1 
  2468. 	while transmitter_info.additional_waves.air[wave_number] ~= nil do 
  2469. 	 
  2470. 		local percent_complete = DLC2_M03_global.current_virus_progress / transmitter_info.duration 
  2471. 		if (percent_complete >= (transmitter_info.additional_waves.air[wave_number]/100)) then 
  2472.  
  2473. 			local wave_group = transmitter_info.groups.air[wave_number] 
  2474. 			 
  2475. 			group_create_hidden(wave_group.name, true) 
  2476.  
  2477. 			for i, pilot in pairs(wave_group.pilots) do 
  2478. 				local vehicle = wave_group.vehicles[i] 
  2479. 				local is_hostile = wave_group.is_hostile[i] 
  2480. 				local spawn_navpoint 
  2481. 				local spawn_point_invalid = true 
  2482. 				 
  2483. 				-- Now we need to find a valid navpoint.  To be valid there must be no other npcs within range of it 
  2484. 				while spawn_point_invalid do 
  2485. 					 
  2486. 					spawn_navpoint = get_random_table_entry(transmitter_info.wave_spawn_navs.air) 
  2487. 					 
  2488. 					-- Loop over all of the reinforcement npcs again 
  2489. 					for j, test_member in pairs(wave_group.pilots) do 
  2490. 						-- If we find ourself, the spawn point is valid 
  2491. 						if i == j then 
  2492. 							spawn_point_invalid = false 
  2493. 							break 
  2494. 						end 
  2495. 					 
  2496. 						-- See if anyone else is close to this navpoint 
  2497. 						local dist = get_dist(test_member, spawn_navpoint, false, true) 
  2498. 						if dist < 15 then 
  2499. 							break 
  2500. 						end 
  2501. 						 
  2502. 						-- Make sure the spawn isn't close to the player 
  2503. 						dist = get_dist(test_member, LOCAL_PLAYER, false, true) 
  2504. 						if dist < 15 then 
  2505. 							break 
  2506. 						end 
  2507. 					end 
  2508. 					thread_yield() 
  2509. 				end 
  2510. 				 
  2511. 				teleport_vehicle_to_object(vehicle, spawn_navpoint) 
  2512. 				vehicle_enter_teleport(pilot, vehicle, 0, true, true) 
  2513. 				vehicle_suppress_npc_exit(vehicle, true) 
  2514. 				vehicle_chase(vehicle, CLOSEST_PLAYER, false) 
  2515. 				if is_hostile then 
  2516. 					set_behavior_set(pilot, "Default STAG") 
  2517. 					ai_add_enemy_target(pilot, CLOSEST_PLAYER, ATTACK_NOW_NEVER_LOSE, true) 
  2518. 					on_vehicle_destroyed("dlc2_m03_ach_veh_destroyed_cb", vehicle) 
  2519. 				else 
  2520. 					on_vehicle_destroyed("dlc2_m03_heli_destroyed_cb", vehicle) 
  2521. 				end 
  2522. 				character_show(pilot) 
  2523. 				vehicle_show(vehicle) 
  2524. 			end 
  2525. 				 
  2526. 			wave_number = wave_number + 1 
  2527. 		end 
  2528. 		thread_yield() 
  2529. 	end 
  2530. end 
  2531.  
  2532. function dlc2_m03_virus_ground_wave_spawn_thread() 
  2533. 	local transmitter_info = DLC2_M03_global.current_transmitter_sequence 
  2534. 	local wave_number = 1 
  2535. 	while transmitter_info.additional_waves.ground[wave_number] ~= nil do 
  2536. 	 
  2537. 		local percent_complete = DLC2_M03_global.current_virus_progress / transmitter_info.duration 
  2538. 		if (percent_complete >= (transmitter_info.additional_waves.ground[wave_number]/100)) then 
  2539.  
  2540. 			local wave_group = transmitter_info.groups.ground[wave_number] 
  2541. 			 
  2542. 			group_create_hidden(wave_group.name, true) 
  2543.  
  2544. 			for i, member in pairs(wave_group.pilots) do 
  2545. 				local vehicle = wave_group.vehicles[i] 
  2546. 				local is_hostile = wave_group.is_hostile[i] 
  2547. 				local spawn_navpoint 
  2548. 				local spawn_point_invalid = true 
  2549. 				 
  2550. 				-- Now we need to find a valid navpoint.  To be valid there must be no other npcs within range of it 
  2551. 				while spawn_point_invalid do 
  2552. 					 
  2553. 					spawn_navpoint = get_random_table_entry(transmitter_info.wave_spawn_navs.ground) 
  2554. 					 
  2555. 					-- Loop over all of the reinforcement npcs again 
  2556. 					for j, test_member in pairs(wave_group.pilots) do 
  2557. 						-- If we find ourself, the spawn point is valid 
  2558. 						if i == j then 
  2559. 							spawn_point_invalid = false 
  2560. 							break 
  2561. 						end 
  2562. 					 
  2563. 						-- See if anyone else is close to this navpoint 
  2564. 						local dist = get_dist(test_member, spawn_navpoint, false, true) 
  2565. 						if dist < 15 then 
  2566. 							break 
  2567. 						end 
  2568. 						 
  2569. 						-- Make sure the spawn isn't close to the player 
  2570. 						dist = get_dist(test_member, LOCAL_PLAYER, false, true) 
  2571. 						if dist < 15 then 
  2572. 							break 
  2573. 						end 
  2574. 					end 
  2575. 					thread_yield() 
  2576. 				end 
  2577. 				 
  2578. 				teleport_vehicle_to_object(vehicle, spawn_navpoint) 
  2579. 				vehicle_enter_teleport(member, vehicle, 0, true, true) 
  2580. 				vehicle_suppress_npc_exit(vehicle, true) 
  2581. 				vehicle_chase(vehicle, CLOSEST_PLAYER, false) 
  2582. 				if is_hostile then 
  2583. 					set_behavior_set(member, "Default STAG") 
  2584. 					ai_add_enemy_target(member, CLOSEST_PLAYER, ATTACK_NOW_NEVER_LOSE, true) 
  2585. 				end 
  2586. 				character_show(member) 
  2587. 				vehicle_show(vehicle) 
  2588. 			end 
  2589. 				 
  2590. 			wave_number = wave_number + 1 
  2591. 		end 
  2592. 		thread_yield() 
  2593. 	end 
  2594. end 
  2595.  
  2596. -- Thread that handles the spawning of enemies as the player destroys transmitter shields 
  2597. function dlc2_m03_shield_destroyed_spawn_thread() 
  2598. 	local transmitter_info = DLC2_M03_global.current_transmitter_sequence 
  2599. 	local wave_number = 1 
  2600. 	while transmitter_info.additional_waves.shield[wave_number] ~= nil do 
  2601.  
  2602. 		-- If the player has killed enough shields to trigger the spawning of a wave 
  2603. 		if DLC2_M03_global.num_shields_destroyed >= transmitter_info.additional_waves.shield[wave_number] then 
  2604.  
  2605. 			local wave_group = transmitter_info.groups.shield[wave_number] 
  2606. 			 
  2607. 			group_create_hidden(wave_group.name, true) 
  2608.  
  2609. 			for i, member in pairs(wave_group.members) do 
  2610. 				local vehicle = wave_group.vehicles[i] 
  2611. 				local is_hostile = wave_group.is_hostile[i] 
  2612. 				local spawn_navpoint 
  2613. 				local spawn_point_invalid = true 
  2614. 				 
  2615. 				-- Now we need to find a valid navpoint.  To be valid there must be no other npcs within range of it 
  2616. 				while spawn_point_invalid do 
  2617. 					 
  2618. 					spawn_navpoint = get_random_table_entry(transmitter_info.wave_spawn_navs.shield) 
  2619. 					 
  2620. 					-- Loop over all of the reinforcement npcs again 
  2621. 					for j, test_member in pairs(wave_group.members) do 
  2622. 						-- If we find ourself, the spawn point is valid 
  2623. 						if i == j then 
  2624. 							spawn_point_invalid = false 
  2625. 							break 
  2626. 						end 
  2627. 					 
  2628. 						-- See if anyone else is close to this navpoint 
  2629. 						local dist = get_dist(test_member, spawn_navpoint, false, true) 
  2630. 						if dist < 15 then 
  2631. 							break 
  2632. 						end 
  2633. 						 
  2634. 						-- Make sure the spawn isn't close to the player 
  2635. 						dist = get_dist(test_member, LOCAL_PLAYER, false, true) 
  2636. 						if dist < 15 then 
  2637. 							break 
  2638. 						end 
  2639. 					end 
  2640. 					thread_yield() 
  2641. 				end 
  2642. 				 
  2643. 				teleport_vehicle_to_object(vehicle, spawn_navpoint) 
  2644. 				vehicle_enter_teleport(member, vehicle, 0, true, true) 
  2645. 				vehicle_suppress_npc_exit(vehicle, true) 
  2646. 				vehicle_chase(vehicle, CLOSEST_PLAYER, false) 
  2647. 				if is_hostile then 
  2648. 					set_behavior_set(member, "Default STAG") 
  2649. 					ai_add_enemy_target(member, CLOSEST_PLAYER, ATTACK_NOW_NEVER_LOSE, true) 
  2650. 				end 
  2651. 				character_show(member) 
  2652. 				vehicle_show(vehicle) 
  2653. 			end 
  2654. 				 
  2655. 			wave_number = wave_number + 1 
  2656. 		end 
  2657. 		thread_yield() 
  2658. 	end 
  2659. end 
  2660.  
  2661.  
  2662. -- Thread that handles the spawning of enemies during the escape sequence. 
  2663. function dlc2_m03_escape_npc_spawn_thread() 
  2664. 	while true do 
  2665. 		for i, spawn_group in pairs(DLC2_M03_escape_groups) do 
  2666. 			if not spawn_group.spawned then 
  2667. 				local dist, closest_player = get_dist_closest_player_to_object(spawn_group.navpoint) 
  2668. 				if dist < 500 then 
  2669. 			 
  2670. 					-- Create npcs to attack the player as they try to escape 
  2671. 					group_create(spawn_group.name, true) 
  2672. 					for i, npc in pairs(spawn_group.members) do 
  2673. 						vehicle_enter_teleport(npc, spawn_group.vehicles[i], 0, true, true) 
  2674. 						vehicle_chase(spawn_group.vehicles[i], CLOSEST_PLAYER, false) 
  2675. 						ai_add_enemy_target(npc, CLOSEST_PLAYER, ATTACK_NOW_NEVER_LOSE, true) 
  2676. 						--marker_add(spawn_group.vehicles[i], MINIMAP_ICON_KILL, OI_ASSET_KILL, OI_FLAGS_DEFAULT, SYNC_ALL) 
  2677. 					end 
  2678. 					spawn_group.spawned = true 
  2679. 				end 
  2680. 			end 
  2681. 		end 
  2682. 		thread_yield() 
  2683. 	end 
  2684. end 
  2685.