./m10.lua

  1. --[[ 
  2. 	m10.lua 
  3. 	SR3 Mission Script 
  4. 	DATE: 9-14-10 
  5. 	AUTHOR:	John Karczewski 
  6. ]]-- 
  7.  
  8.  
  9. -- Debug flags -- 
  10.  
  11. -- Tweakable Parameters -- 
  12. 	M10_tweak_parameters = { 
  13. 		roof_vtol_shoot_delay = { 20.0, 35.0 }, -- (min, max) in seconds 
  14. 		club_fake_notoriety_level = 4, 
  15. 		goto_hq_notoriety_level = 4, 
  16. 		 
  17. 		drive_01_dist_from_hq = 1600, 
  18. 		shaundi_update_dist_from_hq = 900, 
  19. 		-- drive_02_dist_from_hq = 1200, 
  20. 		 
  21. 		rooftop_soldier_spread_mult = 0.0001, 
  22. 	} 
  23.  
  24. 	M10_timed_lines = { 
  25. 		stag = { 
  26. 			situation = "m10_attack", 
  27. 			delay = 10.0, 
  28. 			callback = "m10_stag_attack_cb", 
  29. 			timer = INVALID_THREAD_HANDLE 
  30. 		} 
  31. 	} 
  32.  
  33. 	 
  34. -- Dialog lines -- 
  35. 	M10_dialog_lines = { 
  36. 		mission_start = "M10_Mission_Start", 
  37. 		laser_guns = "M10_Call_Out_Laser_Guns", 
  38. 		get_to_roof = "M10_Get_To_Roof", 
  39. 		rooftop_start = "M10_Rooftop_Start", 
  40. 		first_dropoff = "M10_First_Dropoff_On_Roof_01", 
  41. 		second_dropoff = "M10_Second_Dropoff_On_Roof_01", 
  42. 		third_dropoff = "M10_Third_Dropoff_On_Roof_01", 
  43. 		first_wave = "M10_First_VTOL_Wave_01", 
  44. 		second_wave = "M10_Second_VTOL_Wave_01", 
  45. 		across_street = "M10_Dropoff_Across_Street_01", 
  46. 		stag_bullhorn_01 = "M10_STAG_Ground_Bullhorn_01", 
  47. 		stag_bullhorn_02 = "M10_STAG_Ground_Bullhorn_02", 
  48. 		stag_bullhorn_03 = "M10_STAG_Ground_Bullhorn_03", 
  49. 		stag_bullhorn_04 = "M10_STAG_Ground_Bullhorn_04", 
  50. 		stag_bullhorn_vtol_01 = "M10_STAG_VTOL_Bullhorn_01", 
  51. 		stag_bullhorn_vtol_02 = "M10_STAG_VTOL_Bullhorn_02", 
  52. 		ammo_callout = "M10_Call_Out_Ammo_On_Roof", 
  53. 		oleg_downed = "M10_Oleg_Down", 
  54. 		oleg_help = "M10_Help_Oleg_Up", 
  55. 		oleg_revived = "M10_Oleg_Up", 
  56. 		oleg_roar = "M10_Oleg_Leap", 
  57. 		oleg_vtol = "M10_Oleg_VTOL", 
  58. 		oleg_jump_player = "M10_STAG_VTOL_Oleg_Jumps_On", 
  59. 		oleg_riding_vtol = "M10_See_Oleg_On_VTOL", 
  60. 		elevator_fixed = "M10_Elevator_Fixed", 
  61. 		off_the_roof = "M10_Leaving", 
  62. 		exit_building = "M10_Exiting_Building", 
  63. 		roadblocks_01 = "M10_Roadblocks_01",--** 
  64. 		roadblocks_02 = "M10_Roadblocks_02",--** 
  65. 		radio_drive = "M10_End_Radio_Newscast", 
  66. 	} 
  67. 	 
  68. -- Conversations -- 
  69. 	M10_convo = { 
  70. 		stag_entrance = { 
  71. 			name = "M10_Stag_Entrance_01", 
  72. 			handle = INVALID_CONVERSATION_HANDLE, 
  73. 			load_direct = false, 
  74. 		}, 
  75. 		 
  76. 		building_surrounded = { 
  77. 			name = "M10_Building_Surrounded", 
  78. 			handle = INVALID_CONVERSATION_HANDLE, 
  79. 			load_direct = false, 
  80. 		}, 
  81. 		 
  82. 		elevators = { 
  83. 			name = "M10_Power_Cut_To_Elevator", 
  84. 			handle = INVALID_CONVERSATION_HANDLE, 
  85. 			load_direct = true, 
  86. 		}, 
  87. 		 
  88. 		viola_check_in = { 
  89. 			name = "M10_Checkin_In_On_Viola", 
  90. 			handle = INVALID_CONVERSATION_HANDLE, 
  91. 			load_direct = false, 
  92. 		}, 
  93. 		 
  94. 		oleg_check_in = { 
  95. 			name = "M10_Checkin_In_On_Oleg", 
  96. 			handle = INVALID_CONVERSATION_HANDLE, 
  97. 			load_direct = false, 
  98. 		}, 
  99. 		 
  100. 		oleg_walking = { 
  101. 			name = "M10_Oleg_Walking_To_Spot", 
  102. 			handle = INVALID_CONVERSATION_HANDLE, 
  103. 			load_direct = false, 
  104. 		}, 
  105. 		 
  106. 		to_hq = { 
  107. 			name = "M10_Saints_HQ", 
  108. 			handle = INVALID_CONVERSATION_HANDLE, 
  109. 			load_direct = false, 
  110. 		}, 
  111. 		 
  112. 		drive_01 = { 
  113. 			name = "M10_Drive_01", 
  114. 			handle = INVALID_CONVERSATION_HANDLE, 
  115. 			load_direct = false, 
  116. 		}, 
  117. 		 
  118. 		oleg_flyby = { --** 
  119. 			name = "M10_Oleg_Flies_By_On_VTOL", 
  120. 			handle = INVALID_CONVERSATION_HANDLE, 
  121. 			load_direct = false, 
  122. 		}, 
  123. 		 
  124. 		city_update = { 
  125. 			name = "M10_City_Update_Call_01", 
  126. 			handle = INVALID_CONVERSATION_HANDLE, 
  127. 			load_direct = false, 
  128. 		}, 
  129. 	} 
  130.  
  131. -- Checkpoints -- 
  132. 	M10_checkpoints = { 
  133. 		start = { 
  134. 			name = MISSION_START_CHECKPOINT,			-- defined in ug_lib.lua 
  135. 			player_starts = { "nav_player_start_chk_01_ 001", "nav_player_start_chk_01_ 002" }, 
  136. 		}, 
  137. 		survive = { 
  138. 			name = "m10_checkpoint_survive", 
  139. 			player_starts = { "nav_player_start_chk_02_ 001", "nav_player_start_chk_02_ 002" }, 
  140. 		}, 
  141. 		oleg_to_the_rescue = { 
  142. 			name = "m10_checkpoint_oleg_to_the_rescue", 
  143. 			player_starts = { "nav_player_start_chk_02_ 001", "nav_player_start_chk_02_ 002" }, 
  144. 		}, 
  145. 		escape_to_hq = { 
  146. 			name = "m10_checkpoint_escape_to_hq", 
  147. 			player_starts = { "nav_player_start_chk_04_ 001", "nav_player_start_chk_04_ 002" }, 
  148. 		}			 
  149. 	} 
  150. 	 
  151. -- Groups -- 
  152. 	M10_groups = { 
  153. 		oleg = { 
  154. 			name = "Group_oleg 001", 
  155. 			members = { "char_oleg 001" }, 
  156. 			oleg = "char_oleg 001" 
  157. 		}, 
  158. 		 
  159. 		viola = { 
  160. 			name = "Group_viola 001", 
  161. 			members = { "char_viola 001" }, 
  162. 			viola = "char_viola 001" 
  163. 		}, 
  164. 		 
  165. 		strippers = { 
  166. 			name = "Group_club_ambient_peds 001", 
  167. 			members = {	"char_npc_stripper 001", "char_npc_stripper 002", "char_npc_stripper 003", 
  168. 							"char_npc_stripper 004", 
  169. 			}, 
  170. 			anims = { "Stand_Strip", "PoleDancer_C", "Stand_Strip", "PoleDancer_B" } 
  171. 		}, 
  172. 		 
  173. 		stag_ambush = { 
  174. 			name = "Group_stag_ambush 001", 
  175. 			squads = { 
  176. 				-- back_hall = { 
  177. 				-- 	chars = { "char_stag_back_hall 001", "char_stag_back_hall 002", "char_stag_back_hall 003" }, 
  178. 				-- 	destination = "nav_stag_back_hall_dest 001", 
  179. 				-- }, 
  180. 				front_door = { 
  181. 					chars = { "char_stag_front_door 001", "char_stag_front_door 002", }, 
  182. 					destination = "nav_stag_front_door_dest 001", 
  183. 				}, 
  184. 				main_stage_01 = { 
  185. 					chars = { "char_stag_main_stage 001", "char_stag_main_stage 002" }, 
  186. 					destination = "nav_stag_main_stage_dest 001", 
  187. 				}, 
  188. 				main_stage_02 = { 
  189. 					chars = { "char_stag_main_stage 003", "char_stag_main_stage 004" }, 
  190. 					destination = "nav_stag_main_stage_dest 002", 
  191. 				}, 
  192. 				main_stage_03 = { 
  193. 					chars = { "char_stag_main_stage 005", "char_stag_main_stage 006" }, 
  194. 					destination = "nav_stag_main_stage_dest 003", 
  195. 				}, 
  196. 				-- side_stage = { 
  197. 				-- 	chars = { "char_stag_side_stage 001", "char_stag_side_stage 002" }, 
  198. 				-- 	destination = "nav_stag_side_stage_dest 001", 
  199. 				-- }, 
  200. 			}, 
  201. 			 
  202. 			flashbang_throwers = { 
  203. 				chars = { "char_stag_main_stage 005", "char_stag_main_stage 003" }, 
  204. 				targets = { "nav_stag_flashbang 001", "nav_stag_flashbang 002" }, 
  205. 			}, 
  206. 		}, 
  207. 		 
  208. 		police_containment = { 
  209. 			name = "Group_police_containment 001", 
  210. 			vehicles = { "veh_containment_cop_car 001", "veh_containment_cop_car 002", "veh_containment_cop_car 003", 
  211. 							"veh_containment_cop_car 004", "veh_containment_cop_car 005", "veh_containment_cop_car 006", 
  212. 							"veh_containment_cop_car 007", "veh_containment_cop_car 008", "veh_containment_cop_car 009" }, 
  213. 		}, 
  214. 		 
  215. 		emergency_responders = { 
  216. 			name = "Group_emergency_responders 001", 
  217. 			vehicles = {  
  218. 				{ 
  219. 					vehicle = "veh_emt_cop_car 001", 
  220. 					chars = { }, 
  221. 				}, 
  222. 			}, 
  223. 		}, 
  224. 		 
  225. 		stag_ground_troops = { 
  226. 			name = "Group_stag_ground_troops 001", 
  227. 			tanks = { 
  228. 				{ 
  229. 					tank = "veh_stag_tank 001", 
  230. 					chars = { "char_stag_tank_driver 001" },-- "char_stag_tank_gunner 001" }, 
  231. 					chase_path = "path_stag_tank_chase 001", 
  232. 					thread_id = -1, 
  233. 				}, 
  234. 				{ 
  235. 					tank = "veh_stag_tank 002", 
  236. 					chars = { "char_stag_tank_driver 002" },--, "char_stag_tank_gunner 002" }, 
  237. 					chase_path = "path_stag_tank_chase 001", 
  238. 					thread_id = -1, 
  239. 				}, 
  240. 				{ 
  241. 					tank = "veh_stag_tank 003", 
  242. 					chars = { "char_stag_tank_driver 003" },--, "char_stag_tank_gunner 003" }, 
  243. 					chase_path = "path_stag_tank_chase 002", 
  244. 					thread_id = -1, 
  245. 				}, 
  246. 				{ 
  247. 					tank = "veh_stag_tank 004", 
  248. 					chars = { "char_stag_tank_driver 004"},--, "char_stag_tank_gunner 004" }, 
  249. 					chase_path = "path_stag_tank_chase 002", 
  250. 					thread_id = -1, 
  251. 				}, 
  252. 			}, 
  253. 			troops = { "char_stag_trooper 009", "char_stag_trooper 010", "char_stag_trooper 011", "char_stag_trooper 012", 
  254. 						"char_stag_trooper 013", "char_stag_trooper 014", "char_stag_trooper 015" }, 
  255. 		}, 
  256. 		 
  257. 		stag_ext_aftermath = { 
  258. 			name = 		"group_stag_ext_aftermath 001", 
  259. 			vehicle = 	{ "veh_stag_aftermath 001", "veh_stag_aftermath 002", "veh_stag_aftermath 003", "veh_stag_aftermath 004", 
  260. 							"veh_stag_aftermath 005" }, 
  261. 			gunners = 	{ "char_gunner_aftermath 001", "char_gunner_aftermath 002" }, 
  262. 			chars = 		{ "char_stag_aftermath 001", "char_stag_aftermath 002", "char_stag_aftermath 003", "char_stag_aftermath 004", 
  263. 							"char_stag_aftermath 005" }, 
  264. 		}, 
  265. 		 
  266. 		vtol_cont_spawn_02 = { 
  267. 			name = "Group_vtol_cont_spawn 002", 
  268. 			vtol = "veh_vtol_cont_spawn_02_ 001", 
  269. 			chars = { "char_vtol_cont_spawn_02_ 001", "char_vtol_cont_spawn_02_ 002", "char_vtol_cont_spawn_02_ 003",  
  270. 						"char_vtol_cont_spawn_02_ 004", "char_vtol_cont_spawn_02_ 005" }, 
  271. 			path = "path_vtol_cont_spawn_02_ 001", 
  272. 		}, 
  273. 		 
  274. 		vtol_intro_flyby_01 = { 
  275. 			name = "Group_vtol_intro 001", 
  276. 			vtols = { 
  277. 				{ 
  278. 					vehicle = "veh_vtol_intro_01_ 001", 
  279. 					chars = { "char_vtol_intro_pilot_01_ 001" }, 
  280. 					path = "path_vtol_intro_01_ 001", 
  281. 					speed = 120.0, 
  282. 					invulnerable = false, 
  283. 					thread_id = -1, 
  284. 				}, 
  285. 				{ 
  286. 					vehicle = "veh_vtol_intro_01_ 002", 
  287. 					chars = { "char_vtol_intro_pilot_01_ 002" }, 
  288. 					path = "path_vtol_intro_01_ 002", 
  289. 					speed = 120.0, 
  290. 					invulnerable = false, 
  291. 					thread_id = -1, 
  292. 				}, 
  293. 				{ 
  294. 					vehicle = "veh_vtol_intro_01_ 003", 
  295. 					chars = { "char_vtol_intro_pilot_01_ 003" }, 
  296. 					path = "path_vtol_intro_01_ 003", 
  297. 					speed = 120.0, 
  298. 					invulnerable = false, 
  299. 					thread_id = -1, 
  300. 				}, 
  301. 				{ 
  302. 					vehicle = "veh_vtol_intro_01_ 004", 
  303. 					chars = { "char_vtol_intro_pilot_01_ 004" }, 
  304. 					path = "path_vtol_intro_01_ 004", 
  305. 					speed = 120.0, 
  306. 					invulnerable = false, 
  307. 					thread_id = -1, 
  308. 				}, 
  309. 			}, 
  310. 		}, 
  311. 		 
  312. 		vtol_transport_flyby_01 = { 
  313. 			name = "Group_vtol_trans_flyby 001", 
  314. 			vtols = { 
  315. 				{ 
  316. 					vehicle = "veh_trans_flyby_01_ 001", 
  317. 					chars = { "char_trans_flyby_pilot_01_ 001" }, 
  318. 					path = "path_trans_flyby_01_ 001", 
  319. 					speed = 100.0, 
  320. 					invulnerable = false, 
  321. 					thread_id = -1, 
  322. 				}, 
  323. 				{ 
  324. 					vehicle = "veh_trans_flyby_01_ 002", 
  325. 					chars = { "char_trans_flyby_pilot_01_ 002" }, 
  326. 					path = "path_trans_flyby_01_ 002", 
  327. 					speed = 100.0, 
  328. 					invulnerable = false, 
  329. 					thread_id = -1, 
  330. 				}, 
  331. 				{ 
  332. 					vehicle = "veh_trans_flyby_01_ 003", 
  333. 					chars = { "char_trans_flyby_pilot_01_ 003" }, 
  334. 					path = "path_trans_flyby_01_ 003", 
  335. 					speed = 100.0, 
  336. 					invulnerable = false, 
  337. 					thread_id = -1, 
  338. 				}, 
  339. 				{ 
  340. 					vehicle = "veh_trans_flyby_01_ 004", 
  341. 					chars = { "char_trans_flyby_pilot_01_ 004" }, 
  342. 					path = "path_trans_flyby_01_ 004", 
  343. 					speed = 100.0, 
  344. 					invulnerable = false, 
  345. 					thread_id = -1, 
  346. 				}, 
  347. 			}, 
  348. 		}, 
  349. 		 
  350. 		--[[ 
  351. 		attack_vtols_01 = { 
  352. 			name = "Group_attack_vtol 001", 
  353. 			vtols = {  
  354. 				{ 
  355. 					vtol = "veh_attack_vtol_01_ 001", 
  356. 					chars = { "char_attack_vtol_pilot_01_ 001" }, 
  357. 					destination = "nav_attack_vtol_dest_01_ 001", 
  358. 					delay = 1.0, 
  359. 					speed = 10.0, 
  360. 					thread_id = -1, 
  361. 				}, 
  362. 			}, 
  363. 		}, 
  364. 		--]] 
  365. 		 
  366. 		attack_vtols_02 = { 
  367. 			name = "Group_attack_vtol 002", 
  368. 			vtols = { 
  369. 				{ 
  370. 					vtol = "veh_attack_vtol_02_ 001", 
  371. 					chars = { "char_attack_vtol_pilot_02_ 001" }, 
  372. 					destination = "path_attack_vtol_02_ 001", 
  373. 					delay = 0.0, 
  374. 					speed = 120.0, 
  375. 					thread_id = -1, 
  376. 				}, 
  377. 				--[[ 
  378. 				{ 
  379. 					vtol = "veh_attack_vtol_02_ 002", 
  380. 					chars = { "char_attack_vtol_pilot_02_ 002" }, 
  381. 					destination = "path_attack_vtol_02_ 002", 
  382. 					delay = 0.0, 
  383. 					speed = 100.0, 
  384. 					thread_id = -1, 
  385. 				}, 
  386. 				--]] 
  387. 			}, 
  388. 		}, 
  389.  
  390. 		stag_transport_01a = { 
  391. 			name = "Group_stag_transport 001a",  
  392. 			vtol = "veh_stag_transport_01a_ 001", 
  393. 			pilots = { "char_stag_trans_pilot_01a_ 001" }, 
  394. 			drop_offs = { 
  395. 				{ 
  396. 					soldiers = { "char_stag_trans_soldier_01a_ 001", "char_stag_trans_soldier_01a_ 002", "char_stag_trans_soldier_01a_ 003", 
  397. 									"char_stag_trans_soldier_01a_ 004" }, 
  398. 					navs = { "nav_stag_trans_soldier_01a_ 001", "nav_stag_trans_soldier_01a_ 002", "nav_stag_trans_soldier_01a_ 003", 
  399. 									"nav_stag_trans_soldier_01a_ 004" }, 
  400. 					path = "path_stag_transport_01a_ 001",							 
  401. 				}, 
  402. 			}, 
  403. 			heli_dropoff_nav = "nav_trans_dropoff_01a", 
  404. 			escape_path = "path_stag_transport_01a_ 002", 
  405. 			rooftop_trigger = "tgr_rooftop_area 001a", 
  406. 			thread_id = -1, 
  407. 			marker_added = false, 
  408. 			marker_removed = false, 
  409. 			snipers = false, 
  410. 			oleg_line = M10_dialog_lines.first_dropoff, 
  411. 		}, 
  412. 		 
  413. 		stag_transport_01a_vtol = { 
  414. 			name = "Group_stag_transport_vtol 001a", 
  415. 			vtol = "veh_stag_transport_01a_ 001", 
  416. 		}, 
  417. 		 
  418. 		stag_transport_01 = { 
  419. 			name = "Group_stag_transport 001",  
  420. 			vtol = "veh_stag_transport_01_ 001", 
  421. 			pilots = { "char_stag_trans_pilot_01_ 001" }, 
  422. 			drop_offs = { 
  423. 				{ 
  424. 					soldiers = { "char_stag_trans_soldier_01_ 001", "char_stag_trans_soldier_01_ 002", "char_stag_trans_soldier_01_ 003", 
  425. 									"char_stag_trans_soldier_01_ 004" }, 
  426. 					navs = { "nav_stag_trans_soldier_01_ 001", "nav_stag_trans_soldier_01_ 002", "nav_stag_trans_soldier_01_ 003", 
  427. 									"nav_stag_trans_soldier_01_ 004" }, 
  428. 					path = "path_stag_transport_01_ 001", 
  429. 					dialog = { speaker = "Interrogation", line = "M10_STAG_Ground_Bullhorn_01" },					 
  430. 				}, 
  431. 			}, 
  432. 			heli_dropoff_nav = "nav_trans_dropoff_01", 
  433. 			escape_path = "", 
  434. 			rooftop_trigger = "tgr_rooftop_area 001", 
  435. 			thread_id = -1, 
  436. 			marker_added = false, 
  437. 			marker_removed = false, 
  438. 			bullhorn = "", 
  439. 			snipers = false, 
  440. 			oleg_line = "", 
  441. 		}, 
  442.  
  443. 		stag_transport_01_vtol = { 
  444. 			name = "Group_stag_transport_vtol 001", 
  445. 			vtol = "veh_stag_transport_01_ 001", 
  446. 		}, 
  447. 		 
  448. 		stag_transport_02 = { 
  449. 			name = "Group_stag_transport 002", 
  450. 			vtol = "veh_stag_transport_02_ 001", 
  451. 			pilots = { "char_stag_trans_pilot_02_ 001" }, 
  452. 			drop_offs = { 
  453. 				{ 
  454. 					soldiers = { "char_stag_trans_soldier_02_ 001", "char_stag_trans_soldier_02_ 002", "char_stag_trans_soldier_02_ 003", 
  455. 									"char_stag_trans_soldier_02_ 004" }, 
  456. 					navs = { "nav_stag_trans_soldier_02_ 001", "nav_stag_trans_soldier_02_ 002", "nav_stag_trans_soldier_02_ 003", 
  457. 									"nav_stag_trans_soldier_02_ 004" }, 
  458. 					path = "path_stag_transport_02_ 001", 
  459. 					dialog = { speaker = "Interrogation", line = "M10_STAG_Ground_Bullhorn_02" }, 
  460. 				}, 
  461. 			}, 
  462. 			heli_dropoff_nav = "nav_trans_dropoff_02", 
  463. 			escape_path = "", 
  464. 			rooftop_trigger = "tgr_rooftop_area 002", 
  465. 			thread_id = -1, 
  466. 			marker_added = false, 
  467. 			marker_removed = false, 
  468. 			snipers = false, 
  469. 			oleg_line = "", 
  470. 		}, 
  471. 		 
  472. 		stag_transport_02_vtol = { 
  473. 			name = "Group_stag_transport_vtol 002", 
  474. 			vtol = "veh_stag_transport_02_ 001", 
  475. 		}, 
  476. 		 
  477. 		stag_transport_02b = { 
  478. 			name = "Group_stag_transpot 002b", 
  479. 			vtol = "veh_stag_transport_02b_ 001", 
  480. 			pilots = { "char_stag_trans_pilot_02b_ 001" }, 
  481. 			drop_offs = { 
  482. 				{ 
  483. 					soldiers = { "char_stag_trans_soldier_02b_ 001", "char_stag_trans_soldier_02b_ 002", "char_stag_trans_soldier_02b_ 003", "char_stag_trans_soldier_02b_ 004" }, 
  484. 					navs = { "nav_stag_trans_soldier_02b_ 001", "nav_stag_trans_soldier_02b_ 002", "nav_stag_trans_soldier_02b_ 003", 
  485. 									"nav_stag_trans_soldier_02b_ 004" }, 
  486. 					path = "path_stag_transport_02b_ 001", 
  487. 					-- dialog = { speaker = LOCAL_PLAYER, line = "M10_Call_Out_Ammo_On_Roof" }, 
  488. 				}, 
  489. 			}, 
  490. 			heli_dropoff_nav = "nav_trans_dropoff_02b", 
  491. 			escape_path = "path_stag_transport_01a_ 002", 
  492. 			rooftop_trigger = "tgr_rooftop_area 002b", 
  493. 			thread_id = -1, 
  494. 			marker_added = false, 
  495. 			marker_removed = false, 
  496. 			snipers = false, 
  497. 			oleg_line = M10_dialog_lines.second_dropoff, 
  498. 		}, 
  499. 		 
  500. 		stag_transport_02b_vtol = { 
  501. 			name = "Group_stag_transport_vtol 002b", 
  502. 			vtol = "veh_stag_transport_02b_ 001", 
  503. 		}, 
  504. 		 
  505. 		stag_transport_03 = { 
  506. 			name = "Group_stag_transport 003", 
  507. 			vtol = "veh_stag_transport_03_ 001", 
  508. 			pilots = { "char_stag_trans_pilot_03_ 001" }, 
  509. 			drop_offs = { 
  510. 				{ 
  511. 					soldiers = { "char_stag_trans_soldier_03_ 001", "char_stag_trans_soldier_03_ 002", "char_stag_trans_soldier_03_ 003", 
  512. 									"char_stag_trans_soldier_03_ 004" }, 
  513. 					navs = { "nav_stag_trans_soldier_03_ 001", "nav_stag_trans_soldier_03_ 002", "nav_stag_trans_soldier_03_ 003", 
  514. 									"nav_stag_trans_soldier_03_ 004" }, 
  515. 					path = "path_stag_transport_03_ 001", 
  516. 					dialog = { speaker = "Interrogation", line = "M10_STAG_Ground_Bullhorn_03" }, 
  517. 				}, 
  518. 			}, 
  519. 			heli_dropoff_nav = "nav_trans_dropoff_03", 
  520. 			escape_path = "", 
  521. 			rooftop_trigger = "tgr_rooftop_area 003", 
  522. 			thread_id = -1, 
  523. 			marker_added = false, 
  524. 			marker_removed = false, 
  525. 			snipers = false, 
  526. 			oleg_line = "", 
  527. 		}, 
  528. 		 
  529. 		stag_transport_03_vtol = { 
  530. 			name = "Group_stag_transport_vtol 003", 
  531. 			vtol = "veh_stag_transport_03_ 001", 
  532. 		}, 
  533. 		 
  534. 		stag_transport_04 = { 
  535. 			name = "Group_stag_transport 004", 
  536. 			vtol = "veh_stag_transport_04_ 001", 
  537. 			pilots = { "char_stag_trans_pilot_04_ 001" }, 
  538. 			drop_offs = { 
  539. 				{ 
  540. 					soldiers = { "char_stag_trans_soldier_04_ 001", "char_stag_trans_soldier_04_ 002", "char_stag_trans_soldier_04_ 003", "char_stag_trans_soldier_04_ 004" }, 
  541. 					navs = { "nav_stag_trans_soldier_04_ 001", "nav_stag_trans_soldier_04_ 002", "nav_stag_trans_soldier_04_ 003", 
  542. 									"nav_stag_trans_soldier_04_ 004" }, 
  543. 					path = "path_stag_transport_04_ 001", 
  544. 					dialog = { speaker = "char_viola 001", line = "M10_Rooftop_02" }, 
  545. 				}, 
  546. 			}, 
  547. 			heli_dropoff_nav = "nav_trans_dropoff_04", 
  548. 			escape_path = "", 
  549. 			rooftop_trigger = "tgr_rooftop_area 004", 
  550. 			thread_id = -1, 
  551. 			marker_added = false, 
  552. 			marker_removed = false, 
  553. 			snipers = true, 
  554. 			oleg_line = "", 
  555. 		}, 
  556. 		 
  557. 		stag_transport_04_vtol = { 
  558. 			name = "Group_stag_transport_vtol 004", 
  559. 			vtol = "veh_stag_transport_04_ 001", 
  560. 		}, 
  561. 		 
  562. 		stag_transport_05 = { 
  563. 			name = "Group_stag_transport 005", 
  564. 			vtol = "veh_stag_transport_05_ 001", 
  565. 			pilots = { "char_stag_trans_pilot_05_ 001" }, 
  566. 			drop_offs = { 
  567. 				{ 
  568. 					soldiers = { "char_stag_trans_soldier_05_ 001", "char_stag_trans_soldier_05_ 002", "char_stag_trans_soldier_05_ 003", "char_stag_trans_soldier_05_ 004" }, 
  569. 					navs = { "nav_stag_trans_soldier_05_ 001", "nav_stag_trans_soldier_05_ 002", "nav_stag_trans_soldier_05_ 003", 
  570. 									"nav_stag_trans_soldier_05_ 004" }, 
  571. 					path = "path_stag_transport_05_ 001", 
  572. 					dialog = { speaker = "Interrogation", line = "M10_STAG_Ground_Bullhorn_04" }, 
  573. 				}, 
  574. 			}, 
  575. 			heli_dropoff_nav = "nav_trans_dropoff_05", 
  576. 			escape_path = "path_stag_transport_01a_ 002", 
  577. 			rooftop_trigger = "tgr_rooftop_area 005", 
  578. 			thread_id = -1, 
  579. 			marker_added = false, 
  580. 			marker_removed = false, 
  581. 			snipers = false, 
  582. 			oleg_line = M10_dialog_lines.third_dropoff, 
  583. 		}, 
  584. 		 
  585. 		stag_transport_05_vtol = { 
  586. 			name = "Group_stag_transport_vtol 005", 
  587. 			vtol = "veh_stag_transport_05_ 001", 
  588. 		}, 
  589. 		 
  590. 		vtol_flyby_01 = { 
  591. 			name = "Group_vtol_flyby 001", 
  592. 			vtols = { 
  593. 				{ 
  594. 					vehicle = "veh_vtol_flyby_01_ 001", 
  595. 					chars = { "char_vtol_flyby_pilot_01_ 001" }, 
  596. 					path = "path_vtol_flyby_01_ 001", 
  597. 					target = "", 
  598. 					target_nav = "nav_vtol_flyby_01_ 001", 
  599. 					speed = 120.0, 
  600. 					invulnerable = false, 
  601. 					fired = false, 
  602. 					rockets = false, 
  603. 					thread_id = -1, 
  604. 				}, 
  605. 				{ 
  606. 					vehicle = "veh_vtol_flyby_01_ 002", 
  607. 					chars = { "char_vtol_flyby_pilot_01_ 002" }, 
  608. 					path = "path_vtol_flyby_01_ 002", 
  609. 					target = "", 
  610. 					target_nav = "nav_vtol_flyby_01_ 002", 
  611. 					speed = 120.0, 
  612. 					invulnerable = false, 
  613. 					fired = false, 
  614. 					rockets = false, 
  615. 					thread_id = -1, 
  616. 				}, 
  617. 			}, 
  618. 		}, 
  619. 		 
  620. 		vtol_flyby_02 = { 
  621. 			name = "Group_vtol_flyby 002", 
  622. 			vtols = { 
  623. 				{ 
  624. 					vehicle = "veh_vtol_flyby_02_ 001", 
  625. 					chars = { "char_vtol_flyby_pilot_02_ 001", "char_vtol_flyby_copilot_02_ 001" }, 
  626. 					path = "path_vtol_flyby_02_ 001", 
  627. 					target = "char_oleg 001", 
  628. 					speed = 120.0, 
  629. 					invulnerable = true, 
  630. 					fired = false, 
  631. 					rockets = true, 
  632. 					thread_id = -1, 
  633. 				}, 
  634. 				{ 
  635. 					vehicle = "veh_vtol_flyby_02_ 002", 
  636. 					chars = { "char_vtol_flyby_pilot_02_ 002", "char_vtol_flyby_copilot_02_ 002" }, 
  637. 					path = "path_vtol_flyby_02_ 002", 
  638. 					target = "char_oleg 001", 
  639. 					target_nav = "nav_vtol_flyby_02_ 002", 
  640. 					speed = 120.0, 
  641. 					invulnerable = true, 
  642. 					fired = false, 
  643. 					rockets = false, 
  644. 					thread_id = -1, 
  645. 				}, 
  646. 			}, 
  647. 		}, 
  648. 		 
  649. 		oleg_vtol = { 
  650. 			name = "Group_oleg_vtol 001", 
  651. 			member = "char_oleg_vtol_driver 001", 
  652. 			vtol = "veh_oleg_vtol 001", 
  653. 			driver = "char_oleg_vtol_driver 001", 
  654. 			path_approach = "path_oleg_vtol_approach 001", 
  655. 			path_dest = "path_oleg_vtol_dest 001", 
  656. 			nav_dest = "nav_oleg_vtol_dest 001", 
  657. 			 
  658. 			-- Panic/escape 
  659. 			path = "path_oleg_vtol_jerky 001", 
  660. 			path_flee = "path_oleg_vtol_flee 001", 
  661. 			fire_navs = {  
  662. 				{ nav = "nav_oleg_vtol_shoot 001", duration = 1.0, alt_fire = false }, 
  663. 				{ nav = "nav_oleg_vtol_shoot 002", duration = 2.0, alt_fire = false }, 
  664. 				{ nav = "nav_oleg_vtol_shoot 003", duration = 1.0, alt_fire = true }, 
  665. 				{ nav = "nav_oleg_vtol_shoot 004", duration = 2.0, alt_fire = false }, 
  666. 				{ nav = "nav_oleg_vtol_shoot 005", duration = 3.0, alt_fire = false, destroy_vehicles = { "veh_stag_tank 001" } }, 
  667. 				{ nav = "nav_oleg_vtol_shoot 006", duration = 1.0, alt_fire = true, destroy_vehicles = { "veh_stag_tank 002" } }, 
  668. 				{ nav = "nav_oleg_vtol_shoot 007", duration = 2.0, alt_fire = false }, 
  669. 			}, 
  670. 		}, 
  671. 		 
  672. 		stag_elevator_guys = { 
  673. 			name = "Group_stag_elevator 001", 
  674. 			chars = { "char_stag_elevator 001", "char_stag_elevator 002", "char_stag_elevator 003", "char_stag_elevator 004"}, 
  675. 		}, 
  676. 		 
  677. 		stag_club_aftermath = { 
  678. 			name = "Group_stag_club_aftermath 001", 
  679. 			members = { "char_stag_club_aftermath 001", "char_stag_club_aftermath 002", "char_stag_club_aftermath 003" }, 
  680. 		}, 
  681. 		 
  682. 		saints_hq = { 
  683. 			name = "Group_saints_hq 001", 
  684. 		}, 
  685. 		 
  686. 		stag_encounter_bridge_01 = { 
  687. 			name = "Group_stag_bridge_encounter 001", 
  688. 			vehicles = { 
  689. 				{ 
  690. 					vehicle = "veh_bridge_suv_01_ 001", 
  691. 					chars = { "char_bridge_suv_01_01_ 001", "char_bridge_suv_01_01_ 002" }, 
  692. 					behavior = "exit_at_dest", 
  693. 					path = "path_bridge_suv_01_ 001", use_navmesh = true, 
  694. 					thread_id = -1, 
  695. 				}, 
  696. 				{ 
  697. 					vehicle = "veh_bridge_suv_01_ 002", 
  698. 					chars = { "char_bridge_suv_01_02_ 001", "char_bridge_suv_01_02_ 002" }, 
  699. 					behavior = "exit_at_dest", 
  700. 					path = "path_bridge_suv_01_ 002", use_navmesh = true, 
  701. 					thread_id = -1, 
  702. 				}, 
  703. 				{ 
  704. 					vehicle = "veh_bridge_tank_01_ 001", 
  705. 					chars = { "char_bridge_tank_01_01_ 001", "char_bridge_tank_01_01_ 002" }, 
  706. 					behavior = "stop_at_dest", 
  707. 					path = "path_bridge_tank_01_ 001", use_navmesh = true, 
  708. 					thread_id = -1, 
  709. 				}, 
  710. 			}, 
  711. 			creation_trigger = "tgr_bridge_creation 001", 
  712. 			action_trigger = "tgr_bridge_do_action 001", 
  713. 			 
  714. 			max_activations = 1, 
  715. 			thread_id = INVALID_THREAD_HANDLE, 
  716. 		}, 
  717. 		 
  718. 		stag_encounter_bridge_02 = { 
  719. 			name = "Group_stag_bridge_encounter 002", 
  720. 			vehicles = { 
  721. 				{ 
  722. 					vehicle = "veh_bridge_suv_02_ 001", 
  723. 					chars = { "char_bridge_suv_02_01_ 001", "char_bridge_suv_02_01_ 002" }, 
  724. 					behavior = "exit_at_dest", 
  725. 					path = "path_bridge_suv_02_ 001", use_navmesh = true, 
  726. 					thread_id = -1, 
  727. 				}, 
  728. 				{ 
  729. 					vehicle = "veh_bridge_suv_02_ 002", 
  730. 					chars = { "char_bridge_suv_02_02_ 001", "char_bridge_suv_02_02_ 002" }, 
  731. 					behavior = "exit_at_dest", 
  732. 					path = "path_bridge_suv_02_ 002", use_navmesh = true, 
  733. 					thread_id = -1, 
  734. 				}, 
  735. 				{ 
  736. 					vehicle = "veh_bridge_tank_02_ 001", 
  737. 					chars = { "char_bridge_tank_02_01_ 001", "char_bridge_tank_02_01_ 002" }, 
  738. 					behavior = "stop_at_dest", 
  739. 					path = "path_bridge_tank_02_ 001", use_navmesh = false, 
  740. 					thread_id = -1, 
  741. 				}, 
  742. 			}, 
  743. 			creation_trigger = "tgr_bridge_creation 002", 
  744. 			action_trigger = "tgr_bridge_do_action 002", 
  745. 			 
  746. 			max_activations = 1, 
  747. 			thread_id = INVALID_THREAD_HANDLE, 
  748. 		}, 
  749. 		 
  750. 		stag_encounter_chem_01 = { 
  751. 			name = "Group_stag_chem_encounter 001", 
  752. 			vehicles = { 
  753. 				{ 
  754. 					vehicle = "veh_vtol_chem_plant 001", 
  755. 					chars = { "char_vtol_chem_plant_pilot 001" }, 
  756. 					behavior = "fly_by", 
  757. 					path = "path_vtol_chem_plant 001", 
  758. 					speed = 100.0, 
  759. 					no_perfect_aim = true, 
  760. 					thread_id = -1, 
  761. 				}, 
  762. 				{ 
  763. 					vehicle = "veh_vtol_chem_plant 002", 
  764. 					chars = { "char_vtol_chem_plant_pilot 002" }, 
  765. 					behavior = "fly_by", 
  766. 					path = "path_vtol_chem_plant 002", 
  767. 					speed = 100.0, 
  768. 					no_perfect_aim = true, 
  769. 					thread_id = -1, 
  770. 				}, 
  771. 			}, 
  772. 			creation_trigger = "tgr_chem_plant_creation 001", 
  773. 			action_trigger = "tgr_chem_plant_do_action 001", 
  774. 			 
  775. 			max_activations = 1, 
  776. 			thread_id = INVALID_THREAD_HANDLE, 
  777. 		}, 
  778. 		 
  779. 		stag_encounter_bridge_03 = { 
  780. 			name = "Group_stag_encounter_bridge 001", 
  781. 			vehicles = { 
  782. 				{ 
  783. 					vehicle = "veh_tank_bridge_03_ 001", 
  784. 					chars = { "char_tank_bridge_03_ 001", "char_tank_bridge_03_ 002" }, 
  785. 					behavior = "stop_at_dest", 
  786. 					path = "path_tank_bridge_03_ 001", use_navmesh = false, 
  787. 					thread_id = -1, 
  788. 				}, 
  789. 				{ 
  790. 					vehicle = "veh_vtol_bridge_03_ 001", 
  791. 					chars = { "char_vtol_bridge_03_pilot 001", "char_vtol_bridge_03_copilot 001", "char_vtol_bridge_03_oleg 001" }, 
  792. 					behavior = "fly_by_and_shoot", 
  793. 					path = "path_vtol_bridge_03_ 001", 
  794. 					target = "char_tank_bridge_03_ 001", 
  795. 					trigger = "tgr_vtol_bridge_03_fire 001", 
  796. 					speed = 50.0, invulnerable = true, fired = false, 
  797. 					rockets = true, 
  798. 					thread_id = -1, 
  799. 				}, 
  800. 			}, 
  801. 			creation_trigger = "tgr_bridge_creation 003", 
  802. 			action_trigger = "tgr_bridge_do_action 003", 
  803. 			 
  804. 			max_activations = 1, 
  805. 			thread_id = INVALID_THREAD_HANDLE,			 
  806. 		}, 
  807. 		 
  808. 		stag_encounter_bridge_04 = { 
  809. 			name = "Group_stag_bridge_encounter 004", 
  810. 			vehicles = { 
  811. 				{ 
  812. 					vehicle = "veh_bridge_suv_04_ 001", 
  813. 					chars = { "char_bridge_suv_04_01_ 001", "char_bridge_suv_04_01_ 002" }, 
  814. 					behavior = "exit_at_dest", 
  815. 					path = "path_bridge_suv_04_ 001", use_navmesh = true, 
  816. 					thread_id = -1, 
  817. 				}, 
  818. 				{ 
  819. 					vehicle = "veh_bridge_suv_04_ 002", 
  820. 					chars = { "char_bridge_suv_04_02_ 001", "char_bridge_suv_04_02_ 002" }, 
  821. 					behavior = "exit_at_dest", 
  822. 					path = "path_bridge_suv_04_ 002", use_navmesh = true, 
  823. 					thread_id = -1, 
  824. 				}, 
  825. 				{ 
  826. 					vehicle = "veh_bridge_suv_04_ 003", 
  827. 					chars = { "char_bridge_suv_04_03_ 001", "char_bridge_suv_04_03_ 002" }, 
  828. 					behavior = "exit_at_dest", 
  829. 					path = "path_bridge_suv_04_ 003", use_navmesh = true, 
  830. 					thread_id = -1, 
  831. 				}, 
  832. 			}, 
  833. 			creation_trigger = "tgr_bridge_creation 004", 
  834. 			action_trigger = "tgr_bridge_do_action 004", 
  835. 			 
  836. 			max_activations = 1, 
  837. 			thread_id = INVALID_THREAD_HANDLE, 
  838. 		}, 
  839. 		 
  840. 		stag_encounter_bridge_05 = { 
  841. 			name = "Group_stag_bridge_encounter 005", 
  842. 			vehicles = { 
  843. 				{ 
  844. 					vehicle = "veh_bridge_suv_05_ 001", 
  845. 					chars = { "char_bridge_suv_05_01_ 001", "char_bridge_suv_05_01_ 002" }, 
  846. 					behavior = "exit_at_dest", 
  847. 					path = "path_bridge_suv_05_ 001", use_navmesh = true, 
  848. 					thread_id = -1, 
  849. 				}, 
  850. 				{ 
  851. 					vehicle = "veh_bridge_suv_05_ 002", 
  852. 					chars = { "char_bridge_suv_05_02_ 001", "char_bridge_suv_05_02_ 002" }, 
  853. 					behavior = "exit_at_dest", 
  854. 					path = "path_bridge_suv_05_ 002", use_navmesh = true, 
  855. 					thread_id = -1, 
  856. 				}, 
  857. 			}, 
  858. 			creation_trigger = "tgr_bridge_creation 005", 
  859. 			action_trigger = "tgr_bridge_do_action 005", 
  860. 			 
  861. 			max_activations = 1, 
  862. 			thread_id = INVALID_THREAD_HANDLE, 
  863. 		}, 
  864. 		heli_soldiers = {"char_stag_trans_soldier_01a_ 001", "char_stag_trans_soldier_01a_ 002", "char_stag_trans_soldier_01a_ 003", "char_stag_trans_soldier_01a_ 004", 
  865. 							"char_stag_trans_soldier_01_ 001", "char_stag_trans_soldier_01_ 002", "char_stag_trans_soldier_01_ 003", "char_stag_trans_soldier_01_ 004", 
  866. 							"char_stag_trans_soldier_02_ 001", "char_stag_trans_soldier_02_ 002", "char_stag_trans_soldier_02_ 003", "char_stag_trans_soldier_02_ 004", 
  867. 							"char_stag_trans_soldier_02b_ 001", "char_stag_trans_soldier_02b_ 002", "char_stag_trans_soldier_02b_ 003", "char_stag_trans_soldier_02b_ 004", 
  868. 							"char_stag_trans_soldier_03_ 001", "char_stag_trans_soldier_03_ 002", "char_stag_trans_soldier_03_ 003", "char_stag_trans_soldier_03_ 004", 
  869. 							"char_stag_trans_soldier_04_ 001", "char_stag_trans_soldier_04_ 002", "char_stag_trans_soldier_04_ 003", "char_stag_trans_soldier_04_ 004", 
  870. 							"char_stag_trans_soldier_05_ 001", "char_stag_trans_soldier_05_ 002", "char_stag_trans_soldier_05_ 003", "char_stag_trans_soldier_05_ 004" }, 
  871. 							 
  872. 		weapons = { name = "Group_weapons 001" }, 
  873. 	} 
  874.  
  875. -- Navpoints -- 
  876. 	M10_navpoints = { 
  877. 		mission_cancel = { "nav_player_mission_exit 001", "nav_player_mission_exit 002" }, 
  878. 		oleg_start = "nav_oleg_start_chk_01_ 001", 
  879. 		viola_start = "nav_viola_start_chk_01_ 001", 
  880. 		oleg_roof = "nav_oleg_start_chk_02_ 001", 
  881. 		viola_roof = "nav_viola_start_chk_02_ 001", 
  882. 		roof_viola_investigate = "nav_viola_roof_investigate 001", 
  883. 		roof_oleg_investigate = "nav_oleg_roof_investigate 001", 
  884. 		roof_viola_fix_elevator = "nav_viola_roof_fix_elev 001", 
  885. 		roof_oleg_dest = "nav_roof_oleg_dest 001", 
  886. 		roof_viola_dest = "nav_roof_viola_dest 001", 
  887. 		oleg_sequence_oleg = "nav_oleg_sequence_oleg 001", 
  888. 		viola_roof_edge = "nav_viola_roof_edge 001", 
  889. 		mission_win = { "nav_player_mission_complete 001", "nav_player_mission_complete 002"}, 
  890. 		clear_airspace_points = { "nav_clear_airspace_dest 001", "nav_clear_airspace_dest 002", "nav_clear_airspace_dest 003",  
  891. 								"nav_clear_airspace_dest 004", "nav_clear_airspace_dest 005", "nav_clear_airspace_dest 006", 
  892. 								"nav_clear_airspace_dest 007", "nav_clear_airspace_dest 008", "nav_clear_airspace_dest 009" }, 
  893. 		stag_aftermath_rush = "nav_stag_aftermath 001" 
  894. 	} 
  895.  
  896. -- Triggers -- 
  897. 	M10_triggers = { 
  898. 		club_door = "tgr_club_door 001", 
  899. 		stag_ambush_01 = "tgr_stag_ambush 001",  
  900. 		front_door_exit = "tgr_front_door 001", 
  901. 		roof_kill_region = "tgr_roof_kill_region 001", 
  902. 		roof_air_space = "tgr_roof_air_space 001", 
  903. 		vtol_flyby_fire_01 = "tgr_vtol_flyby_fire 001", 
  904. 		vtol_flyby_fire_02 = "tgr_vtol_flyby_fire 002", 
  905. 		vtol_oi_01 = "tgr_vtol_OI 001", 
  906. 		vtol_oi_02 = "tgr_vtol_OI 002", 
  907. 		club_roof_area = "tgr_club_roof_area 001", 
  908. 		rooftop_elevator = "tgr_rooftop_elevator 001", 
  909. 		club_exit = "tgr_club_exit 001", 
  910. 		start_notoriety = "tgr_start_notoriety 001", 
  911. 		saints_hq = "tgr_saints_hq 001", 
  912. 		--saints_hq_traffic = "tgr_saints_hq 002", 
  913. 	} 
  914.  
  915. -- Characters -- 
  916. 	M10_characters = { 
  917. 		oleg = M10_groups.oleg.oleg, 
  918. 		viola = M10_groups.viola.viola 
  919. 	} 
  920.  
  921. -- Vehicles -- 
  922. 	M10_vehicles = { 
  923. 		oleg_vtol = M10_groups.oleg_vtol.vtol 
  924. 	} 
  925.  
  926. -- Mesh Movers -- 
  927. 	M10_movers = { 
  928. 		club_doors = { 
  929. 			main_stage = { 
  930. 				door_movers = { "mvr_main_stage_door 001" }, 
  931. 				locked = false, 
  932. 				open = true, 
  933. 			}, 
  934. 			front_door = { 
  935. 				door_movers = { "mvr_front_door 001" }, 
  936. 				locked = true, 
  937. 				open = false, 
  938. 			}, 
  939. 			back_door = { 
  940. 				door_movers = { "mvr_back_door 001" }, 
  941. 				locked = true, 
  942. 				open = false, 
  943. 			}, 
  944. 			lobby_door = { 
  945. 				door_movers = { "mvr_lobby_door 001" }, 
  946. 				locked = false, 
  947. 				open = true, 
  948. 			}, 
  949. 			roof_entry = { 
  950. 				door_movers = { "mvr_roof_entry_door 001" }, 
  951. 				locked = true, 
  952. 				open = false, 
  953. 			},	 
  954. 			roof_exit = { 
  955. 				door_movers = { "mvr_roof_exit_door 001" }, 
  956. 				locked = true, 
  957. 				open = false, 
  958. 			}, 
  959. 		}, 
  960. 	} 
  961. 	 
  962. -- Continuous Spawn Groups -- 
  963. 	M10_spawn_groups = { 
  964. 		stag_roof = { "Group_stag_roof_cont_spawn 001", "Group_stag_roof_cont_spawn 002", "Group_stag_roof_cont_spawn 003" }, 
  965. 		stag_club = { "Group_stag_club_cont_spawn 001", "Group_stag_club_cont_spawn 002" }, 
  966. 		 
  967. 	} 
  968. 	 
  969. -- Spawn Regions -- 
  970. 	M10_spawn_regions = { 
  971. 		stag_roof = { "spr_rooftop 001", "spr_rooftop 002" }, 
  972. 		stag_club = { "spr_stag_club_cont_spawn 001", "spr_stag_club_cont_spawn 002", "spr_stag_club_cont_spawn 003" } 
  973. 	} 
  974. 	 
  975. -- Text -- 
  976. 	M10_strings = { 
  977. 		objective_escape_stag = "m10_obj_escape_stag", 
  978. 		objective_kill_rooftop_enemies = "m10_obj_kill_stag_on_roofs", 
  979. 		objective_kill_snipers = "m10_obj_kill_stag_snipers", 
  980. 		objective_kill_vtol = "m10_obj_kill_stag_vtol", 
  981. 		objective_survive = "m10_obj_survive", 
  982. 		objective_obj_escape_to_saints_hq = "m10_obj_escape_to_saints_hq", 
  983. 	 
  984. 		failure_oleg_died = "m10_failure_oleg_died", 
  985. 		failure_viola_died = "m10_failure_viola_died", 
  986. 		failure_oleg_dismissed = "m10_failure_oleg_dismissed", 
  987. 		failure_viola_dismissed = "m10_failure_viola_dismissed", 
  988. 	} 
  989.  
  990. -- Threads -- 
  991. 	M10_threads = { 
  992. 		viola_rooftop_intro = INVALID_THREAD_HANDLE, 
  993. 		oleg_rooftop_intro = INVALID_THREAD_HANDLE, 
  994. 		vtol_flyby = INVALID_THREAD_HANDLE, 
  995. 		vtol_panic = INVALID_THREAD_HANDLE, 
  996. 		escape_convo = INVALID_THREAD_HANDLE, 
  997. 		soldier_count = INVALID_THREAD_HANDLE, 
  998. 	} 
  999.  
  1000. -- Cutscenes -- 
  1001. 	M10_cutscenes = { 
  1002. 		mission_intro = "10_in", 
  1003. 		rooftop_intro = "10_Mid", 
  1004. 		mission_outro = "10_Out", --"10_out_v3" cannot find this video 
  1005. 	} 
  1006.  
  1007. 	 
  1008. -- Off-screen personas -- 
  1009. 	M10_personas = { 
  1010. 		shaundi = { 
  1011. 			name = "Shaundi", 
  1012. 			persona_id = -1, 
  1013. 		}, 
  1014. 		 
  1015. 		interrogation = { 
  1016. 			name = "Interrogation", 
  1017. 			persona_id = -1, 
  1018. 		}, 
  1019. 	} 
  1020. 	 
  1021. -- Other -- 
  1022. 	M10_cover_nodes = { 
  1023. 		oleg_roof = "cvr_roof_oleg 001", 
  1024. 		viola_roof = "cvr_roof_viola 001", 
  1025. 	} 
  1026. 	 
  1027. 	M10_vtol_cont_spawn = { 
  1028. 		groups = {M10_groups.vtol_cont_spawn_02 }, 
  1029. 		thread_id = -1, 
  1030. 	} 
  1031.  
  1032. 	M10_runtime = { 
  1033. 		mission10_completed = false, 
  1034. 		 
  1035. 		player_reached_objective = false, 
  1036. 		 
  1037. 		phonecall_complete = false, 
  1038. 		 
  1039. 		ambush_soldiers_alive = 0, 
  1040. 		transport_soldiers_alive = 0, 
  1041. 		transport_snipers_alive = 0, 
  1042. 		roof_attack_vtols_active = 0, 
  1043. 		roof_attack_vtols_killed = 0, 
  1044. 		 
  1045. 		vehicles_in_airspace = { }, 
  1046. 		damaged_vehicles_exiting = { }, 
  1047. 		spawned_vtols = { }, 
  1048. 		transport_vtols = { }, 
  1049. 		vtol_flyby_groups = { }, 
  1050. 		rooftop_trigger_chars = { }, 
  1051. 		stag_encounters = { }, 
  1052. 	} 
  1053. 	 
  1054.  
  1055. -- ************************* 
  1056. -- 
  1057. -- Standard functions 
  1058. -- 
  1059. -- ************************* 
  1060.  
  1061. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  1062. -- at the specified checkpoint. 
  1063. -- CALLED FROM CODE 
  1064. -- 
  1065. -- m10_checkpoint:	The checkpoint the mission should begin at 
  1066. -- is_restart:					TRUE if the mission is restarting, FALSE otherwise 
  1067. -- 
  1068. function m10_start(m10_checkpoint, is_restart) 
  1069. 	-- Make sure the screen is completly faded out 
  1070. 	mission_start_fade_out(0.0) 
  1071.  
  1072. 	-- Check if this mission starting from the beginning 
  1073. 	if (m10_checkpoint == M10_checkpoints.start.name) then 
  1074. 		if (is_restart == false) then 
  1075. 			-- First time playing mission 
  1076. 			 
  1077. 			-- Play an intro cutscene??? 
  1078. 			if (M10_cutscenes.mission_intro ~= "") then 
  1079. 				cutscene_play(M10_cutscenes.mission_intro, nil, M10_checkpoints.start.player_starts) 
  1080. 				--bink_play(M10_cutscenes.mission_intro) 
  1081. 			end 
  1082. 		else 
  1083. 			teleport_coop(M10_checkpoints.start.player_starts[1], M10_checkpoints.start.player_starts[2]) 
  1084. 		end 
  1085. 	end 
  1086.  
  1087. 	-- Handle mission initialization for the current checkpoint 
  1088. 	m10_initialize(m10_checkpoint) 
  1089. 	 
  1090. 	-- Start fading in  
  1091. 	mission_start_fade_in() 
  1092.  
  1093. 	-- Run the mission from the current checkpoint 
  1094. 	m10_run(m10_checkpoint) 
  1095. end 
  1096.  
  1097. -- This is the primary function responsible for running the entire mission from start to finish. 
  1098. -- 
  1099. -- first_checkpoint:	The first checkpoint to begin running the mission at 
  1100. -- 
  1101. function m10_run(first_checkpoint) 
  1102. 	local current_checkpoint = first_checkpoint 
  1103. 	 
  1104. 	set_traffic_density(0.00001) 
  1105.  
  1106. 	-- Run the mission from the beginning 
  1107. 	if (current_checkpoint == M10_checkpoints.start.name) then 
  1108. 		m10_run_get_to_the_front_door() 
  1109. 		m10_run_lobby_cutscene() 
  1110. 		 
  1111. 		-- Setup the perimeter and the rooftop 
  1112. 		teleport( M10_characters.oleg, M10_navpoints.oleg_roof ) 
  1113. 		teleport( M10_characters.viola, M10_navpoints.viola_roof ) 
  1114. 		m10_setup_perimeter() 
  1115. 		m10_setup_rooftop() 
  1116. 		m10_setup_rooftop_intro() 
  1117.  
  1118. 		-- Set the checkpoint  
  1119. 		current_checkpoint = M10_checkpoints.survive.name 
  1120. 		mission_set_checkpoint(M10_checkpoints.survive.name) 
  1121. 	end 
  1122. 	 
  1123. 	if (current_checkpoint == M10_checkpoints.survive.name) then 
  1124. 		m10_run_rooftop_intro() 
  1125. 		m10_run_vtol_transports_01() 
  1126. 		m10_run_rooftop_attack_vtols() 
  1127.  
  1128. 		-- Set the checkpoint  
  1129. 		current_checkpoint = M10_checkpoints.oleg_to_the_rescue.name 
  1130. 		mission_set_checkpoint(M10_checkpoints.oleg_to_the_rescue.name) 
  1131. 	end 
  1132. 	 
  1133. 	if (current_checkpoint == M10_checkpoints.oleg_to_the_rescue.name) then 
  1134. 		m10_run_oleg_gets_downed() 
  1135. 		m10_run_oleg_jump_on_vtol() 
  1136. 		m10_run_oleg_vtol_panic() 
  1137. 		m10_run_rooftop_escape() 
  1138. 		 
  1139. 		thread_yield() 
  1140. 		m10_setup_club_aftermath() 
  1141. 		 
  1142. 		mission_start_fade_out() 
  1143. 		teleport_coop(M10_checkpoints.escape_to_hq.player_starts[1], M10_checkpoints.escape_to_hq.player_starts[2]) 
  1144. 		mission_start_fade_in() 
  1145.  
  1146. 		-- Set the checkpoint  
  1147. 		current_checkpoint = M10_checkpoints.escape_to_hq.name 
  1148. 		mission_set_checkpoint(M10_checkpoints.escape_to_hq.name) 
  1149. 	end 
  1150. 	 
  1151. 	if (current_checkpoint == M10_checkpoints.escape_to_hq.name) then 
  1152. 		m10_run_escape_club_aftermath() 
  1153. 		m10_run_escape_to_saints_hq() 
  1154. 	end 
  1155. 	 
  1156. 	-- Call mission success?? 
  1157. 	M10_runtime.mission10_completed = true -- Used to keep track of world state  
  1158. 	mission_end_success("m10", M10_cutscenes.mission_outro, M10_navpoints.mission_win) 
  1159. 	 
  1160. end 
  1161.  
  1162. -- This is the primary function responsible for cleaning up the entire mission 
  1163. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  1164. -- 
  1165. function m10_cleanup() 
  1166. 	-- Call the clean-up functions for each sectin of the mission 
  1167. 	m10_cleanup_get_to_the_front_door() 
  1168. 	m10_cleanup_lobby_cutscene() 
  1169. 	m10_cleanup_vtol_transports_01(true) 
  1170. 	m10_cleanup_rooftop_attack_vtols() 
  1171. 	m10_cleanup_oleg_gets_downed() 
  1172. 	m10_cleanup_oleg_jump_on_vtol() 
  1173. 	m10_cleanup_oleg_vtol_panic() 
  1174. 	m10_cleanup_rooftop_escape() 
  1175. 	m10_cleanup_escape_club_aftermath() 
  1176. 	m10_cleanup_escape_to_saints_hq() 
  1177.  
  1178. 	-- Clean up Oleg and Viola 
  1179. 	party_dismiss_all() 
  1180. 	m10_cleanup_oleg() 
  1181. 	m10_cleanup_viola() 
  1182.  
  1183. 	-- Reset notoriety 
  1184. 	notoriety_set_can_decay(ENABLE)	 
  1185. 	hud_set_fake_notoriety("police", false) 
  1186. 	notoriety_force_no_spawn("police", false) 
  1187. 	notoriety_reset("police") 
  1188.  
  1189. 	-- Clean-up all the script groups 
  1190. 	cleanup_groups(M10_groups) 
  1191. 	 
  1192. 	-- Make sure all the triggers have been cleared 
  1193. 	for i, trigger in pairs(M10_triggers) do 
  1194. 		m10_clear_trigger(trigger) 
  1195. 	end 
  1196. 	 
  1197. 	-- Clean-up any threads that are still running  
  1198. 	for i, thread in pairs(M10_threads) do 
  1199. 		if (thread_check_done(thread) == false) then 
  1200. 			thread_kill(thread) 
  1201. 		end 
  1202. 	end 
  1203. 	 
  1204. 	-- Cleanup any threads from VTOL fly-bys 
  1205. 	for i, vtol in pairs(M10_groups.vtol_intro_flyby_01.vtols) do 
  1206. 		if (thread_check_done(vtol.thread_id) == false) then 
  1207. 			thread_kill(vtol.thread_id) 
  1208. 			vtol.thread_id = -1 
  1209. 		end 
  1210. 	end	 
  1211. 	 
  1212. 	-- Cleanup any threads from VTOL fly-bys 
  1213. 	for i, vtol in pairs(M10_groups.vtol_flyby_01.vtols) do 
  1214. 		if (thread_check_done(vtol.thread_id) == false) then 
  1215. 			thread_kill(vtol.thread_id) 
  1216. 			vtol.thread_id = -1 
  1217. 		end 
  1218. 	end	 
  1219. 	 
  1220. 	-- Reverting World State Changes if Mission Failed 
  1221. 	if (not M10_runtime.mission10_completed) then  
  1222. 		set_stag_active(false) 
  1223. 	end 
  1224. 	 
  1225. 	-- Clean-up and conversations 
  1226. 	for i, convo in pairs(M10_convo) do 
  1227. 		if (convo.handle ~= INVALID_CONVERSATION_HANDLE) then 
  1228. 			audio_conversation_end(convo.handle) 
  1229. 			convo.handle = INVALID_CONVERSATION_HANDLE 
  1230. 		end 
  1231. 	end 
  1232. 	 
  1233. 	-- clean up phonecalls 
  1234. 	audio_remove_mission_cellphone(M10_convo.city_update.name) 
  1235. 	audio_ambient_emitter_start( "m10_stripclub_music" ) 
  1236. 	-- Unload any loaded personas 
  1237. 	for i, persona in pairs(M10_personas) do 
  1238. 		if (persona.persona_id ~= -1) then 
  1239. 			audio_persona_remove_2d(persona.persona_id) 
  1240. 			persona.persona_id = -1 
  1241. 		end 
  1242. 	end 
  1243. 	 
  1244. 	--cleanup callbacks 
  1245. 	for i, squad in pairs(M10_groups.stag_ambush.squads) do 
  1246. 		for j, char in pairs(squad.chars) do 
  1247. 			on_death("", char) 
  1248. 			on_attack_performed("", char) 
  1249. 		end 
  1250. 	end 
  1251. 	 
  1252. 	for j, char in pairs(M10_groups.heli_soldiers) do 
  1253. 		on_attack_performed("", char) 
  1254. 	end 
  1255. 	 
  1256. 	--make sure the player isn't a priority target anymore 
  1257. 	character_make_priority_target(LOCAL_PLAYER, false) 
  1258. 	if (coop_is_active()) then 
  1259. 		character_make_priority_target(REMOTE_PLAYER, false) 
  1260. 	end 
  1261. 	 
  1262. 	-- Reset ped/vehicle density 
  1263. 	set_ped_density(1.0) 
  1264. 	set_traffic_density(1.0) 
  1265. 	 
  1266. 	-- Re-enable roadblocks 
  1267. 	roadblocks_enable(true) 
  1268. 	 
  1269. 	city_zone_swap("thermint1", DISABLE) -- Disable the NW Thermopolye 
  1270. end 
  1271.  
  1272. -- Called when the mission has ended with success 
  1273. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  1274. -- 
  1275. function m10_success() 
  1276. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
  1277. 	 
  1278. 	-- Set STAG to Spawn Heavy in their HQ Hood and be the active law group 
  1279. 	M10_runtime.mission10_completed = true  -- Sets Mission Completed if you use 'Mission_Win' for testing 
  1280.  
  1281. 	local skip_teleport = true 
  1282. 	m10_coop_skip(skip_teleport) -- do the stuff we'd do in the skip case 
  1283. end 
  1284.  
  1285.  
  1286. -- ************************* 
  1287. -- 
  1288. -- Local functions 
  1289. -- 
  1290. -- ************************* 
  1291.  
  1292. -- Initialize the mission for the specified checkpoint 
  1293. -- 
  1294. -- checkpoint:		Checkpoint to initialize the mission to 
  1295. -- 
  1296. function m10_initialize(checkpoint) 
  1297. 	-- Set the mission author 
  1298. 	set_mission_author("John Karczewski") 
  1299.  
  1300. 	-- Common initialization 
  1301. 	m10_initialize_common() 
  1302.  
  1303. 	-- Checkpoint specific initialization 
  1304. 	m10_initialize_checkpoint(checkpoint) 
  1305. end 
  1306.  
  1307. -- *************************************************** 
  1308. -- m10_initialize Helper Functions 
  1309. -- *************************************************** 
  1310.  
  1311. -- Handle any common initialization 
  1312. -- 
  1313. function m10_initialize_common() 
  1314. 	set_stag_active(ENABLE) 
  1315. 	 
  1316. 	-- Load the persona for STAG members 
  1317. 	M10_personas.interrogation.persona_id = audio_persona_load_2d(M10_personas.interrogation.name) 
  1318. 	 
  1319. 	-- Setup the doors to their initial states 
  1320. 	for i, door in pairs(M10_movers.club_doors) do 
  1321. 		m10_setup_door(door) 
  1322. 	end 
  1323. 	 
  1324. 	hud_set_fake_notoriety("police", true, M10_tweak_parameters.club_fake_notoriety_level) 
  1325. 	notoriety_force_no_spawn("police", true) 
  1326. 	notoriety_set_max("police", 1) 
  1327. 	notoriety_set("police", 1) 
  1328. 	 
  1329. 	city_zone_swap("thermint1") 
  1330. 	 
  1331. 	-- Set the mission cancel warp locations 
  1332. 	mission_set_cancel_warp_location(M10_navpoints.mission_cancel[1], M10_navpoints.mission_cancel[2]) 
  1333. end 
  1334.  
  1335. -- Checkpoint specific initialization 
  1336. -- 
  1337. -- checkpoint:		The checkpoint to be initialized 
  1338. function m10_initialize_checkpoint(checkpoint) 
  1339. 	 
  1340. 	audio_object_post_event( "m10_all_checkpoint_restore" ) 
  1341. 	 
  1342. 	if (checkpoint == M10_checkpoints.start.name) then 
  1343. 		-- Intro animations 
  1344. 		-- Player(s) look cool GO! 
  1345. 		local anim_name = "M10 Player Mission Start" 
  1346. 		local morph_name = "M10 Player Mission Start" 
  1347. 		local force_play = false 
  1348. 		local stand_still = false 
  1349. 		local zero_movement = false 
  1350. 		action_play_non_blocking(LOCAL_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement) 
  1351. 		player_script_controlled_clear(LOCAL_PLAYER)	-- let player escape this animation 
  1352. 		if (coop_is_active()) then 
  1353. 			action_play_non_blocking(REMOTE_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement) 
  1354. 			player_script_controlled_clear(REMOTE_PLAYER)	-- let player escape this animation 
  1355. 		end 
  1356. 		 
  1357. 		m10_setup_oleg() 
  1358. 		m10_setup_viola() 
  1359. 		m10_setup_club() 
  1360. 		roadblocks_enable(false) 
  1361. 		 
  1362. 		--teleport_coop(M10_checkpoints.start.player_starts[1], M10_checkpoints.start.player_starts[2], true) 
  1363. 		teleport( M10_characters.oleg, M10_navpoints.oleg_start ) 
  1364. 		teleport( M10_characters.viola, M10_navpoints.viola_start ) 
  1365. 	end 
  1366. 	 
  1367. 	if (checkpoint == M10_checkpoints.survive.name) then 
  1368. 		m10_setup_oleg() 
  1369. 		m10_setup_viola() 
  1370. 		teleport_coop(M10_checkpoints.survive.player_starts[1], M10_checkpoints.survive.player_starts[2], true) 
  1371. 		teleport( M10_characters.oleg, M10_navpoints.oleg_roof ) 
  1372. 		teleport( M10_characters.viola, M10_navpoints.viola_roof ) 
  1373. 		m10_setup_perimeter() 
  1374. 		m10_setup_rooftop() 
  1375. 		m10_setup_rooftop_intro() 
  1376. 		 
  1377. 		roadblocks_enable(false) 
  1378.  
  1379. 	end 
  1380. 	 
  1381. 	if (checkpoint == M10_checkpoints.oleg_to_the_rescue.name) then 
  1382. 		m10_setup_oleg() 
  1383. 		m10_setup_viola() 
  1384. 		 
  1385. 		-- Setup Oleg 
  1386. 		follower_make_independent(M10_characters.oleg, true) 
  1387. 		teleport(M10_characters.oleg, M10_navpoints.roof_oleg_dest) 
  1388. 		npc_leash_to_nav(M10_characters.oleg, M10_navpoints.roof_oleg_dest, 1.0, false)	 
  1389. 		 
  1390. 		-- Setup Viola 
  1391. 		follower_make_independent(M10_characters.viola, true) 
  1392. 		teleport(M10_characters.viola, M10_navpoints.roof_viola_investigate) 
  1393. 		npc_leash_to_nav(M10_characters.viola, M10_navpoints.roof_viola_investigate, 1.0, false) 
  1394. 		turn_invulnerable(M10_characters.viola) 
  1395. 		set_dont_attack_me_on_sight_flag(M10_characters.viola, true) 
  1396. 		teleport_coop(M10_checkpoints.oleg_to_the_rescue.player_starts[1], M10_checkpoints.oleg_to_the_rescue.player_starts[2], true) 
  1397. 		 
  1398. 		m10_setup_perimeter() 
  1399. 		m10_setup_rooftop() 
  1400. 		 
  1401. 		 
  1402. 		roadblocks_enable(false) 
  1403. 	end 
  1404. 	 
  1405. 	if (checkpoint == M10_checkpoints.escape_to_hq.name) then 
  1406. 		m10_setup_viola() 
  1407. 		m10_setup_perimeter() 
  1408. 		m10_setup_club_aftermath()	-- must happen after the perimeter has been created 
  1409. 		 
  1410. 		set_dont_attack_me_on_sight_flag(M10_characters.viola, true) 
  1411. 		turn_invulnerable(M10_characters.viola) 
  1412. 		 
  1413. 		-- Turn police (STAG) notoriety on 
  1414. 		hud_set_fake_notoriety("police", false) 
  1415. 		notoriety_reset("police") 
  1416. 		notoriety_set("police", M10_tweak_parameters.goto_hq_notoriety_level) 
  1417. 		notoriety_set_can_decay(DISABLE) 
  1418. 		 
  1419. 		-- Just hide the tanks at the front of the club that chased after the VTOL Oleg hijacked 
  1420. 		for i, tank in pairs(M10_groups.stag_ground_troops.tanks) do 
  1421. 			if (tank.chase_path ~= "") then 
  1422. 				vehicle_hide(tank.tank) 
  1423. 			end 
  1424. 		end 
  1425. 	 
  1426. 		teleport_coop(M10_checkpoints.escape_to_hq.player_starts[1], M10_checkpoints.escape_to_hq.player_starts[2], true) 
  1427. 	end 
  1428.  
  1429. end 
  1430.  
  1431.  
  1432. -- *************************************************** 
  1433. -- m10_run Helper Functions 
  1434. -- *************************************************** 
  1435.  
  1436. --[[ 
  1437. 	CHECKPOINT 01: Mission Start (Strip Club Inteior) 
  1438. 	--]] 
  1439.  
  1440. -- First checkpoint where the player(s) must battle through the STAG forces to get to the roof 
  1441. function m10_run_get_to_the_front_door() 
  1442. 	objective_text_clear(0) 
  1443. 	objective_text( 0, "m10_obj_escape_stag", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  1444. 	 
  1445. 	-- Setup the trigger for the first door 
  1446. 	trigger_enable(M10_triggers.club_door, true) 
  1447. 	on_trigger("m10_player_reached_objective_cb", M10_triggers.club_door) 
  1448. 	marker_add_trigger(M10_triggers.club_door, MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, OI_ASSET_LOCATION, SYNC_ALL)	 
  1449. 	 
  1450. 	-- Setup the trigger for the stag ambush 
  1451. 	trigger_enable(M10_triggers.stag_ambush_01, true) 
  1452. 	on_trigger("m10_trigger_stag_ambush_cb", M10_triggers.stag_ambush_01) 
  1453. 	audio_play_persona_line(M10_characters.viola, M10_dialog_lines.mission_start)	 
  1454. 	 
  1455. 		-- Put the strippers into their animation states 
  1456. 	for i, stripper in pairs(M10_groups.strippers.members) do 
  1457. 		npc_use_closest_action_node_of_type(stripper, M10_groups.strippers.anims[i]) 
  1458. 	end	 
  1459. 		 
  1460. 	delay(3.0)	 
  1461. 	m10_helper_play_conversation(M10_convo.stag_entrance, false) 
  1462. 	zscene_prep(M10_cutscenes.rooftop_intro) 
  1463. 	-- Wait til the player gets to the club 
  1464. 	while not M10_runtime.player_reached_objective do 
  1465. 		thread_yield() 
  1466. 	end 
  1467. 	 
  1468. 	-- Setup the trigger for the front door 
  1469. 	M10_runtime.player_reached_objective = false 
  1470. 	trigger_enable(M10_triggers.front_door_exit, true) 
  1471. 	on_trigger("m10_player_reached_objective_cb", M10_triggers.front_door_exit) 
  1472. 	marker_add_trigger(M10_triggers.front_door_exit, MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, OI_ASSET_LOCATION, SYNC_ALL) 
  1473.  
  1474. 	while((not M10_runtime.player_reached_objective) and (M10_runtime.ambush_soldiers_alive > 0)) do 
  1475. 		thread_yield() 
  1476. 	end 
  1477. 	 
  1478. 	-- Start the continuous spawn for the club 
  1479. 	continuous_spawn_regions_enable(M10_spawn_regions.stag_club, true) 
  1480. 	for i, spawn_group in pairs(M10_spawn_groups.stag_club) do 
  1481. 		continuous_spawn_start(spawn_group, 0, 3) 
  1482. 	end 
  1483. 	 
  1484. 	if (M10_runtime.ambush_soldiers_alive == 0) then 
  1485. 		audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.get_to_roof) 
  1486. 	end 
  1487. 	 
  1488. 	-- Wait til the player gets to the stairs 
  1489. 	while not M10_runtime.player_reached_objective do 
  1490. 		thread_yield() 
  1491. 	end 
  1492. 	 
  1493. 	m10_cleanup_get_to_the_front_door() 
  1494. end 
  1495.  
  1496. -- Cleanup for getting to the front door 
  1497. function m10_cleanup_get_to_the_front_door() 
  1498. 	-- Remove the triggers 
  1499. 	m10_clear_trigger(M10_triggers.front_door_exit) 
  1500. 	m10_clear_trigger(M10_triggers.stag_ambush_01) 
  1501. 	 
  1502. 	-- MLG 04/02/11 - Fix for Bug #12442: Releasing these guys to the world can cause an assert since they are still doing 
  1503. 	--					their script action (which is bad) 
  1504. 	-- Clean-up the stag ambush group 
  1505. 	--[[ 
  1506. 	for i, squad in pairs(M10_groups.stag_ambush.squads) do 
  1507. 		for j, char in pairs(squad.chars) do 
  1508. 			release_to_world(char) 
  1509. 		end 
  1510. 	end 
  1511. 	--]] 
  1512. 	group_destroy(M10_groups.stag_ambush.name) 
  1513. 	 
  1514. 	-- Stop the continuous spawn for the club 
  1515. 	continuous_spawn_regions_enable(M10_spawn_regions.stag_club, false) 
  1516. 	for i, spawn_group in pairs(M10_spawn_groups.stag_club) do 
  1517. 		continuous_spawn_stop(spawn_group, true) 
  1518. 	end 
  1519. 	 
  1520. 	for i, squad in pairs(M10_groups.stag_ambush.squads) do 
  1521. 		for j, char in pairs(squad.chars) do 
  1522. 			on_death("", char) 
  1523. 		end 
  1524. 	end 
  1525. 	-- Destroy the group for the strippers (we need those slots!!) 
  1526. 	group_destroy(M10_groups.strippers.name) 
  1527. 	 
  1528. 	-- End the STAG entrance conversation 
  1529. 	audio_conversation_end(M10_convo.stag_entrance.handle) 
  1530. 	 
  1531. 	audio_object_post_event( "m10_flashbang_stop" ) 
  1532. end 
  1533.  
  1534. -- Trigger callback for when the play enters the area for the STAG ambush on the club 
  1535. -- 
  1536. -- triggerer:		Charcter that entered the trigger region 
  1537. -- trigger_name:	Name of the trigger that the character entered 
  1538. function m10_trigger_stag_ambush_cb(triggerer, trigger_name) 
  1539. 	-- Clear the trigger for the STAG ambush 
  1540. 	m10_clear_trigger(M10_triggers.stag_ambush_01) 
  1541.  
  1542. 	-- Throw the flashbangs 
  1543. 	for i, char in pairs(M10_groups.stag_ambush.flashbang_throwers.chars) do 
  1544. 		explosion_create("Flashbang", M10_groups.stag_ambush.flashbang_throwers.targets[i], char, false) 
  1545. 		delay(0.3) 
  1546. 	end 
  1547. 	audio_object_post_event( "m10_flashbang" ) 
  1548. 	 
  1549. 	-- Show the stag ambush, and move all the characters to their destinations 
  1550. 	group_show(M10_groups.stag_ambush.name) 
  1551. 	for i, squad in pairs(M10_groups.stag_ambush.squads) do 
  1552. 		for j, char in pairs(squad.chars) do 
  1553. 			on_death("m10_stag_ambush_soldier_killed_cb", char) 
  1554. 			ai_do_scripted_move(char, squad.destination, true, true) 
  1555. 		end 
  1556. 	end 
  1557. 	 
  1558. 	delay(3.0) 
  1559. 	audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.laser_guns) 
  1560. end 
  1561.  
  1562. -- Callback for when an ambush soldier is killed 
  1563. -- 
  1564. -- victim:		Name of the soldier killed 
  1565. function m10_stag_ambush_soldier_killed_cb(victim) 
  1566. 	on_death("", victim) 
  1567. 	on_attack_performed("", victim) 
  1568. 	M10_runtime.ambush_soldiers_alive = M10_runtime.ambush_soldiers_alive - 1 
  1569. end 
  1570.  
  1571. -- Proccessing for the mid-mission cutscene in the lobby 
  1572. function m10_run_lobby_cutscene() 
  1573. 	-- Play the cinematic 
  1574. 	--bink_play(M10_cutscenes.rooftop_intro) 
  1575. 	cutscene_play(M10_cutscenes.rooftop_intro, nil, M10_checkpoints.survive.player_starts) 
  1576. 	m10_cleanup_lobby_cutscene() 
  1577. end 
  1578.  
  1579. -- Cleanup for the mid-mission cutscene in the lobby 
  1580. function m10_cleanup_lobby_cutscene() 
  1581. 	--[[ NOTHING TO DO ]]-- 
  1582. end 
  1583.  
  1584. -- Run the intro sequence on the rooftop 
  1585. function m10_run_rooftop_intro() 
  1586. 	objective_text_clear(0) 
  1587. 	objective_text( 0, M10_strings.objective_survive, "", "", SYNC_ALL, OI_ASSET_DEFEND ) 
  1588. 	turn_invulnerable(M10_characters.viola) 
  1589. 	set_dont_attack_me_on_sight_flag(M10_characters.viola, true) 
  1590. 	character_make_priority_target(LOCAL_PLAYER, true) 
  1591. 	if (coop_is_active()) then 
  1592. 		character_make_priority_target(REMOTE_PLAYER, true) 
  1593. 	end 
  1594. 	-- Make the door open 
  1595. 	door_open(M10_movers.club_doors.roof_entry.door_movers[1], false, false) 
  1596. 	 
  1597. 	-- Add infinite respawning pistols to rooftop 
  1598. 	group_create(M10_groups.weapons.name, true) 
  1599. 	 
  1600. 	-- Setup the VTOLs that are flying-by as the cutscene ends 
  1601. 	group_show(M10_groups.vtol_intro_flyby_01.name) 
  1602. 	M10_threads.vtol_flyby = thread_new("m10_thread_process_flyby", M10_groups.vtol_intro_flyby_01) 
  1603.  
  1604. 	delay(0.5) 
  1605. 	 
  1606. 	audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.rooftop_start) 
  1607. 	 
  1608. 	audio_object_post_event( "m10_vtol_group_flyby" ) 
  1609. 	 
  1610. 	-- Close and lock the roof entry door 
  1611. 	door_close(M10_movers.club_doors.roof_entry.door_movers[1], true) 
  1612. 	door_lock(M10_movers.club_doors.roof_entry.door_movers[1], true) 
  1613. 	 
  1614. 	M10_threads.viola_rooftop_intro = thread_new("m10_thread_process_viola_rooftop_intro") 
  1615. 	M10_threads.oleg_rooftop_intro = thread_new("m10_thread_process_oleg_rooftop_intro") 
  1616. 	 
  1617. 	-- Initialize our enemy counts 
  1618. 	M10_runtime.transport_soldiers_alive = 0 
  1619. 	M10_runtime.transport_snipers_alive = 0 
  1620. 	 
  1621. 	--spawn an initial group of baddies towards the roof 
  1622. 	delay(1.0) 
  1623. 	group_create_hidden(M10_groups.stag_transport_01a.name, true) 
  1624. 	group_create_hidden(M10_groups.stag_transport_01a_vtol.name, true) 
  1625. 	m10_setup_stag_transport(M10_groups.stag_transport_01a, false) -- not snipers 
  1626. 	--audio_play_persona_line(M10_characters.oleg, M10_dialog_lines.first_dropoff) 
  1627. 	M10_groups.stag_transport_01a.thread_id = thread_new("m10_vtol_transport_drop_off_thread", M10_groups.stag_transport_01a, true) -- show markers 
  1628. 	 
  1629. 	 
  1630. 	-- Wait for the two threads to finish 
  1631. 	while(thread_check_done(M10_threads.viola_rooftop_intro) == false or thread_check_done(M10_threads.oleg_rooftop_intro) == false) do 
  1632. 		thread_yield() 
  1633. 	end 
  1634. 	 
  1635. 	-- Move Viola to the elevator to start fixing it 
  1636. 	npc_leash_remove(M10_characters.viola) 
  1637. 	ai_do_scripted_move(M10_characters.viola, M10_navpoints.roof_viola_fix_elevator, true, false) 
  1638. 	m10_helper_play_conversation(M10_convo.elevators, false) 
  1639. 	-- Wait for Viola to stop moving 
  1640. 	while(ai_scripted_action_is_complete(M10_characters.viola) == false) do 
  1641. 		thread_yield() 
  1642. 	end 
  1643. 	 
  1644. 	-- audio_play_persona_line(M10_characters.viola, M10_dialog_lines.power_elevators_02) 
  1645. 	--m10_helper_play_conversation(M10_convo.elevators, false) 
  1646. 	 
  1647. 	-- Leash Viola near the elevator 
  1648. 	npc_leash_to_nav(M10_characters.viola, M10_navpoints.roof_viola_fix_elevator, 0.0, false) 
  1649. 	set_ignore_ai_flag(M10_characters.viola, true) 
  1650. 	set_animation_state(M10_characters.viola, "m10_viola_elevator_fix", M10_navpoints.roof_viola_fix_elevator, true) 
  1651. 	character_prevent_flinching(M10_characters.viola, true) 
  1652. 	character_prevent_bumping(M10_characters.viola, true) 
  1653. 	character_allow_ragdoll(M10_characters.viola, false) 
  1654. 	character_set_immune_to_explosion_vomit(M10_characters.viola, true) 
  1655. 	 
  1656. 	m10_cleanup_rooftop_intro() 
  1657. end 
  1658.  
  1659. -- Process Viola running over to the elevator 
  1660. function m10_thread_process_viola_rooftop_intro() 
  1661. 	-- Move Viola to check out the perimeter 
  1662. 	follower_make_independent(M10_characters.viola, true) 
  1663. 	ai_do_scripted_move(M10_characters.viola, M10_navpoints.roof_viola_investigate, true, false) 
  1664. 	 
  1665. 	-- Wait for Viola to stop moving 
  1666. 	while(ai_scripted_action_is_complete(M10_characters.viola) == false) do 
  1667. 		thread_yield() 
  1668. 	end 
  1669. 	delay(0.3) 
  1670. 	 
  1671. 	-- Play the "building surrounded" convo 
  1672. 	m10_helper_play_conversation(M10_convo.building_surrounded, false) 
  1673. 	 
  1674. 	-- Leash Viola near the elevator 
  1675. 	npc_leash_to_nav(M10_characters.viola, M10_navpoints.roof_viola_investigate, 1.0, false) 
  1676. end 
  1677.  
  1678. -- Process Oleg checking out the perimeter 
  1679. function m10_thread_process_oleg_rooftop_intro() 
  1680. 	-- Move Oleg to check out the elevators 
  1681. 	follower_make_independent(M10_characters.oleg, true) 
  1682. 	ai_do_scripted_move(M10_characters.oleg, M10_navpoints.roof_oleg_investigate, true, false) 
  1683. 	 
  1684. 	-- Wait for Oleg to stop moving, then have him return to the player 
  1685. 	while(ai_scripted_action_is_complete(M10_characters.oleg) == false) do 
  1686. 		thread_yield() 
  1687. 	end 
  1688. 	delay(0.3) 
  1689. 	-- audio_play_persona_line(M10_characters.oleg, M10_dialog_lines.power_elevators) 
  1690. 	-- follower_make_independent(M10_characters.oleg, false) 
  1691. end 
  1692.  
  1693. -- Handle any clean-up for the rooftop intro section 
  1694. function m10_cleanup_rooftop_intro() 
  1695. 	-- Kill the threads processing Viola and Oleg 
  1696. 	if (thread_check_done(M10_threads.viola_rooftop_intro) == false) then 
  1697. 		thread_kill(M10_threads.viola_rooftop_intro) 
  1698. 		M10_threads.viola_rooftop_intro = INVALID_THREAD_HANDLE 
  1699. 	end 
  1700. 	if (thread_check_done(M10_threads.oleg_rooftop_intro) == false) then 
  1701. 		thread_kill(M10_threads.oleg_rooftop_intro) 
  1702. 		M10_threads.oleg_rooftop_intro = INVALID_THREAD_HANDLE 
  1703. 	end 
  1704. end 
  1705.  
  1706.  
  1707. --[[ 
  1708. 	CHECKPOINT 02 - Survive the Rooftop Battle 
  1709. 	--]] 
  1710. 	 
  1711. function m10_run_vtol_transports_01() 
  1712. 	-- Update the objective text 
  1713. 	objective_text( 0, M10_strings.objective_kill_rooftop_enemies, "", "", SYNC_ALL, OI_ASSET_KILL ) 
  1714. 	 
  1715. 	-- Start the continuous spawn VTOL transport thread 
  1716. 	-- M10_vtol_cont_spawn.thread_id = thread_new("m10_club_drop_off_cont_spawn_thread", M10_vtol_cont_spawn, 25) 
  1717. 	 
  1718. 	trigger_enable(M10_triggers.vtol_oi_01, true) 
  1719. 	on_trigger("m10_vtol_oi_tgr_cb", M10_triggers.vtol_oi_01) 
  1720. 	 
  1721. 	-- Setup the first transport 
  1722. 	group_create_hidden(M10_groups.stag_transport_01.name, true) 
  1723. 	group_create_hidden(M10_groups.stag_transport_01_vtol.name, true) 
  1724. 	m10_setup_stag_transport(M10_groups.stag_transport_01, false) -- not snipers 
  1725. 	m10_vtol_transport_drop_off_thread(M10_groups.stag_transport_01, true) -- regular marker 
  1726. 	 
  1727. 	-- Wait until there 5 seconds have passed, or all the enemies have been killeds 
  1728. 	--local elapsed_time = 0.0 
  1729. 	--while((elapsed_time < 5.0) and (M10_runtime.transport_soldiers_alive > 3)) do 
  1730. 	--	elapsed_time = elapsed_time + get_frame_time() 
  1731. 	--	thread_yield() 
  1732. 	--end 
  1733. 	 
  1734. 	-- Setup the second transport 
  1735. 	group_create_hidden(M10_groups.stag_transport_02.name, true) 
  1736. 	group_create_hidden(M10_groups.stag_transport_02_vtol.name, true) 
  1737. 	m10_setup_stag_transport(M10_groups.stag_transport_02, false) -- not snipers 
  1738. 	M10_groups.stag_transport_02.thread_id = thread_new("m10_vtol_transport_drop_off_thread", M10_groups.stag_transport_02, true) -- show markers 
  1739. 	 
  1740. 	-- Wait until there are 0 guys remaining 
  1741. 	while(M10_runtime.transport_soldiers_alive > 3) do 
  1742. 		thread_yield() 
  1743. 	end 
  1744. 	 
  1745. 	-- Setup the 2B transport TEMP TESTING SCRIPT 
  1746. 	group_create_hidden(M10_groups.stag_transport_02b.name, true) 
  1747. 	group_create_hidden(M10_groups.stag_transport_02b_vtol.name, true) 
  1748. 	m10_setup_stag_transport(M10_groups.stag_transport_02b, false) -- not snipers 
  1749. 	--audio_play_persona_line(M10_characters.oleg, M10_dialog_lines.first_dropoff) 
  1750. 	M10_groups.stag_transport_02b.thread_id = thread_new("m10_vtol_transport_drop_off_thread", M10_groups.stag_transport_02b, true) -- show markers 
  1751. 			 
  1752. 	-- Wait until there are 3 guys remaining 
  1753. 	while(M10_runtime.transport_soldiers_alive > 3) do 
  1754. 		thread_yield() 
  1755. 	end 
  1756. 	 
  1757. 	m10_helper_play_conversation(M10_convo.viola_check_in, false) 
  1758. 	 
  1759. 	-- Wait until there are 1 guy1 remaining 
  1760. 	while(M10_runtime.transport_soldiers_alive > 1) do 
  1761. 		thread_yield() 
  1762. 	end 
  1763. 	 
  1764. 	-- Enable the triggers to turn on the object indicators  
  1765. 	trigger_enable(M10_triggers.vtol_oi_01, false) 
  1766. 	on_trigger("", M10_triggers.vtol_oi_01) 
  1767. 	trigger_enable(M10_triggers.vtol_oi_02, true) 
  1768. 	on_trigger("m10_vtol_oi_tgr_cb", M10_triggers.vtol_oi_02) 
  1769. 	 
  1770. 	-- Setup the third transport 
  1771. 	group_create_hidden(M10_groups.stag_transport_03.name, true) 
  1772. 	group_create_hidden(M10_groups.stag_transport_03_vtol.name, true) 
  1773. 	m10_setup_stag_transport(M10_groups.stag_transport_03, false) -- not snipers 
  1774. 	M10_groups.stag_transport_03.thread_id = thread_new("m10_vtol_transport_drop_off_thread", M10_groups.stag_transport_03, true) -- show markers 
  1775. 	 
  1776. 	-- Setup the forth transport (with snipers) 
  1777. 	-- Don't do this in a thread, we want to know when the transport has dropped off the snipers (or was destroyed) 
  1778. 	group_create_hidden(M10_groups.stag_transport_04.name, true) 
  1779. 	group_create_hidden(M10_groups.stag_transport_04_vtol.name, true) 
  1780. 	group_create_hidden(M10_groups.vtol_transport_flyby_01.name, true) 
  1781. 	m10_setup_stag_transport(M10_groups.stag_transport_04, true) -- SNIPERS!! 
  1782. 	m10_vtol_transport_drop_off_thread(M10_groups.stag_transport_04, true) -- show markers 
  1783. 	 
  1784. 	-- Time to spawn a wave of VTOL flying by the player 
  1785. 	group_show(M10_groups.vtol_transport_flyby_01.name) 
  1786. 	M10_threads.vtol_flyby = thread_new("m10_thread_process_flyby", M10_groups.vtol_transport_flyby_01) 
  1787. 	 
  1788. 	delay(2) 
  1789. 	audio_play_persona_line(M10_characters.viola, M10_dialog_lines.first_wave) 
  1790. 	audio_object_post_event( "m10_vtol_group_flyby" ) 
  1791. 	 
  1792. 	-- delay(5) 
  1793. 	-- If there are any snipers remaining (after being dropped off) then update the objective 
  1794. 	-- if (M10_runtime.transport_snipers_alive > 0) then 
  1795. 		-- Call out the snipers 
  1796. 	-- 	audio_play_persona_line(M10_characters.viola, M10_dialog_lines.sniper_transport) 
  1797. 	-- end 
  1798. 		-- Wait until all the snipers have been killed 
  1799. 		--while(M10_runtime.transport_snipers_alive > 0) do 
  1800. 		--	thread_yield() 
  1801. 		--end 
  1802. 	--end 
  1803. 	 
  1804. 	local total_soldiers = M10_runtime.transport_snipers_alive + M10_runtime.transport_soldiers_alive 
  1805. 	-- Wait until all soldiers have been killed 
  1806. 	while(total_soldiers > 4) do 
  1807. 		thread_yield() 
  1808. 		total_soldiers = M10_runtime.transport_snipers_alive + M10_runtime.transport_soldiers_alive 
  1809. 	end 
  1810. 	 
  1811. 	trigger_enable(M10_triggers.vtol_oi_02, false) 
  1812. 	on_trigger("", M10_triggers.vtol_oi_02) 
  1813. 	 
  1814. 	-- Setup the fifth transport 
  1815. 	group_create_hidden(M10_groups.stag_transport_05.name, true) 
  1816. 	group_create_hidden(M10_groups.stag_transport_05_vtol.name, true) 
  1817. 	m10_setup_stag_transport(M10_groups.stag_transport_05, false) -- not snipers 
  1818. 	M10_groups.stag_transport_05.thread_id = thread_new("m10_vtol_transport_drop_off_thread", M10_groups.stag_transport_05, true) -- show markers 
  1819. 	--audio_play_persona_line(M10_characters.oleg, M10_dialog_lines.second_dropoff) 
  1820. 	 
  1821. 	-- Wait until all soldiers have been killed 
  1822. 	total_soldiers = M10_runtime.transport_snipers_alive + M10_runtime.transport_soldiers_alive 
  1823. 	while(total_soldiers > 0) do 
  1824. 		thread_yield() 
  1825. 		total_soldiers = M10_runtime.transport_snipers_alive + M10_runtime.transport_soldiers_alive 
  1826. 	end 
  1827. 	 
  1828. 	m10_helper_play_conversation(M10_convo.oleg_check_in, false) 
  1829. 	 
  1830. 	--don't clear out the soldiers the last 2 may be left 
  1831. 	m10_cleanup_vtol_transports_01(false) 
  1832. end 
  1833.  
  1834. -- Callback for when a VTOL enters the OI trigger region 
  1835. function m10_vtol_oi_tgr_cb(triggerer, trigger) 
  1836. 	-- Search for the transport group containing this character 
  1837. 	local transport_table = nil 
  1838. 	for i, transport in pairs(M10_runtime.transport_vtols) do 
  1839. 		for i, char in pairs(transport.pilots) do 
  1840. 			if (char == triggerer) then 
  1841. 				-- Fount it! 
  1842. 				transport_table = transport 
  1843. 				break 
  1844. 			end 
  1845. 		end 
  1846. 	end 
  1847. 	 
  1848. 	-- Maybe add a marker, if we haven't already 
  1849. 	if (transport_table ~= nil and transport_table.marker_added == false and transport_table.marker_removed == false) then 
  1850. 		marker_add(transport_table.vtol, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_FULL) 
  1851. 		transport_table.marker_added = true 
  1852. 	end 
  1853. end 
  1854.  
  1855. -- Setup a STAG transport VTOL (assumes the group has already been created) 
  1856. -- 
  1857. -- vtol_table:		Lua table defining the STAG transport (as defined for M10_groups::stag_transport_01) 
  1858. -- snipers:			TRUE if the transport's soldiers should be tracked as snipers, FALSE otherwise 
  1859. function m10_setup_stag_transport(vtol_table, snipers) 
  1860. 	vehicle_show(vtol_table.vtol) 
  1861. 	 
  1862. 	--set up on destroyed 
  1863. 	on_vehicle_destroyed("m10_transport_vtol_destroyed_cb", vtol_table.vtol) 
  1864. 	 
  1865. 	-- Keep track of which vehicle seats have been filled 
  1866. 	local seat_idx = 0 
  1867.  
  1868. 	-- Put the pilots into the VTOL 
  1869. 	for i, char in pairs(vtol_table.pilots) do 
  1870. 		character_show(char) 
  1871. 	 
  1872. 		-- Put the pilots into the vehicle 
  1873. 		vehicle_enter_teleport(char, vtol_table.vtol, seat_idx, true) 
  1874. 		follower_remain_in_car(char, true) 
  1875. 		 
  1876. 		-- Make 'em angry 
  1877. 		ai_add_enemy_target(char, CLOSEST_PLAYER, ATTACK_ON_SIGHT, false) 
  1878. 		seat_idx = seat_idx + 1 
  1879. 		ai_set_action_delay(char, "throw grenade", 9999) 
  1880. 	end 
  1881. 	 
  1882. 	-- Move the seat index to the rear seats if all the pilot seats haven't been filled 
  1883. 	if (seat_idx < 2) then 
  1884. 		seat_idx = 2 
  1885. 	end 
  1886. 	 
  1887. 	-- Setup the soldiers 
  1888. 	for i, drop_off in pairs(vtol_table.drop_offs) do 
  1889. 		local even_soldier = false 
  1890. 		for j, char in pairs(drop_off.soldiers) do 
  1891. 			character_show(char) 
  1892. 			on_attack_performed(M10_timed_lines.stag.callback, char) 
  1893. 			-- Put the soldiers into the vehicle 
  1894. 			vehicle_enter_teleport(char, vtol_table.vtol, seat_idx, true) 
  1895. 			--follower_remain_in_car(char, true) 
  1896. 			 
  1897. 			--give these dudes better aim than normal 
  1898. 			npc_weapon_spread(char, M10_tweak_parameters.rooftop_soldier_spread_mult) 
  1899.  
  1900. 			--give half of em perfect aim 
  1901. 			if (even_soldier) then 
  1902. 				set_perfect_aim(char) 
  1903. 				even_soldier = false 
  1904. 			else 
  1905. 				even_soldier = true 
  1906. 			end 
  1907.  
  1908. 			--make them not attack while in the helicopter 
  1909. 			npc_combat_enable(char, false) 
  1910. 			 
  1911. 			-- Track the soldier/sniper 
  1912. 			if (snipers == true) then 
  1913. 				on_death("m10_stag_transport_sniper_killed_cb", char) 
  1914. 				M10_runtime.transport_snipers_alive = M10_runtime.transport_snipers_alive + 1 
  1915. 			else 
  1916. 				on_death("m10_stag_transport_soldier_killed_cb", char) 
  1917. 				M10_runtime.transport_soldiers_alive = M10_runtime.transport_soldiers_alive + 1 
  1918. 			end 
  1919. 			 
  1920. 			seat_idx = seat_idx + 1 
  1921. 		end 
  1922. 	end 
  1923. 	 
  1924. 	-- Enable the trigger region on the rooftop (so we can kill enemeis that fall off the roof) 
  1925. 	trigger_enable(vtol_table.rooftop_trigger, true) 
  1926. 	on_trigger_exit("m10_rooftop_trigger_exit_cb", vtol_table.rooftop_trigger) 
  1927. end 
  1928.  
  1929. -- Cleanup a STAG transport VTOL 
  1930. -- 
  1931. -- vtol_table:		Lua table defining the STAG transport (as defined for M10_groups::stag_transport_01) 
  1932. function m10_cleanup_stag_transport(vtol_table, clear_soldiers) 
  1933. 	-- Release the group to the world 
  1934. 	--release_to_world(vtol_table.name) 
  1935.  
  1936. 	-- Remove the marker on the VTOL 
  1937. 	marker_remove(vtol_table.vtol) 
  1938. 	 
  1939. 	-- Remove the markers on the soldier, and clear their on_death callback 
  1940. 	if (clear_soldiers) then 
  1941. 		for i, drop_off in pairs(vtol_table.drop_offs) do 
  1942. 			for j, char in pairs(drop_off.soldiers) do 
  1943. 				marker_remove(char) 
  1944. 				on_death("", char) 
  1945. 			end 
  1946. 		end 
  1947. 	end 
  1948. 	 
  1949. 	-- Kill any active threads 
  1950. 	if (vtol_table.thread_id ~= nil and vtol_table.thread_id ~= -1) then 
  1951. 		if (thread_check_done(vtol_table.thread_id) == false) then 
  1952. 			thread_kill(vtol_table.thread_id) 
  1953. 		end 
  1954. 	end 
  1955. 	 
  1956. 	--disable on destroyed cb 
  1957. 	on_vehicle_destroyed("", vtol_table.vtol) 
  1958. 	 
  1959. 	-- Disable the trigger region on the rooftop 
  1960. 	trigger_enable(vtol_table.rooftop_trigger, false) 
  1961. 	on_trigger_exit("", vtol_table.rooftop_trigger) 
  1962. end 
  1963.  
  1964. -- Callback for when a transport soldier is killed 
  1965. -- 
  1966. -- victim:		Name of the soldier killed 
  1967. function m10_stag_transport_soldier_killed_cb(victim) 
  1968. 	on_death("", victim) 
  1969. 	marker_remove(victim) 
  1970. 	on_attack_performed("", victim) 
  1971. 	 
  1972. 	M10_runtime.transport_soldiers_alive = M10_runtime.transport_soldiers_alive - 1 
  1973. end 
  1974.  
  1975. -- Callback for when a transport sniper is killed 
  1976. -- 
  1977. -- victim:		Name of the soldier killed 
  1978. function m10_stag_transport_sniper_killed_cb(victim) 
  1979. 	on_death("", victim) 
  1980. 	marker_remove(victim) 
  1981. 	on_attack_performed("", victim) 
  1982. 	 
  1983. 	M10_runtime.transport_snipers_alive = M10_runtime.transport_snipers_alive - 1 
  1984. end 
  1985.  
  1986. -- Callback for when an enemy dropped off by a STAG transport exits the trigger on the rooftop 
  1987. -- 
  1988. -- triggerer:		Name of the character that exited the rooftop area 
  1989. -- trigger_name:	Name of the trigger 
  1990. function m10_rooftop_trigger_exit_cb(triggerer, trigger_name) 
  1991. 	-- Check to see if the triggerer is in the lsit of rooftop trigger characters 
  1992. 	for i, char in pairs(M10_runtime.rooftop_trigger_chars) do 
  1993. 		if (char == triggerer) then 
  1994. 			character_kill(triggerer) 
  1995. 			break 
  1996. 		end 
  1997. 	end 
  1998. end 
  1999.  
  2000. -- Clean-up the stag transports 
  2001. function m10_cleanup_vtol_transports_01(clear_soldiers) 
  2002. 	m10_cleanup_stag_transport(M10_groups.stag_transport_01a, clear_soldiers) 
  2003. 	m10_cleanup_stag_transport(M10_groups.stag_transport_01, clear_soldiers) 
  2004. 	m10_cleanup_stag_transport(M10_groups.stag_transport_02, clear_soldiers) 
  2005. 	m10_cleanup_stag_transport(M10_groups.stag_transport_02b, clear_soldiers) 
  2006. 	m10_cleanup_stag_transport(M10_groups.stag_transport_03, clear_soldiers) 
  2007. 	m10_cleanup_stag_transport(M10_groups.stag_transport_04, clear_soldiers) 
  2008. 	m10_cleanup_stag_transport(M10_groups.stag_transport_05, clear_soldiers) 
  2009. end 
  2010. 	 
  2011. -- Process the second wave of attack VTOLs (plus some VTOL flybys) 
  2012. function m10_run_rooftop_attack_vtols()	 
  2013. 	-- Create the script groups 
  2014. 	group_create_hidden(M10_groups.attack_vtols_02.name, true) 
  2015. 	group_create_hidden(M10_groups.vtol_flyby_01.name, true) 
  2016. 	group_show(M10_groups.attack_vtols_02.name) 
  2017. 	 
  2018. 	-- Enable the trigger region for when the VTOLs should open fire 
  2019. 	trigger_enable(M10_triggers.vtol_flyby_fire_01, true) 
  2020. 	on_trigger("m10_vtol_flyby_fire_cb", M10_triggers.vtol_flyby_fire_01) 
  2021. 		 
  2022. 	-- Kick-off the attack VTOL group 
  2023. 	for i, vtol in pairs(M10_groups.attack_vtols_02.vtols) do 
  2024. 		m10_setup_stag_attack_vtol(vtol, true) 
  2025. 		vtol.thread_id = thread_new("m10_vtol_attack_thread", vtol, true) 
  2026. 	end 
  2027.  
  2028. 	-- Setup the VTOL flybys 
  2029. 	group_show(M10_groups.vtol_flyby_01.name) 
  2030. 	M10_threads.vtol_flyby = thread_new("m10_thread_process_flyby", M10_groups.vtol_flyby_01)	 
  2031. 	M10_threads.solider_count = thread_new("m10_solider_count_thread") 
  2032. 	delay(1) 
  2033. 	audio_object_post_event( "m10_vtol_group_flyby" ) 
  2034. 	delay(7.0) 
  2035. 	if (M10_threads.solider_count ~= INVALID_THREAD_HANDLE) then 
  2036. 		thread_kill(M10_threads.solider_count) 
  2037. 		M10_threads.solider_count = INVALID_THREAD_HANDLE 
  2038. 	end 
  2039. 	 
  2040. 	objective_text( 0, M10_strings.objective_kill_vtol, "", "", SYNC_ALL, OI_ASSET_KILL ) 
  2041.  
  2042. 	audio_play_persona_line(M10_characters.viola, M10_dialog_lines.second_wave) 
  2043. 	 
  2044. 	-- Add a minimum delay, in case an attack VTOL gets killed before the flyby is finished 
  2045. 	delay(5.0) 
  2046. 	audio_play_persona_line_2d(M10_personas.interrogation.persona_id, M10_dialog_lines.stag_bullhorn_vtol_01) 
  2047.  
  2048. 	-- Wait until all the active attack VTOLs have been killed 
  2049. 	while((M10_runtime.roof_attack_vtols_active - M10_runtime.roof_attack_vtols_killed) > 0) do 
  2050. 		thread_yield() 
  2051. 	end 
  2052. 	 
  2053. 	--make sure we've polished off the soldiers 
  2054. 	local total_soldiers = M10_runtime.transport_snipers_alive + M10_runtime.transport_soldiers_alive 
  2055. 	if (total_soldiers > 0) then 
  2056. 		objective_text( 0, M10_strings.objective_kill_rooftop_enemies, "", "", SYNC_ALL, OI_ASSET_KILL ) 
  2057. 		while (total_soldiers > 0) do 
  2058. 			thread_yield() 
  2059. 			total_soldiers = M10_runtime.transport_snipers_alive + M10_runtime.transport_soldiers_alive 
  2060. 		end 
  2061. 	end 
  2062. 	 
  2063. 	m10_cleanup_rooftop_attack_vtols() 
  2064. end 
  2065.  
  2066. -- Clean-up the second wave of attack VTOLs 
  2067. function m10_cleanup_rooftop_attack_vtols() 
  2068. 	-- Remove the fire region trigger for the VTOL flyby 
  2069. 	m10_clear_trigger(M10_triggers.vtol_flyby_fire_01) 
  2070. 	 
  2071. 	-- Clean-up the attack vtols, since we know they are all destroyed now 
  2072. 	for i, vtol in pairs(M10_groups.attack_vtols_02.vtols) do 
  2073. 		-- Kill any thread that's still running 
  2074. 		if (thread_check_done(vtol.thread_id) == false) then 
  2075. 			thread_kill(vtol.thread_id) 
  2076. 		end 
  2077. 		 
  2078. 		on_vehicle_destroyed("", vtol.vtol) 
  2079. 		 
  2080. 		marker_remove(vtol.vtol) 
  2081. 	end		 
  2082. end 
  2083.  
  2084. function m10_solider_count_thread() 
  2085. 	local total_soldiers = M10_runtime.transport_snipers_alive + M10_runtime.transport_soldiers_alive 
  2086. 	while (total_soldiers > 0) do 
  2087. 		thread_yield() 
  2088. 		total_soldiers = M10_runtime.transport_snipers_alive + M10_runtime.transport_soldiers_alive 
  2089. 	end 
  2090. 	objective_text( 0, M10_strings.objective_survive, "", "", SYNC_ALL, OI_ASSET_DEFEND ) 
  2091. 	 
  2092. end 
  2093.  
  2094. --[[ 
  2095. 	CHECKPOINT 03: Oleg to the Resuce (This is the sequence where Oleg jumps onto a VTOL) 
  2096. 	--]] 
  2097.  
  2098. -- VTOL flyby downs Oleg 
  2099. function m10_run_oleg_gets_downed() 
  2100. 	objective_text( 0, M10_strings.objective_survive, "", "", SYNC_ALL, OI_ASSET_DEFEND ) 
  2101. 	 
  2102. 	-- 
  2103. 	-- Leash Oleg again 
  2104. 	npc_leash_to_nav(M10_characters.oleg, M10_navpoints.oleg_sequence_oleg, 0.5) 
  2105. 	ai_do_scripted_move(M10_characters.oleg, M10_navpoints.oleg_sequence_oleg, true) 
  2106. 	 
  2107. 	m10_helper_play_conversation(M10_convo.oleg_walking, false) 
  2108. 	 
  2109. 	-- Enable the trigger region for when the VTOLs should open fire 
  2110. 	trigger_enable(M10_triggers.vtol_flyby_fire_02, true) 
  2111. 	on_trigger("m10_vtol_flyby_fire_cb", M10_triggers.vtol_flyby_fire_02) 
  2112.  
  2113. 	-- Setup the VTOL flybys 
  2114. 	group_create(M10_groups.vtol_flyby_02.name, true) 
  2115. 	for i, vtol in pairs(M10_groups.vtol_flyby_02.vtols) do 
  2116. 		vtol.thread_id = thread_new("m10_thread_run_stag_flyby_vtol", vtol) 
  2117. 	end	 
  2118. 	 
  2119. 	--make sure Oleg is in his spot! 
  2120. 	while(ai_scripted_action_is_processing(M10_characters.oleg) == true) do 
  2121. 		thread_yield() 
  2122. 	end 
  2123. 	 
  2124. 	-- Setup the VTOL that Oleg is going to jump onto 
  2125. 	group_create(M10_groups.oleg_vtol.name, true) 
  2126. 	vehicle_enter_teleport(M10_groups.oleg_vtol.driver, M10_groups.oleg_vtol.vtol) 
  2127. 	turn_invulnerable(M10_groups.oleg_vtol.vtol, false)	 
  2128. 	 
  2129. 	--delay(1.0) 
  2130. 	 
  2131. 	-- Wait until the VTOL has fired at Oleg 
  2132. 	local break_loop = false 
  2133. 	while((M10_groups.vtol_flyby_02.vtols[2].fired == false) and (break_loop == false)) do 
  2134. 		--someone destroyed our invulnearable vehicle? wtf 
  2135. 		if (vehicle_is_destroyed(M10_groups.vtol_flyby_02.vtols[2].vehicle)) then 
  2136. 			break_loop = true 
  2137. 		end 
  2138. 		-- thread ended, it hides the vehicles at the end, we won't be shooting at all 
  2139. 		if (vehicle_hidden(M10_groups.vtol_flyby_02.vtols[2].vehicle)) then 
  2140. 			break_loop = true 
  2141. 		end 
  2142. 		--someone killed our invulnerable pilot, wtf 
  2143. 		for i, char in pairs(M10_groups.vtol_flyby_02.vtols[2].chars) do 
  2144. 			if (character_is_dead(char)) then 
  2145. 				break_loop = true 
  2146. 			end 
  2147. 		end 
  2148. 		thread_yield() 
  2149. 	end 
  2150. 	 
  2151. 	-- Clear any corpses that might have landed on the rooftop (so it doesn't break Oleg's path) 
  2152. 	m10_helper_clear_club_rooftop() 
  2153.  
  2154. 	-- Down Oleg 
  2155. 	turn_invulnerable(M10_characters.oleg) 
  2156. 	delay(3.0) 
  2157. 	human_enter_downed(M10_characters.oleg) 
  2158. 	 
  2159. 	-- Register a callback for when a player revives Oleg 
  2160. 	M10_runtime.oleg_revived = false 
  2161. 	on_revived("m10_oleg_revived_cb", M10_characters.oleg) 
  2162. 	 
  2163. 	-- Play some dialog 
  2164. 	delay(0.4) 
  2165. 	audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.oleg_downed) 
  2166. 	 
  2167. 	-- Move the VTOL that Oleg will jump on into position 
  2168. 	helicopter_fly_to_direct(M10_vehicles.oleg_vtol, -1, M10_groups.oleg_vtol.path_approach) 
  2169. 	 
  2170. 	-- Wait until Oleg is revived 
  2171. 	while(M10_runtime.oleg_revived == false) do 
  2172. 		thread_yield() 
  2173. 	end 
  2174. 	 
  2175. 	-- At this point, Oleg is invulnerable 
  2176. 	turn_invulnerable(M10_characters.oleg, false) 
  2177. 	 
  2178. 	m10_cleanup_oleg_gets_downed() 
  2179. end 
  2180.  
  2181. -- Cleanup Oleg getting downed by a VTOL flyby 
  2182. function m10_cleanup_oleg_gets_downed() 
  2183. 	-- Clear the trigger for the flyby fire region 
  2184. 	m10_clear_trigger(M10_triggers.vtol_flyby_fire_02) 
  2185. 	 
  2186. 	-- Clear the callbacks on Oleg 
  2187. 	on_revived("", M10_characters.oleg) 
  2188. end 
  2189.  
  2190. -- Callback for when Oleg gets revived 
  2191. -- 
  2192. -- character_name:		Name of the character that was revived 
  2193. function m10_oleg_revived_cb(character_name) 
  2194. 	M10_runtime.oleg_revived = true 
  2195. 	on_revived("", M10_characters.oleg) 
  2196. 	audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.oleg_help) 
  2197. end 
  2198.  
  2199. -- Oleg jumps onto the vtol and beats the crap out of it. 
  2200. function m10_run_oleg_jump_on_vtol() 
  2201. 	-- Create the guys in the elevator 
  2202. 	-- group_create(M10_groups.stag_elevator_guys.name, true) 
  2203.  
  2204. 	-- Remove Viola's leash, and make her follow the player again 
  2205. 	set_ignore_ai_flag(M10_characters.viola, false) 
  2206. 	npc_leash_remove(M10_characters.viola) 
  2207. 	character_prevent_flinching(M10_characters.viola, false) 
  2208. 	character_prevent_bumping(M10_characters.viola, false) 
  2209. 	character_allow_ragdoll(M10_characters.viola, true) 
  2210. 	character_set_immune_to_explosion_vomit(M10_characters.viola, false) 
  2211. 	follower_make_independent(M10_characters.viola, false) 
  2212.  
  2213. 	-- Move the helicopter into postion, and freeze it 
  2214. 	turn_invulnerable(M10_groups.oleg_vtol.vtol, false) 
  2215. 	helicopters_set_jitter_override(0.1, 0.1) 
  2216. 	helicopter_fly_to_direct(M10_groups.oleg_vtol.vtol, -1, M10_groups.oleg_vtol.path_dest) 
  2217. 	--removed, end of the direct path is close enough and there's correction built into the animation, should be ok, removes the snap 
  2218. 	--teleport_vehicle(M10_groups.oleg_vtol.vtol, M10_groups.oleg_vtol.nav_dest) 
  2219. 	vehicle_set_keyframed_physics(M10_groups.oleg_vtol.vtol, true) 
  2220.  
  2221. 	audio_play_persona_line_2d(M10_personas.interrogation.persona_id, M10_dialog_lines.stag_bullhorn_vtol_02) 
  2222. 	 
  2223. 	delay(2) 
  2224. 	 
  2225. 	-- Add an object indicator on the VTOL 
  2226. 	marker_add(M10_groups.oleg_vtol.vtol, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_FULL) 
  2227. 	 
  2228. 	audio_play_persona_line(M10_characters.oleg, M10_dialog_lines.oleg_revived) 
  2229. 	 
  2230. 	-- Move Oleg into position 
  2231. 	npc_leash_remove(M10_characters.oleg) 
  2232. 	ai_clear_scripted_action(M10_characters.oleg) 
  2233. 	 
  2234. 	local tries = 0 
  2235. 	while (ai_scripted_action_is_complete(M10_characters.oleg) == false and tries < 3) do 
  2236. 		ai_do_scripted_move(M10_characters.oleg, M10_navpoints.oleg_sequence_oleg, true) 
  2237. 		while(ai_scripted_action_is_processing(M10_characters.oleg) == true) do 
  2238. 			thread_yield() 
  2239. 		end 
  2240. 		 
  2241. 		tries = tries + 1 
  2242. 		thread_yield() 
  2243. 	end 
  2244. 	 
  2245. 	audio_play_persona_line(M10_characters.oleg, M10_dialog_lines.oleg_roar) 
  2246.  
  2247. 	delay(3.0) 
  2248. 	audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.oleg_jump_player) 
  2249. 	 
  2250. 	-- Make the VTOL fire at Oleg 
  2251. 	-- ai_set_action_delay(M10_groups.oleg_vtol.driver, "throw grenade", 9999) 
  2252. 	-- helicopter_shoot_human(M10_groups.oleg_vtol.vtol, M10_characters.oleg, false) 
  2253.  
  2254. 	-- Have Oleg jump onto the VTOL (Oleg is no longer a member of the player's party) 
  2255. 	tries = 0 
  2256. 	local success = false 
  2257. 	while(success == false and tries < 5) do 
  2258. 		success = vehicle_enter(M10_characters.oleg, M10_groups.oleg_vtol.vtol, 2, true, false, true, nil, true) 
  2259. 		 
  2260. 		tries = tries + 1 
  2261. 		thread_yield() 
  2262. 	end 
  2263. 	-- Vehicel enter failed, just do a teleport 
  2264. 	if (success == false) then 
  2265. 		vehicle_enter_teleport(M10_characters.oleg, M10_groups.oleg_vtol.vtol, 2, true, true, true) 
  2266. 	end 
  2267. 	 
  2268. 	vehicle_set_keyframed_physics(M10_groups.oleg_vtol.vtol, false) 
  2269. 	--M10_threads.vtol_panic = thread_new("m10_vtol_panic_thread") 
  2270. 	party_dismiss(M10_characters.oleg) 
  2271. 	marker_remove(M10_groups.oleg_vtol.vtol) 
  2272. 	 
  2273. 	audio_play_persona_line(M10_characters.oleg, M10_dialog_lines.oleg_vtol) 
  2274. 	 
  2275. 	m10_cleanup_oleg_jump_on_vtol() 
  2276. end 
  2277.  
  2278. -- Cleanup the Oleg vs VTOL sequence 
  2279. function m10_cleanup_oleg_jump_on_vtol() 
  2280. 	-- Restor the normal helicopter jitter 
  2281. 	helicopters_set_jitter_override(1.0, 1.0) 
  2282.  
  2283. 	-- Make Viola follow the player again 
  2284. 	ai_set_personality(M10_characters.viola, "gang defensive") 
  2285. 	if (character_exists(M10_characters.oleg)) then 
  2286. 		npc_suppress_persona(M10_characters.oleg, true) 
  2287. 	end 
  2288. 	character_prevent_explosion_fling(M10_characters.viola, false) 
  2289. 	-- npc_suppress_persona(M10_characters.oleg, true) 
  2290. 	 
  2291. 	-- Remove the marker on the VTOL Oleg jumps on 
  2292. 	marker_remove(M10_groups.oleg_vtol.vtol) 
  2293. end 
  2294.  
  2295. function m10_vtol_panic_thread() 
  2296. 	vehicle_anim_start(M10_groups.oleg_vtol.vtol, "", "plane stumble forward") 
  2297. 	 
  2298. end 
  2299.  
  2300. -- Handle the VTOL panicing with Oleg on it 
  2301. function m10_run_oleg_vtol_panic() 
  2302. 	-- Tell the helicopter to fly around trying to shake off Oleg 
  2303. 	m10_process_oleg_vtol_panic_thread() 
  2304. 	 
  2305. 	--audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.oleg_riding_vtol) 
  2306. 	helicopter_fly_to_do(M10_groups.oleg_vtol.vtol, -1, true, "", true, M10_groups.oleg_vtol.path_flee) 
  2307.  
  2308. 	-- These tanks are now dead because the VTOL Oleg jumped on shot and destroyed them 
  2309. 	--[[ 
  2310. 	-- The tanks at the front entrance should chase the VTOL now (to make a path for the player to escape) 
  2311. 	for i, tank in pairs(M10_groups.stag_ground_troops.tanks) do 
  2312. 		if (tank.chase_path ~= "") then 
  2313. 			set_dont_attack_me_on_sight_flag(char, false) -- so homies can attack the tanks 
  2314. 			tank.thread_id = thread_new("m10_process_tank_chase_thread", tank) 
  2315. 		end 
  2316. 	end 
  2317. 	--]] 
  2318. 	 
  2319. 	m10_cleanup_oleg_vtol_panic() 
  2320. end 
  2321.  
  2322. -- Process the VTOL with Oleg on it panicing and shooting wildly 
  2323. function m10_process_oleg_vtol_panic_thread() 
  2324. 	-- Start the pathfind 
  2325. 	vehicle_anim_start(M10_groups.oleg_vtol.vtol, "Oleg vtol attack", "Oleg vtol jump") 
  2326. 	helicopter_fly_to_do(M10_groups.oleg_vtol.vtol, 15, true, "", false, M10_groups.oleg_vtol.path) 
  2327. 	-- We don't want AI firing on their own, 20 seconds should be enough time  
  2328. 	-- (they should be allowed to shoot after that) 
  2329. 	ai_set_action_delay(M10_groups.oleg_vtol.driver, "fire", 20000) 
  2330. 	 
  2331. 	-- Start firing 
  2332. 	for i, fire_nav in pairs(M10_groups.oleg_vtol.fire_navs) do 
  2333. 		if (fire_nav.alt_fire == true) then 
  2334. 			-- Fire the alt weapon (missles) 
  2335. 			set_perfect_aim(M10_groups.oleg_vtol.driver, true) -- give AI perfect aim for this shot (missles are very inaccurate) 
  2336. 			helicopter_shoot_navpoint(M10_groups.oleg_vtol.vtol, fire_nav.nav, true) 
  2337. 			set_perfect_aim(M10_groups.oleg_vtol.driver, false) -- restore regular AI aim 
  2338.  
  2339. 			-- Wait for the specified duration 
  2340. 			delay(fire_nav.duration) 
  2341. 		else 
  2342. 			-- Fire the primary weapon (laser) - need to hold down the trigger for the duration (by shooting every frame) 
  2343. 			local elapsed_time = 0 
  2344. 			while(elapsed_time < fire_nav.duration) do 
  2345. 				-- Shoot this frame 
  2346. 				helicopter_shoot_navpoint(M10_groups.oleg_vtol.vtol, fire_nav.nav, false) 
  2347. 				 
  2348. 				-- Increment the timer 
  2349. 				elapsed_time = elapsed_time + get_frame_time() 
  2350. 				thread_yield() 
  2351. 			end 
  2352. 		end 
  2353.  
  2354. 		-- Destroy any vehicles that should go boom 
  2355. 		if (fire_nav.destroy_vehicles ~= nil) then 
  2356. 			for i, vehicle in pairs(fire_nav.destroy_vehicles) do 
  2357. 				vehicle_detonate(vehicle) 
  2358. 			end 
  2359. 		end 
  2360. 	end 
  2361. 	 
  2362. 	while (vehicle_anim_finished(M10_groups.oleg_vtol.vtol) == false) do 
  2363. 		thread_yield() 
  2364. 	end 
  2365. 	 
  2366. 	-- Now just wait for the pathfind to finish (if it hasn't already) 
  2367. 	--while (vehicle_pathfind_check_done(M10_groups.oleg_vtol.vtol) == 0) do 
  2368. 	--	thread_yield() 
  2369. 	--end 
  2370. end 
  2371.  
  2372. -- Cleanup the Oleg VTOL panicing 
  2373. function m10_cleanup_oleg_vtol_panic() 
  2374. 	-- Nothing to do here 
  2375. end 
  2376.  
  2377. -- Process the rooftop escape 
  2378. function m10_run_rooftop_escape() 
  2379. 	objective_text_clear(0) 
  2380. 	objective_text( 0, "m10_obj_escape_to_saints_hq", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  2381. 	--turn_vulnerable(M10_characters.viola) 
  2382. 	character_make_priority_target(LOCAL_PLAYER, false) 
  2383. 	if (coop_is_active()) then 
  2384. 		character_make_priority_target(REMOTE_PLAYER, false) 
  2385. 	end 
  2386. 	-- Setup the trigger for the elevator 
  2387. 	M10_runtime.player_reached_objective = false 
  2388. 	on_trigger("m10_player_reached_objective_cb", M10_triggers.rooftop_elevator) 
  2389. 	trigger_enable(M10_triggers.rooftop_elevator, true) 
  2390. 	marker_add_trigger(M10_triggers.rooftop_elevator, MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, OI_ASSET_LOCATION, SYNC_ALL) 
  2391.  
  2392. 	-- Turn police (STAG) notoriety on 
  2393. 	hud_set_fake_notoriety("police", false) 
  2394. 	notoriety_reset("police") 
  2395. 	notoriety_set("police", M10_tweak_parameters.goto_hq_notoriety_level) 
  2396. 	notoriety_spawn_only_air(true) 
  2397. 	notoriety_set_can_decay(DISABLE) 
  2398. 	 
  2399. 	-- Unlock the elevator 
  2400. 	door_lock(M10_movers.club_doors.roof_exit.door_movers[1], false) 
  2401. 	 
  2402. 	audio_play_persona_line(M10_characters.viola, M10_dialog_lines.elevator_fixed) 
  2403. 	delay(4.0) 
  2404. 	-- Play some dialog 
  2405. 	audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.off_the_roof) 
  2406. 	delay(4.0) 
  2407. 	-- audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.back_to_hq) 
  2408.  
  2409. 	-- Wait until the player gets into the elevator 
  2410. 	while not M10_runtime.player_reached_objective do 
  2411. 		thread_yield() 
  2412. 	end	 
  2413. 	 
  2414. 	m10_cleanup_rooftop_escape() 
  2415. end 
  2416.  
  2417. -- Cleanup for the rooftop escape 
  2418. function m10_cleanup_rooftop_escape() 
  2419. 	-- Disable the kill region for the roof 
  2420. 	m10_clear_trigger(M10_triggers.roof_kill_region) 
  2421. 	 
  2422. 	-- Clean-up for any vehicles that were over the club's airspace, and disable the trigger 
  2423. 	for i, vehicle in pairs(M10_runtime.vehicles_in_airspace) do 
  2424. 		if (vehicle ~= "") then 
  2425. 			on_damage("", vehicle, 0.0) 
  2426. 		end 
  2427. 	end 
  2428. 	m10_clear_trigger(M10_triggers.roof_air_space) 
  2429.  
  2430. 	-- Disable the trigger for the elevator 
  2431. 	m10_clear_trigger(M10_triggers.rooftop_elevator) 
  2432. 	 
  2433. 	-- Stop the continuous spawn for the rooftops 
  2434. 	continuous_spawn_regions_enable(M10_spawn_regions.stag_roof, false) 
  2435. 	for i, spawn_group in pairs(M10_spawn_groups.stag_roof) do 
  2436. 		continuous_spawn_stop(spawn_group, true) 
  2437. 	end 
  2438. 	 
  2439. 	-- Stop the VTOL continuous spawn 
  2440. 	if (thread_check_done(M10_vtol_cont_spawn.thread_id) == false) then 
  2441. 		thread_kill(M10_vtol_cont_spawn.thread_id) 
  2442. 	end 
  2443. 	for i, group in pairs(M10_vtol_cont_spawn.groups) do 
  2444. 		if (group_is_loaded(group.name) == true) then 
  2445. 			group_destroy(group.name) 
  2446. 		end 
  2447. 		 
  2448. 		-- Make sure the markers got cleaned up 
  2449. 		marker_remove(group.vtol) 
  2450. 	end 
  2451. 	 
  2452. 	-- Clean-up any threads still running for the tanks chasing Oleg on the VTOL 
  2453. 	for i, tank in pairs(M10_groups.stag_ground_troops.tanks) do 
  2454. 		if (thread_check_done(tank.thread_id) == false) then 
  2455. 			thread_kill(tank.thread_id) 
  2456. 		end 
  2457. 	end 
  2458. 	 
  2459. 	if (group_is_loaded(M10_groups.stag_ground_troops.name) == true) then 
  2460. 		group_destroy(M10_groups.stag_ground_troops.name) 
  2461. 	end 
  2462. 	 
  2463. 	-- Clean-up Oleg and the VTOL 
  2464. 	if (group_is_loaded(M10_groups.oleg_vtol.name)) then 
  2465. 		group_destroy(M10_groups.oleg_vtol.name) 
  2466. 	end 
  2467. 	m10_cleanup_oleg() 
  2468. 	 
  2469. 	-- Clean-up all of the STAG script groups used on the rooftop 
  2470. 	--[[ 
  2471. 	if (group_is_loaded(M10_groups.attack_vtols_01.name) == true) then 
  2472. 		group_destroy(M10_groups.attack_vtols_01.name) 
  2473. 	end 
  2474. 	--]] 
  2475. 	if (group_is_loaded(M10_groups.attack_vtols_02.name) == true) then 
  2476. 		group_destroy(M10_groups.attack_vtols_02.name) 
  2477. 	end 
  2478. 	if (group_is_loaded(M10_groups.stag_transport_01.name) == true) then 
  2479. 		group_destroy(M10_groups.stag_transport_01.name) 
  2480. 	end 
  2481. 	if (group_is_loaded(M10_groups.vtol_flyby_01.name) == true) then 
  2482. 		group_destroy(M10_groups.vtol_flyby_01.name) 
  2483. 	end 
  2484. 	if (group_is_loaded(M10_groups.vtol_flyby_02.name) == true) then 
  2485. 		group_destroy(M10_groups.vtol_flyby_02.name) 
  2486. 	end 
  2487. 	if (group_is_loaded(M10_groups.stag_elevator_guys.name) == true) then 
  2488. 		group_destroy(M10_groups.stag_elevator_guys.name) 
  2489. 	end 
  2490. 	if group_is_loaded(M10_groups.weapons.name) then 
  2491. 		group_destroy(M10_groups.weapons.name) 
  2492. 	end 
  2493. 	 
  2494. 	-- Set the ambient ped/traffic density back to normal 
  2495. 	set_ped_density(1.0) 
  2496. end 
  2497.  
  2498.  
  2499. --[[ 
  2500. 	CHECKPOINT 04: Escape to the Saints HQ 
  2501. 	--]] 
  2502.  
  2503. -- Process escaping through the club after the rooftop battle 
  2504. function m10_run_escape_club_aftermath() 
  2505. 	objective_text_clear(0) 
  2506. 	objective_text( 0, "m10_obj_escape_to_saints_hq", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  2507.  
  2508. 	roadblocks_enable(true) 
  2509. 	 
  2510. 	--setup ground notoriety, no air spawns, but everyoen else is good to start 
  2511. 	-- will enable air spawns later 
  2512. 	notoriety_spawn_only_air(false) 
  2513. 	notoriety_force_no_air_spawn(true) 
  2514. 		 
  2515. 	set_ped_density(0.00001) 
  2516. 	set_traffic_density(0.00001) 
  2517. 	 
  2518. 	-- Enable the trigger at the strip club exit 
  2519. 	M10_runtime.player_reached_objective = false 
  2520. 	trigger_enable(M10_triggers.front_door_exit, true) 
  2521. 	on_trigger("m10_player_reached_objective_cb", M10_triggers.front_door_exit) 
  2522. 	marker_add_trigger(M10_triggers.front_door_exit, MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, OI_ASSET_LOCATION, SYNC_ALL) 
  2523. 	 
  2524. 	-- Unlock the front doors (and make sure they're closed) 
  2525. 	for i, door in pairs(M10_movers.club_doors.front_door.door_movers) do 
  2526. 		door_lock(door, false) 
  2527. 		door_close(door) 
  2528. 		 
  2529. 		-- Register a callback for when the front door is opened by the player 
  2530. 		on_door_opened("m10_front_door_opened_cb", door) 
  2531. 	end 
  2532. 	 
  2533. 	door_open(M10_movers.club_doors.lobby_door.door_movers[1], false, false) 
  2534. 	 
  2535. 	-- Interior troops rush and set up at the door 
  2536. 	for i, npc in pairs(M10_groups.stag_club_aftermath.members) do 
  2537. 		ai_add_enemy_target(npc, CLOSEST_PLAYER, ATTACK_ON_SIGHT, false) 
  2538. 	--	ai_attack_region(npc, M10_navpoints.stag_aftermath_rush, 8) 
  2539. 	end 
  2540. 	 
  2541. 	-- Disable the driver in the tank at the front of the club, from firing the main tank cannon 
  2542. 	-- npc_combat_enable(M10_groups.stag_ground_troops.tanks[5].chars[1], false) 
  2543. 	 
  2544. 	delay(1.5) 
  2545. 	m10_helper_play_conversation(M10_convo.to_hq, false) 
  2546. 	 
  2547. 	while (M10_runtime.player_reached_objective == false) do 
  2548. 		thread_yield() 
  2549. 	end 
  2550. 	 
  2551. 	M10_runtime.player_reached_objective = false 
  2552. 	trigger_enable(M10_triggers.club_exit, true) 
  2553. 	on_trigger("m10_player_reached_objective_cb", M10_triggers.club_exit) 
  2554. 	marker_add_trigger(M10_triggers.club_exit, MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, OI_ASSET_LOCATION, SYNC_ALL) 
  2555. 	 
  2556. 	-- Wait until the player reaches the trigger for the strip club exit 
  2557. 	M10_runtime.player_reached_objective = false 
  2558. 	while (M10_runtime.player_reached_objective == false) do 
  2559. 		thread_yield() 
  2560. 	end 
  2561. 	audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.exit_building) 
  2562. 	m10_cleanup_escape_club_aftermath() 
  2563. end 
  2564.  
  2565. -- Handle any cleanup for the sequence escaping the strip club interior 
  2566. function m10_cleanup_escape_club_aftermath() 
  2567. 	m10_clear_trigger(M10_triggers.club_exit) 
  2568. end 
  2569.  
  2570. -- Processing for the excape to Saint's HQ sequence 
  2571. function m10_run_escape_to_saints_hq() 
  2572. 	-- Setup the trigger at the Saint's HQ 
  2573. 	M10_runtime.player_reached_objective = false 
  2574. 	on_trigger("m10_player_reached_objective_cb", M10_triggers.saints_hq) 
  2575. 	trigger_enable(M10_triggers.saints_hq, true) 
  2576. 	marker_add_trigger(M10_triggers.saints_hq, MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, OI_ASSET_LOCATION, SYNC_ALL) 
  2577. 	waypoint_add(M10_triggers.saints_hq) 
  2578. 	 
  2579. 	--traffic_disable_lanes(M10_trigger.saints_hq_traffic, true) 
  2580. 	 
  2581. 	trigger_enable(M10_triggers.start_notoriety, true) 
  2582. 	on_trigger_exit("m10_start_notoriety_cb", M10_triggers.start_notoriety) 
  2583. 	 
  2584. 	M10_threads.escape_convo = thread_new("m10_thread_process_escape_to_hq_conversations") 
  2585. 	 
  2586. 	zscene_prep(M10_cutscenes.mission_outro) 
  2587. 	 
  2588. 	-- Wait until the player reaches the Saint's HQ 
  2589. 	while not M10_runtime.player_reached_objective do 
  2590. 		thread_yield() 
  2591. 	end 
  2592. 	 
  2593. 	audio_object_post_event( "m10_chase_music_stop" ) 
  2594. 	-- MLG (04/16/11): Don't clean up this checkpoint immediatly 
  2595. 	--m10_cleanup_escape_to_saints_hq() 
  2596. end 
  2597.  
  2598. -- Thread to process the conversations on the way back to the Saints' HQ 
  2599. function m10_thread_process_escape_to_hq_conversations() 
  2600. 	while(get_dist(LOCAL_PLAYER, M10_triggers.saints_hq) > M10_tweak_parameters.drive_01_dist_from_hq) do 
  2601. 		thread_yield() 
  2602. 	end 
  2603. 	 
  2604. 	m10_helper_play_conversation(M10_convo.drive_01, true) 
  2605. 	audio_conversation_end(M10_convo.drive_01.handle) 
  2606. 	delay(3.0) 
  2607. 	 
  2608. 	while(get_dist(LOCAL_PLAYER, M10_triggers.saints_hq) > M10_tweak_parameters.shaundi_update_dist_from_hq) do 
  2609. 		thread_yield() 
  2610. 	end 
  2611. 	 
  2612. 	M10_runtime.phonecall_complete = false 
  2613. 	audio_play_for_mission_cellphone(M10_convo.city_update.name , true, true, "", "m10_finish_phonecall_cb") 
  2614. 	while (M10_runtime.phonecall_complete == false) do 
  2615. 		thread_yield() 
  2616. 	end 
  2617. 	delay(3.0) 
  2618. 	 
  2619. 	-- while(get_dist(LOCAL_PLAYER, M10_triggers.saints_hq) > M10_tweak_parameters.drive_02_dist_from_hq) do 
  2620. 	-- 	thread_yield() 
  2621. 	-- end 
  2622. 	 
  2623. 	-- m10_helper_play_conversation(M10_convo.drive_02, true) 
  2624. 	-- audio_conversation_end(M10_convo.drive_02.handle) 
  2625. end 
  2626.  
  2627. -- Cleanup for the escape to Saints HQ sequence 
  2628. function m10_cleanup_escape_to_saints_hq() 
  2629. 	m10_clear_trigger(M10_triggers.saints_hq) 
  2630. 	--traffic_disable_lanes(M10_trigger.saints_hq_traffic, false) 
  2631. 	waypoint_remove() 
  2632. 	 
  2633. 	-- Clear the callbacks on the front doors 
  2634. 	for i, door in pairs(M10_movers.club_doors.front_door.door_movers) do 
  2635. 		on_door_opened("", door) 
  2636. 	end	 
  2637. 	 
  2638. 	group_destroy(M10_groups.stag_club_aftermath.name) 
  2639. 	group_destroy(M10_groups.stag_ext_aftermath.name) 
  2640. 	group_destroy(M10_groups.saints_hq.name) 
  2641. 	 
  2642. 	-- Disable the STAG encounters 
  2643. 	m10_helper_cleanup_stag_encounter(M10_groups.stag_encounter_bridge_01) 
  2644. 	m10_helper_cleanup_stag_encounter(M10_groups.stag_encounter_bridge_02) 
  2645. 	m10_helper_cleanup_stag_encounter(M10_groups.stag_encounter_chem_01) 
  2646. 	m10_helper_cleanup_stag_encounter(M10_groups.stag_encounter_bridge_03) 
  2647. 	m10_helper_cleanup_stag_encounter(M10_groups.stag_encounter_bridge_04) 
  2648. 	m10_helper_cleanup_stag_encounter(M10_groups.stag_encounter_bridge_05) 
  2649. 	 
  2650. 	-- Clean-up the conversation thread 
  2651. 	if (thread_check_done(M10_threads.escape_convo) == false) then 
  2652. 		thread_kill(M10_threads.escape_convo) 
  2653. 		M10_threads.escape_convo = INVALID_THREAD_HANDLE 
  2654. 	end 
  2655. end 
  2656.  
  2657. -- Callback for when the front door is opened by the player 
  2658. -- 
  2659. -- door_name:		Name of the door that was opened 
  2660. function m10_front_door_opened_cb(door_name)	 
  2661. 	-- Clear the mission cancel warp location 
  2662. 	mission_set_cancel_warp_location() 
  2663.  
  2664. 	-- Clear the callbacks on the front doors 
  2665. 	for i, door in pairs(M10_movers.club_doors.front_door.door_movers) do 
  2666. 		on_door_opened("", door) 
  2667. 	end	 
  2668. 	 
  2669. 	-- Remove the leash on the STAG in the streets, and allow notoriety to spawn ground troops 
  2670. 	-- delay(1.5) 
  2671. 	-- for i, char in pairs(M10_groups.stag_ground_troops.troops) do 
  2672. 	-- 	npc_leash_remove(char) 
  2673. 	-- end 
  2674. 	 
  2675. 	-- Wait 20 seconds before allowing ground notoriety troops to be spawned 
  2676. 	-- delay(20.0) 
  2677. 	-- notoriety_spawn_only_air(false) 
  2678. end 
  2679.  
  2680. -- Start normal notoriety spawns when leaving the club 
  2681. function m10_start_notoriety_cb() 
  2682. 	notoriety_reset("police") 
  2683. 	notoriety_set("police", M10_tweak_parameters.goto_hq_notoriety_level) 
  2684. 	notoriety_set_can_decay(DISABLE) 
  2685. 	notoriety_force_no_air_spawn(false) 
  2686. 	 
  2687. 	-- Set the ambient ped/traffic density 
  2688. 	set_ped_density(0.7) 
  2689. 	set_traffic_density(0.3) 
  2690. end 
  2691.  
  2692. -- *************************************************** 
  2693. -- Miscellaneous m10 Helper Funcrtions 
  2694. -- *************************************************** 
  2695.  
  2696. -- Simple function that spawns Oleg, adds him to the player's party, and sets his callbacks 
  2697. function m10_setup_oleg() 
  2698. 	group_create(M10_groups.oleg.name, true) 
  2699. 	party_add(M10_characters.oleg) 
  2700. 	follower_set_can_abandon(M10_characters.oleg, true) 
  2701. 	on_death("m10_oleg_died_cb", M10_characters.oleg) 
  2702. 	on_dismiss("m10_oleg_dismissed_cb", M10_characters.oleg) 
  2703. end 
  2704.  
  2705. -- Clean-up Oleg 
  2706. function m10_cleanup_oleg() 
  2707. 	if (group_is_loaded(M10_groups.oleg.name) == true) then 
  2708. 		party_dismiss(M10_characters.oleg) 
  2709. 		on_death("", M10_characters.oleg) 
  2710. 		on_dismiss("", M10_characters.oleg) 
  2711. 		group_destroy(M10_groups.oleg.name) 
  2712. 	end 
  2713. end 
  2714.  
  2715. -- Simple function that spawns Viola, adds her to the player's party, and sets her callbacks 
  2716. function m10_setup_viola() 
  2717. 	group_create(M10_groups.viola.name, true) 
  2718. 	party_add(M10_characters.viola) 
  2719. 	follower_set_can_abandon(M10_characters.viola, true) 
  2720. 	on_death("m10_viola_died_cb", M10_characters.viola) 
  2721. 	on_dismiss("m10_viola_dismissed_cb", M10_characters.viola) 
  2722. end 
  2723.  
  2724. -- Clean-up Viola 
  2725. function m10_cleanup_viola() 
  2726. 	if (group_is_loaded(M10_groups.viola.name) == true) then 
  2727. 		party_dismiss(M10_characters.viola) 
  2728. 		on_death("", M10_characters.viola) 
  2729. 		on_dismiss("", M10_characters.viola) 
  2730. 		group_destroy(M10_groups.viola.name) 
  2731. 	end 
  2732. end 
  2733.  
  2734. -- Setup the string club interior 
  2735. function m10_setup_club()	 
  2736. 	-- Initialize our enemy counts 
  2737. 	M10_runtime.ambush_soldiers_alive = 0 
  2738. 	 
  2739. 	audio_ambient_emitter_start( "m10_stripclub_music" ) 
  2740. 	-- Create the strippers and the stag ambush groups 
  2741. 	group_create(M10_groups.strippers.name, true) 
  2742. 	group_create_hidden(M10_groups.stag_ambush.name, true) 
  2743. 	for i, squad in pairs(M10_groups.stag_ambush.squads) do 
  2744. 		for j, char in pairs(squad.chars) do 
  2745. 			M10_runtime.ambush_soldiers_alive = M10_runtime.ambush_soldiers_alive + 1 
  2746. 			on_death("m10_stag_ambush_soldier_killed_cb", char) 
  2747. 			on_attack_performed(M10_timed_lines.stag.callback, char) 
  2748. 		end 
  2749. 	end 
  2750. end 
  2751.  
  2752. -- Setup the perimeter around the strip club 
  2753. function m10_setup_perimeter() 
  2754. 	-- Create all the perimeter groups 
  2755. 	group_create(M10_groups.police_containment.name, true) 
  2756. 	group_create(M10_groups.emergency_responders.name, true) 
  2757. 	group_create(M10_groups.stag_ground_troops.name, true) 
  2758. 	 
  2759. 	-- All the police vehicles should have flashers going 
  2760. 	for i, vehicle in pairs(M10_groups.police_containment.vehicles) do 
  2761. 		vehicle_set_sirenlights(vehicle, true) 
  2762. 	end 
  2763. 	 
  2764. 	-- Turn on the flashing lights for the emergency response vehicles, and put characters in their vehicles 
  2765. 	for i, vehicle in pairs(M10_groups.emergency_responders.vehicles) do 
  2766. 		-- Put all of the characters into the vehicle 
  2767. 		for j, char in pairs(vehicle.chars) do 
  2768. 			vehicle_enter_teleport(char, vehicle.vehicle, (j - 1), false)	-- don't block 
  2769. 		end 
  2770. 		 
  2771. 		-- This vehicle should not move 
  2772. 		vehicle_disable_chase(vehicle.vehicle, true) 
  2773. 		vehicle_disable_flee(vehicle.vehicle, true) 
  2774.  
  2775. 		-- Turn the lights on 
  2776. 		vehicle_set_sirenlights(vehicle.vehicle, true) 
  2777. 	end 
  2778. 	 
  2779. 	-- Setup the STAG tanks 
  2780. 	for i, tank in pairs(M10_groups.stag_ground_troops.tanks) do 
  2781. 		-- Put all the characters into the tank 
  2782. 		for j, char in pairs(tank.chars) do 
  2783. 			vehicle_enter_teleport(char, tank.tank, (j - 1), false)	-- don't block 
  2784. 			set_dont_attack_me_on_sight_flag(char, true) -- so homies don't attack the tanks 
  2785. 		end 
  2786. 		 
  2787. 		-- Make the tank stationary 
  2788. 		vehicle_disable_chase(tank.tank, true) 
  2789. 		vehicle_disable_flee(tank.tank, true) 
  2790. 	end 
  2791. 	 
  2792. 	-- Setup the ground troops 
  2793. 	for i, char in pairs(M10_groups.stag_ground_troops.troops) do 
  2794. 		ai_do_scripted_take_cover(char) 
  2795. 	end 
  2796. 	 
  2797. 	-- STAG should all be combat ready 
  2798. 	set_force_combat_ready_team("stag") 
  2799. end 
  2800.  
  2801. -- Setup for the rooftop 
  2802. function m10_setup_rooftop() 
  2803. 	audio_ambient_emitter_stop( "m10_stripclub_music" ) 
  2804. 	audio_object_post_event( "m10_amb_rooftop" ) 
  2805. 	 
  2806. 	-- Setup the kill region trigger (if the player get's flung off the roof) 
  2807. 	trigger_enable(M10_triggers.roof_kill_region, true) 
  2808. 	on_trigger("m10_roof_kill_region_cb", M10_triggers.roof_kill_region) 
  2809. 	 
  2810. 	-- Setup the trigger region for the roof airspace (so we can make sure helicopters don't crash on the roof) 
  2811. 	trigger_enable(M10_triggers.roof_air_space, true) 
  2812. 	on_trigger("m10_roof_air_space_entered", M10_triggers.roof_air_space) 
  2813. 	on_trigger_exit("m10_roof_air_space_exited", M10_triggers.roof_air_space) 
  2814. 	 
  2815. 	-- Adjust the player's homies to react to the VTOL threat 
  2816. 	ai_set_personality(M10_characters.oleg, "gang offensive") 
  2817. 	ai_set_personality(M10_characters.viola, "gang defensive") 
  2818. 	character_prevent_explosion_fling(M10_characters.oleg, true) 
  2819. 	character_prevent_explosion_fling(M10_characters.viola, true) 
  2820. 	follower_set_can_abandon(M10_characters.oleg, false) 
  2821. 	follower_set_can_abandon(M10_characters.viola, false) 
  2822. 	-- npc_suppress_persona(M10_characters.oleg, true) 
  2823. 	-- npc_suppress_persona(M10_characters.viola, true) 
  2824. 	 
  2825. 	set_ped_density(0.00001) 
  2826. 	set_traffic_density(0.00001) 
  2827. end 
  2828.  
  2829. -- Setup the rooftop intro 
  2830. function m10_setup_rooftop_intro() 
  2831. 	-- Create the initial group of VTOL flying by the player 
  2832. 	group_create_hidden(M10_groups.vtol_intro_flyby_01.name, true) 
  2833. end 
  2834.  
  2835. -- Setup the aftermath when the player escapes through the strip club 
  2836. function m10_setup_club_aftermath() 
  2837. 	-- Setup some stag remaining in the club 
  2838. 	group_create(M10_groups.stag_club_aftermath.name, true) 
  2839. 	group_create(M10_groups.stag_ext_aftermath.name, true) 
  2840. 	group_create(M10_groups.saints_hq.name, true) 
  2841. 	for i, npc in pairs(M10_groups.stag_ext_aftermath.gunners) do 
  2842. 		vehicle_enter_teleport(npc, M10_groups.stag_ext_aftermath.vehicle[i], 4, true) 
  2843. 	end 
  2844. 	 
  2845. 	-- Enable the STAG encounters 
  2846. 	m10_helper_setup_stag_encounter(M10_groups.stag_encounter_bridge_01) 
  2847. 	m10_helper_setup_stag_encounter(M10_groups.stag_encounter_bridge_02) 
  2848. 	m10_helper_setup_stag_encounter(M10_groups.stag_encounter_chem_01) 
  2849. 	m10_helper_setup_stag_encounter(M10_groups.stag_encounter_bridge_03) 
  2850. 	m10_helper_setup_stag_encounter(M10_groups.stag_encounter_bridge_04) 
  2851. 	m10_helper_setup_stag_encounter(M10_groups.stag_encounter_bridge_05) 
  2852. 	 
  2853. 	-- Load the persona for Shaundi 
  2854. 	M10_personas.shaundi.persona_id = audio_persona_load_2d(M10_personas.shaundi.name) 
  2855. 	 
  2856. 	-- Turn notoriety off 
  2857. 	notoriety_reset("police") 
  2858. 	notoriety_force_no_spawn("police", true) 
  2859. 	 
  2860. 	-- Viola can be abandoned again 
  2861. 	follower_set_can_abandon(M10_characters.viola, false) 
  2862. 	audio_object_post_event( "m10_amb_rooftop_stop" ) 
  2863. 	audio_object_post_event( "m10_chase_music" ) 
  2864. 	 
  2865. 	-- npc_suppress_persona(M10_characters.viola, true) 
  2866. end 
  2867.  
  2868. -- Disable trigger, clear callback, and remove marker 
  2869. -- 
  2870. -- trigger:			(string) Name of the trigger 
  2871. function m10_clear_trigger(trigger) 
  2872. 	on_trigger("", trigger) 
  2873. 	on_trigger_exit("", trigger) 
  2874. 	trigger_enable(trigger, DISABLE) 
  2875. 	marker_remove_trigger(trigger, SYNC_ALL) 
  2876. end 
  2877.  
  2878. -- Setup a door into it's initial state 
  2879. -- 
  2880. -- door:		(lua table) for the door, as defined under M10_movers::club_doors 
  2881. function m10_setup_door(door) 
  2882. 	for i, mover in pairs(door.door_movers) do 
  2883. 		-- Open/close the door 
  2884. 		if (door.open == true) then 
  2885. 			door_open(mover) 
  2886. 		else 
  2887. 			door_close(mover) 
  2888. 		end 
  2889. 		 
  2890. 		-- Lock/unlock the door 
  2891. 		door_lock(mover, door.locked) 
  2892. 	end 
  2893. end 
  2894.  
  2895. -- Setup helper for STAG attack VTOLs (assumes the group has already been created) 
  2896. -- 
  2897. -- vtol_table:		(lua table) for the VTOL, as defined under M10_groups::attack_vtol 
  2898. function m10_setup_stag_attack_vtol(vtol_table) 
  2899. 	on_vehicle_destroyed("m10_vtol_destroyed_cb", vtol_table.vtol) 
  2900. 	 
  2901. 	-- Add the VTOL to the list of spawned VTOLs 
  2902. 	M10_runtime.spawned_vtols[#M10_runtime.spawned_vtols + 1] = vtol_table.vtol 
  2903.  
  2904. 	vehicle_enter_group_teleport(vtol_table.chars, vtol_table.vtol) 
  2905. 	vehicle_disable_flee(vtol_table.vtol, true) 
  2906. 	 
  2907. 	-- Add the VTOL to our active count 
  2908. 	M10_runtime.roof_attack_vtols_active = M10_runtime.roof_attack_vtols_active + 1 
  2909. end 
  2910.  
  2911. -- Helper function to play a mission conversation 
  2912. -- 
  2913. -- convo_table:		Lua table defining the conversation to play (see M10_convo) 
  2914. -- block:			TRUE if the function should block until the conversation is finished, FALSE otherwise 
  2915. function m10_helper_play_conversation(convo_table, block) 
  2916. 	-- Load the conversation data 
  2917. 	if (convo_table.load_direct == false) then 
  2918. 		convo_table.handle = audio_conversation_load(convo_table.name) 
  2919. 	else 
  2920. 		convo_table.handle = audio_conversation_load_direct(convo_table.name) 
  2921. 	end 
  2922. 	 
  2923. 	-- Play the conversation 
  2924. 	audio_conversation_play(convo_table.handle) 
  2925. 	 
  2926. 	-- Should we wait for the conversation to end? 
  2927. 	if (block == true) then 
  2928. 		audio_conversation_wait_for_end(convo_table.handle) 
  2929. 		audio_conversation_end(convo_table.handle) 
  2930. 		convo_table.handle = INVALID_CONVERSATION_HANDLE 
  2931. 	end 
  2932. end 
  2933.  
  2934. -- Thread to process moving a vechile to a destination, and forcing all the occupants to exit the vehicle 
  2935. -- 
  2936. -- vehicle_table:	Lua table defining the vehicle info, path, etc. (see M10_groups.stag_encounter_bridge.vehicles) 
  2937. function m10_do_vehicle_exit_at_dest_thread(vehicle_table) 
  2938. 	-- Teleport the characters into the group, setup the vehicle 
  2939. 	vehicle_enter_group_teleport(vehicle_table.chars, vehicle_table.vehicle) 
  2940. 	vehicle_ignore_repulsors(vehicle_table.vehicle, true) 
  2941. 	-- vehicle_infinite_mass(vehicle_table.vehicle, true) 
  2942. 	 
  2943. 	-- Do the pathfind 
  2944. 	vehicle_pathfind_to(vehicle_table.vehicle, vehicle_table.path, vehicle_table.use_navmesh, true) 
  2945. 	 
  2946. 	-- Turn off infinite mass 
  2947. 	vehicle_ignore_repulsors(vehicle_table.vehicle, false) 
  2948. 	-- vehicle_infinite_mass(vehicle_table.vehicle, false) 
  2949. 	 
  2950. 	-- Wait a second and then force the enemies to exit the vehicle 
  2951. 	delay(1.0) 
  2952. 	vehicle_exit_group(vehicle_table.chars) 
  2953. end 
  2954.  
  2955. -- Thread to process moving a vehicle to a destination and stopping (and staying put with occupants inside) 
  2956. -- 
  2957. -- vehicle_table:	Lua table defining the vehicle info, path, etc. (see M10_groups.stag_encounter_bridge.vehicles) 
  2958. function m10_do_vehicle_stop_at_dest_thread(vehicle_table) 
  2959. 	-- Teleport the characters into the group, setup the vehicle 
  2960. 	vehicle_enter_group_teleport(vehicle_table.chars, vehicle_table.vehicle) 
  2961. 	vehicle_suppress_npc_exit(vehicle_table.vehicle, true) 
  2962. 	vehicle_ignore_repulsors(vehicle_table.vehicle, true) 
  2963. 	-- vehicle_infinite_mass(vehicle_table.vehicle, true) 
  2964. 	 
  2965. 	-- Do the pathfind 
  2966. 	if (vehicle_table.path ~= nil and vehicle_table.path ~= "") then 
  2967. 		vehicle_pathfind_to(vehicle_table.vehicle, vehicle_table.path, vehicle_table.use_navmesh, true) 
  2968. 	end 
  2969. 	 
  2970. 	-- Turn off infinite mass 
  2971. 	vehicle_ignore_repulsors(vehicle_table.vehicle, false) 
  2972. 	-- vehicle_infinite_mass(vehicle_table.vehicle, false) 
  2973. 	 
  2974. 	-- Disable fleeing and chasing 
  2975. 	vehicle_disable_flee(vehicle_table.vehicle, true) 
  2976. 	vehicle_disable_chase(vehicle_table.vehicle, true) 
  2977. end 
  2978.  
  2979. -- Create the script group for a STAG encounter 
  2980. -- 
  2981. -- encounter_table:		Lua table defining the STAG encounter info (see M10_groups.stag_encounter_bridge) 
  2982. function m10_create_stag_encounter_thread(encounter_table) 
  2983. 	-- Create the script group 
  2984. 	if (group_is_loaded(encounter_table.name) == false) then 
  2985. 		group_create_hidden(encounter_table.name, true) 
  2986. 	end 
  2987. end 
  2988.  
  2989. -- Destroy a STAG encounter 
  2990. -- 
  2991. -- encounter_table:		Lua table defining the STAG encounter info (see M10_groups.stag_encounter_bridge) 
  2992. function m10_destroy_stag_encounter_thread(encounter_table) 
  2993. 	-- Stop any running vehicel threads 
  2994. 	for i, vehicle in pairs(encounter_table.vehicles) do 
  2995. 		if (thread_check_done(vehicle.thread_id) == false) then 
  2996. 			thread_kill(vehicle.thread_id) 
  2997. 			vehicle.thread_id = INVALID_THREAD_HANDLE 
  2998. 		end 
  2999. 		 
  3000. 		-- Remvoe any vehicle trigger 
  3001. 		if (vehicle.trigger ~= nil) then 
  3002. 			trigger_enable(vehicle.trigger, false) 
  3003. 			on_trigger("", vehicle.trigger) 
  3004. 		end 
  3005. 	end 
  3006. 	 
  3007. 	-- Destroy the script group 
  3008. 	if (group_is_loaded(encounter_table.name) == true) then 
  3009. 		group_destroy(encounter_table.name) 
  3010. 	end 
  3011. 	 
  3012. 	encounter_table.active = false 
  3013. end 
  3014.  
  3015. -- Callback when the player enters the creation trigger region for a STAG encounter 
  3016. -- 
  3017. -- triggerer:		Name of the player that triggered the callback 
  3018. -- trigger_name:	Name of the trigger that was entered 
  3019. function m10_stag_encounter_entered_cb(triggerer, trigger_name) 
  3020. 	-- Search through all the encounters that have been setup 
  3021. 	for i, encounter in pairs(M10_runtime.stag_encounters) do 
  3022. 		if (encounter.creation_trigger == trigger_name) then 
  3023. 			-- If the player count was at 0, then start the encounter 
  3024. 			if (encounter.player_count == 0) then 
  3025. 				-- Kill any existing threads for the encounter, and start a new thread to start-up the encounter 
  3026. 				if (thread_check_done(encounter.thread_id) == false) then 
  3027. 					thread_kill(encounter.thread_id) 
  3028. 				end 
  3029. 				encounter.thread_id = thread_new("m10_create_stag_encounter_thread", encounter) 
  3030. 			end 
  3031. 			 
  3032. 			-- Increment the player counter 
  3033. 			encounter.player_count = encounter.player_count + 1 
  3034. 			break 
  3035. 		end 
  3036. 	end 
  3037. end 
  3038.  
  3039. -- Callback when the players exits the creation trigger region for a STAG encounter 
  3040. -- 
  3041. -- triggerer:		Name of the player that triggered the callback 
  3042. -- trigger_name:	Name of the trigger that was entered 
  3043. function m10_stag_encounter_exited_cb(triggerer, trigger_name) 
  3044. 	-- Search through all the encounters that have been setup 
  3045. 	for i, encounter in pairs(M10_runtime.stag_encounters) do 
  3046. 		if (encounter.creation_trigger == trigger_name) then 
  3047. 			-- Decrement the player count 
  3048. 			encounter.player_count = encounter.player_count - 1 
  3049. 			 
  3050. 			-- If the player count is at zero, stop the encounter 
  3051. 			if (encounter.player_count <= 0) then 
  3052. 				-- Kill any existing threads for the encounter, and start a new thread to stop the encounter 
  3053. 				if (thread_check_done(encounter.thread_id) == false) then 
  3054. 					thread_kill(encounter.thread_id) 
  3055. 				end 
  3056. 				encounter.thread_id = thread_new("m10_destroy_stag_encounter_thread", encounter) 
  3057. 			end 
  3058. 			break 
  3059. 		end 
  3060. 	end 
  3061. end 
  3062.  
  3063. -- Callback when a player enter the trigger region that activates the "action" on a STAG encounter (show enemies and do individual behaviors) 
  3064. -- 
  3065. -- triggerer:		Name of the player that triggered the callback 
  3066. -- trigger_name:	Name of the trigger that was entered 
  3067. function m10_stag_encounter_do_action_cb(triggerer, trigger_name) 
  3068. 	-- Search through all the encounters that have been setup 
  3069. 	for i, encounter in pairs(M10_runtime.stag_encounters) do 
  3070. 		if (encounter.action_trigger == trigger_name) then 
  3071. 			if (encounter.active == false and group_is_loaded(encounter.name) == true) then 
  3072. 				if (encounter.max_activations == -1 or encounter.num_activations < encounter.max_activations) then 
  3073. 					-- Show the group			 
  3074. 					group_show(encounter.name) 
  3075. 					 
  3076. 					-- Setup all the vehicles 
  3077. 					for i, vehicle in pairs(encounter.vehicles) do 
  3078. 						-- This is the tank Oleg targets during his encounter 
  3079. 						if (vehicle.vehicle == "veh_tank_bridge_03_ 001") then 
  3080. 							on_vehicle_destroyed("m13_oleg_tank_cb", vehicle.vehicle) 
  3081. 						end 
  3082. 						 
  3083. 						-- This is Oleg's VTOL on his bridge encounter 
  3084. 						if (vehicle.vehicle == "veh_vtol_bridge_03_ 001") then 
  3085. 							vehicle_anim_start(vehicle.vehicle, "Oleg vtol attack", "Oleg vtol jump") 
  3086. 						end 
  3087. 						 
  3088. 						if (vehicle.behavior == "exit_at_dest") then 
  3089. 							vehicle.thread_id = thread_new("m10_do_vehicle_exit_at_dest_thread", vehicle) 
  3090. 						elseif (vehicle.behavior == "stop_at_dest") then 
  3091. 							vehicle.thread_id = thread_new("m10_do_vehicle_stop_at_dest_thread", vehicle) 
  3092. 						elseif (vehicle.behavior == "fly_by") then 
  3093. 							vehicle.thread_id = thread_new("m10_thread_run_stag_flyby_vtol", vehicle) 
  3094. 						elseif (vehicle.behavior == "fly_by_and_shoot") then 
  3095. 							-- Setup the shoot trigger 
  3096. 							trigger_enable(vehicle.trigger, true) 
  3097. 							on_trigger("m10_vtol_flyby_fire_cb", vehicle.trigger) 
  3098. 							 
  3099. 							vehicle.thread_id = thread_new("m10_thread_run_stag_flyby_vtol", vehicle) 
  3100. 						end 
  3101. 					end 
  3102. 					 
  3103. 					-- Flag the encounter as active 
  3104. 					encounter.active = true 
  3105. 					encounter.num_activations = encounter.num_activations + 1 
  3106. 				end 
  3107. 			end 
  3108. 			 
  3109. 			break 
  3110. 		end 
  3111. 	end 
  3112. end 
  3113.  
  3114. function m13_oleg_tank_cb(vehicle) 
  3115. 	on_vehicle_destroyed("", vehicle) 
  3116. 	audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.oleg_riding_vtol) 
  3117. end 
  3118.  
  3119. -- Setup a STAG encounter 
  3120. -- 
  3121. -- encounter_table:		Lua table defining the STAG encounter info (see M10_groups.stag_encounter_bridge) 
  3122. function m10_helper_setup_stag_encounter(encounter_table) 
  3123. 	-- Enable the creation and action triggers 
  3124. 	trigger_enable(encounter_table.creation_trigger, true) 
  3125. 	on_trigger("m10_stag_encounter_entered_cb", encounter_table.creation_trigger) 
  3126. 	on_trigger_exit("m10_stag_encounter_exited_cb", encounter_table.creation_trigger) 
  3127.  
  3128. 	trigger_enable(encounter_table.action_trigger, true) 
  3129. 	on_trigger("m10_stag_encounter_do_action_cb", encounter_table.action_trigger) 
  3130. 	 
  3131. 	-- Initialize the player count and add this encounter table to the array 
  3132. 	encounter_table.player_count = 0 
  3133. 	encounter_table.num_activations = 0 
  3134. 	encounter_table.active = false 
  3135. 	M10_runtime.stag_encounters[#M10_runtime.stag_encounters + 1] = encounter_table 
  3136. end 
  3137.  
  3138. -- Clean-up a STAG encounter 
  3139. -- 
  3140. -- encounter_table:		Lua table defining the STAG encounter info (see M10_groups.stag_encounter_bridge) 
  3141. function m10_helper_cleanup_stag_encounter(encounter_table) 
  3142. 	-- Clean-up the creation and action triggers 
  3143. 	trigger_enable(encounter_table.creation_trigger, false) 
  3144. 	on_trigger("", encounter_table.creation_trigger) 
  3145. 	on_trigger_exit("", encounter_table.creation_trigger) 
  3146.  
  3147. 	trigger_enable(encounter_table.action_trigger, false) 
  3148. 	on_trigger("", encounter_table.action_trigger) 
  3149. 	 
  3150. 	-- Stop any running threads 
  3151. 	if (thread_check_done(encounter_table.thread_id) == false) then 
  3152. 		thread_kill(encounter_table.thread_id) 
  3153. 		encounter_table.thread_id = INVALID_THREAD_HANDLE 
  3154. 	end 
  3155.  
  3156. 	-- Stop the encoutner (in case it was still running) 
  3157. 	m10_destroy_stag_encounter_thread(encounter_table) 
  3158. 	 
  3159. 	-- Remove the encounter from the list of encounters 
  3160. 	for i, encounter in pairs(M10_runtime.stag_encounters) do 
  3161. 		if (encounter_table == encounter) then 
  3162. 			M10_runtime.stag_encounters[i] = M10_runtime.stag_encounters[#M10_runtime.stag_encounters] 
  3163. 		end 
  3164. 	end 
  3165. end 
  3166.  
  3167. -- Helper function to clear any vehicle corpses from the club's rooftop 
  3168. function m10_helper_clear_club_rooftop() 
  3169. 	for i, vtol in pairs(M10_runtime.spawned_vtols) do 
  3170. 		if (object_is_in_trigger(M10_triggers.club_roof_area, vtol) == true) then 
  3171. 			vehicle_hide(vtol, true) 
  3172. 		end 
  3173. 	end 
  3174. end 
  3175.  
  3176. -- ************************* 
  3177. -- 
  3178. -- Callback functions 
  3179. -- 
  3180. -- ************************* 
  3181.  
  3182. --finished a phonecall 
  3183. function m10_finish_phonecall_cb() 
  3184. 	M10_runtime.phonecall_complete = true 
  3185. end 
  3186.  
  3187. 	 
  3188. --attack callback 
  3189. function m10_stag_attack_cb(name)		 
  3190. 	-- don't play this if we have done this recently 
  3191. 	if (not thread_check_done(M10_timed_lines.stag.timer)) then 
  3192. 		return 
  3193. 	end 
  3194. 	 
  3195. 	-- start timer 
  3196. 	M10_timed_lines.stag.timer = thread_new("delay", M10_timed_lines.stag.delay) 
  3197. 	-- play situation 
  3198. 	audio_play_persona_line(name, M10_timed_lines.stag.situation) 
  3199.  
  3200. end 
  3201.  
  3202. -- Oleg died, fail the mission 
  3203. function m10_oleg_died_cb() 
  3204. 	mission_end_failure("m10", M10_strings.failure_oleg_died) 
  3205. end 
  3206.  
  3207. -- Viola died, fail the mission 
  3208. function m10_viola_died_cb() 
  3209. 	mission_end_failure("m10", M10_strings.failure_viola_died) 
  3210. end 
  3211.  
  3212. -- Oleg dismissed, fail the mission 
  3213. function m10_oleg_dismissed_cb() 
  3214. 	mission_end_failure("m10", M10_strings.failure_oleg_dismissed) 
  3215. end 
  3216.  
  3217. -- Viola dismissed, fail the mission 
  3218. function m10_viola_dismissed_cb() 
  3219. 	mission_end_failure("m10", M10_strings.failure_viola_dismissed) 
  3220. end 
  3221.  
  3222. -- Callback triggered when a player enters a destination trigger region 
  3223. -- 
  3224. -- triggerer:		Name of the character that entered the trigger region 
  3225. -- trigger_name:	Name of the trigger region that the character entered 
  3226. function m10_player_reached_objective_cb(triggerer, trigger_name) 
  3227. 	M10_runtime.player_reached_objective = true 
  3228. 	m10_clear_trigger(trigger_name) 
  3229. end 
  3230.  
  3231. -- Callback when a player enters the kill region for falling off the roof 
  3232. -- 
  3233. -- triggerer:		Name of the character that entered the trigger region 
  3234. -- trigger_name:	Name of the trigger region that the character entered 
  3235. function m10_roof_kill_region_cb(triggerer, trigger_name) 
  3236. 	if ((triggerer == LOCAL_PLAYER) or (triggerer == REMOTE_PLAYER) or (triggerer == M10_characters.oleg) or (triggerer == M10_characters.viola)) then 
  3237. 		character_kill(triggerer, true) 
  3238. 	end 
  3239. end 
  3240.  
  3241. -- Callback when a character enters the airspace above the strip club roof 
  3242. -- 
  3243. -- triggerer:		Name of the character that entered the trigger region 
  3244. -- trigger_name:	Name of the trigger region that the character entered 
  3245. function m10_roof_air_space_entered(triggerer, trigger_name) 
  3246. 	if (triggerer == nil or triggerer == "") then 
  3247. 		return 
  3248. 	end 
  3249. 	 
  3250. 	local vehicle_name = get_char_vehicle_name(triggerer) 
  3251. 	if (vehicle_name == nil or vehicle_name == "") then 
  3252. 		return 
  3253. 	end 
  3254. 	 
  3255. 	for i, vehicle in pairs(M10_runtime.vehicles_in_airspace) do 
  3256. 		if (vehicle == vehicle_name) then 
  3257. 			return 
  3258. 		end 
  3259. 	end 
  3260. 	 
  3261. 	-- If the character is in a valid vehicle, then see if we need to do any setup on it 
  3262. 	if ((vehicle_is_helicopter(vehicle_name) == true or vehicle_is_vtol(vehicle_name) == true)) then 
  3263. 		local free_idx = -1 
  3264. 	 
  3265. 		-- Check if the vehicle is already in the list 
  3266. 		for i, vehicle in pairs(M10_runtime.vehicles_in_airspace) do 
  3267. 			if (vehicle == vehicle_name) then 
  3268. 				-- Already in the list, nothing to do 
  3269. 				return 
  3270. 			elseif (vehicle == "") then 
  3271. 				-- Mark any free slots we've found 
  3272. 				free_idx = i 
  3273. 			end 
  3274. 		end 
  3275. 		 
  3276. 		-- The vehicle wasn't in the list, so we need to set it up 
  3277. 		on_damage("m10_vehicle_over_roof_damaged", vehicle_name, 0.1) 
  3278. 		local new_min = get_max_hit_points(vehicle_name) * 0.1 
  3279. 		set_min_hit_points(vehicle_name, new_min) 
  3280. 		local driver = vehicle_get_driver(vehicle_name) 
  3281. 		if (driver ~= nil) then 
  3282. 			turn_invulnerable(vehicle_get_driver(vehicle_name)) 
  3283. 		end 
  3284. 		 
  3285. 		-- Store the name of the vehicle 
  3286. 		if (free_idx == -1) then 
  3287. 			free_idx = sizeof_table(M10_runtime.vehicles_in_airspace) + 1 
  3288. 		end 
  3289. 		M10_runtime.vehicles_in_airspace[free_idx] = vehicle_name 
  3290. 	end 
  3291. end 
  3292.  
  3293. -- Callback when a character enters the airspace above the strip club roof 
  3294. -- 
  3295. -- triggerer:		Name of the character that entered the trigger region 
  3296. -- trigger_name:	Name of the trigger region that the character entered 
  3297. function m10_roof_air_space_exited(triggerer, trigger_name) 
  3298. 	if (triggerer == nil or triggerer == "") then 
  3299. 		return 
  3300. 	end 
  3301. 	 
  3302. 	local vehicle_name = get_char_vehicle_name(triggerer) 
  3303. 	if (vehicle_name == nil or vehicle_name == "") then 
  3304. 		return 
  3305. 	end 
  3306. 	 
  3307. 	if (vehicle_name ~= "") then 
  3308. 		-- Find the vehicle in our list 
  3309. 		for i, vehicle in pairs(M10_runtime.vehicles_in_airspace) do 
  3310. 			if (vehicle == vehicle_name) then 
  3311. 				on_damage("", vehicle_name) 
  3312. 				local driver = vehicle_get_driver(vehicle_name) 
  3313. 				if (driver ~= nil) then 
  3314. 					turn_vulnerable(driver) 
  3315. 				end 
  3316. 				set_min_hit_points(vehicle_name, 0) 
  3317. 				M10_runtime.vehicles_in_airspace[i] = "" 
  3318. 				return 
  3319. 			end 
  3320. 		end 
  3321. 	end		 
  3322. end 
  3323.  
  3324. -- Callback when a vehicle currently in the airspace above the strip club is damaged past 0.1 health 
  3325. -- 
  3326. -- victim:		Name of the object that was damaged 
  3327. function m10_vehicle_over_roof_damaged(victim) 
  3328. 	if (victim == "") then 
  3329. 		return 
  3330. 	end 
  3331. 	-- Remove this callback 
  3332. 	on_damage("", victim) 
  3333. 	turn_invulnerable(victim) 
  3334. 	 
  3335. 	--add this guy to a list 
  3336. 	-- Check if the vehicle is already in the list 
  3337. 	local free_idx = -1 
  3338. 	local found_vehicle = false 
  3339. 	for i, vehicle in pairs(M10_runtime.damaged_vehicles_exiting) do 
  3340. 		if (vehicle == victim) then 
  3341. 			-- Already in the list, nothing to do 
  3342. 			found_vehicle = true 
  3343. 		elseif (vehicle == "") then 
  3344. 			-- Mark any free slots we've found 
  3345. 			free_idx = i 
  3346. 		end 
  3347. 	end 
  3348. 	if (free_idx == -1) then 
  3349. 		free_idx = sizeof_table(M10_runtime.damaged_vehicles_exiting) + 1 
  3350. 	end 
  3351. 	M10_runtime.damaged_vehicles_exiting[free_idx] = victim 
  3352. 	 
  3353. 	-- Smoke and fire time 
  3354. 	vehicle_set_smoke_and_fire_state(victim, true, false) 
  3355.  
  3356. 	-- Pick a random point to fly to outside of the club's airspace, and fly to it 
  3357. 	local point_idx = rand_int(1, sizeof_table(M10_navpoints.clear_airspace_points)) 
  3358. 	helicopter_fly_to_dont_stop(victim, -1, M10_navpoints.clear_airspace_points[point_idx]) 
  3359. 	 
  3360. 	-- Now destroy the helicopter 
  3361. 	vehicle_set_smoke_and_fire_state(victim, true, true) 
  3362. 	set_min_hit_points(victim, 0) 
  3363. 	 
  3364. 	delay(1) 
  3365. 	turn_vulnerable(victim) 
  3366. 	vehicle_detonate(victim) 
  3367. 	 
  3368. 	for i, vehicle in pairs(M10_runtime.damaged_vehicles_exiting) do 
  3369. 		if (vehicle == victim) then 
  3370. 			M10_runtime.damaged_vehicles_exiting[i] = "" 
  3371. 			return 
  3372. 		end 
  3373. 	end 
  3374. end 
  3375.  
  3376. -- Called when one of the vtols the player must destroy dies 
  3377. -- 
  3378. -- vehicle_name:	Name of the vehicle that wsa destroyed 
  3379. function m10_vtol_destroyed_cb(vehicle_name) 
  3380. 	M10_runtime.roof_attack_vtols_killed = M10_runtime.roof_attack_vtols_killed + 1 
  3381.  
  3382. 	on_vehicle_destroyed("", vehicle_name) 
  3383. 	marker_remove(vehicle_name) 
  3384. end 
  3385.  
  3386. function m10_transport_vtol_destroyed_cb(victim) 
  3387. 	on_vehicle_destroyed("", victim) 
  3388. 	--wait, then unload this dude, high component vehicles suck 
  3389. 	delay(10) 
  3390. 	if (victim == M10_groups.stag_transport_01a_vtol.vtol) then 
  3391. 		cleanup_groups(M10_groups.stag_transport_01a_vtol.name) 
  3392. 	elseif (victim == M10_groups.stag_transport_01_vtol.vtol) then 
  3393. 		cleanup_groups(M10_groups.stag_transport_01_vtol.name) 
  3394. 	elseif (victim == M10_groups.stag_transport_02_vtol.vtol) then 
  3395. 		cleanup_groups(M10_groups.stag_transport_02_vtol.name) 
  3396. 	elseif (victim == M10_groups.stag_transport_02b_vtol.vtol) then 
  3397. 		cleanup_groups(M10_groups.stag_transport_02b_vtol.name) 
  3398. 	elseif (victim == M10_groups.stag_transport_03_vtol.vtol) then 
  3399. 		cleanup_groups(M10_groups.stag_transport_03_vtol.name) 
  3400. 	elseif (victim == M10_groups.stag_transport_04_vtol.vtol) then 
  3401. 		cleanup_groups(M10_groups.stag_transport_04_vtol.name) 
  3402. 	elseif (victim == M10_groups.stag_transport_05_vtol.vtol) then 
  3403. 		cleanup_groups(M10_groups.stag_transport_05_vtol.name) 
  3404. 	end 
  3405. end 
  3406.  
  3407. -- Callback when a character in a VTOL in the flyby enters the fire region 
  3408. -- 
  3409. -- triggerer:		Character that entered the trigger region 
  3410. -- trigger_name:	Name of the trigger region that the chracter entered 
  3411. function m10_vtol_flyby_fire_cb(triggerer, trigger_name) 
  3412. 	local vtol_group = nil 
  3413.  
  3414. 	-- Find the VTOL group containing this triggerer 
  3415. 	for i, vtol in pairs(M10_runtime.vtol_flyby_groups) do 
  3416. 		for j, char in pairs(vtol.chars) do 
  3417. 			if (char == triggerer) then 
  3418. 				vtol_group = vtol 
  3419. 			end 
  3420. 		end 
  3421. 	end 
  3422. 	 
  3423. 	-- If we found a VTOL group and it hasn't fired yet, then trigger the forced fire 
  3424. 	if (vtol_group ~= nil and vtol_group.fired == false) then 
  3425. 		for i, char in pairs(vtol_group.chars) do 
  3426. 			-- Need to add an enemy, to make sure the pilot equips the VTOL weapon 
  3427. 			if (vtol_group.target ~= "") then 
  3428. 				ai_add_enemy_target(char, vtol_group.target, ATTACK_NOW_NEVER_LOSE, false) 
  3429. 			end 
  3430. 			set_perfect_aim(char, true) 
  3431. 		end 
  3432. 		 
  3433. 		-- Mark that this VTOL has fired 
  3434. 		vtol_group.fired = true 
  3435. 		 
  3436. 		-- Determine what type of target this VTOL is supposed to shoot at 
  3437. 		if (vtol_group.target_nav ~= nil) then 
  3438. 			helicopter_shoot_navpoint(vtol_group.vehicle, vtol_group.target_nav, vtol_group.rockets) 
  3439. 		elseif (vtol_group.target ~= "") then 
  3440. 			helicopter_shoot_human(vtol_group.vehicle, vtol_group.target, false, 0.0, vtol_group.rockets) 
  3441. 		end 
  3442. 	end 
  3443. 	 
  3444. 	--audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.oleg_riding_vtol) 
  3445. end 
  3446.  
  3447.  
  3448. -- ************************* 
  3449. -- 
  3450. -- Thread functions 
  3451. -- 
  3452. -- ************************* 
  3453.  
  3454. -- Helper function to process an attack VTOL flying to it's initial destination 
  3455. -- 
  3456. -- vehicle_table:	VTOL Lua table (as defined in M10_groups::attack_vtols::vtols) 
  3457. function m10_attack_vtol_fly_to(vehicle_table) 
  3458. 	-- Wait the specified amount of time 
  3459. 	delay(vehicle_table.delay) 
  3460. 	 
  3461. 	-- Fly to the destination 
  3462. 	vehicle_max_speed(vehicle_table.vtol, vehicle_table.speed) 
  3463. 	helicopter_fly_to_direct(vehicle_table.vtol, vehicle_table.speed, vehicle_table.destination) 
  3464. 	vehicle_max_speed(vehicle_table.vtol, -1.0) 
  3465. end 
  3466.  
  3467. -- Main thread for the vtols in the survive portion of the mission 
  3468. -- 
  3469. -- vehicle_table:	VTOL Lua table (as defined in M10_groups::attack_vtols::vtols) 
  3470. -- do_pathfind:		TRUE if the VTOL should do the initial pathfind, false otherwise 
  3471. function m10_vtol_attack_thread(vehicle_table, do_pathfind) 
  3472. 	-- Check if we should do the initial pathfind 
  3473. 	if (do_pathfind == true) then 
  3474. 		m10_attack_vtol_fly_to(vehicle_table) 
  3475. 	end 
  3476. 	-- Register all the enemies 
  3477. 	ai_add_enemy_target(vehicle_table.chars[1], LOCAL_PLAYER, ATTACK_ON_SIGHT) 
  3478. 	ai_add_enemy_target(vehicle_table.chars[1], M10_characters.viola, ATTACK_ON_SIGHT) 
  3479. 	ai_add_enemy_target(vehicle_table.chars[1], M10_characters.oleg, ATTACK_ON_SIGHT) 
  3480. 	if (coop_is_active() == true) then 
  3481. 		ai_add_enemy_target(vehicle_table.chars[1], REMOTE_PLAYER, ATTACK_ON_SIGHT) 
  3482. 	end 
  3483. 	ai_set_action_delay(vehicle_table.chars[1], "throw grenade", 9999) 
  3484. 	-- Add a marker and put the VTOL in chase mode 
  3485. 	marker_add(vehicle_table.vtol, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL) 
  3486. 	vehicle_chase(vehicle_table.vtol, LOCAL_PLAYER, false, false, true, false) 
  3487. end 
  3488.  
  3489. -- Process a VTOL transport drop-off 
  3490. -- 
  3491. -- transport_table:		VTOL transport Lua table (as defined in M10_groups::stag_transport_01) 
  3492. -- soldier_markers:		TRUE to add markers to the soldiers when the exit VTOL, FALSE to now put markers on the soldier 
  3493. function m10_vtol_transport_drop_off_thread(transport_table, soldier_markers) 
  3494. 	-- Add this transport to the transport array 
  3495. 	local transport_idx = #M10_runtime.transport_vtols + 1 
  3496. 	M10_runtime.transport_vtols[transport_idx] = transport_table 
  3497. 	 
  3498. 	-- Add the VTOL to the list of spawned VTOLs 
  3499. 	M10_runtime.spawned_vtols[#M10_runtime.spawned_vtols + 1] = transport_table.vtol 
  3500.  
  3501. 	-- Add a maker 
  3502. 	--marker_add(transport_table.vtol, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_FULL) 
  3503. 	 
  3504. 	-- Play a bullhorn announcement 
  3505. 	-- Loop over all of the drop off points, and do the drop-offs 
  3506. 	for i, drop_off in pairs(transport_table.drop_offs) do 
  3507. 		helicopter_fly_to_direct(transport_table.vtol, -1, drop_off.path) 
  3508. 		-- Stop processing if the VTOL has been destroyed 
  3509. 		local found_vehicle = false 
  3510. 		for i, damaged_veh in pairs(M10_runtime.damaged_vehicles_exiting) do 
  3511. 			if (damaged_veh == transport_table.vtol) then 
  3512. 				found_vehicle = true 
  3513. 			end 
  3514. 		end 
  3515. 		if (found_vehicle) then 
  3516. 			--don't keep going, we were destroyed on the way in 
  3517. 			break 
  3518. 		end 
  3519. 		-- If there's any dialog, then trigger it now 
  3520. 		if (drop_off.dialog ~= nil) then 
  3521. 			if (drop_off.dialog.speaker == "Interrogation" ) then 
  3522. 				audio_play_persona_line_2d(M10_personas.interrogation.persona_id, drop_off.dialog.line) 
  3523. 			else 
  3524. 				audio_play_persona_line(drop_off.dialog.speaker, drop_off.dialog.line) 
  3525. 			end 
  3526. 		end 
  3527. 		helicopter_enter_dropoff(transport_table.vtol, transport_table.heli_dropoff_nav, false, LOCAL_PLAYER, false) 
  3528. 		while (vehicle_pathfind_check_done(transport_table.vtol) == 0) do 
  3529. 			thread_yield() 
  3530. 		end 
  3531. 		-- Force all the soldiers that got dropped off to take cover 
  3532. 		for j, char in pairs(drop_off.soldiers) do 
  3533. 			if (character_is_dead(char) == false) then 
  3534. 				--vehicle_exit(char, true) 
  3535. 				npc_combat_enable(char, true) 
  3536. 				npc_leash_to_nav(char, drop_off.navs[j], 8.0) 
  3537. 				 
  3538. 				ai_add_enemy_target(M10_characters.oleg, char, ATTACK_NOW_NEVER_LOSE, false)  -- tell oleg to attack these guys. 
  3539. 				character_make_priority_target(char, true)  -- make these guy a higher priority target 
  3540. 				 
  3541. 				-- Some time is passed, make sure they're still alive 
  3542. 				if (character_is_dead(char) == false) then 
  3543. 					-- Add the marker 
  3544. 					if (soldier_markers == true) then 
  3545. 						marker_add(char, MINIMAP_ICON_KILL, OI_ASSET_KILL) 
  3546. 					end 
  3547. 					 
  3548. 					-- Make sure they made it onto the rooftop area 
  3549. 					if (object_is_in_trigger(transport_table.rooftop_trigger, char) == false) then 
  3550. 						-- They didn't make it onto the roof, kill them 
  3551. 						character_kill(char) 
  3552. 					else 
  3553. 						-- They're on the roof for now - add them to the list so we know if they've fallen off 
  3554. 						M10_runtime.rooftop_trigger_chars[#M10_runtime.rooftop_trigger_chars + 1] = char 
  3555. 					end 
  3556. 				end 
  3557. 			end 
  3558. 		end 
  3559.  
  3560. 		--[[ 
  3561. 		-- Tell the soldiers to exit the transport VTOL 
  3562. 		vehicle_exit_group(drop_off.soldiers, true) -- unenterable to make sure the soldiers don't try to get back in the transport 
  3563. 		delay(3) 
  3564. 		--]] 
  3565. 		 
  3566. 		-- Stop processing if the VTOL has been destroyed 
  3567. 		if (vehicle_is_destroyed(transport_table.vtol) == true) then 
  3568. 			break 
  3569. 		end 
  3570. 	end 
  3571. 	 
  3572. 	if (transport_table.snipers and M10_runtime.transport_snipers_alive > 0) then 
  3573. 		--audio_play_persona_line(LOCAL_PLAYER, M10_dialog_lines.rooftop) 
  3574. 	elseif (transport_table.oleg_line ~= "") then 
  3575. 		audio_play_persona_line(M10_characters.oleg, transport_table.oleg_line) 
  3576. 	end 
  3577. 	 
  3578. 	-- Remove the marker 
  3579. 	marker_remove(transport_table.vtol) 
  3580. 	transport_table.marker_removed = true 
  3581. 	 
  3582. 	-- All drop offs are complete, so tell it to retreat  
  3583. 	-- if it's smoking or on fire and it's invulnerable, it's already destroyed, just running away from the roof 
  3584. 	local smoke, fire = vehicle_get_smoke_and_fire_state(transport_table.vtol) 
  3585. 	local dying = vehicle_is_invulnerable(transport_table.vtol) and (smoke or fire) 
  3586. 	if (vehicle_is_destroyed(transport_table.vtol) == false and dying == false ) then 
  3587. 	 
  3588. 		--fly a path before retreating 
  3589. 		if (transport_table.escape_path ~= "") then 
  3590. 			helicopter_fly_to_direct(transport_table.vtol, -1, transport_table.escape_path) 
  3591. 		end 
  3592. 		--now retreat 
  3593. 		helicopter_enter_retreat(transport_table.vtol) 
  3594. 		 
  3595. 		-- whatever we do, never ever release a vehicle that's in our airspace 
  3596. 		local in_airspace = true 
  3597. 		while (in_airspace == true) do 
  3598. 			in_airspace = false 
  3599. 			for i, vehicle in pairs(M10_runtime.vehicles_in_airspace) do 
  3600. 				if (vehicle == transport_table.vtol) then 
  3601. 					in_airspace = true 
  3602. 				end 
  3603. 			end 
  3604. 			delay(1) 
  3605. 		end 
  3606. 		 
  3607. 		--or being scripted to fly away due to damage 
  3608. 		local dying_helicopter = true 
  3609. 		while (dying_helicopter == true) do 
  3610. 			dying_helicopter = false 
  3611. 			for i, vehicle in pairs(M10_runtime.damaged_vehicles_exiting) do 
  3612. 				if (vehicle == transport_table.vtol) then 
  3613. 					dying_helicopter = true 
  3614. 				end 
  3615. 			end 
  3616. 			delay(1) 
  3617. 		end 
  3618. 		 
  3619. 		-- Release the transport VTOL and the pilots to the world 
  3620. 		release_to_world(transport_table.vtol) 
  3621. 		for i, pilot in pairs(transport_table.pilots) do 
  3622. 			release_to_world(pilot) 
  3623. 		end 
  3624. 	end 
  3625. 	 
  3626. 	-- Remove this transport to the transport array 
  3627. 	M10_runtime.transport_vtols[transport_idx] = M10_runtime.transport_vtols[#M10_runtime.transport_vtols] 
  3628. 	M10_runtime.transport_vtols[#M10_runtime.transport_vtols] = nil 
  3629. end 
  3630.  
  3631. -- Thread to process a STAG VTOL flyby 
  3632. -- 
  3633. -- vtol_table:		Lua table defining the VTOL 
  3634. function m10_thread_run_stag_flyby_vtol(vtol_table) 
  3635. 	-- Track this VTOL flyby group 
  3636. 	local group_idx = #M10_runtime.vtol_flyby_groups + 1 
  3637. 	M10_runtime.vtol_flyby_groups[group_idx] = vtol_table 
  3638. 	 
  3639. 	-- Add the VTOL to the list of spawned VTOLs 
  3640. 	M10_runtime.spawned_vtols[#M10_runtime.spawned_vtols + 1] = vtol_table.vehicle 
  3641.  
  3642. 	if (vtol_table.invulnerable == true) then 
  3643. 		turn_invulnerable(vtol_table.vehicle, false) 
  3644. 		for i, char in pairs (vtol_table.chars) do 
  3645. 			turn_invulnerable(char, false) 
  3646. 		end 
  3647. 	end 
  3648. 	 
  3649. 	if (vtol_table.vehicle == "veh_vtol_bridge_03_ 001") then 
  3650. 		vehicle_enter_teleport(vtol_table.chars[1], vtol_table.vehicle, 0, true, true) 
  3651. 		vehicle_enter_teleport(vtol_table.chars[2], vtol_table.vehicle, 1, true, true) 
  3652. 		vehicle_enter_teleport(vtol_table.chars[3], vtol_table.vehicle, 2, true, true, true) 
  3653. 	else 
  3654. 		vehicle_enter_group_teleport(vtol_table.chars, vtol_table.vehicle) 
  3655. 	end 
  3656. 	vehicle_max_speed(vtol_table.vehicle, vtol_table.speed) 
  3657. 	 
  3658. 	-- "Pre-aim" at the target, so the VTOL Laser can better track the position (otherwise the weapons can keep up with the movement) 
  3659. 	if (vtol_table.target ~= nil) then 
  3660. 		for i, char in pairs(vtol_table.chars) do 
  3661. 			ai_add_enemy_target(char, vtol_table.target, ATTACK_NOW_NEVER_LOSE, false) 
  3662. 		end 
  3663. 	else 
  3664. 		for i, char in pairs(vtol_table.chars) do 
  3665. 			npc_combat_enable(char, false) 
  3666. 		end 
  3667. 	end 
  3668. 	 
  3669. 	ai_set_action_delay(vtol_table.chars[1], "throw grenade", 9999) 
  3670. 	 
  3671. 	if (vtol_table.target_nav ~= nil) then 
  3672. 		helicopter_shoot_navpoint(vtol_table.vehicle, vtol_table.target_nav) 
  3673. 	else 
  3674. 		-- If not target is specified, assume Oleg's current position navpoint 
  3675. 		helicopter_shoot_navpoint(vtol_table.vehicle, M10_navpoints.roof_oleg_dest) 
  3676. 	end 
  3677. 	 
  3678. 	-- Give them perfect aim (they need to hit their targets) 
  3679. 	if (vtol_table.no_perfect_aim == nil or vtol_table.no_perfect_aim == false) then 
  3680. 		set_perfect_aim(vtol_table.chars[1], true) 
  3681. 	end 
  3682. 	 
  3683. 	-- vehicle_anim_start(vtol_table.vehicle, "vtol jet flyby", nil) 
  3684. 	helicopter_set_path_orientation(vtol_table.vehicle, HELI_PF_PATH_PITCH) 
  3685. 	helicopter_fly_to_direct(vtol_table.vehicle, vtol_table.speed, vtol_table.path) 
  3686. 	 
  3687. 	-- Hide the vehicle at the end of the pathfind 
  3688. 	vehicle_hide(vtol_table.vehicle) 
  3689. 	 
  3690. 	-- Unregister this VTOL flyby group 
  3691. 	M10_runtime.vtol_flyby_groups[group_idx] = M10_runtime.vtol_flyby_groups[#M10_runtime.vtol_flyby_groups] 
  3692. 	M10_runtime.vtol_flyby_groups[#M10_runtime.vtol_flyby_groups] = nil 
  3693. end 
  3694.  
  3695. -- Thread to process a squadron of VTOLs doing a flyby 
  3696. -- 
  3697. -- vtol_group:		Lua table defining the group of VTOLs doing a flyby 
  3698. function m10_thread_process_flyby(vtol_group) 
  3699. 	-- Create a thread for each VTOL in the flyby 
  3700. 	for i, vtol in pairs(vtol_group.vtols) do 
  3701. 		vtol.thread_id = thread_new("m10_thread_run_stag_flyby_vtol", vtol) 
  3702. 	end	 
  3703. 	 
  3704. 	-- Wait until each thread has finished 
  3705. 	local flyby_finished = false 
  3706. 	while(flyby_finished == false) do 
  3707. 		flyby_finished = true 
  3708. 		 
  3709. 		for i, vtol in pairs(vtol_group.vtols) do 
  3710. 			if (thread_check_done(vtol.thread_id) == false) then 
  3711. 				flyby_finished = false 
  3712. 			end 
  3713. 		end	 
  3714. 		 
  3715. 		thread_yield() 
  3716. 	end 
  3717. 	 
  3718. 	-- Destroy the script group 
  3719. 	group_destroy(vtol_group.name) 
  3720. end 
  3721.  
  3722. -- Process the continuous spawn of transport VTOLs dropping enemies off on the strip club roof 
  3723. -- 
  3724. -- vtol_cont_spawn:		The VTOL continuous spawn Lua table (as defined in M10_vtol_cont_spawn) 
  3725. -- delay_time:			Time (in seconds) to delay before starting the continuous spawn 
  3726. function m10_club_drop_off_cont_spawn_thread(vtol_cont_spawn, delay_time) 
  3727. 	-- Add a delay before the first VTOL drop-off occurs 
  3728. 	delay(delay_time) 
  3729.  
  3730. 	-- Loop forever 
  3731. 	local group_idx = 1 
  3732. 	while (true) do 
  3733. 		thread_yield()		 
  3734. 	 
  3735. 		-- Create the VTOL group 
  3736. 		if (group_is_loaded(vtol_cont_spawn.groups[group_idx].name) == true) then 
  3737. 			group_destroy(vtol_cont_spawn.groups[group_idx].name) 
  3738. 			thread_yield() 
  3739. 		end 
  3740. 		group_create(vtol_cont_spawn.groups[group_idx].name, true) 
  3741. 		 
  3742. 		-- Put all the soldiers in the VTOL 
  3743. 		local seat_idx = 0 
  3744. 		for i, char in pairs(vtol_cont_spawn.groups[group_idx].chars) do 
  3745. 			vehicle_enter_teleport(char, vtol_cont_spawn.groups[group_idx].vtol, seat_idx, true) 
  3746. 			 
  3747. 			-- Increment the seat index 
  3748. 			seat_idx = seat_idx + 1 
  3749. 			if (i == 1) then 
  3750. 				-- Make the pilot stay in the vehicle 
  3751. 				follower_remain_in_car(char, true) 
  3752. 			 
  3753. 				-- Skip the first passenger seat  
  3754. 				seat_idx = seat_idx + 1 
  3755. 			end 
  3756. 		end 
  3757. 		 
  3758. 		-- Add a marker to the VTOL 
  3759. 		--marker_add(vtol_cont_spawn.groups[group_idx].vtol, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL) 
  3760. 		 
  3761. 		-- Start a pathfind to a random destination point 
  3762. 		local dest_idx = rand_int(1, sizeof_table(vtol_cont_spawn.groups[group_idx].dest_navs)) 
  3763. 		helicopter_fly_to_direct(vtol_cont_spawn.groups[group_idx].vtol, -1, vtol_cont_spawn.groups[group_idx].path) 
  3764. 		 
  3765. 		-- Check if the VTOL made it to the drop-off point (if it got blown up mid-flight, we should just create a new continuous spawn)	 
  3766. 		if (vehicle_is_destroyed(vtol_cont_spawn.groups[group_idx].vtol) == false) then 
  3767. 			-- Unlease Oleg 
  3768. 			npc_leash_remove(M10_characters.oleg) 
  3769.  
  3770. 			-- Make the soldiers exit the VTOL 
  3771. 			for i, char in pairs(vtol_cont_spawn.groups[group_idx].chars) do 
  3772. 				if (i ~= 1) then 
  3773. 					vehicle_exit(char, true) 
  3774. 					ai_add_enemy_target(M10_characters.oleg, char, ATTACK_ON_SIGHT) 
  3775. 				end 
  3776. 			end 
  3777. 			 
  3778. 			-- Remove the marker, and retreat 
  3779. 			delay(1.0) 
  3780. 			--marker_remove(vtol_cont_spawn.groups[group_idx].vtol) 
  3781. 			helicopter_enter_retreat(vtol_cont_spawn.groups[group_idx].vtol) 
  3782. 			 
  3783. 			-- Wait until all the soldiers are incapacitated 
  3784. 			local all_soldiers_incapacitated = false 
  3785. 			while(all_soldiers_incapacitated == false) do 
  3786. 				-- Loop over all the soldiers in the VTOL, to see if any are still alive 
  3787. 				all_soldiers_incapacitated = true 
  3788. 				for i, char in pairs(vtol_cont_spawn.groups[group_idx].chars) do 
  3789. 					-- Skip the pilot 
  3790. 					if (i ~= 1) then 
  3791. 						-- If this guy is alive (and not in a vehicle) then not all the soliders have been incapacitated 
  3792. 						if (character_is_dead(char) == false and character_is_in_vehicle(char) == false) then 
  3793. 							all_soldiers_incapacitated = false 
  3794. 							ai_add_enemy_target(M10_characters.oleg, char, ATTACK_NOW) 
  3795. 							break 
  3796. 						end 
  3797. 					end 
  3798. 				end 
  3799. 				 
  3800. 				thread_yield() 
  3801. 			end 
  3802. 			 
  3803. 			-- Leash Oleg again 
  3804. 			ai_do_scripted_move(M10_characters.oleg, M10_navpoints.roof_oleg_dest, true) 
  3805. 			npc_leash_to_nav(M10_characters.oleg, M10_navpoints.roof_oleg_dest, 1.0) 
  3806. 		end 
  3807. 		 
  3808. 		--marker_remove(vtol_cont_spawn.groups[group_idx].vtol) 
  3809. 		 
  3810. 		-- Wait 50 seconds before respawning the continuous spawn 
  3811. 		delay(50.0) 
  3812. 		 
  3813. 		-- Remove the group 
  3814. 		group_destroy(vtol_cont_spawn.groups[group_idx].name) 
  3815. 		 
  3816. 		local group_idx = group_idx + 1 
  3817. 		if (group_idx > sizeof_table(vtol_cont_spawn.groups)) then 
  3818. 			group_idx = 1 
  3819. 		end 
  3820. 	end 
  3821. end 
  3822.  
  3823. -- Process the tanks chasing after the VTOL with Oleg on it 
  3824. -- 
  3825. -- tank_table:		Tank Lua table (as defined in M10_groups::stag_ground_troops::tanks) 
  3826. function m10_process_tank_chase_thread(tank_table) 
  3827. 	vehicle_pathfind_to(tank_table.tank, tank_table.chase_path, true, false) 
  3828. 	vehicle_chase(tank_table.tank, M10_characters.oleg) 
  3829. end 
  3830.  
  3831.