./m06.lua

  1.  
  2. --[[ 
  3. 	M06.lua 
  4. 	SR3 Mission Script 
  5. 	DATE: 06-09-2010 
  6. 	AUTHOR:	Neil Ryan 
  7. ]]-- 
  8.  
  9.  
  10. -- Debug flags -- 
  11.  
  12. -- Tweakable Parameters -- 
  13. 	M06_BOMB_TIMER_INITIAL_MS = 960000 
  14. 	M06_BOMB_TIMER_FACTORY_MS = 900000 
  15. 	M06_BOMB_TIMER_BRUTE_KILLED_MS = 540000 
  16. 	M06_BOMB_TIMER_BALL_DROP_MS = 480000 
  17.  
  18. -- Groups -- 
  19. 	M06_group = { 
  20. 		-- loading dock trucks 
  21. 		trucks = { 
  22. 			name = "trucks_group" 
  23. 		}, 
  24. 		 
  25. 		escape_truck = { 
  26. 			name = "Escape_truck_group", 
  27. 			vehicle = "Escape Truck" 
  28. 		}, 
  29. 		 
  30. 		workers = { 
  31. 			name = "Dock_workers", 
  32. 			members1 = { "Dock_worker 001", "Dock_worker 002", "Dock_worker 003", 
  33. 						"Dock_worker 004", "Dock_worker 005", "Dock_worker 006" } 
  34. 		}, 
  35. 		 
  36. 		dock = { 
  37. 			name = "Dock_thugs", 
  38. 			members = { "Dock_sniper 001", "Dock_thug 007", "Dock_thug 008", 
  39. 						"Dock_thug 009", "Dock_thug 011", "Dock_thug 004<001>" } 
  40. 		}, 
  41. 		 
  42. 		dock1 = { 
  43. 			name = "Dock_reenforcement 000", 
  44. 			members = { "Dock_thug 002", 
  45. 						"Dock_thug 001", "Dock_thug 018" }, 
  46. 			navpoints = { "Dock_Nav 002", 
  47. 						"Dock_Nav 003", "Dock_Nav 004" } 
  48. 		}, 
  49. 		 
  50. 		dock2 = { 
  51. 			name = "Dock_reenforcement 001", 
  52. 			members = {  "Dock_sniper 003", "Dock_thug 003", 
  53. 						"Dock_thug 004", "Dock_thug 006"}, 
  54. 			navpoints = { "Dock_Nav 011", "Dock_Nav 012", 
  55. 						"Dock_Nav 014",	"Dock_Nav 015"} 
  56. 		}, 
  57. 		 
  58. 		-- These guys come out of the elevators 
  59. 		dock3 = { 
  60. 			name = "Dock_reenforcement 002", 
  61. 			members = { "Dock_thug 013",  
  62. 						"Dock_thug 015", "Dock_thug 017" }, 
  63. 			navpoints = { "Dock_Nav 006", 
  64. 						"Dock_Nav 009", "Dock_Nav 010" } 
  65. 		}, 
  66.  
  67. 		dock_brute = { 
  68. 			name = "Dock_brute_group", 
  69. 			brute = "Dock_brute", 
  70. 			brute_killed = false, 
  71. 		}, 
  72. 		 
  73. 		saints_backup = { 
  74. 			name = "saints_backup_group", 
  75. 			vehicle = "saint_truck", 
  76. 			members = { "Saint_Backup 001", "Saint_Backup 002", 
  77. 							"Saint_Backup 003", "Saint_Backup 004" }, 
  78. 			navpoint = "saints_backup_nav", 
  79. 			thread = INVALID_THREAD_HANDLE 
  80. 		},	 
  81.  
  82. 		bomb_truck = { 
  83. 			name = "bomb_truck_group", 
  84. 			driver = "bomb_truck_driver", 
  85. 			vehicle = "bomb_truck", 
  86. 			path = "bomb_drive_spline", 
  87. 			nav = "bomb_end_nav" 
  88. 		}, 
  89. 		 
  90. 		-- This groups starts active in the cloning facility 
  91. 		-- There are two snipers in the group not shown below as they dont wander 
  92. 		factory1 = { 
  93. 			name = "factory_thugs 001", 
  94. 			members = { "factory_thug 003", "factory_thug 004", "factory_thug 013", 
  95. 						"factory_thug 006", "factory_thug 007", "factory_thug 008" }, 
  96. 			wander = {  "Factory_Wander 002", "Factory_Wander 002", "Factory_Wander 001", 
  97. 						"Factory_Wander 003", "Factory_Wander 001", "Factory_Wander 001" }, 
  98. 			distance = { 3, 3, 5, 5, 5, 5, 5 }, 
  99. 			walker = "factory_thug 007<001>", 
  100. 			walk_nav = "Hall Walk", 
  101. 		},  
  102. 		 
  103. 		factory1a = { 
  104. 			members = { "factory_thug 005", "factory_thug 009",  
  105. 						"factory_thug 022", "factory_thug 035" }, 
  106. 			navpoints = { "Factory_Nav 019", "Factory_Nav 020", 
  107. 							"Factory_Nav 021", "Factory_Nav 022" } 
  108. 		}, 
  109. 		 
  110. 		factory2 = { 
  111. 			trigger = "factory_wave_trigger 001", 
  112. 			hit = false, 
  113. 			name = "factory_thugs 002", 
  114. 			members = { "factory_thug 001", "factory_thug 002", 
  115. 						"factory_thug 010", "factory_thug 011" }, 
  116. 			navpoints = { "Factory_Nav 001", "Factory_Nav 002",  
  117. 						  "Factory_Nav 003", "Factory_Nav 004" } 
  118. 		}, 
  119.  
  120. 		factory3 = { 
  121. 			trigger = "factory_wave_trigger 002", 
  122. 			hit = false, 
  123. 			name = "factory_thugs 003", 
  124. 			members = { "factory_thug 012", "factory_thug 014", "factory_thug 015", 
  125. 						"factory_thug 016", "factory_thug 017", "factory_thug 018" }, 
  126. 			navpoints = { "Factory_Nav 005", "Factory_Nav 006", "Factory_Nav 007", 
  127. 						  "Factory_Nav 008", "Factory_Nav 009", "Factory_Nav 010" } 
  128. 		}, 
  129.  
  130. 		factory4 = { 
  131. 			trigger = "factory_wave_trigger 003", 
  132. 			hit = false, 
  133. 			name = "factory_thugs 004", 
  134. 			members = { "factory_thug 019", "factory_thug 021", 
  135. 							"factory_thug 023", "factory_thug 024", "factory_thug 025", 
  136. 							"factory_thug 026", "factory_thug 027" }, 
  137. 			navpoints = { "Factory_Nav 011", "Factory_Nav 012", "Factory_Nav 013", 
  138. 							"Factory_Nav 015", "Factory_Nav 016", 
  139. 							"Factory_Nav 017", "Factory_Nav 018" } 
  140. 		}, 
  141.  
  142. 		factory_brute = { 
  143. 			name = "Factory_brute_group", 
  144. 			brute = "factory_brute", 
  145. 			brute_killed = false, 
  146. 			brute_flamer = "factory_brute_flamer", 
  147. 			flamer_killed = false, 
  148. 			navpoint = "Brute_Nav 001" 
  149. 		}, 
  150. 		 
  151. 		top_floor = { 
  152. 			name = "Top_floor_thugs", 
  153. 			members = { "top_floor_thug 001", "top_floor_thug 002", "top_floor_thug 003", "top_floor_thug 004",  
  154. 						"top_floor_thug 005", "top_floor_thug 006", "top_floor_thug 007", "top_floor_thug 008",  
  155. 						"top_floor_thug 009", "top_floor_thug 010", "top_floor_thug 011", "top_floor_thug 012",  
  156. 						"top_floor_thug 013", "top_floor_thug 014", "top_floor_thug 015", "top_floor_thug 016"	}, 
  157. 		}, 
  158. 		 
  159. 		Phillipe = { 
  160. 			name = "Phillipe 001", 
  161. 			phillipe = "Phillipe" 
  162. 		}, 
  163.  
  164. 	-- Ball Drop Groups 
  165. 		ball = { 
  166. 			name = "ball_group", 
  167. 			vehicle = "the_ball", 
  168. 			nav = "ball_start", 
  169. 		}, 
  170. 		 
  171. 		-- not exactly homies 
  172. 		ball_saints = { 
  173. 			name = "ball_saints_group", 
  174. 			oleg = "Oleg_ball_drop" 
  175. 		}, 
  176. 		 
  177. 		ball_thugs = { 
  178. 			name = "support_thugs_group", 
  179. 			-- broken down by floor and cable being broken 
  180. 			floor1 = { 
  181. 						{ "Support_thug_first 001" }, 
  182. 						{ "Support_thug_first 002", "Support_thug_first 003" }, 
  183. 						{} 
  184. 					}, 
  185. 			-- "Cable__nav 00" 
  186. 			floor1_nav = { "Cable_one_nav 003", "Cable_two_nav 003", "Cable_three_nav 003" }, 
  187. 			-- only on Oleg's floor (keep watching Oleg do cool stuff) 
  188. 			floor2 = { 
  189. 						{ "Support_thug_second 001", "Support_thug_second 002" }, 
  190. 						{ "Support_thug_second 003", "Support_thug_second 004" }, 
  191. 						{ "Support_thug_second 005" }, 
  192. 					}, 
  193. 			floor2_nav = { "Cable_one_nav 003", "Cable_two_nav 003", "Cable_three_nav 003" }, 
  194. 			floor3 = { 
  195. 						{}, 
  196. 						{ "Support_thug_third 001", "Support_thug_third 002" }, 
  197. 						{ "Support_thug_third 003" } 
  198. 					}, 
  199. 			floor3_nav = { "Cable_one_nav 002", "Cable_two_nav 002", "Cable_three_nav 002" }, 
  200. 		}, 
  201. 		 
  202. 		ball_stop1 = { 
  203. 			name = "ball_stop1_group", 
  204. 			members = { "ball_stop1_attacker 001", "ball_stop1_attacker 002", "ball_stop1_attacker 003", 
  205. 						  "ball_stop1_attacker 004", "ball_stop1_attacker 005", "ball_stop1_attacker 006", 
  206. 						  "ball_stop1_attacker 007", "ball_stop1_attacker 008", "ball_stop1_attacker 009", 
  207. 						  "ball_stop1_attacker 010", "ball_stop1_attacker 011", "ball_stop1_attacker 012", 
  208. 						  "ball_stop1_attacker 013", "ball_stop1_attacker 014", "ball_stop1_attacker 015" 
  209. 						}, 
  210. 			lookat = "stop1_lookat" 
  211. 		}, 
  212. 		 
  213. 		ball_stop2 = { 
  214. 			name = "ball_stop2_group", 
  215. 			members = { "ball_stop2_attacker 001", "ball_stop2_attacker 002", "ball_stop2_attacker 003", 
  216. 						  "ball_stop2_attacker 004", "ball_stop2_attacker 005", "ball_stop2_attacker 006", 
  217. 						  "ball_stop2_attacker 007", "ball_stop2_attacker 008", "ball_stop2_attacker 009", 
  218. 						  "ball_stop2_attacker 010", "ball_stop2_attacker 011", "ball_stop2_attacker 012", 
  219. 						  "ball_stop2_attacker 013", "ball_stop2_attacker 014", "ball_stop2_attacker 015" 
  220. 						}, 
  221. 			brute = "ball_stop2_attacker 002", 
  222. 			brute_nav = "Brute_run_to", 
  223. 			brute_restart = "brute_restart", 
  224. 			lookat = "stop2_lookat" 
  225. 		}, 
  226. 		 
  227. 		ball_stop3 = { 
  228. 			name = "ball_stop3_group", 
  229. 			brute = "ball_stop3_attacker 001", 
  230. 			brute_nav = "Brute_nav", 
  231. 			lookat = "stop3_lookat", 
  232. 			upper_nav = "Upper_nav", 
  233. 			mid_nav = "Mid_nav", 
  234. 			lower_nav = "Lower_nav", 
  235. 			set1 = { "ball_stop3_attacker 006", "ball_stop3_attacker 007" }, 
  236. 			set2 = { "ball_stop3_attacker 010" }, 
  237. 			set3 = { "ball_stop3_attacker 005" }, 
  238. 			set4 = { "ball_stop3_attacker 011", "ball_stop3_attacker 012" }, 
  239. 			set5 = { "ball_stop3_attacker 013" }, 
  240. 			set6 = { "ball_stop3_attacker 014" }, 
  241. 			set7 = { "ball_stop3_attacker 015", "ball_stop3_attacker 016" }			 
  242. 		}, 
  243. 			 
  244. 		start_homies = { 
  245. 			name = "start_homies", 
  246. 			pierce = "Pierce_start", 
  247. 			shaundi = "Shaundi_start", 
  248. 			oleg = "", 
  249. 			vehicle = "Script_Vehicle 001"	-- car for you if you like 
  250. 		}, 
  251. 			 
  252. 		dock_homies = { 
  253. 			name = "dock_homies", 
  254. 			pierce = "Pierce_dock", 
  255. 			shaundi = "Shaundi_dock", 
  256. 			oleg = "" 
  257. 		}, 
  258. 		 
  259. 		factory_homies = { 
  260. 			name = "factory_homies", 
  261. 			pierce = "Pierce_factory", 
  262. 			shaundi = "Shaundi_factory", 
  263. 			oleg = "" 
  264. 		}, 
  265. 		 
  266. 		-- after you find Oleg, before you are upstairs 
  267. 		brute_killed_homies = { 
  268. 			name = "brute_killed_homies", 
  269. 			pierce = "Pierce_brute_killed", 
  270. 			shaundi = "Shaundi_brute_killed", 
  271. 			oleg = "Oleg_brute_killed" 
  272. 		}, 
  273. 		 
  274. 		top_floor_homies = { 
  275. 			name = "top_floor_homies", 
  276. 			pierce = "Pierce_top_floor", 
  277. 			shaundi = "Shaundi_top_floor", 
  278. 			oleg = "Oleg_top_floor" 
  279. 		}, 
  280. 		 
  281. 		off_ball_homies = { 
  282. 			name = "off_ball_homies", 
  283. 			pierce = "Pierce_off_ball", 
  284. 			shaundi = "Shaundi_off_ball", 
  285. 			oleg = "Oleg_off_ball", 
  286. 			falling_brute = "Falling Brute" 
  287. 		}, 
  288.  
  289. 	} 
  290.  
  291. -- Keep track of the current homie 
  292. 	M06_current_Pierce = "" 
  293. 	M06_current_Shaundi = "" 
  294.  
  295. -- Navpoints -- 
  296. 	M06_sniper_leash_nav = "Sniper_Leash_Nav" 
  297. 	M06_elevator_noise = "Elevator_Noise_Nav" 
  298. 	M06_found_Phillipe_nav = "Phillipe_teleport_nav" 
  299. 	M06_bomb_arm_nav = "Bomb_arm_nav" 
  300. 	M06_worker_nav = "Worker_run_nav" 
  301. 	M06_done_with_ball_nav = "Done_on_ball" 
  302. 	M06_done_with_ball_nav1 = "Done_on_ball<001>" 
  303. 	M06_oleg_zscene_navs = { "Oleg_zscene_nav 001", "Oleg_zscene_nav 002" } 
  304. 	M06_falling_brute = "Falling Brute Nav" 
  305. 	 
  306. 	M06_Oleg_path = { 
  307. 		stair = "Oleg Spline 01", 
  308. 		climbs = "Oleg Spline 02", 
  309. 		offices = "Oleg Spline 03", 
  310. 		stairs = {"Oleg_floor_nav0", "Oleg_floor_nav1", "Oleg_floor_nav2", "Oleg_floor_nav3"}, 
  311. 		climb = {"Oleg_stairs_nav1", "Oleg_stairs_nav2", "Oleg_stairs_nav3", "Oleg_stairs_nav4"}, 
  312. 		office = "Oleg_door_nav", 
  313. 		upstairs = {"Oleg_upstairs_nav0", "Oleg_upstairs_nav1", "Oleg_upstairs_nav2", "Oleg_upstairs_nav3"} 
  314. 	} 
  315.  
  316. -- Audio Emitters -- 
  317. 	M06_emitter = { 
  318. 		dock_start = "M06_em_alarm", 
  319. 		dock_end = "M06_em_alarm_STOP", 
  320. 		clone_room_start = { "M06_amb_cloning_room", "M06_em_elec_unit_hum", "M06_em_elec_unit_hum<001>",  
  321. 					"M06_em_chem_tank_hiss", "M06_em_chem_tank_hiss<001>", "M06_em_chem_tank_hiss<002>", 
  322. 					"M06_em_chem_tank_hiss<003>", "M06_em_chem_tank_hiss<004>", "M06_em_hi_tech_hum", 
  323. 					"M06_em_hi_tech_hum<001>", "M06_em_hi_tech_hum<002>", "M06_em_flutter_throb", 
  324. 					"M06_em_flutter_throb<001>", "M06_em_flutter_throb<002>", "M06_em_flutter_throb<003>", 
  325. 					"M06_em_flutter_throb<004>", "M06_em_power_hum", "M06_em_power_hum<001>", 
  326. 					"M06_em_power_hum<002>", "M06_em_power_hum<003>", "M06_em_power_hum<004>", 
  327. 					"M06_em_power_hum<005>", "M06_em_power_hum<006>", "M06_em_turbine_throb", 
  328. 					"M06_em_turbine_throb<001>", "M06_em_turbine_throb<002>", "M06_em_turbine_throb<003>" }, 
  329. 		clone_room_end = "M06_amb_cloning_room_STOP", 
  330. 		office_start = "M06_amb_offices", 
  331. 		office_end = "M06_amb_offices_STOP", 
  332. 		ball_start = "M06_amb_cweight_shaft", 
  333. 		ball_end = "M06_amb_cweight_shaft_STOP", 
  334. 		ball_groan = "m06_sfx_counterweight_groans", 
  335. 		ball_traffic = "m06_sfx_cweight_roll_traffic", 
  336. 		music = { 
  337. 			mission_start = "M06_music_mission_start", 
  338. 			dock_start = "M06_music_loading_dock", 
  339. 			dock_end = "M06_music_loading_dock_end", 
  340. 			clone_start = "M06_music_cloning_lab", 
  341. 			clone_end = "M06_music_cloning_lab_end", 
  342. 			clone_cp = "M06_music_cloning_lab_checkpoint", 
  343. 			follow_oleg = "M06_music_follow_oleg", 
  344. 			hanging = "M06_music_ball_hang", 
  345. 			ball_start = "M06_music_ball_fall", 
  346. 			ball_end = "M06_music_ball_fall_end", 
  347. 			stop = "M06_music_STOP ", 
  348. 		}, 
  349. 	} 
  350. 	 
  351. -- Triggers -- 
  352. 	M06_trigger = { 
  353. 		dock = { 
  354. 			name = "Dock_trigger", 
  355. 			hit = false 
  356. 		}, 
  357. 		 
  358. 		closet = { 
  359. 			name = "Closet Trigger", 
  360. 			hit = false 
  361. 		},		 
  362. 		 
  363. 		notice_snipers = { 
  364. 			name = "notice_snipers", 
  365. 			hit = false 
  366. 		}, 
  367. 		 
  368. 		dock_thug_trigger01 = { 
  369. 			name = "Dock_Thug_Trigger_01", 
  370. 			hit = false 
  371. 		}, 
  372.  
  373. 		dock_thug_trigger02 = { 
  374. 			name = "Dock_Thug_Trigger_02", 
  375. 			hit = false 
  376. 		},		 
  377. 				 
  378. 		arm_bomb = { 
  379. 			name = "bomb_trigger", 
  380. 			hit = false 
  381. 		}, 
  382. 		 
  383. 		enter_factory = { 
  384. 			name = "enter_factory", 
  385. 			hit = false 
  386. 		}, 
  387. 		 
  388. 		factory_breadcrumb1 = { 
  389. 			name = "factory_breadcrumb_001", 
  390. 			hit = false 
  391. 		}, 
  392. 		 
  393. 		factory_breadcrumb2 = { 
  394. 			name = "factory_breadcrumb_002", 
  395. 			hit = false 
  396. 		}, 
  397. 		 
  398. 		factory_breadcrumb3 = { 
  399. 			name = "factory_breadcrumb_003", 
  400. 			hit = false 
  401. 		}, 
  402. 		 
  403. 		factory_brute = { 
  404. 			name = "factory_brute_trigger", 
  405. 			hit = false 
  406. 		}, 
  407. 		 
  408. 		factory_brute_flamer = { 
  409. 			name = "factory_brute_flamer_trigger", 
  410. 			hit = false 
  411. 		}, 
  412. 		 
  413. 		oleg_cutscene = { 
  414. 			name = "Oleg_trigger", 
  415. 			hit = false 
  416. 		}, 
  417. 		 
  418. 		oleg_crash1 = { 
  419. 			name = "Oleg Crash 01", 
  420. 			hit = false 
  421. 		}, 
  422. 		 
  423. 		oleg_crash2 = { 
  424. 			name = "Oleg Crash 02", 
  425. 			hit = false 
  426. 		}, 
  427. 		 
  428. 		ball_drop = { 
  429. 			name = "ball_drop_trigger", 
  430. 			hit = false 
  431. 		}, 
  432. 		 
  433. 		brute_net = { 
  434. 			name = "brute_safety_net", 
  435. 			hit = false 
  436. 		}, 
  437. 		 
  438. 		destroy_building = { 
  439. 			name = "bomb_leave", 
  440. 			hit = false 
  441. 		}, 
  442. 		 
  443. 		disarm_bomb = { 
  444. 			name = "bomb_disarm", 
  445. 			hit = false 
  446. 		}, 
  447. 	 
  448. 		stairs1 = { 
  449. 			name = "At_stairs_trigger 001", 
  450. 			hit = false 
  451. 		}, 
  452. 	 
  453. 		stairs2 = { 
  454. 			name = "At_stairs_trigger 002", 
  455. 			hit = false 
  456. 		}, 
  457. 		 
  458. 		office = { 
  459. 			name = "At_office_trigger", 
  460. 			hit = false 
  461. 		}, 
  462. 		 
  463. 		phillipe = { 
  464. 			name = "Phillipe_trigger", 
  465. 			hit = false 
  466. 		}, 
  467. 	} 
  468.  
  469. -- Characters -- 
  470.  
  471. -- Vehicles -- 
  472.  
  473. -- Animations -- 
  474. 	M06_anim = { 
  475. 		brute_break_cable = "brute finish 2 hug a", 
  476. 		brute_taunt = "brotherhood insult c", 
  477. 		brute_crawl = "ball brute attack" 
  478. 	} 
  479.  
  480. -- Text -- 
  481.  
  482. -- Threads -- 
  483.  
  484. -- Checkpoints -- 
  485. 	M06_checkpoint = { 
  486. 		start = { 
  487. 			name = MISSION_START_CHECKPOINT, 
  488. 			nav1 = "start_nav 001", 
  489. 			nav2 = "start_nav 002", 
  490. 			p1_car = "Player_car_check1<001>", 
  491. 			p2_car = "Player_car_check1<002>" 
  492. 		}, 
  493. 		 
  494. 		dock = { 
  495. 			name = "m06_dock", 
  496. 			nav1 = "dock_start_nav 001", 
  497. 			nav2 = "dock_start_nav 002" 
  498. 		}, 
  499. 		 
  500. 		factory = { 
  501. 			name = "m06_factory", 
  502. 			nav1 = "Factory_start_nav", 
  503. 			nav2 = "Factory_start_nav<001>" 
  504. 		}, 
  505. 		 
  506. 		brute_killed = { 
  507. 			name = "m06_brute_killed", 
  508. 			nav1 = "Top_floor_nav", 
  509. 			nav2 = "Top_floor_nav2" 
  510. 		}, 
  511. 		 
  512. 		ball_drop = { 
  513. 			name = "m06_checkpoint_ball_drop", 
  514. 			nav1 = "ball_drop_nav 001", 
  515. 			nav2 = "ball_drop_nav 002" 
  516. 		} 
  517. 	} 
  518. 	M06_swap_vault_seats = false 
  519.  
  520. -- Cutscenes -- 
  521. 	M06_scene = { 
  522. 		intro = "06_in", 
  523. 		oleg = "06_Mid",		-- z-scene 
  524. 		phillipe = "06_Z01",		-- z-scene 
  525. 		ballsmash = "06_Z_ballsmash", 
  526. 		disarm_bomb = "06_Out2", 
  527. 		destroy_building = "06_Out1", 
  528. 	} 
  529. 	 
  530. -- Conversations -- 
  531. 	M06_convo = { 
  532. 		mission_start = { 
  533. 			name = "m06_convo_1", 
  534. 			handle = INVALID_CONVERSATION_HANDLE 
  535. 		}, 
  536. 		 
  537. 		driving1 = { 
  538. 			name = "M06_Driving_1", 
  539. 			handle = INVALID_CONVERSATION_HANDLE 
  540. 		}, 
  541. 		 
  542. 		driving2 = { 
  543. 			name = "M06_Driving_2", 
  544. 			handle = INVALID_CONVERSATION_HANDLE 
  545. 		}, 
  546. 		 
  547. 		driving3 = { 
  548. 			name = "M06_Driving_3", 
  549. 			handle = INVALID_CONVERSATION_HANDLE 
  550. 		}, 
  551. 		 
  552. 		dock3 = { 
  553. 			name = "M06_Loading_Dock_3", 
  554. 			handle = INVALID_CONVERSATION_HANDLE, 
  555. 			load_direct = true 
  556. 		}, 
  557. 		 
  558. 		bomb_set = { 
  559. 			name = "M06_Bomb_Set_1", 
  560. 			handle = INVALID_CONVERSATION_HANDLE, 
  561. 			load_direct = true 
  562. 		}, 
  563. 		 
  564. 		elevator = { 
  565. 			name = "M06_Elevator_Stop", 
  566. 			handle = INVALID_CONVERSATION_HANDLE, 
  567. 			phillipe_persona_id = INVALID_PERSONA_HANDLE 
  568. 		}, 
  569. 		 
  570. 		clone2 = { 
  571. 			name = "M06_Clone_Room_2", 
  572. 			handle = INVALID_CONVERSATION_HANDLE 
  573. 		}, 
  574. 		 
  575. 		clone3 = { 
  576. 			name = "M06_Clone_Room_3", 
  577. 			handle = INVALID_CONVERSATION_HANDLE 
  578. 		}, 
  579. 		 
  580. 		oleg = { 
  581. 			name = "m06_convo_2", 
  582. 			handle = INVALID_CONVERSATION_HANDLE 
  583. 		}, 
  584. 		 
  585. 		ball_start = { 
  586. 			name = "M06_Break_Cables", 
  587. 			handle = INVALID_CONVERSATION_HANDLE 
  588. 		}, 
  589. 			 
  590. 		counter_balance = { 
  591. 			name = "m06_convo_3", 
  592. 			handle = INVALID_CONVERSATION_HANDLE 
  593. 		}, 
  594. 		 
  595. 		decision = { 
  596. 			name = "m06_convo_4", 
  597. 			handle = INVALID_CONVERSATION_HANDLE 
  598. 		}, 
  599. 	} 
  600.  
  601. 	M06_attack_info = { 
  602. 		situation = "M06_attack", 
  603. 		delay = 10.0, 
  604. 		callback = "m06_process_attack_cb", 
  605. 		timer = INVALID_THREAD_HANDLE 
  606. 	} 
  607. 	 
  608. -- Threads -- 
  609. 	M06_thread = { 
  610. 		conversations = INVALID_THREAD_HANDLE, 
  611. 		ball_setup = INVALID_THREAD_HANDLE, 
  612. 		oleg_navigate0 = INVALID_THREAD_HANDLE, 
  613. 		oleg_navigate1 = INVALID_THREAD_HANDLE, 
  614. 		oleg_navigate2 = INVALID_THREAD_HANDLE, 
  615. 		weapon_check = INVALID_THREAD_HANDLE, 
  616. 	} 
  617.  
  618. -- Movers -- 
  619. 	M06_mover = { 
  620. 		platform1 = "stage_mover 001", 
  621. 		--platform2 = "stage_mover 002", 
  622. 		closet = "Dock Closet", 
  623. 		elevator1 = "CF_Elevator_Door", 
  624. 		elevator2 = "Post_Oleg_Elevator", 
  625. 		garage = "syn_garage_door_mover", 
  626. 		damage = "syn_damaged_floor" 
  627. 	} 
  628.  
  629. -- Effects -- 
  630. 	M06_effects = { 
  631. 		ball_effect = { 
  632. 			name = "Gp M06 Balldust<001>", 
  633. 			effect_handle = -1 
  634. 		}, 
  635. 		 
  636. 		tunnel_effect = { 
  637. 			name = "Gp M06 Dustplumes<001>", 
  638. 			effect_handle = -1 
  639. 		} 
  640. 	} 
  641.  
  642. 	 
  643. 	 
  644. -- Other -- 
  645. 	M06_WAIT = true 
  646. 	M06_DO_NOT_WAIT = false 
  647. 	M06_INTERRUPT = true 
  648. 	M06_DO_NOT_INTERRUPT = false 
  649. 	 
  650. 	M06_WASHER_CAMERA = "Washer_camera" 
  651. 	SNAP_CAMERA = true 
  652. 	 
  653. 	M06_PLAYER_PISTOL = "Pistol-NG" 
  654. 	M06_PLAYER_SMG = "SMG-Gang" 
  655. 	M06_PLAYER_RIFLE = "Rifle-Gang" 
  656. 	 
  657. 	M06_BALL_PLAYER_LOADOUT = { M06_PLAYER_RIFLE } 
  658. 	 
  659. 	M06_DOCK_THUGS = 16 
  660. 	M06_MONSTER_TALLY = 0 
  661. 	 
  662. 	M06_ball_support = { 
  663. 		support1 = { 
  664. 			target = "Support_target 001", 
  665. 			object = "ball_support 001", 
  666. 			brute_nav = "Break_cable_nav 001", 
  667. 		}, 
  668. 		 
  669. 		support2 = { 
  670. 			target = "Support_target 003", 
  671. 			object = "ball_support 003", 
  672. 			brute_nav = "Break_cable_nav 002", 
  673. 		}, 
  674. 		 
  675. 		support3 = { 
  676. 			target = "Support_target 002", 
  677. 			object = "ball_support 002", 
  678. 			brute_nav = "Break_cable_nav 003", 
  679. 		} 
  680. 	} 
  681. 	 
  682. 	M06_cancel_nav = { 
  683. 		host = "m06_cancel_nav", 
  684. 		coop = "m06_cancel_nav_coop" 
  685. 	} 
  686. 	 
  687. 	M06_stilwater_nav = { 
  688. 		"m06_stilwater_water", "m06_stilwater_water_coop" 
  689. 	} 
  690. 		 
  691. 	In_coop = false 
  692. 		 
  693. 	M06_decision_made = false 
  694. 	M06_entered_garage = true	-- usually true 
  695. 		 
  696. 	-- elevator 
  697. 	M06_elevator_trigger = "" 
  698. 	M06_elevator_destination = "" 
  699. 	M06_elevator_destination_remote = "" 
  700. 	M06_dock_elevator = "dock_elevator" 
  701. 	M06_factory_elevator = "Factory_elevator" 
  702. 	 
  703. 	M06_ball_brute_killed = false 
  704. 	 
  705. 	M06_oleg_crash1_nav = "Oleg Crash1 Nav" 
  706. 	M06_oleg_crash2_nav = "Oleg Crash2 Nav" 
  707. 	 
  708. 	-- Emergency Ragdoll Survival Navs 
  709. 	M06_ragdoll_emergency = {"dock_start_nav 001", "Factory_start_nav", "Top_floor_nav", "Done_on_ball<001>"} 
  710. 	 
  711. 	M06_mission_completed = false 
  712.  
  713. -- ************************* 
  714. -- 
  715. -- Standard functions 
  716. -- 
  717. -- ************************* 
  718.  
  719. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  720. -- at the specified checkpoint. 
  721. -- CALLED FROM CODE 
  722. -- 
  723. -- checkpoint:	The checkpoint the mission should begin at 
  724. -- is_restart:					TRUE if the mission is restarting, FALSE otherwise 
  725. -- 
  726. function m06_start(checkpoint, is_restart) 
  727. 	In_coop = coop_is_active() 
  728. 	M06_mission_completed = false 
  729. 	 
  730. 	if checkpoint == "m06_checkpoint_coop" then 
  731. 		M06_swap_vault_seats = true 
  732. 		checkpoint = M06_checkpoint.ball_drop.name 
  733. 	end 
  734.  
  735. 	-- Check if this mission starting from the beginning 
  736. 	if (checkpoint == M06_checkpoint.start.name) then 
  737. 		if (is_restart == false) then 
  738. 			-- First time playing mission 
  739. 			local fade_in_after = false 
  740. 			-- Play an intro cutscene??? 
  741. 			if (M06_scene.intro ~= "") then 
  742. 				cutscene_play(M06_scene.intro, nil, {M06_checkpoint.start.nav1, M06_checkpoint.start.nav2}, fade_in_after) 
  743. 				--bink_play(M06_scene.intro) 
  744. 			end 
  745. 		else 
  746. 			teleport_coop(M06_checkpoint.start.nav1, M06_checkpoint.start.nav2, true) 
  747. 		end 
  748. 		fade_out(0) 
  749. 	end 
  750.  
  751. 	-- Handle mission initialization for the current checkpoint 
  752. 	m06_initialize(checkpoint) 
  753.  
  754. 	-- Run the mission from the current checkpoint 
  755. 	m06_run(checkpoint) 
  756. 	 
  757. end 
  758.  
  759. -- This is the primary function responsible for running the entire mission from start to finish. 
  760. -- 
  761. -- first_checkpoint:	The first checkpoint to begin running the mission at 
  762. -- 
  763. function m06_run(first_checkpoint) 
  764. 	local current_checkpoint = first_checkpoint 
  765.  
  766. 	-- Always have the garage door open and hide damaged floor piece 
  767. 	mesh_mover_hide(M06_mover.garage) 
  768. 	mesh_mover_hide(M06_mover.damage) 
  769. 	 
  770. 	-- Run the mission from the beginning 
  771. 	if current_checkpoint == M06_checkpoint.start.name then 
  772. 		M06_entered_garage = false 
  773. 		objective_text( 0, "m06_obj_syn_tower", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  774. 		m06_go_to_dock() 
  775. 		objective_text_clear(0) 
  776. 		current_checkpoint = M06_checkpoint.dock.name 
  777. 		mission_set_checkpoint(current_checkpoint, true) 
  778. 	end 
  779. 	 
  780. 	-- Cancel after here and you're warped in front of the building 
  781. 	mission_set_cancel_warp_location(M06_cancel_nav.host, M06_cancel_nav.coop) 
  782. 	 
  783. 	-- You're stuck in interior for the rest of the mission.  Throttle density. 
  784. 	set_ped_density(0.01) 
  785. 	set_traffic_density(0.01) 
  786. 	 
  787. 	-- everyone's pissed 
  788. 	notoriety_set_min("morningstar", 5) 
  789. 	if current_checkpoint == M06_checkpoint.dock.name then 
  790. 		objective_text( 0, "m06_obj_dock_thugs", "", "", SYNC_ALL, OI_ASSET_KILL ) 
  791. 		notoriety_force_no_spawn("morningstar", true) 
  792. 		m06_emergency_ragdoll_save(1) 
  793. 		door_lock(M06_mover.closet, true) 
  794. 		m06_kill_dock_guards() 
  795. 		objective_text_clear(0) 
  796. 		m06_enter_bomb_truck() 
  797. 		objective_text( 0, "m06_obj_set_bomb", "", "", SYNC_ALL, OI_ASSET_USE ) 
  798. 		m06_set_bomb() 
  799. 		hud_timer_set( 1, M06_BOMB_TIMER_INITIAL_MS, "m06_failure_truck_destroyed_cb" ) 
  800. 		objective_text_clear(0) 
  801. 		objective_text( 0, "m06_obj_to_factory", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  802. 		m06_go_to_factory() 
  803. 		objective_text_clear(0) 
  804. 		m06_clear_crew(M06_group.dock_homies) 
  805. 		m06_clear_crew(M06_group.start_homies) 
  806. 		current_checkpoint = M06_checkpoint.factory.name 
  807. 		mission_set_checkpoint(current_checkpoint, true) 
  808. 	end 
  809. 	 
  810. 	if current_checkpoint == M06_checkpoint.factory.name then		 
  811. 		zscene_prep(M06_scene.oleg) 
  812. 		m06_setup_crew(M06_group.factory_homies) 
  813. 		objective_text( 0, "m06_obj_to_oleg", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  814. 		audio_ambient_emitter_stop(M06_emitter.dock_start) 
  815. 		for i, sound in pairs(M06_emitter.clone_room_start) do 
  816. 			audio_ambient_emitter_start(sound) 
  817. 		end 
  818. 		m06_emergency_ragdoll_save(2) 
  819. 		m06_fight_through_factory() 
  820. 		objective_text_clear(0) 
  821. 		m06_meet_oleg() 
  822. 		objective_text( 0, "m06_obj_to_oleg", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  823. 		m06_go_to_top_floor() 
  824. 		m06_clear_crew(M06_group.brute_killed_homies) 
  825. 		current_checkpoint = M06_checkpoint.brute_killed.name 
  826. 		mission_set_checkpoint(current_checkpoint, true) 
  827. 	end 
  828. 	 
  829. 	 
  830. 	if current_checkpoint == M06_checkpoint.brute_killed.name then 
  831. 		zscene_prep(M06_scene.phillipe) 
  832. 		m06_setup_crew(M06_group.top_floor_homies) 
  833. 		objective_text( 0, "m06_obj_phillipe", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  834. 		for i, sound in pairs(M06_emitter.clone_room_start) do	 
  835. 			audio_ambient_emitter_stop(M06_emitter.office_start) 
  836. 		end 
  837. 		audio_ambient_emitter_start(M06_emitter.office_start) 
  838. 		m06_emergency_ragdoll_save(3) 
  839. 		m06_fight_through_top_floor() 
  840. 		objective_text_clear(0) 
  841. 		m06_watch_phillipe() 
  842. 		objective_text( 0, "m06_obj_find_ball", "", "", SYNC_ALL, OI_ASSET_USE ) 
  843. 		m06_go_to_ball() 
  844. 		objective_text_clear(0) 
  845. 		m06_clear_crew(M06_group.top_floor_homies) 
  846. 		current_checkpoint = M06_checkpoint.ball_drop.name 
  847. 		mission_set_checkpoint(current_checkpoint, true) 
  848. 	end 
  849. 	 
  850. 	if current_checkpoint == M06_checkpoint.ball_drop.name then 
  851. 		zscene_prep(M06_scene.ballsmash)	 
  852. 		objective_text( 0, "m06_obj_ride_ball", "", "", SYNC_ALL, OI_ASSET_KILL ) 
  853. 		audio_ambient_emitter_stop(M06_emitter.office_start) 
  854. 		audio_ambient_emitter_start(M06_emitter.ball_start) 
  855. 		m06_ball_stop1() 
  856. 		m06_ball_stop_brute() 
  857. 		m06_scrape_off_brute() 
  858. 		m06_ball_stop2() 
  859. 		objective_text_clear(0) 
  860. 		objective_text( 0, "m06_obj_decide", "", "", SYNC_ALL, OI_ASSET_INVALID ) 
  861. 		audio_ambient_emitter_stop(M06_emitter.ball_start) 
  862. 		audio_ambient_emitter_start(M06_emitter.dock_start) 
  863. 		m06_emergency_ragdoll_save(4) 
  864. 		door_lock(M06_mover.closet, true) 
  865. 		m06_final_decision() 
  866. 		objective_text_clear(0) 
  867. 		hud_timer_stop(1) 
  868. 	end 
  869. 			 
  870. 	-- Next up, back to the Stilwater bridge! 
  871. 	mission_set_next_mission("m07") 
  872. 	 
  873. 	-- No more cancel warps 
  874. 	mission_set_cancel_warp_location() 
  875. 	-- flag to not do end teleport 
  876. 	M06_mission_completed = true 
  877. 	-- teleport to the water where the m07 cutscene will take place to avoid unneeded teleports 
  878. 	 
  879. 	if M06_trigger.disarm_bomb.hit then 
  880. 		if (M06_scene.disarm_bomb ~= "") then 
  881. 			mission_end_success("m06", M06_scene.disarm_bomb, M06_stilwater_nav) 
  882. 			--bink_play(M06_scene.disarm_bomb) 
  883. 			--mission_end_success("m06") 
  884. 		end 
  885. 	else 
  886. 		if (M06_scene.destroy_building ~= "") then 
  887. 			mission_end_success("m06", M06_scene.destroy_building, M06_stilwater_nav) 
  888. 			--bink_play(M06_scene.destroy_building) 
  889. 			--mission_end_success("m06") 
  890. 		end 
  891. 	end 
  892. 	 
  893. end 
  894.  
  895. -- This is the primary function responsible for cleaning up the entire mission 
  896. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  897. -- 
  898. function m06_cleanup() 
  899. 	 
  900. 	hud_timer_stop(1) 
  901. 	 
  902. 	-- restore ped/traffic density 
  903. 	set_ped_density(1.0) 
  904. 	set_traffic_density(1.0) 
  905. 	 
  906. 	-- stop any conversations 
  907. 	cleanup_conversations(M06_convo) 
  908. 	 
  909. 	-- allow notoriety spawns again 
  910. 	notoriety_set_min("morningstar", 0) 
  911. 	notoriety_force_no_spawn("morningstar", false)	 
  912. 	 
  913. 	-- stop any music that may be playing 
  914. 	for i,emitter in pairs(M06_emitter.music) do 
  915. 		audio_ambient_emitter_stop(emitter) 
  916. 	end 
  917. 	 
  918. 	-- clear any elevators 
  919. 	m06_clear_elevator() 
  920. 	 
  921. 	-- This might be set separately 
  922. 	m06_clear_trigger(M06_factory_elevator) 
  923. 	 
  924. 	-- clean up dock groups/triggers 
  925. 	m06_cleanup_docks() 
  926. 			 
  927. 	-- clean up factory groups/triggers 
  928. 	m06_cleanup_factory() 
  929. 	 
  930. 	-- clean up top floor groups/triggers 
  931. 	m06_cleanup_top_floor() 
  932. 	 
  933. 	-- clean up the ball drop sequence 
  934. 	action_sequence_end() 
  935. 	 
  936. 	-- clean up homies 
  937. 	m06_clear_crew(M06_group.start_homies) 
  938. 	m06_clear_crew(M06_group.dock_homies) 
  939. 	m06_clear_crew(M06_group.factory_homies) 
  940. 	m06_clear_crew(M06_group.brute_killed_homies) 
  941. 	m06_clear_crew(M06_group.top_floor_homies) 
  942. 	m06_clear_crew(M06_group.off_ball_homies) 
  943. 	 
  944. 	-- clean up final choice triggers	 
  945. 	m06_clear_trigger(M06_trigger.brute_net.name) 
  946. 	m06_clear_trigger(M06_trigger.dock.name) 
  947. 	m06_clear_trigger(M06_trigger.notice_snipers.name) 
  948. 	m06_clear_trigger(M06_trigger.destroy_building.name) 
  949. 	m06_clear_trigger(M06_trigger.disarm_bomb.name) 
  950. 	 
  951. 	-- kick everyone out! 
  952. 	if group_is_loaded(M06_group.ball.name) then 
  953. 		vehicle_evacuate(M06_group.ball.vehicle) 
  954. 	end 
  955. 	m06_cleanup_ball_drop_checkpoint_groups() 
  956. 	 
  957. 	-- cleanup escape truck 
  958. 	if group_is_loaded(M06_group.escape_truck.name) then 
  959. 		group_destroy(M06_group.escape_truck.name) 
  960. 	end 
  961. 		 
  962. 	-- remove temp weapons 
  963. 	inv_remove_temp_loadout(M06_BALL_PLAYER_LOADOUT) 
  964. 	 
  965. 	-- re-enable all weapons 
  966. 	inv_weapon_disable_all_slots(false) 
  967. 	 
  968. 	-- Don't force me to look at anything 
  969. 	camera_restrict_set_active(DISABLE) 
  970. 	 
  971. 	-- clear animation states for ball drop 
  972. 	clear_animation_state(LOCAL_PLAYER) 
  973. 	set_player_can_enter_exit_vehicles(LOCAL_PLAYER, true) 
  974. 	set_players_can_be_downed(LOCAL_PLAYER, true) 
  975. 	if In_coop then 
  976. 		clear_animation_state(REMOTE_PLAYER) 
  977. 		set_player_can_enter_exit_vehicles(REMOTE_PLAYER, true) 
  978. 		set_players_can_be_downed(REMOTE_PLAYER, true) 
  979. 	end 
  980. 	 
  981. 	-- if we were in the building at any point 
  982. 	if M06_entered_garage and not M06_mission_completed then 
  983. 		-- teleport them outside 
  984. 		local exit_vehicles = true 
  985. 		teleport(LOCAL_PLAYER, M06_cancel_nav.host, exit_vehicles) 
  986. 		if (coop_is_active()) then 
  987. 			teleport( REMOTE_PLAYER, M06_cancel_nav.coop, exit_vehicles) 
  988. 		end 
  989. 	end 
  990. 	 
  991. 	-- cleanup the threads 
  992. 	cleanup_threads(M06_thread) 
  993. end 
  994.  
  995. -- Called when the mission has ended with success 
  996. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  997. -- 
  998. function m06_success() 
  999. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]--			 
  1000. 	if M06_trigger.disarm_bomb.hit then 
  1001. 		game_choice_set_state( MISSION_06_CHOICE, M06_CHOICE_BRANDED_TOWER ) 
  1002. 	else 
  1003. 		game_choice_set_state( MISSION_06_CHOICE, M06_CHOICE_BLOWN_TOWER ) 
  1004. 	end 
  1005.  
  1006. 	local skip_teleport = true 
  1007. 	m06_coop_skip(skip_teleport) -- do the stuff we'd do in the skip case 
  1008. end 
  1009.  
  1010.  
  1011. -- ************************* 
  1012. -- 
  1013. -- Local functions 
  1014. -- 
  1015. -- ************************* 
  1016.  
  1017. -- Initialize the mission for the specified checkpoint 
  1018. -- 
  1019. -- checkpoint:		Checkpoint to initialize the mission to 
  1020. -- 
  1021. function m06_initialize(checkpoint) 
  1022. 	-- Make sure the screen is completly faded out 
  1023. 	mission_start_fade_out(0.0) 
  1024.  
  1025. 	-- Set the mission author 
  1026. 	set_mission_author("Neil Ryan") 
  1027.  
  1028. 	-- Common initialization 
  1029. 	m06_initialize_common() 
  1030.  
  1031. 	-- Checkpoint specific initialization 
  1032. 	m06_initialize_checkpoint(checkpoint) 
  1033.  
  1034. 	-- Start fading in  
  1035. 	mission_start_fade_in() 
  1036. 	 
  1037. 	--Swap in the garage 
  1038. 	-- city_zone_swap("SG", true) 
  1039.  
  1040. end 
  1041.  
  1042. function m06_go_to_dock() 
  1043. 	M06_trigger.dock.hit = false 
  1044. --	m06_music(M06_emitter.music.mission_start)  --SP 7/21 - disabling as this doesn't fit. 
  1045. 	 
  1046. 	-- conversations	 
  1047. 	M06_thread.conversations = thread_new("m06_start_convos_thread") 
  1048. 	 
  1049. 	repeat 
  1050. 		thread_yield() 
  1051. 	until action_play_is_finished(LOCAL_PLAYER, 1.0) 
  1052. 		 
  1053. 	-- set waypoint to morning star tower dock 
  1054. 	mission_waypoint_add(M06_trigger.dock.name) 
  1055. 	trigger_enable(M06_trigger.dock.name, true) 
  1056. 	on_trigger("m06_dock_trigger_cb", M06_trigger.dock.name)	 
  1057. 	marker_add_trigger(M06_trigger.dock.name, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1058. 	 
  1059. 	while not M06_trigger.dock.hit do 
  1060. 		thread_yield() 
  1061. 	end 
  1062. 	M06_entered_garage = true 
  1063. 	 
  1064. 	door_lock(M06_mover.closet, true) 
  1065. 	 
  1066. 	m06_music(M06_emitter.music.clone_start) --SP changed to cloning from dock 
  1067.  
  1068. 	-- when hit trigger, spawn dock workers and continue 
  1069. 	group_create( M06_group.dock.name, true ) 
  1070. 	m06_setup_attack_lines(M06_group.dock.members) 
  1071. 	group_create( M06_group.workers.name, true ) 
  1072. 	group_create_hidden( M06_group.dock1.name, false ) 
  1073. 	m06_setup_attack_lines(M06_group.dock1.members) 
  1074.  
  1075. end 
  1076.  
  1077. function m06_kill_dock_guards() 
  1078. 	M06_convo.dock3.handle = audio_conversation_load_direct(M06_convo.dock3.name)	 
  1079. 	 
  1080. 	-- manual process_enemy_set()	 
  1081. 	for i, guard in pairs(M06_group.dock.members) do 
  1082. 		m06_dock_goons(guard) 
  1083. 	end 
  1084. 	 
  1085. 	audio_play_persona_line(M06_current_Pierce, "M06_Loading_Dock_01") 
  1086. 	 
  1087. 	trigger_enable(M06_trigger.notice_snipers.name, true) 
  1088. 	on_trigger("m06_notice_snipers_cb", M06_trigger.notice_snipers.name)	 
  1089. 	 
  1090. 	trigger_enable(M06_trigger.dock_thug_trigger01.name, true) 
  1091. 	on_trigger("m06_dock_thugs01_cb", M06_trigger.dock.name) 
  1092. 	 
  1093. 	trigger_enable(M06_trigger.dock_thug_trigger02.name, true) 
  1094. 	on_trigger("m06_dock_thugs02_cb", M06_trigger.dock.name) 
  1095. 	 
  1096. 	audio_ambient_emitter_start(M06_emitter.dock_start) 
  1097. 	 
  1098. 	while (not M06_trigger.notice_snipers.hit) do 
  1099. 		thread_yield() 
  1100. 	end 
  1101. 	 
  1102. 	delay(3.0) 
  1103. 	audio_conversation_play(M06_convo.dock3.handle) 
  1104.  
  1105. 	-- get the dock workers running 
  1106. 	while M06_DOCK_THUGS > 14 do 
  1107. 		thread_yield() 
  1108. 	end 
  1109. 	 
  1110. 	for i, worker in pairs(M06_group.workers.members1) do 
  1111. 		ai_do_scripted_move(worker, M06_worker_nav, true, false) 
  1112. 	end 
  1113. 	 
  1114. 	-- spawn the guys that are hiding among the crates and trucks 
  1115. 	while M06_DOCK_THUGS > 13 do 
  1116. 		thread_yield() 
  1117. 	end 
  1118. 	 
  1119. 	if not group_is_loaded(M06_group.dock2.name) then 
  1120. 		group_create_hidden( M06_group.dock2.name, false ) 
  1121. 		m06_setup_attack_lines(M06_group.dock2.members) 
  1122. 	end 
  1123. 	 
  1124. 	-- Make sure we havent already spawned them via trigger 
  1125. 	if (not M06_trigger.dock_thug_trigger01.hit) then 
  1126. 		group_show( M06_group.dock1.name, true ) 
  1127. 		for i, guard in pairs(M06_group.dock1.members) do 
  1128. 			m06_dock_goons(guard) 
  1129. 			ai_do_scripted_move(guard, M06_group.dock1.navpoints[i]) 
  1130. 		end 
  1131. 		m06_clear_trigger(M06_trigger.dock_thug_trigger01.name) 
  1132. 	end 
  1133. 	 
  1134. 	-- spawn the group of guys on the far right 
  1135. 	while M06_DOCK_THUGS > 9 do 
  1136. 		thread_yield() 
  1137. 	end 
  1138. 	 
  1139. 	-- bring in a few Saints reenforcements 
  1140. 	M06_group.saints_backup.thread = thread_new("m06_saint_reenforcement_thread") 
  1141. 	 
  1142. 	-- Make sure we havent already spawned them via trigger 
  1143. 	if (not M06_trigger.dock_thug_trigger02.hit) then 
  1144. 		group_show( M06_group.dock2.name, true ) 
  1145. 		for i, guard in pairs(M06_group.dock2.members) do 
  1146. 			m06_dock_goons(guard) 
  1147. 			ai_do_scripted_move(guard, M06_group.dock2.navpoints[i]) 
  1148. 		end 
  1149. 		m06_clear_trigger(M06_trigger.dock_thug_trigger02.name) 
  1150. 	end 
  1151. 	 
  1152. 	-- spawn the group of guys in the elevator shafts 
  1153. 	while M06_DOCK_THUGS > 5 do 
  1154. 		thread_yield() 
  1155. 	end 
  1156. 	 
  1157. 	group_create( M06_group.dock3.name, true ) 
  1158. 	m06_setup_attack_lines(M06_group.dock3.members) 
  1159.  
  1160. 	-- spawn in the brute and make him a required kill 
  1161. 	group_create(M06_group.dock_brute.name, true) 
  1162. 	M06_group.dock_brute.brute_killed = false 
  1163. 	m06_brute_attack(M06_group.dock_brute.brute, "m06_dock_brute_killed_cb") 
  1164. 	door_open(M06_mover.closet, false) 
  1165. 		 
  1166. 	for i, guard in pairs(M06_group.dock3.members) do 
  1167. 		m06_dock_goons(guard) 
  1168. 		ai_do_scripted_rush(guard, M06_group.dock3.navpoints[i]) 
  1169. 	end 
  1170. 	 
  1171. 	delay(2) 
  1172. 	-- say a line 
  1173. 	audio_play_persona_line(M06_current_Pierce, "M06_Loading_Dock_Brute") 
  1174. 	 
  1175. 	while ( M06_DOCK_THUGS > 0 ) or (not M06_group.dock_brute.brute_killed) do 
  1176. 		thread_yield() 
  1177. 	end 
  1178. 	 
  1179. 	-- make sure markers are removed 
  1180. 	enemy_set_cleanup(M06_group.dock.members) 
  1181. end 
  1182.  
  1183. function m06_dock_goons(goon) 
  1184. 	on_death("m06_dock_goon_dead_cb", goon) 
  1185. 	marker_add(goon, MINIMAP_ICON_KILL, OI_ASSET_KILL, OI_FLAGS_DEFAULT, SYNC_ALL) 
  1186. end 
  1187.  
  1188. function m06_setup_bomb_truck() 
  1189. 	group_show(M06_group.bomb_truck.name, true) 
  1190. 	-- set_ignore_ai_flag( M06_group.bomb_truck.driver, true ) 
  1191. 	vehicle_enter_teleport(M06_group.bomb_truck.driver, M06_group.bomb_truck.vehicle, 0) 
  1192. 	-- somebody set us up the bomb 
  1193. 	on_vehicle_destroyed("m06_failure_truck_destroyed_cb", M06_group.bomb_truck.vehicle) 
  1194. 	set_unjackable_flag(M06_group.bomb_truck.vehicle, true) 
  1195. 	vehicle_infinite_mass(M06_group.bomb_truck.vehicle) 
  1196. 	radio_block(M06_group.bomb_truck.vehicle) 
  1197. end 
  1198.  
  1199. function m06_enter_bomb_truck() 
  1200. 	m06_setup_bomb_truck() 
  1201. 	audio_play_persona_line(M06_current_Pierce, "M06_Bomb_Arrive") 
  1202. 	vehicle_pathfind_to(M06_group.bomb_truck.vehicle, M06_group.bomb_truck.path, true) 
  1203. 	vehicle_exit(M06_group.bomb_truck.driver) 
  1204. 	set_unjackable_flag(M06_group.bomb_truck.vehicle, true) 
  1205. end 
  1206.  
  1207. function m06_setup_saint_reenforcement() 
  1208. 	group_create(M06_group.saints_backup.name, true) 
  1209. 	delay(1) 
  1210. 	for i, saint in pairs(M06_group.saints_backup.members) do 
  1211. 		vehicle_enter_teleport(saint, M06_group.saints_backup.vehicle, (i-1)) 
  1212. 	end 
  1213. 	radio_block(M06_group.saints_backup.vehicle) 
  1214. 	 
  1215. end 
  1216.  
  1217. -- Arm the bomb on the truck 
  1218. function m06_set_bomb() 
  1219. 	M06_convo.bomb_set.handle = audio_conversation_load_direct(M06_convo.bomb_set.name)	 
  1220.  
  1221. 	M06_trigger.arm_bomb.hit = false 
  1222. 	trigger_enable(M06_trigger.arm_bomb.name, true) 
  1223. 	on_trigger("m06_bomb_cb", M06_trigger.arm_bomb.name) 
  1224. 	marker_add_trigger(M06_trigger.arm_bomb.name, MINIMAP_ICON_USE, INGAME_EFFECT_CHECKPOINT, OI_ASSET_USE, OI_FLAGS_LOCATION, SYNC_ALL) 
  1225. 	 
  1226. 	while not M06_trigger.arm_bomb.hit do 
  1227. 		thread_yield() 
  1228. 	end 
  1229. 	audio_conversation_play(M06_convo.bomb_set.handle) 
  1230. end 
  1231.  
  1232. function m06_go_to_factory() 
  1233.  
  1234. 	m06_factory_setup() 
  1235. 	 
  1236. 	m06_set_elevator( M06_dock_elevator, M06_checkpoint.factory.nav1, M06_checkpoint.factory.nav2 ) 
  1237. 	 
  1238. 	while M06_elevator_trigger ~= "" do 
  1239. 		thread_yield() 
  1240. 	end 
  1241. 	 
  1242. 	-- destroy dock groups 
  1243. 	m06_cleanup_docks() 
  1244. end 
  1245.  
  1246. -- set all the spawns/triggers for the factory 
  1247. function m06_factory_setup() 
  1248. 	-- spawn factory workers (not required kills) 
  1249. 	group_create_hidden(M06_group.factory1.name, true) 
  1250. 	m06_setup_attack_lines(M06_group.factory1.members) 
  1251. 	 
  1252. 	-- spawn the brute and setup trigger region to make him mad 
  1253. 	group_create_hidden(M06_group.factory_brute.name, true) 
  1254. 	 
  1255. 	-- This is now a flamer brute 
  1256. 	M06_trigger.factory_brute.hit = false 
  1257. 	trigger_enable(M06_trigger.factory_brute.name, true) 
  1258. 	on_trigger("m06_brute_cb", M06_trigger.factory_brute.name) 
  1259. 	door_lock(M06_mover.elevator1, true) 
  1260. 	-- Flamer removed for now 
  1261. 	-- M06_trigger.factory_brute_flamer.hit = true --false 
  1262. 	-- trigger_enable(M06_trigger.factory_brute_flamer.name, true) 
  1263. 	-- on_trigger("m06_brute_flamer_cb", M06_trigger.factory_brute_flamer.name) 
  1264. 	 
  1265. end 
  1266.  
  1267. -- Fight through people in the factory and kill the brutes 
  1268. function m06_fight_through_factory() 
  1269. 	 
  1270. 	trigger_enable(M06_trigger.factory_breadcrumb1.name, true) 
  1271. 	marker_add_trigger(M06_trigger.factory_breadcrumb1.name, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1272. 	on_trigger("m06_factory_breadcrumb1_cb", M06_trigger.factory_breadcrumb1.name) 
  1273.  
  1274. 	thread_kill(M06_thread.conversations) 
  1275. 	 
  1276. 	 
  1277. 	door_lock(M06_mover.elevator2, true) 
  1278.  
  1279. 	-- create first mob 
  1280. 	group_show( M06_group.factory1.name, true ) 
  1281.  
  1282. 	-- Wander  
  1283. 	for i, goon in pairs(M06_group.factory1.members) do 
  1284. 		wander_start(goon, M06_group.factory1.wander[i], M06_group.factory1.distance[i]) 
  1285. 	end 
  1286. 	 
  1287. 	-- load persona early so it has enough time to get loaded 
  1288. 	M06_convo.elevator.phillipe_persona_id = audio_persona_load_2d("Phillipe") 
  1289. 	 
  1290. 	-- Wait a few seconds then unlock and open the elevator door 
  1291. 	delay(1) 
  1292. 	audio_play_for_navpoint("M06_sfx_elevator_grind_halt", M06_elevator_noise) 
  1293. 	thread_new("m06_stumble", LOCAL_PLAYER) 
  1294. 	if (coop_is_active() == true) then 
  1295. 		thread_new("m06_stumble", REMOTE_PLAYER) 
  1296. 	end 
  1297. 	delay(1.0) 
  1298. 	M06_thread.conversations = thread_new("m06_factory_convos_thread") 
  1299. 	delay(3.0) 
  1300. 	door_open(M06_mover.elevator1) 
  1301. 	ai_do_scripted_move(M06_group.factory1.walker, M06_group.factory1.walk_nav, false, true)  
  1302. 	 
  1303. 	M06_trigger.enter_factory.hit = false 
  1304. 	trigger_enable(M06_trigger.enter_factory.name, true) 
  1305. 	on_trigger("m06_enter_factory_cb", M06_trigger.enter_factory.name)	 
  1306.  
  1307. 	M06_group.factory2.hit = false 
  1308. 	trigger_enable(M06_group.factory2.trigger, true ) 
  1309. 	on_trigger("m06_factory_wave2", M06_group.factory2.trigger) 
  1310.  
  1311. 	M06_group.factory3.hit = false 
  1312. 	trigger_enable(M06_group.factory3.trigger, true ) 
  1313. 	on_trigger("m06_factory_wave3", M06_group.factory3.trigger) 
  1314. 	 
  1315. 	M06_group.factory4.hit = false 
  1316. 	trigger_enable(M06_group.factory4.trigger, true ) 
  1317. 	on_trigger("m06_wave4_cb", M06_group.factory4.trigger) 
  1318. 	 
  1319. 	while not M06_group.factory_brute.brute_killed do --or not M06_group.factory_brute.flamer_killed do 
  1320. 		thread_yield() 
  1321. 	end 
  1322. 	 
  1323. 	M06_trigger.oleg_cutscene.hit = false 
  1324. 	trigger_enable(M06_trigger.oleg_cutscene.name, true) 
  1325. 	on_trigger("m06_oleg_cb", M06_trigger.oleg_cutscene.name) 
  1326. 	delay(3.0)	-- a few seconds if you are already in the trigger 
  1327. 		 
  1328. 	while not M06_trigger.oleg_cutscene.hit do 
  1329. 		thread_yield() 
  1330. 	end 
  1331. end 
  1332.  
  1333. function m06_factory_wave2() 
  1334. 	trigger_enable(M06_group.factory2.trigger, false ) 
  1335. 	for i, goon in pairs(M06_group.factory1a.members) do 
  1336. 		ai_do_scripted_move(goon, M06_group.factory1a.navpoints[i], true, false) 
  1337. 		delay(1) 
  1338. 	end 
  1339. 	group_create( M06_group.factory2.name, true ) 
  1340. 	m06_setup_attack_lines(M06_group.factory2.members) 
  1341. 	for i, guard in pairs(M06_group.factory2.members) do 
  1342. 		ai_do_scripted_move(guard, M06_group.factory2.navpoints[i]) 
  1343. 		delay(1) 
  1344. 	end 
  1345. 	M06_group.factory2.hit = true 
  1346. end 
  1347.  
  1348. function m06_factory_wave3() 
  1349. 	trigger_enable(M06_group.factory3.trigger, false ) 
  1350.  
  1351. 	group_create( M06_group.factory3.name, true ) 
  1352. 	m06_setup_attack_lines(M06_group.factory3.members) 
  1353. 	for i, guard in pairs(M06_group.factory3.members) do 
  1354. 		ai_do_scripted_move(guard, M06_group.factory3.navpoints[i], true, false) 
  1355. 		delay(1) 
  1356. 	end 
  1357. 	M06_group.factory3.hit = true 
  1358. end 
  1359.  
  1360. function m06_factory_brute() 
  1361. 	-- Bring on the brute 
  1362. 	group_show(M06_group.factory_brute.name) 
  1363. 	ai_do_scripted_move(M06_group.factory_brute.brute, M06_group.factory_brute.navpoint, true, false) 
  1364. end 
  1365.  
  1366. function m06_factory_wave4() 
  1367. 	-- and some flamer fodder 
  1368. 	group_create( M06_group.factory4.name, true ) 
  1369. 	m06_setup_attack_lines(M06_group.factory4.members) 
  1370. 	for i, guard in pairs(M06_group.factory4.members) do 
  1371. 		ai_do_scripted_move(guard, M06_group.factory4.navpoints[i], true, true) 
  1372. 	end 
  1373. end 
  1374.  
  1375. -- Z-Scene talking to Oleg 
  1376. function m06_meet_oleg() 
  1377.  
  1378. 	--bink_play(M06_scene.oleg) 
  1379. 	--fade_out(0.0) 
  1380. 	--fade_out_block() 
  1381. 	m06_clear_crew(M06_group.factory_homies) 
  1382. 	m06_cleanup_factory() 
  1383. 	 
  1384. 	m06_music(M06_emitter.music.clone_end) -- SP: moved to stop it before the cinematic so it doesn't overrun the z-scene 
  1385. 	m06_music(M06_emitter.music.mission_start)  --SP: start mission start audio to chill things out 
  1386.  
  1387. 	--teleport_coop(M06_oleg_zscene_navs[1], M06_oleg_zscene_navs[2], true) 
  1388. 	local create_this_group = nil 
  1389. 	local fade_in_after = true 
  1390. 	cutscene_play(M06_scene.oleg, create_this_group, M06_oleg_zscene_navs, fade_in_after) 
  1391. 	m06_setup_crew(M06_group.brute_killed_homies) 
  1392. 	--fade_in(0.5) 
  1393. 	--fade_in_block() 
  1394. end 
  1395.  
  1396. function m06_go_to_top_floor() 
  1397. 	-- need to handle this elevator a little different.  We have teleporting and creating and we 
  1398. 	-- have to make sure everyone is in place so we don't error playing the conversation 
  1399. 	 
  1400. 	-- setup the elevator trigger	 
  1401. 	M06_elevator_trigger = M06_factory_elevator  -- still use this 
  1402. 	trigger_enable(M06_elevator_trigger, true) 
  1403. 	marker_add_trigger(M06_elevator_trigger, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1404. 	 
  1405. 	-- we will use a custom callback that doesn't fade back in 
  1406. 	on_trigger("m06_elevator_to_top_floor_cb", M06_elevator_trigger) 
  1407. 	M06_elevator_destination = M06_checkpoint.brute_killed.nav1 
  1408. 	M06_elevator_destination_remote = M06_checkpoint.brute_killed.nav2 
  1409. 	 
  1410. 	audio_play_persona_line(M06_group.brute_killed_homies.oleg, "M06_Office") 
  1411. 	 
  1412. 	while M06_elevator_trigger ~= "" do 
  1413. 		thread_yield() 
  1414. 	end 
  1415. 	 
  1416. 	m06_top_floor_setup() 
  1417. 	group_show(M06_group.top_floor.name) 
  1418. 	-- now we can fade back in 
  1419. 	fade_in(0.5) 
  1420. end 
  1421.  
  1422. -- setup spawns/triggers for top floor 
  1423. function m06_top_floor_setup() 
  1424. 	-- TEMP TEMP TEMP 
  1425. 	-- city_zone_swap("SGDest", true) 
  1426.  
  1427. 	-- spawn factory workers (not required kills) 
  1428. 	group_create_hidden(M06_group.top_floor.name, true) 
  1429. 	m06_spawn_ball() 
  1430. 	 
  1431. 	-- spawn Phillipe and setup trigger region to make him run away 
  1432. 	M06_trigger.phillipe.hit = false 
  1433. 	group_create_hidden(M06_group.Phillipe.name) 
  1434. 	trigger_enable(M06_trigger.phillipe.name, true) 
  1435. 	on_trigger("m06_Phillipe_callback", M06_trigger.phillipe.name) 
  1436. end 
  1437.  
  1438. -- Fight through people in the top floors until you find the Phillipe. 
  1439. function m06_fight_through_top_floor() 
  1440. 	group_show(M06_group.top_floor.name) 
  1441. 	--group_show(M06_group.Phillipe.name) 
  1442. 	--marker_add(M06_group.Phillipe.phillipe, MINIMAP_ICON_KILL, OI_ASSET_KILL, OI_FLAGS_DEFAULT, SYNC_ALL) 
  1443.  
  1444. 	for i, npc in pairs(M06_group.top_floor.members) do 
  1445. 		cower(npc, M06_group.top_floor_homies.oleg, true, true) 
  1446. 	end 
  1447. 	 
  1448. 	-- follow oleg 
  1449. 	marker_add(M06_group.top_floor_homies.oleg, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_FULL, SYNC_ALL) 
  1450. 	follower_make_independent(M06_group.top_floor_homies.oleg, true) 
  1451. 	 
  1452. 	-- setup follow Oleg triggers 
  1453. 	M06_trigger.stairs1.hit = false 
  1454. 	M06_trigger.stairs2.hit = false 
  1455. 	M06_trigger.office.hit = false 
  1456. 	trigger_enable(M06_trigger.stairs1.name, true) 
  1457. 	trigger_enable(M06_trigger.stairs2.name, true) 
  1458. 	trigger_enable(M06_trigger.office.name, true) 
  1459. 	trigger_enable(M06_trigger.oleg_crash1.name, true) 
  1460. 	trigger_enable(M06_trigger.oleg_crash2.name, true) 
  1461. 	on_trigger("m06_stairs_cb", M06_trigger.stairs1.name) 
  1462. 	on_trigger("m06_stairs_cb", M06_trigger.stairs2.name) 
  1463. 	on_trigger("m06_office_cb", M06_trigger.office.name) 
  1464. 	on_trigger("m06_oleg_door1_cb", M06_trigger.oleg_crash1.name) 
  1465. 	on_trigger("m06_oleg_door2_cb", M06_trigger.oleg_crash2.name) 
  1466. 	 
  1467. 	-- send Oleg to the stairs 
  1468. 	ai_do_scripted_move(M06_group.top_floor_homies.oleg, M06_Oleg_path.stair, true, false) 
  1469.  
  1470. 	-- say your line 
  1471. 	delay(2.0) 
  1472. 	M06_convo.oleg.handle = audio_conversation_load(M06_convo.oleg.name)	 
  1473. 	audio_conversation_play(M06_convo.oleg.handle) 
  1474.  
  1475. 	m06_music(M06_emitter.music.follow_oleg) 
  1476. 	 
  1477. 	while not M06_trigger.stairs1.hit do 
  1478. 		thread_yield() 
  1479. 	end	 
  1480. 	 
  1481. 	ai_do_scripted_move(M06_group.top_floor_homies.oleg, M06_Oleg_path.climbs, true, false) 
  1482. 	 
  1483. 	while not M06_trigger.office.hit do 
  1484. 		thread_yield() 
  1485. 	end	 
  1486. 	 
  1487. 	-- send Oleg upstairs 
  1488. 	ai_do_scripted_move(M06_group.top_floor_homies.oleg, M06_Oleg_path.offices, true, false) 
  1489.  
  1490. 	while not M06_trigger.phillipe.hit do 
  1491. 		thread_yield() 
  1492. 	end 
  1493. 	 
  1494. end 
  1495.  
  1496. -- Z-Scene talking to Oleg 
  1497. function m06_watch_phillipe() 
  1498. 	--M06_thread.ball_setup = thread_new("m06_go_to_ball") 
  1499. 	if audio_conversation_playing(M06_convo.oleg.handle) then 
  1500. 		audio_conversation_end(M06_convo.oleg.handle) 
  1501. 	end 
  1502.  
  1503. 	local teleport_navs = { M06_checkpoint.ball_drop.nav1, M06_checkpoint.ball_drop.nav2 } 
  1504. 	m06_music(M06_emitter.music.dock_start) --SP changed from follow_oleg to dock to ramp the intensity, moved to trigger as you reach the z-scene 
  1505.  
  1506. 	local fade_in_after = false  -- stay faded so we can get on the damn ball 
  1507. 	cutscene_play(M06_scene.phillipe, nil, teleport_navs, fade_in_after) 
  1508. 	 
  1509. 	if group_is_loaded(M06_group.top_floor_homies.name) then 
  1510. 		marker_remove(M06_group.top_floor_homies.oleg) 
  1511. 	end 
  1512. 	 
  1513. 	-- combining cutscene with next section 
  1514. end 
  1515.  
  1516. function m06_go_to_ball() 
  1517.  
  1518. 	m06_cleanup_top_floor() 
  1519. 	m06_ball_setup() 
  1520. 	fade_in(0.5) 
  1521. 	 
  1522. end 
  1523.  
  1524. function m06_ball_stop1() 
  1525. 	--m06_lookat(M06_group.ball_stop1.lookat) 
  1526. 	m06_lookat("top_floor_lookat") 
  1527. 	camera_restrict_set_limits( -20, 23, -60, 60 ) 
  1528. 	 
  1529. --	m06_music(M06_emitter.music.hanging) SP: disabling as it's too low intensity 
  1530. 	 
  1531. 	-- focus on the door 
  1532. 	camera_restrict_target_object("top_floor_lookat") 
  1533. 	camera_restrict_set_active(ENABLE) 
  1534. 	m06_support_thugs(1) 
  1535. 	 
  1536. 	-- audio_play_persona_line(LOCAL_PLAYER, "M06_Ball_Stuck") 
  1537. 	M06_convo.ball_start.handle = audio_conversation_load(M06_convo.ball_start.name)	 
  1538. 	audio_conversation_play(M06_convo.ball_start.handle) 
  1539. 	m06_support_thugs(2) 
  1540. 	 
  1541. 	m06_support_thugs(3) 
  1542. 	 
  1543. 	-- player has some time to shoot some guys 
  1544. 	delay(10.0) 
  1545. 	audio_object_post_event(M06_emitter.ball_groan, nil, nil, LOCAL_PLAYER) 
  1546. 	delay(10.5) 
  1547. 	 
  1548. 	-- Fucktastic!  when we put the brute on the ball, other morningstar try to jump on and kick off the coop player.  WTF! 
  1549. 	-- So, we need to make sure the morningstar can't get on, but that blocks players so we're fucked if the coop player isn't on yet. 
  1550. 	-- Delay the call to make the ball unjackable for as long as is reasonable. 
  1551. 	-- Are you shitting me? People are jacking my ball? 
  1552. 	set_unjackable_flag(M06_group.ball.vehicle, true) 
  1553. 	delay(4.0) 
  1554. 	 
  1555. --	m06_music(M06_emitter.music.ball_start) SP: disabling as it's too low intensity 
  1556. 	 
  1557. 	audio_play_persona_line(M06_group.ball_saints.oleg, "M06_Finished_Breaking_Cables",3) 
  1558. 	 
  1559. 	delay(0.5) 
  1560. 	-- fall 
  1561. 	camera_restrict_set_active(DISABLE) 
  1562. 	audio_play_persona_line(LOCAL_PLAYER, "M06_Ball_Start") 
  1563. 	 
  1564. 	-- play some effects 
  1565. 	local tag_name = "" 
  1566. 	local looping = true 
  1567. 	--M06_effects.ball_effect.effect_handle = effect_play_on_script_object(M06_effects.ball_effect.name, M06_group.ball.vehicle, nil, looping) 
  1568. 	M06_effects.ball_effect.effect_handle = effect_play_on_script_object(M06_effects.ball_effect.name, LOCAL_PLAYER, nil, looping) 
  1569. 	M06_effects.tunnel_effect.effect_handle = effect_play(M06_effects.tunnel_effect.name, looping) 
  1570. 	--camera_restrict_target_object("stop2_lookat", 5000) 
  1571. 	--camera_restrict_set_active(ENABLE) 
  1572. 	--m06_play_next_ball_animations(M06_WAIT, M06_DO_NOT_INTERRUPT) 
  1573. 	-- brute goes on right away and start playing his animation (may need to move this to MAS) 
  1574. 	local seat = 3 
  1575. 	vehicle_enter_teleport(M06_group.ball_stop2.brute, M06_group.ball.vehicle, seat) 
  1576. 	m06_play_next_ball_animations(M06_DO_NOT_WAIT, M06_INTERRUPT) 
  1577. 	 
  1578. 	audio_play_persona_line(LOCAL_PLAYER, "M06_Ball_Stuck") 
  1579. 	local anim_name = "brute ball climb" 
  1580. 	local morph_name = anim_name 
  1581. 	local force_play = true	 
  1582. 	local percentage = 0.1 
  1583. 	action_play(M06_group.ball_stop2.brute, anim_name, morph_name, force_play, percentage) 
  1584. 	 
  1585. 	audio_play_persona_line(LOCAL_PLAYER, "M06_Brute_On_Ball") 
  1586. end 
  1587.  
  1588. function m06_ball_stop_brute() 
  1589.  
  1590. 	-- the short version 
  1591. 	 
  1592. 	-- wait a few seconds 
  1593. 	delay(0.5) 
  1594. 	local ignore_pitch = true 
  1595. 	camera_restrict_set_limits( -15, 25, -15, 15, nil, ignore_pitch )	 
  1596. 	-- look at brute (offset) 
  1597. 	camera_restrict_target_object(M06_group.ball_stop2.brute, 0, nil, -2.0, 1.0, 0.0) 
  1598. 	--camera_restrict_target_object(LOCAL_PLAYER, 0, nil, -2.0, 1.0, 0.0) 
  1599. 	----camera_end_look_through( SNAP_CAMERA ) 
  1600. 	-- look at the brute 
  1601. 	 
  1602. 	-- lock it 
  1603. 	camera_restrict_set_active(ENABLE) 
  1604. 	-- and get on the ball 
  1605. --	local seat = 3 
  1606. --	vehicle_enter_teleport(M06_group.ball_stop2.brute, M06_group.ball.vehicle, seat) 
  1607. 	-- wait a second or two 
  1608. 	delay(6.0) 
  1609. 	 
  1610. 	if (M06_effects.ball_effect.effect_handle ~= -1) then 
  1611. 		effect_stop(M06_effects.ball_effect.effect_handle) 
  1612. 		M06_effects.ball_effect.effect_handle = -1 
  1613. 	end 
  1614.  
  1615. 	--repeat 
  1616. 	--	thread_yield() 
  1617. 	--until not action_sequence_is_playing() 
  1618. 	 
  1619. 	-- script cut (eww) 
  1620. 	delay(4.0) 
  1621. 	--repeat 
  1622. 	--	thread_yield() 
  1623. 	--until action_play_is_finished(M06_group.ball_stop2.brute, 1.0) 
  1624. 		 
  1625. end 
  1626.  
  1627. -- Shoot the brute to make him fall off 
  1628. function m06_scrape_off_brute() 
  1629.  
  1630. 	-- Hackery or magic? 
  1631. 	camera_restrict_set_active(DISABLE) 
  1632. --	teleport_vehicle(M06_group.ball.vehicle, "ball_spot 001") 
  1633. --	thread_yield() 
  1634. --	camera_restrict_set_active(ENABLE) 
  1635. 	-- Start the next animation before we swtich the camera 
  1636. 	m06_play_next_ball_animations(M06_DO_NOT_WAIT, M06_INTERRUPT) 
  1637. 	M06_ball_brute_killed = false 
  1638. 	on_damage("m06_ball_brute_damage_cb", M06_group.ball_stop2.brute, 0.8) 
  1639. 	turn_vulnerable(M06_group.ball_stop2.brute) 
  1640. 	marker_add(M06_group.ball_stop2.brute, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_FULL, SYNC_ALL) 
  1641. 	-- start brute's animations 
  1642. 	local anim_name = M06_anim.brute_crawl 
  1643. 	local morph_name = anim_name 
  1644. 	local force_play = true	 
  1645. 	local percentage = 0.0 
  1646. 	-- thread this animation.  If the animation plays to 80%(?) without the brute being 'killed', kill the player 
  1647. 	action_play(M06_group.ball_stop2.brute, anim_name, morph_name, force_play, percentage) 
  1648. 	delay(0.1)	 
  1649. 	camera_restrict_set_active(ENABLE) 
  1650. 	delay(0.1)	 
  1651. 	 
  1652. 	set_players_can_be_downed(LOCAL_PLAYER, false) 
  1653. 	set_players_can_be_downed(REMOTE_PLAYER, false) 
  1654. 	 
  1655. 	-- 8 seconds to kill him 
  1656. 	delay(4.0) 
  1657. 	audio_play_persona_line(LOCAL_PLAYER, "M06_Brute_On_Ball") 
  1658. 	delay(4.0) 
  1659. 	 
  1660. 	if not M06_ball_brute_killed then 
  1661. 		local kill_player_pct = 0.79 
  1662. 		repeat 
  1663. 			thread_yield() 
  1664. 		until action_play_is_finished(M06_group.ball_stop2.brute, kill_player_pct) 
  1665. 		character_kill(LOCAL_PLAYER, true) 
  1666. 		character_kill(REMOTE_PLAYER, true) 
  1667. 		marker_remove(M06_group.ball_stop2.brute) 
  1668. 		 
  1669. 		while true do 
  1670. 			thread_yield() 
  1671. 			-- wait for player death 
  1672. 		end 
  1673. 	end 
  1674. 	 
  1675. 	set_players_can_be_downed(LOCAL_PLAYER, true) 
  1676. 	set_players_can_be_downed(REMOTE_PLAYER, true)	 
  1677. 	 
  1678. 	marker_remove(M06_group.ball_stop2.brute) 
  1679. 	 
  1680. 	-- you did it! 
  1681. 	local anim_name = "ball brute death" 
  1682. 	local morph_name = anim_name 
  1683. 	local force_play = true	 
  1684. 	local percentage = 0.8 
  1685. 	-- thread this animation.  If the animation plays to 80%(?) without the brute being 'killed', kill the player 
  1686. 	action_play(M06_group.ball_stop2.brute, anim_name, morph_name, force_play, percentage) 
  1687. 	 
  1688. 	camera_restrict_set_active(DISABLE) 
  1689. 	 
  1690. 	-- cut to next sequence 
  1691. 	--m06_play_next_ball_animations(M06_DO_NOT_WAIT, M06_INTERRUPT) 
  1692. 	vehicle_exit_teleport(M06_group.ball_stop2.brute)	 
  1693. 	------ kill him twice to get past his DBNO 
  1694. 	----character_kill(M06_group.ball_stop2.brute, true) 
  1695. 	----character_kill(M06_group.ball_stop2.brute, true) 
  1696. 	-- nuke him 
  1697. 	 
  1698. 	on_damage("", M06_group.ball_stop2.brute) 
  1699. 	group_destroy(M06_group.ball_stop2.name) 
  1700. 	 
  1701. 	--delay(1.5) 
  1702. 	--repeat  
  1703. 	--	thread_yield() 
  1704. 	--until not action_sequence_is_playing() 
  1705. end 
  1706.  
  1707. function m06_ball_stop2() 
  1708. 	 
  1709. 	--delay(4.0) 
  1710. 	local player_navs = {M06_done_with_ball_nav, M06_done_with_ball_nav1} 
  1711. 	m06_music(M06_emitter.music.dock_end) --SP: changed to end the high intensity dock music 
  1712.  
  1713. 	mesh_mover_show(M06_mover.damage) 
  1714. 	 
  1715. 	cutscene_play(M06_scene.ballsmash, nil, player_navs) 
  1716. 		 
  1717. 	-- clean up the ball drop sequence 
  1718. 	action_sequence_end() 
  1719. 	 
  1720. 	-- make sure garage is hidden 
  1721. 	mesh_mover_hide(M06_mover.garage) 
  1722. 	 
  1723. 	-- stop checking weapons 
  1724. 	thread_kill(M06_thread.weapon_check) 
  1725. 		 
  1726. 	-- all done with custom player states 
  1727. 	clear_animation_state(LOCAL_PLAYER) 
  1728. 	if In_coop then 
  1729. 		clear_animation_state(REMOTE_PLAYER) 
  1730. 	end 
  1731. 	 
  1732. 	-- no more infinite ammo 
  1733. 	inv_remove_temp_loadout(M06_BALL_PLAYER_LOADOUT) 
  1734. 	 
  1735. 	-- re-enable all weapons 
  1736. 	inv_weapon_disable_all_slots(false) 
  1737. end 
  1738.  
  1739. function m06_final_decision() 
  1740. 	 
  1741. 	if group_is_loaded(M06_group.trucks.name) then 
  1742. 		group_destroy(M06_group.trucks.name) 
  1743. 	end 
  1744. 	group_create(M06_group.escape_truck.name, true) 
  1745. 	set_unjackable_flag(M06_group.escape_truck.vehicle, true) 
  1746. 	vehicle_infinite_mass(M06_group.escape_truck.vehicle) 
  1747. 	radio_block(M06_group.escape_truck.vehicle) 
  1748. 	if not group_is_loaded(M06_group.bomb_truck.name) then 
  1749. 		-- may or may not be loaded 
  1750. 		group_create_hidden(M06_group.bomb_truck.name, true) 
  1751. 	end 
  1752. 	 
  1753. 	audio_object_post_event(M06_emitter.ball_traffic, nil, nil, LOCAL_PLAYER) 
  1754. 		 
  1755. 	-- teleport out of ball 
  1756. 	if In_coop then 
  1757. 		set_player_can_enter_exit_vehicles(REMOTE_PLAYER, true) 
  1758. 		--vehicle_exit_teleport(REMOTE_PLAYER) 
  1759. 	end 
  1760. 	set_player_can_enter_exit_vehicles(LOCAL_PLAYER, true) 
  1761. 	--vehicle_exit_teleport(LOCAL_PLAYER, true) 
  1762. 	 
  1763. 	-- teleport to spot 
  1764. 	--teleport_coop(M06_done_with_ball_nav, M06_done_with_ball_nav1, true) 
  1765. 	 
  1766. 	-- camera cut to show homies getting out of elevator so we can teleport the player 
  1767. 	m06_setup_bomb_truck() 
  1768. 	teleport_vehicle(M06_group.bomb_truck.vehicle, M06_group.bomb_truck.nav) 
  1769. 	M06_convo.decision.handle = audio_conversation_load_direct(M06_convo.decision.name) 
  1770. 	 
  1771. 	m06_cleanup_ball_drop_checkpoint_groups() 
  1772. 	m06_setup_crew(M06_group.off_ball_homies) 
  1773. 	--fade_in(0.5) 
  1774. 	--fade_in_block() 
  1775. 	 
  1776. 	M06_decision_made = false 
  1777. 	 
  1778. 	--player_choice_tut_open("m06") 
  1779. 	-- set up the triggers to make choice 
  1780. 	m06_set_choice_trigger(M06_trigger.destroy_building.name, "m06_choice_destroy_cb") 
  1781. 	m06_set_choice_trigger(M06_trigger.disarm_bomb.name, "m06_choice_disarm_cb") 
  1782. 	delay(.5) 
  1783. 	-- drop a brute 
  1784. 	teleport(M06_group.off_ball_homies.falling_brute, M06_falling_brute) 
  1785. 	character_kill(M06_group.off_ball_homies.falling_brute) 
  1786. 	delay(1) 
  1787. 	 
  1788. 	audio_play_persona_line(LOCAL_PLAYER, "M06_Phillipe_Crushed") 
  1789. 	delay(4.5) 
  1790. 	audio_conversation_play(M06_convo.decision.handle) 
  1791. 	thread_yield() 
  1792. 	 
  1793. 	audio_conversation_wait_for_end(M06_convo.decision.handle) 
  1794. 	M06_convo.decision.handle = INVALID_CONVERSATION_HANDLE 
  1795. 	 
  1796. 	--tutorial_start("player_choice") 
  1797. 	 
  1798. 	while not M06_decision_made do 
  1799. 		thread_yield() 
  1800. 	end 
  1801. end 
  1802.  
  1803. -- *************************************************** 
  1804. -- M06_run Helper Functions 
  1805. -- *************************************************** 
  1806.  
  1807. -- Set a trigger enabled with a mission marker 
  1808. -- 
  1809. -- trigger:					(string) Name of the trigger 
  1810. -- destination:			(string) Name of the navpoint destination 
  1811. -- 
  1812. function m06_set_elevator(trigger, destination, destination_remote) 
  1813. 	--waypoint_add(trigger) 
  1814. 	M06_elevator_trigger = trigger 
  1815. 	trigger_enable(M06_elevator_trigger, true) 
  1816. 	marker_add_trigger(M06_elevator_trigger, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1817. 	-- we have an inactive elevator while waiting for brute battle, so don't set this 
  1818. 	-- We "shouldn't" be able to get to the inactive elevator, but peoples are smart 
  1819. 	if destination ~= "" then 
  1820. 		on_trigger("m06_elevator_callback", M06_elevator_trigger) 
  1821. 		M06_elevator_destination = destination 
  1822. 		M06_elevator_destination_remote = destination_remote 
  1823. 	end 
  1824. end 
  1825.  
  1826. -- Disable elevator 
  1827. -- 
  1828. function m06_clear_elevator() 
  1829. 	if M06_elevator_trigger ~= "" then 
  1830. 		m06_clear_trigger(M06_elevator_trigger) 
  1831. 		M06_elevator_trigger = "" 
  1832. 		M06_elevator_destination = "" 
  1833. 	end 
  1834. end 
  1835.  
  1836.  
  1837. -- clear trigger 
  1838. -- 
  1839. function m06_clear_trigger(trigger) 
  1840. 	on_trigger("", trigger) 
  1841. 	trigger_enable(trigger, false) 
  1842. 	marker_remove_trigger(trigger, SYNC_ALL) 
  1843. 	mission_waypoint_remove() 
  1844. end 
  1845.  
  1846. -- Set the final choice triggers 
  1847. -- 
  1848. -- trigger:		(string) name of trigger to set 
  1849. -- callback:	(string) function name to call on trigger activation 
  1850. --  
  1851. function m06_set_choice_trigger(trigger, callback) 
  1852. 	--mission_waypoint_add(trigger) 
  1853. 	trigger_enable(trigger, true) 
  1854. 	-- color-code options 
  1855. 	if trigger == M06_trigger.disarm_bomb.name then 
  1856. 		marker_add_trigger(trigger, MINIMAP_ICON_USE, INGAME_EFFECT_CHECKPOINT, OI_ASSET_USE, OI_FLAGS_LOCATION, SYNC_ALL) 
  1857. 		object_indicator_add_objective_text(M06_trigger.disarm_bomb.name, "PLAYER_CHOICE_M06_OPTION2_TITLE", "PLAYER_CHOICE_M06_OPTION2_BODY") 
  1858. 	else 
  1859. 		marker_add_trigger(trigger, MINIMAP_ICON_KILL, INGAME_EFFECT_CHECKPOINT, OI_ASSET_KILL_FULL, OI_FLAGS_LOCATION, SYNC_ALL) 
  1860. 		object_indicator_add_objective_text(M06_trigger.destroy_building.name, "PLAYER_CHOICE_M06_OPTION1_TITLE", "PLAYER_CHOICE_M06_OPTION1_BODY") 
  1861. 	end 
  1862. 	on_trigger(callback, trigger) 
  1863. end 
  1864.  
  1865. -- send thugs to a ball support to be killed 
  1866. -- 
  1867. -- support_num:		(int) number of the support that will be broken next 
  1868. -- 
  1869. function m06_support_thugs(support_num) 
  1870. 	-- wake up some new guys 
  1871. 	m06_wake_up_group(M06_group.ball_thugs.floor1[support_num]) 
  1872. 	m06_wake_up_group(M06_group.ball_thugs.floor2[support_num]) 
  1873. 	m06_wake_up_group(M06_group.ball_thugs.floor3[support_num]) 
  1874. 	 
  1875. 	-- send them and any earlier guys still alive to the navpoint to get killed 
  1876. 	local group_num = support_num 
  1877. 	--while group_num > 0 do 
  1878. 		m06_send_group_to(M06_group.ball_thugs.floor1[group_num], M06_group.ball_thugs.floor2_nav[support_num]) 
  1879. 		m06_send_group_to(M06_group.ball_thugs.floor2[group_num], M06_group.ball_thugs.floor2_nav[support_num]) 
  1880. 		m06_send_group_to(M06_group.ball_thugs.floor3[group_num], M06_group.ball_thugs.floor3_nav[support_num]) 
  1881. 	--	group_num = group_num - 1 
  1882. 	--end 
  1883. end 
  1884.  
  1885. -- force the camera to look at a navpoint and release control 
  1886. -- 
  1887. -- lookat_nav:	(string) name of the navpoint to look at 
  1888. function m06_lookat(lookat_nav) 
  1889. 	-- use current camera facing as start direction 
  1890. 	camera_restrict_target_object() 
  1891. 	camera_restrict_set_limits( 0.0, 0.0, 0.0, 0.0) 
  1892. 	-- lock it 
  1893. 	camera_restrict_set_active(ENABLE) 
  1894. 	thread_yield() 
  1895. 	 
  1896. 	camera_restrict_target_object(lookat_nav, 500) 
  1897. 	delay(0.6) 
  1898. 	-- make sure we are looking at it 
  1899. 	camera_restrict_target_object(lookat_nav) 
  1900. 	thread_yield() 
  1901. 	camera_restrict_set_active(DISABLE) 
  1902. end 
  1903.  
  1904. -- setup followers as necessary 
  1905. function m06_setup_crew( homie_table ) 
  1906. 	group_create(homie_table.name, true) 
  1907. 	party_add( homie_table.pierce, LOCAL_PLAYER ) 
  1908. 	follower_set_can_abandon( homie_table.pierce, true ) 
  1909. 	on_death("m06_failure_pierce_died_cb", homie_table.pierce) 
  1910. 	on_dismiss("m06_failure_dismissed_cb", homie_table.pierce) 
  1911. 	M06_current_Pierce = homie_table.pierce 
  1912. 	--turn_invulnerable(homie_table.pierce) 
  1913. 	 
  1914. 	-- in coop, remote gets Shaundi 
  1915. 	if false then --In_coop then 
  1916. 		party_add( homie_table.shaundi, REMOTE_PLAYER ) 
  1917. 	else 
  1918. 		party_add( homie_table.shaundi, LOCAL_PLAYER ) 
  1919. 	end 
  1920. 	follower_set_can_abandon( homie_table.shaundi, true ) 
  1921. 	on_death("m06_failure_shaundi_died_cb", homie_table.shaundi) 
  1922. 	on_dismiss("m06_failure_dismissed_cb", homie_table.shaundi) 
  1923. 	M06_current_Shaundi = homie_table.shaundi 
  1924. 	--turn_invulnerable(homie_table.shaundi) 
  1925.  
  1926. 	-- Oleg if we got him 
  1927. 	if homie_table.oleg ~= "" then 
  1928. 		party_add( homie_table.oleg, LOCAL_PLAYER ) 
  1929. 		--turn_invulnerable(homie_table.oleg) 
  1930. 		follower_set_can_abandon( homie_table.oleg, true ) 
  1931. 		on_death("m06_failure_oleg_died_cb", homie_table.oleg) 
  1932. 		on_dismiss("m06_failure_dismissed_cb", homie_table.oleg) 
  1933. 	end 
  1934. 	 
  1935. end 
  1936.  
  1937. -- clear followers as necessary 
  1938. function m06_clear_crew( homie_table ) 
  1939. 	if group_is_loaded(homie_table.name) then 
  1940. 		on_death("", homie_table.pierce) 
  1941. 		on_dismiss("", homie_table.pierce) 
  1942. 		on_death("", homie_table.shaundi) 
  1943. 		on_dismiss("", homie_table.shaundi) 
  1944. 		 
  1945. 		-- Oleg if we got him 
  1946. 		if homie_table.oleg ~= "" then 
  1947. 			on_death("", homie_table.oleg) 
  1948. 			on_dismiss("", homie_table.oleg) 
  1949. 		end 
  1950. 		group_destroy(homie_table.name) 
  1951. 	end 
  1952. end 
  1953.  
  1954. -- teleport followers to a set of navpoints 
  1955. function m06_teleport_crew( homie_table, navs )	 
  1956. 	teleport(homie_table.pierce, navs[1]) 
  1957. 	teleport(homie_table.shaundi, navs[2]) 
  1958. 	 
  1959. 	if homie_table.oleg ~= "" then 
  1960. 		teleport(homie_table.oleg, navs[3]) 
  1961. 	end 
  1962. end 
  1963.  
  1964. -- set crew to ignore ai (to say lines) 
  1965. function m06_dumb_crew( homie_table ) 
  1966. 	set_ignore_ai_flag( homie_table.pierce, true ) 
  1967. 	set_ignore_ai_flag( homie_table.shaundi, true ) 
  1968. 	 
  1969. 	if homie_table.oleg ~= "" then 
  1970. 		set_ignore_ai_flag( homie_table.oleg, true ) 
  1971. 	end 
  1972. end 
  1973.  
  1974. -- *************************************************** 
  1975. -- M06_initialize Helper Functions 
  1976. -- *************************************************** 
  1977.  
  1978. -- Handle any common initialization 
  1979. -- 
  1980. function m06_initialize_common() 
  1981. 	 
  1982. 	-- loading dock trucks 
  1983. 	group_create(M06_group.trucks.name, true) 
  1984. 	 
  1985. 	-- create the bomb truck so we make sure we have the resources (customized vehicle slot) 
  1986. 	group_create_hidden(M06_group.bomb_truck.name, true) 
  1987. 	 
  1988. 	-- show platforms (action sequence will hide these) 
  1989. 	mesh_mover_show(M06_mover.platform1) 
  1990. 	--mesh_mover_show(M06_mover.platform2)	 
  1991. end 
  1992.  
  1993. -- Checkpoint specific initialization 
  1994. -- 
  1995. -- checkpoint:		The checkpoint to be initialized 
  1996. function m06_initialize_checkpoint(checkpoint) 
  1997.  
  1998. 	if (checkpoint == M06_checkpoint.start.name) then 
  1999. 		teleport_player_vehicles(M06_checkpoint.start.p1_car, M06_checkpoint.start.p2_car) 
  2000. 		m06_setup_crew(M06_group.start_homies) 
  2001. 		-- let the vehicle go or it will fall through the world when you leave it (is bad) 
  2002. 		release_to_world(M06_group.start_homies.vehicle) 
  2003. 		 
  2004. 		-- Player look cool GO! 
  2005. 		local anim_name = "M06 Player Mission Start" 
  2006. 		local morph_name = "M06 Player Mission Start" 
  2007. 		local force_play = false 
  2008. 		local stand_still = false 
  2009. 		local zero_movement = false 
  2010. 		action_play_non_blocking(LOCAL_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement) 
  2011. 		player_script_controlled_clear(LOCAL_PLAYER)	-- let player escape this animation 
  2012. 		if (coop_is_active()) then 
  2013. 			action_play_non_blocking(REMOTE_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement) 
  2014. 			player_script_controlled_clear(REMOTE_PLAYER)	-- let player escape this animation 
  2015. 		end 
  2016. 	end 
  2017.  
  2018. 	if (checkpoint == M06_checkpoint.dock.name) then 
  2019. 		teleport_coop(M06_checkpoint.dock.nav1, M06_checkpoint.dock.nav2, true) 
  2020. 		m06_setup_crew(M06_group.dock_homies) 
  2021. 		group_create( M06_group.dock.name, true ) 
  2022. 		m06_setup_attack_lines(M06_group.dock.members) 
  2023. 		group_create( M06_group.workers.name, true ) 
  2024. 		group_create_hidden( M06_group.dock1.name, false ) 
  2025. 		m06_setup_attack_lines(M06_group.dock1.members) 
  2026. 		group_create_hidden( M06_group.dock2.name, false ) 
  2027. 		m06_setup_attack_lines(M06_group.dock2.members) 
  2028. 		m06_music(M06_emitter.music.clone_cp) 
  2029. 	end 
  2030. 	 
  2031. 	if (checkpoint == M06_checkpoint.factory.name) then 
  2032. 		teleport_coop(M06_checkpoint.factory.nav1, M06_checkpoint.factory.nav2, true) 
  2033. 		hud_timer_set( 1, M06_BOMB_TIMER_FACTORY_MS, "m06_failure_truck_destroyed_cb" ) 
  2034. 		notoriety_force_no_spawn("morningstar", true) 
  2035. 		m06_factory_setup() 
  2036. 		m06_music(M06_emitter.music.clone_cp) 
  2037. 	end 
  2038. 	 
  2039. 	if (checkpoint == M06_checkpoint.brute_killed.name) then 
  2040. 		teleport_coop(M06_checkpoint.brute_killed.nav1, M06_checkpoint.brute_killed.nav2, true) 
  2041. 		hud_timer_set( 1, M06_BOMB_TIMER_BRUTE_KILLED_MS, "m06_failure_truck_destroyed_cb" ) 
  2042. 		notoriety_force_no_spawn("morningstar", true) 
  2043. 		m06_top_floor_setup() 
  2044. 	end	 
  2045. 	 
  2046. 	if (checkpoint == M06_checkpoint.ball_drop.name) then 
  2047. 		teleport_coop(M06_checkpoint.ball_drop.nav1, M06_checkpoint.ball_drop.nav2, true) 
  2048. 		hud_timer_set( 1, M06_BOMB_TIMER_BALL_DROP_MS, "m06_failure_truck_destroyed_cb" ) 
  2049. 		notoriety_force_no_spawn("morningstar", true)		 
  2050. 		m06_spawn_ball()	 
  2051. 		m06_ball_setup()	 
  2052. 		m06_music(M06_emitter.music.dock_start)		 
  2053. 	end 
  2054.  
  2055. end 
  2056.  
  2057. function m06_spawn_ball() 
  2058. 	-- spawn the ball 
  2059. 	group_create(M06_group.ball.name, true)	 
  2060. 	teleport_vehicle(M06_group.ball.vehicle, M06_group.ball.nav) 
  2061. 	while not vehicle_enable_physics(M06_group.ball.vehicle, false) do 
  2062. 		thread_yield() 
  2063. 	end 
  2064. 	vehicle_suppress_npc_exit(M06_group.ball.vehicle) 
  2065. end 
  2066.  
  2067. function m06_ball_setup() 
  2068.  
  2069. 	-- make sure we know what loadout we have 
  2070. 	inv_add_temp_loadout(M06_BALL_PLAYER_LOADOUT) 
  2071. 	thread_yield() 
  2072. 	inv_weapon_disable_all_but_this_slot( WEAPON_SLOT_RIFLE ) 
  2073. 	thread_yield() 
  2074. 	 
  2075. 	-- spawn the dudes to shoot at 
  2076. 	--group_create(M06_group.ball_stop1.name, true) 
  2077. 	group_create(M06_group.ball_stop2.name, true)	 
  2078. 	--group_create(M06_group.ball_stop3.name, true)	 
  2079. 	 
  2080. 	-- Saints 
  2081. 	group_create(M06_group.ball_saints.name, true) 
  2082. 	 
  2083. 	-- guys to shoot 
  2084. 	group_create_hidden(M06_group.ball_thugs.name, true) 
  2085. 		 
  2086. 	local block = true 
  2087. 	local local_seat = 1 
  2088. 	local remote_seat = 2 
  2089. 	if M06_swap_vault_seats then 
  2090. 		local_seat = 2 
  2091. 		remote_seat = 1 
  2092. 	end 
  2093. 	while not vehicle_enter_teleport(LOCAL_PLAYER, M06_group.ball.vehicle, local_seat, block) do 
  2094. 		thread_yield() 
  2095. 	end 
  2096. 	set_player_can_enter_exit_vehicles(LOCAL_PLAYER, false) 
  2097. 	if ( In_coop ) then 
  2098. 		while not vehicle_enter_teleport(REMOTE_PLAYER, M06_group.ball.vehicle, remote_seat, block) do 
  2099. 			thread_yield() 
  2100. 		end 
  2101. 		set_player_can_enter_exit_vehicles(REMOTE_PLAYER, false) 
  2102. 	end 
  2103. 	 
  2104. 	-- restrict his view angle so animation plays properly	 
  2105. 	camera_restrict_set_limits( -20, 23, -60, 60 ) 
  2106. 	-- focus on the door 
  2107. 	camera_restrict_target_object("top_floor_lookat") 
  2108. 	camera_restrict_set_active(ENABLE) 
  2109. 	 
  2110. 	-- spawn a thread to keep trying to give the weapon until we are sure we have it 
  2111. 	M06_thread.weapon_check = thread_new("m06_check_weapon_thread") 
  2112. 	 
  2113. 	action_sequence_setup(BALL_SEQUENCE, M06_group.ball.vehicle) 
  2114. end 
  2115. 	 
  2116. -- *************************************************** 
  2117. -- Miscellaneous M06 Helper Functions 
  2118. -- *************************************************** 
  2119.  
  2120. function m06_cleanup_docks() 
  2121.  
  2122. 	-- destroy dock group 
  2123. 	if group_is_loaded(M06_group.dock.name) then 
  2124. 		for i, guard in pairs(M06_group.dock.members) do 
  2125. 			on_death("", guard) 
  2126. 			on_attack_performed("", guard) 
  2127. 		end 
  2128. 		group_destroy(M06_group.dock.name) 
  2129. 	end 
  2130. 	 
  2131. 	-- destroy dock brute 
  2132. 	if group_is_loaded(M06_group.dock_brute.name) then 
  2133. 		m06_brute_cleanup(M06_group.dock_brute.brute) 
  2134. 		group_destroy(M06_group.dock_brute.name) 
  2135. 	end 
  2136.  
  2137. 	-- enemy reinforcements 1 
  2138. 	if group_is_loaded(M06_group.dock1.name) then 
  2139. 		for i, guard in pairs(M06_group.dock1.members) do 
  2140. 			on_death("", guard) 
  2141. 			on_attack_performed("", guard) 
  2142. 		end 
  2143. 		group_destroy(M06_group.dock1.name) 
  2144. 	end 
  2145. 	 
  2146. 	-- enemy reinforcements 2 
  2147. 	if group_is_loaded(M06_group.dock2.name) then 
  2148. 		for i, guard in pairs(M06_group.dock2.members) do 
  2149. 			on_death("", guard) 
  2150. 			on_attack_performed("", guard) 
  2151. 		end 
  2152. 		group_destroy(M06_group.dock2.name) 
  2153. 	end 
  2154. 	 
  2155. 	-- enemy reinforcements 3 
  2156. 	if group_is_loaded(M06_group.dock3.name) then 
  2157. 		for i, guard in pairs(M06_group.dock3.members) do 
  2158. 			on_death("", guard) 
  2159. 			on_attack_performed("", guard) 
  2160. 		end 
  2161. 		group_destroy(M06_group.dock3.name) 
  2162. 	end 
  2163. 	 
  2164. 	-- dock workers 
  2165. 	if group_is_loaded(M06_group.workers.name) then 
  2166. 		group_destroy(M06_group.workers.name) 
  2167. 	end 
  2168. 	 
  2169. 	-- destroy car bomb group 
  2170. 	if group_is_loaded(M06_group.bomb_truck.name) then 
  2171. 		m06_clear_trigger(M06_trigger.arm_bomb.name) 
  2172. 		on_vehicle_destroyed("", M06_group.bomb_truck.vehicle) 
  2173. 		group_destroy(M06_group.bomb_truck.name) 
  2174. 	end 
  2175. 	 
  2176. 	-- destroy trucks in dock	 
  2177. 	if group_is_loaded(M06_group.trucks.name) then 
  2178. 		group_destroy(M06_group.trucks.name) 
  2179. 	end 
  2180. 	 
  2181. 	-- cleanup saints 
  2182. 	if group_is_loaded(M06_group.saints_backup.name) then 
  2183. 		thread_kill(M06_group.saints_backup.thread) 
  2184. 		group_destroy(M06_group.saints_backup.name) 
  2185. 	end 
  2186. end 
  2187.  
  2188. function m06_cleanup_factory() 
  2189. 	if group_is_loaded(M06_group.factory1.name) then 
  2190. 		for i, guard in pairs(M06_group.factory1.members) do 
  2191. 			on_attack_performed("", guard) 
  2192. 		end 
  2193. 		group_destroy(M06_group.factory1.name) 
  2194. 	end 
  2195. 	if group_is_loaded(M06_group.factory2.name) then 
  2196. 		for i, guard in pairs(M06_group.factory2.members) do 
  2197. 			on_attack_performed("", guard) 
  2198. 		end 
  2199. 		group_destroy(M06_group.factory2.name) 
  2200. 	end 
  2201. 	if group_is_loaded(M06_group.factory3.name) then 
  2202. 		for i, guard in pairs(M06_group.factory3.members) do 
  2203. 			on_attack_performed("", guard) 
  2204. 		end 
  2205. 		group_destroy(M06_group.factory3.name) 
  2206. 	end 
  2207. 	if group_is_loaded(M06_group.factory4.name) then 
  2208. 		for i, guard in pairs(M06_group.factory4.members) do 
  2209. 			on_attack_performed("", guard) 
  2210. 		end 
  2211. 		group_destroy(M06_group.factory4.name) 
  2212. 	end 
  2213. 	if group_is_loaded(M06_group.factory_brute.name) then 
  2214. 		m06_brute_cleanup(M06_group.factory_brute.brute) 
  2215. 		--m06_brute_cleanup(M06_group.factory_brute.brute_flamer) 
  2216. 		group_destroy(M06_group.factory_brute.name) 
  2217. 	end 
  2218. 	 
  2219. 	-- Unload personas 
  2220. 	if (M06_convo.elevator.phillipe_persona_id ~= INVALID_PERSONA_HANDLE) then 
  2221. 		audio_persona_remove_2d(M06_convo.elevator.phillipe_persona_id) 
  2222. 		M06_convo.elevator.phillipe_persona_id = INVALID_PERSONA_HANDLE 
  2223. 	end 
  2224. 	 
  2225. 	-- clear conversation triggers 
  2226. 	m06_clear_trigger(M06_trigger.enter_factory.name) 
  2227. 	-- clear breadcrumb triggers 
  2228. 	m06_clear_trigger(M06_trigger.factory_breadcrumb1.name) 
  2229. 	m06_clear_trigger(M06_trigger.factory_breadcrumb2.name) 
  2230. 	m06_clear_trigger(M06_trigger.factory_breadcrumb3.name) 
  2231. 	-- clear factory thug triggers 
  2232. 	m06_clear_trigger(M06_group.factory2.trigger) 
  2233. 	m06_clear_trigger(M06_group.factory3.trigger) 
  2234. 	m06_clear_trigger(M06_group.factory4.trigger) 
  2235. 	-- clear the brute trigger 
  2236. 	m06_clear_trigger(M06_trigger.factory_brute.name) 
  2237. 	--m06_clear_trigger(M06_trigger.factory_brute_flamer.name) 
  2238. 	m06_clear_trigger(M06_trigger.oleg_cutscene.name) 
  2239. end 
  2240.  
  2241. function m06_cleanup_top_floor() 
  2242. 	if group_is_loaded(M06_group.top_floor.name) then 
  2243. 		group_destroy(M06_group.top_floor.name) 
  2244. 	end 
  2245. 	if group_is_loaded(M06_group.Phillipe.name) then 
  2246. 		marker_remove(M06_group.Phillipe.phillipe) 
  2247. 		group_destroy(M06_group.Phillipe.name) 
  2248. 	end 
  2249. 	 
  2250. 	-- clear follow the Oleg triggers 
  2251. 	m06_clear_trigger(M06_trigger.stairs1.name) 
  2252. 	m06_clear_trigger(M06_trigger.stairs2.name) 
  2253. 	m06_clear_trigger(M06_trigger.office.name) 
  2254. 	m06_clear_trigger(M06_trigger.oleg_crash1.name) 
  2255. 	m06_clear_trigger(M06_trigger.oleg_crash2.name) 
  2256. 	 
  2257. 	-- clear the ball drop trigger 
  2258. 	m06_clear_trigger(M06_trigger.ball_drop.name) 
  2259.  
  2260. 	-- clear the Phillipe trigger 
  2261. 	m06_clear_trigger(M06_trigger.phillipe.name) 
  2262. end 
  2263.  
  2264. function m06_cleanup_ball_drop_checkpoint_groups() 
  2265. 	if group_is_loaded(M06_group.ball_stop1.name) then 
  2266. 		group_destroy(M06_group.ball_stop1.name) 
  2267. 	end 
  2268. 	if group_is_loaded(M06_group.ball_stop2.name) then 
  2269. 		on_damage("", M06_group.ball_stop2.brute) 
  2270. 		marker_remove(M06_group.ball_stop2.brute) 
  2271. 		group_destroy(M06_group.ball_stop2.name) 
  2272. 	end 
  2273. 	if group_is_loaded(M06_group.ball_stop3.name) then 
  2274. 		group_destroy(M06_group.ball_stop3.name) 
  2275. 	end 
  2276. 	if group_is_loaded(M06_group.ball.name) then 
  2277. 		group_destroy(M06_group.ball.name) 
  2278. 	end 
  2279. 	if group_is_loaded(M06_group.ball_saints.name) then 
  2280. 		group_destroy(M06_group.ball_saints.name) 
  2281. 	end 
  2282. 	if group_is_loaded(M06_group.ball_thugs.name) then 
  2283. 		group_destroy(M06_group.ball_thugs.name) 
  2284. 	end 
  2285. 	 
  2286. 	if (M06_effects.ball_effect.effect_handle ~= -1) then 
  2287. 		effect_stop(M06_effects.ball_effect.effect_handle) 
  2288. 		M06_effects.ball_effect.effect_handle = -1 
  2289. 	end 
  2290. 	if (M06_effects.tunnel_effect.effect_handle ~= -1) then 
  2291. 		effect_stop(M06_effects.tunnel_effect.effect_handle) 
  2292. 		M06_effects.tunnel_effect.effect_handle = -1 
  2293. 	end 
  2294. end 
  2295.  
  2296. function m06_music(disco) 
  2297. 	audio_object_post_event(disco, nil, nil, LOCAL_PLAYER) 
  2298. end 
  2299.  
  2300. function m06_emergency_ragdoll_save(area) 
  2301. 	character_ragdoll_clear_last_resort_position() 
  2302. 	character_ragdoll_set_last_resort_position(M06_ragdoll_emergency[area]) 
  2303. end 
  2304.  
  2305. -- play a conversation during the driving section of the mission 
  2306. -- 
  2307. -- convo:		(table) conversation information 
  2308. -- 
  2309. function m06_play_driving_convo(convo) 
  2310. 	convo.handle = audio_conversation_load(convo.name)	 
  2311. 	audio_conversation_play(convo.handle) 
  2312. 	delay(1.0) 
  2313. 	while audio_conversation_playing(convo.handle) and (not M06_trigger.dock.hit) do 
  2314. 		thread_yield() 
  2315. 	end 
  2316. 	if audio_conversation_playing(convo.handle) then 
  2317. 		audio_conversation_end(convo.handle) 
  2318. 	end 
  2319. end 
  2320.  
  2321. -- wake up and unleash an npc 
  2322. -- 
  2323. -- npc_name:		(string) npc to wake up 
  2324. function m06_wake_up_npc(npc_name) 
  2325. 	-- make him vulnerable 
  2326. 	turn_vulnerable(npc_name) 
  2327. 	-- make him hear you 
  2328. 	npc_hearing_enable(npc_name, true) 
  2329. 	-- set him free	 
  2330. 	npc_leash_remove(npc_name) 
  2331. end 
  2332.  
  2333. -- go through a table of npcs and wake up each one 
  2334. -- 
  2335. -- npc_table:	(table) list of npc names to wake up (may be 0) 
  2336. function m06_wake_up_group(npc_table) 
  2337. 	for i, npc_name in pairs(npc_table) do 
  2338. 		character_show(npc_name) 
  2339. 		m06_wake_up_npc(npc_name) 
  2340. 	end	 
  2341. end 
  2342.  
  2343. -- tell a group of npcs to go to a navpoint 
  2344. -- 
  2345. -- npc_table:	(table) list of npcs to move 
  2346. -- navpoint:	(string) name of the place to go 
  2347. function m06_send_group_to(npc_table, navpoint) 
  2348. 	local should_run = true 
  2349. 	local should_fire = false 
  2350. 	for i, npc_name in pairs(npc_table) do 
  2351. 		ai_do_scripted_move(npc_name, navpoint, should_run, should_fire) 
  2352. 	end 
  2353. end 
  2354.  
  2355. -- a brute has been found.  Tag him and make him attack. 
  2356. -- 
  2357. --	brute:			(string) name of the attacking brute 
  2358. -- callback:		(string) name of function to call when brute is killed 
  2359. -- 
  2360. function m06_brute_attack(brute, callback) 
  2361. 	m06_wake_up_npc(brute) 
  2362. 	 
  2363. 	-- set a marker on him 
  2364. 	on_death(callback, brute) 
  2365. 	marker_add(brute, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_FULL, SYNC_ALL) 
  2366. 	-- ai_add_enemy_target(brute, CLOSEST_PLAYER, 2) 
  2367. 	 
  2368. 	-- update the objective 
  2369. 	objective_text( 0, "m06_obj_kill_brute", "", "", SYNC_ALL, OI_ASSET_KILL ) 
  2370. end 
  2371.  
  2372. -- remove markers/callbacks on brute 
  2373. function m06_brute_cleanup(brute) 
  2374. 	marker_remove(brute) 
  2375. 	on_death("", brute) 
  2376. end 
  2377.  
  2378. -- maybe restore the go upstairs objective 
  2379. function m06_maybe_restore_factory_objective() 
  2380. 	-- if all of the brute's we've triggered are dead, reset objective and fake elevator 
  2381. 	local brute_check = M06_group.factory_brute.brute_killed == M06_trigger.factory_brute.hit 
  2382. 	local flamer_check = true --M06_group.factory_brute.flamer_killed == M06_trigger.factory_brute_flamer.hit 
  2383. 	if brute_check and flamer_check then 
  2384. 		m06_set_elevator( M06_factory_elevator, "", "" ) 
  2385. 		objective_text( 0, "m06_obj_to_oleg", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
  2386. 	end 
  2387. end 
  2388.  
  2389. -- Send an npc to a navpoint to play an animation 
  2390. -- 
  2391. -- npc_name:	(string) name of script npc to go do this 
  2392. -- navpoint:	(string) name of navpoint to perform action at (exactly) 
  2393. -- action:		(string) name of action to perform at navpoint 
  2394. -- 
  2395. -- returns after action has been completed 
  2396. function m06_go_here_and_do_this(npc_name, navpoint, action) 
  2397. 	-- get npc to navpoint 
  2398. 	local close_enough = 0.5	-- how close npc needs to be to navpoint to start action 
  2399. 	while close_enough < get_dist(navpoint, npc_name) do 
  2400. 		-- tell npc to go to the navpoint 
  2401. 		local should_run = true 
  2402. 		local should_fire = false 
  2403. 		ai_do_scripted_move(npc_name, navpoint, should_run, should_fire) 
  2404. 		 
  2405. 		-- wait until that is done 
  2406. 		repeat 
  2407. 			thread_yield() 
  2408. 		until ai_scripted_action_is_complete(npc_name) 
  2409. 	end 
  2410. 	delay(0.2) 
  2411. 		 
  2412. 	-- turn AI off while we do the action 
  2413. 	set_ignore_ai_flag( npc_name, true ) 
  2414. 	-- tell npc to play action at navpoint (sliding into place as necessary)\ 
  2415. 	local anim_name = action 
  2416. 	local morph_name = action 
  2417. 	local force_play = false	 
  2418. 	local percentage = 1.0 
  2419. 	local stand_still = true 
  2420. 	local zero_movement = true 
  2421. 	action_play(npc_name, anim_name, morph_name, force_play, percentage, stand_still, zero_movement, navpoint) 
  2422. 	 
  2423. 	repeat 
  2424. 		thread_yield() 
  2425. 	until action_play_is_finished(npc_name) 
  2426. 	 
  2427. 	-- turn AI back on 
  2428. 	set_ignore_ai_flag( npc_name, false ) 
  2429. end 
  2430.  
  2431. -- Play the next ball animations 
  2432. -- Handle all animations while on the ball including 
  2433. --			ball vehicle animations 
  2434. --			vfx 
  2435. --			player animations 
  2436. --			player animation state changes 
  2437. -- 
  2438. -- wait:			(bool) true to wait for the vehicle actions to complete 
  2439. -- interrupt:	(bool) true to possibly interrupt a playing animation 
  2440. function m06_play_next_ball_animations(wait, interrupt) 
  2441. 	action_sequence_advance(interrupt) 
  2442. 	-- make sure physics is still disabled in case we teleport MOTHERFUCKER (not bitter) 
  2443. 	while not vehicle_enable_physics(M06_group.ball.vehicle, false) do 
  2444. 		thread_yield() 
  2445. 	end 
  2446. 	 
  2447. 	if wait then 
  2448. 		repeat 
  2449. 			thread_yield() 
  2450. 		until not action_sequence_is_playing() 
  2451. 	end 
  2452.  
  2453. end 
  2454.  
  2455. -- set attack callbacks on all group members to override their attack lines 
  2456. -- 
  2457. -- members:		(table) list of npcs to override attack lines 
  2458. --  
  2459. function m06_setup_attack_lines(members) 
  2460. 	for i,npc in pairs(members) do 
  2461. 		on_attack_performed(M06_attack_info.callback, npc) 
  2462. 	end 
  2463. end 
  2464.  
  2465. -- ************************* 
  2466. -- 
  2467. -- Callback functions 
  2468. -- 
  2469. -- ************************* 
  2470.  
  2471. -- Handle playing the attack lines 
  2472. -- 
  2473. -- name:	(string) name of character 
  2474. -- weapon:	(string) name of weapon 
  2475. -- attack:	(string) type of attack performed 
  2476. -- 
  2477. function m06_process_attack_cb(name, weapon, attack)	 
  2478. 	-- don't play this if we have done this recently 
  2479. 	if (not thread_check_done(M06_attack_info.timer)) then 
  2480. 		return 
  2481. 	end 
  2482. 	 
  2483. 	-- start timer 
  2484. 	M06_attack_info.timer = thread_new("delay", M06_attack_info.delay) 
  2485. 	 
  2486. 	-- play situation 
  2487. 	if not audio_play_persona_line(name, M06_attack_info.situation) then 
  2488. 		-- line didn't play, kill our timer 
  2489. 		thread_kill(M06_attack_info.timer) 
  2490. 		M06_attack_info.timer = INVALID_THREAD_HANDLE 
  2491. 	end 
  2492.  
  2493. end 
  2494.  
  2495. function m06_dock_trigger_cb() 
  2496. 	-- clear the trigger 
  2497. 	m06_clear_trigger(M06_trigger.dock.name) 
  2498. 	 
  2499. 	M06_trigger.dock.hit = true 
  2500. end 
  2501.  
  2502. function m06_notice_snipers_cb() 
  2503. 	-- clear the trigger 
  2504. 	m06_clear_trigger(M06_trigger.notice_snipers.name)	 
  2505. 	M06_trigger.notice_snipers.hit = true 
  2506. 	 
  2507. 	audio_play_persona_line(M06_current_Shaundi, "M06_Loading_Dock_02") 
  2508. end 
  2509.  
  2510. function m06_dock_thugs01_cb() 
  2511. 	-- clear the trigger 
  2512. 	m06_clear_trigger(M06_trigger.dock_thug_trigger01.name) 
  2513. 	M06_trigger.dock_thug_trigger01.hit = true 
  2514. 	group_show( M06_group.dock1.name ) 
  2515. 	for i, guard in pairs(M06_group.dock1.members) do 
  2516. 		m06_dock_goons(guard) 
  2517. 		ai_do_scripted_move(guard, M06_group.dock1.navpoints[i]) 
  2518. 	end 
  2519. end 
  2520.  
  2521. function m06_dock_thugs02_cb() 
  2522. 	-- clear the trigger 
  2523. 	m06_clear_trigger(M06_trigger.dock_thug_trigger02.name) 
  2524. 	M06_trigger.dock_thug_trigger02.hit = true 
  2525. 	group_show( M06_group.dock2.name ) 
  2526. 	for i, guard in pairs(M06_group.dock2.members) do 
  2527. 		m06_dock_goons(guard) 
  2528. 		ai_do_scripted_move(guard, M06_group.dock2.navpoints[i]) 
  2529. 	end 
  2530. end 
  2531.  
  2532. function m06_dock_goon_dead_cb(goon) 
  2533. 	marker_remove(goon) 
  2534. 	on_death("", goon) 
  2535. 	on_attack_performed("", goon) 
  2536. 	M06_DOCK_THUGS = M06_DOCK_THUGS - 1 
  2537. end 
  2538.  
  2539. function m06_bomb_cb(triggerer) 
  2540. 	-- clear the trigger 
  2541. 	m06_clear_trigger(M06_trigger.arm_bomb.name) 
  2542. 	 
  2543. 	M06_trigger.arm_bomb.hit = true 
  2544. 	-- no animation for you.   
  2545. 	-- action_play( triggerer, "m24 computer hack", nil, nil, nil, nil, true ) 
  2546. end 
  2547.  
  2548. function m06_enter_factory_cb() 
  2549. 	-- clear the trigger 
  2550. 	m06_clear_trigger(M06_trigger.enter_factory.name)	 
  2551. 	M06_trigger.enter_factory.hit = true 
  2552. end 
  2553.  
  2554. function m06_factory_breadcrumb1_cb() 
  2555. 	-- clear the trigger 
  2556. 	m06_clear_trigger(M06_trigger.factory_breadcrumb1.name)	 
  2557. 	M06_trigger.factory_breadcrumb1.hit = true 
  2558. 	 
  2559. 	trigger_enable(M06_trigger.factory_breadcrumb2.name, true) 
  2560. 	marker_add_trigger(M06_trigger.factory_breadcrumb2.name, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  2561. 	on_trigger("m06_factory_breadcrumb2_cb", M06_trigger.factory_breadcrumb2.name) 
  2562. end 
  2563.  
  2564. function m06_factory_breadcrumb2_cb() 
  2565. 	-- clear the trigger 
  2566. 	m06_clear_trigger(M06_trigger.factory_breadcrumb2.name)	 
  2567. 	M06_trigger.factory_breadcrumb2.hit = true 
  2568. 	 
  2569. 	trigger_enable(M06_trigger.factory_breadcrumb3.name, true) 
  2570. 	marker_add_trigger(M06_trigger.factory_breadcrumb3.name, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  2571. 	on_trigger("m06_factory_breadcrumb3_cb", M06_trigger.factory_breadcrumb3.name) 
  2572. end 
  2573.  
  2574. function m06_factory_breadcrumb3_cb() 
  2575. 	-- clear the trigger 
  2576. 	m06_clear_trigger(M06_trigger.factory_breadcrumb3.name)	 
  2577. 	M06_trigger.factory_breadcrumb3.hit = true 
  2578. 	 
  2579. 	-- fake elevator to tell the player where to go 
  2580. 	m06_set_elevator( M06_factory_elevator, "", "" ) 
  2581. end 
  2582.  
  2583. function m06_failure_truck_destroyed_cb()	 
  2584. 	mission_end_failure("m06", "m06_failure_destroy_bomb") 
  2585. end 
  2586.  
  2587. function m06_failure_pierce_died_cb() 
  2588. 	-- End the mission, Pierce died 
  2589. 	mission_end_failure("m06", "m06_failure_pierce_died") 
  2590. end 
  2591.  
  2592. function m06_failure_shaundi_died_cb() 
  2593. 	-- End the mission, Shaundi died 
  2594. 	mission_end_failure("m06", "m06_failure_shaundi_died") 
  2595. end 
  2596.  
  2597. function m06_failure_oleg_died_cb() 
  2598. 	-- End the mission, Oleg died 
  2599. 	mission_end_failure("m06", "m06_failure_oleg_died") 
  2600. end 
  2601.  
  2602. function m06_failure_dismissed_cb() 
  2603. 	mission_end_failure("m06", "m06_failure_homie_dismissed") 
  2604. end 
  2605.  
  2606. function m06_elevator_callback() 
  2607. 	fade_out(0.5) 
  2608. 	fade_out_block()	-- wait for blackness 
  2609. 	-- make sure we aren't in cars 
  2610. 	if character_is_in_vehicle(LOCAL_PLAYER) then 
  2611. 		vehicle_exit(LOCAL_PLAYER) 
  2612. 		thread_yield() 
  2613. 	end 
  2614. 	if coop_is_active() and character_is_in_vehicle(REMOTE_PLAYER) then 
  2615. 		vehicle_exit(REMOTE_PLAYER) 
  2616. 		thread_yield() 
  2617. 	end 
  2618. 	teleport_coop( M06_elevator_destination, M06_elevator_destination_remote )	 
  2619. 	m06_clear_elevator() 
  2620. 	fade_in(0.5) 
  2621. end 
  2622.  
  2623. -- custom callback that doesn't fade back in 
  2624. function m06_elevator_to_top_floor_cb() 
  2625. 	fade_out(0.5) 
  2626. 	fade_out_block()	-- wait for blackness 
  2627. 	m06_clear_crew(M06_group.brute_killed_homies) 
  2628. 	-- make sure we aren't in cars 
  2629. 	if character_is_in_vehicle(LOCAL_PLAYER) then 
  2630. 		vehicle_exit(LOCAL_PLAYER) 
  2631. 		thread_yield() 
  2632. 	end 
  2633. 	if coop_is_active() and character_is_in_vehicle(REMOTE_PLAYER) then 
  2634. 		vehicle_exit(REMOTE_PLAYER) 
  2635. 		thread_yield() 
  2636. 	end 
  2637. 	teleport_coop( M06_elevator_destination, M06_elevator_destination_remote )	 
  2638. 	m06_clear_elevator() 
  2639. end 
  2640.  
  2641. -- callback for brute being killed 
  2642. function m06_dock_brute_killed_cb() 
  2643. 	M06_group.dock_brute.brute_killed = true 
  2644. 	m06_brute_cleanup(M06_group.dock_brute.brute) 
  2645. 	objective_text( 0, "m06_obj_dock_thugs", "", "", SYNC_ALL, OI_ASSET_KILL ) 
  2646. end 
  2647.  
  2648. -- callback for brute being killed 
  2649. function m06_brute_killed_cb() 
  2650. 	M06_group.factory_brute.brute_killed = true 
  2651. 	m06_brute_cleanup(M06_group.factory_brute.brute) 
  2652. 	m06_maybe_restore_factory_objective() 
  2653. end 
  2654.  
  2655. -- callback for brute being killed 
  2656. function m06_flamer_killed_cb() 
  2657. 	M06_group.factory_brute.flamer_killed = true 
  2658. 	m06_brute_cleanup(M06_group.factory_brute.brute_flamer) 
  2659. 	m06_maybe_restore_factory_objective() 
  2660. end 
  2661.  
  2662. -- trigger near the brute has been hit 
  2663. function m06_brute_cb() 
  2664. 	m06_factory_brute() 
  2665. 	delay(1) 
  2666. 	m06_brute_attack(M06_group.factory_brute.brute, "m06_brute_killed_cb") 
  2667. 	 
  2668. 	-- clear the trigger 
  2669. 	m06_clear_trigger(M06_trigger.factory_brute.name)	 
  2670. 	M06_trigger.factory_brute.hit = true 
  2671. 	 
  2672. 	-- disable the elevator 
  2673. 	m06_clear_elevator() 
  2674. end 
  2675.  
  2676. function m06_wave4_cb() 
  2677. 	-- clear the trigger 
  2678. 	m06_clear_trigger(M06_group.factory4.trigger)	 
  2679. 	M06_trigger.factory_brute.hit = true 
  2680.  
  2681. 	-- bring in reenforcements 
  2682. 	m06_factory_wave4() 
  2683. end 
  2684.  
  2685. -- trigger near the flamer brute has been hit 
  2686. function m06_brute_flamer_cb() 
  2687. 	m06_brute_attack(M06_group.factory_brute.brute_flamer, "m06_flamer_killed_cb") 
  2688. 	 
  2689. 	-- clear the trigger 
  2690. 	m06_clear_trigger(M06_trigger.factory_brute_flamer.name)	 
  2691. 	M06_trigger.factory_brute_flamer.hit = true 
  2692. 		 
  2693. 	-- disable the elevator 
  2694. 	m06_clear_elevator() 
  2695. end 
  2696.  
  2697. -- found Oleg in the factory 
  2698. function m06_oleg_cb() 
  2699. 	-- clear the trigger 
  2700. 	m06_clear_trigger(M06_trigger.oleg_cutscene.name)	 
  2701. 	M06_trigger.oleg_cutscene.hit = true 
  2702. end 
  2703.  
  2704. -- followed Oleg to the stairs (or found them on your own) 
  2705. function m06_stairs_cb() 
  2706. 	-- clear them both.  Doesn't matter which was hit 
  2707. 	m06_clear_trigger(M06_trigger.stairs1.name) 
  2708. 	m06_clear_trigger(M06_trigger.stairs2.name) 
  2709. 	 
  2710. 	M06_trigger.stairs1.hit = true 
  2711. 	M06_trigger.stairs2.hit = true 
  2712. end 
  2713.  
  2714. -- followed Oled to the office (or found it on your own) 
  2715. function m06_office_cb() 
  2716. 	m06_clear_trigger(M06_trigger.office.name) 
  2717. 	M06_trigger.office.hit = true 
  2718. end 
  2719.  
  2720. function m06_oleg_door1_cb(whodunit) 
  2721. 	if whodunit == "Oleg_top_floor" then 
  2722. 		m06_clear_trigger(M06_trigger.oleg_crash1.name) 
  2723. 		audio_play_for_navpoint("m06_sfx_oleg_smash_doors", M06_oleg_crash1_nav) 
  2724. 	end 
  2725. end 
  2726.  
  2727. function m06_oleg_door2_cb(whodunit) 
  2728. 	if (whodunit == "Oleg_top_floor") then 
  2729. 		m06_clear_trigger(M06_trigger.oleg_crash2.name) 
  2730. 		audio_play_for_navpoint("m06_sfx_oleg_smash_doors", M06_oleg_crash2_nav) 
  2731. 	end 
  2732. end 
  2733.  
  2734. -- followed Oled to Phillipe (or found him on your own) 
  2735. function m06_Phillipe_callback() 
  2736. 	-- clear the trigger 
  2737. 	m06_clear_trigger(M06_trigger.phillipe.name) 
  2738. 	 
  2739. 	M06_trigger.phillipe.hit = true 
  2740. end 
  2741.  
  2742. function m06_ball_drop_callback() 
  2743. 	-- clear the trigger 
  2744. 	m06_clear_trigger(M06_trigger.ball_drop.name) 
  2745. 	 
  2746. 	M06_trigger.ball_drop.hit = true 
  2747. end 
  2748.  
  2749. -- if the brute that is supposed to jump on the ball falls, teleport him back to where he needs to be 
  2750. function m06_brute_net_cb() 
  2751. 	-- make sure he is where he should be 
  2752. 	teleport(M06_group.ball_stop2.brute, M06_group.ball_stop2.brute_restart) 
  2753. 	-- we don't clear because this could possibly (hopefully not) happen multiple times 
  2754. end 
  2755.  
  2756. function m06_choice_disarm_cb() 
  2757. 	if not M06_decision_made then 
  2758. 		M06_decision_made = true 
  2759. 		M06_trigger.disarm_bomb.hit = true 
  2760. 		-- disable respect modifier reward, player gets cash modifier for destroying the building 
  2761. 		mission_set_excluded_reward("Respect_Bonus_Modifier") 
  2762. 		m06_clear_trigger(M06_trigger.disarm_bomb.name) 
  2763. 		m06_clear_trigger(M06_trigger.destroy_building.name) 
  2764. 	end 
  2765. end 
  2766.  
  2767. function m06_choice_destroy_cb() 
  2768. 	if not M06_decision_made then 
  2769. 		M06_decision_made = true 
  2770. 		M06_trigger.destroy_building.hit = true 
  2771. 		-- disable cash reward, player gets respect modifier for destroying the building 
  2772. 		mission_set_excluded_reward("Cash_Bonus_Modifier") 
  2773. 		m06_clear_trigger(M06_trigger.disarm_bomb.name) 
  2774. 		m06_clear_trigger(M06_trigger.destroy_building.name) 
  2775. 	end 
  2776. end 
  2777.  
  2778. -- callback when ball brute is killed 
  2779. function m06_ball_brute_damage_cb() 
  2780. 	M06_ball_brute_killed = true 
  2781. 	on_damage("", M06_group.ball_stop2.brute) 
  2782. end 
  2783.  
  2784. -- ************************* 
  2785. -- 
  2786. -- Thread functions 
  2787. -- 
  2788. -- ************************* 
  2789.  
  2790. -- Send some Saints in a car as reinforcements 
  2791. -- Threaded in case pathfind fails so we don't break the mission 
  2792. function m06_saint_reenforcement_thread() 
  2793. 	m06_setup_saint_reenforcement() 
  2794.  
  2795. 	vehicle_pathfind_to(M06_group.saints_backup.vehicle, M06_group.saints_backup.navpoint, true) 
  2796.  
  2797. 	for i, saint in pairs(M06_group.saints_backup.members) do 
  2798. 		vehicle_exit(saint) 
  2799. 	end 
  2800.  
  2801. end 
  2802.  
  2803. function m06_stumble(player) 
  2804. 	player_release_human_shield(player) 
  2805. 	character_clear_combat_move(player) 
  2806. 	action_play(player, "Plane Stumble Forward") 
  2807. end 
  2808.  
  2809. -- Handle playing all of the conversations on the drive to the tower 
  2810. -- Exit if tower trigger is hit 
  2811. -- 
  2812. function m06_start_convos_thread() 
  2813.  
  2814. 	m06_play_driving_convo(M06_convo.mission_start) 
  2815. 	 
  2816. 	-- wait 
  2817. 	if (not M06_trigger.dock.hit) then 
  2818. 		delay(4.0) 
  2819. 	end 
  2820. 	 
  2821. 	-- next convo 
  2822. 	if (not M06_trigger.dock.hit) then 
  2823. 		m06_play_driving_convo(M06_convo.driving1) 
  2824. 	end 
  2825. 	 
  2826. 	-- wait 
  2827. 	if (not M06_trigger.dock.hit) then 
  2828. 		delay(3.0) 
  2829. 	end 
  2830. 	 
  2831. 	-- next convo 
  2832. 	if (not M06_trigger.dock.hit) then 
  2833. 		m06_play_driving_convo(M06_convo.driving2) 
  2834. 	end 
  2835. 	 
  2836. 	-- wait 
  2837. 	if (not M06_trigger.dock.hit) then 
  2838. 		delay(5.0) 
  2839. 	end 
  2840. 	 
  2841. 	-- next convo 
  2842. 	if (not M06_trigger.dock.hit) then 
  2843. 		m06_play_driving_convo(M06_convo.driving3) 
  2844. 	end 
  2845. end 
  2846.  
  2847. -- Handle the conversations in the factory 
  2848. -- 
  2849. function m06_factory_convos_thread() 
  2850.  
  2851. 	-- Elevator stopped...Mwahahaha 
  2852. 	M06_convo.elevator.handle = audio_conversation_load(M06_convo.elevator.name)	 
  2853. 	audio_conversation_play(M06_convo.elevator.handle)	 
  2854. 	audio_conversation_wait_for_end(M06_convo.elevator.handle) 
  2855. 	 
  2856. 	-- enter the factory 
  2857. 	while not M06_trigger.enter_factory.hit do 
  2858. 		thread_yield() 
  2859. 	end 
  2860. 	-- knew there would be dudes here 
  2861. 	audio_play_persona_line(M06_current_Pierce, "M06_Clone_Room_01") 
  2862. 	delay(2.0) 
  2863. 	 
  2864. 	-- down the first stairs 
  2865. 	while not M06_group.factory2.hit do 
  2866. 		thread_yield() 
  2867. 	end 
  2868. 	-- What are these dudes? 
  2869. 	M06_convo.clone2.handle = audio_conversation_load(M06_convo.clone2.name)	 
  2870. 	audio_conversation_play(M06_convo.clone2.handle) 
  2871. 	audio_conversation_wait_for_end(M06_convo.clone2.handle) 
  2872. 	delay(1.0) 
  2873. 	 
  2874. 	-- up the second stairs 
  2875. 	while not M06_group.factory3.hit do 
  2876. 		thread_yield() 
  2877. 	end 
  2878. 	-- what do we call them? 
  2879. 	M06_convo.clone3.handle = audio_conversation_load(M06_convo.clone3.name)	 
  2880. 	audio_conversation_play(M06_convo.clone3.handle) 
  2881. 	audio_conversation_wait_for_end(M06_convo.clone3.handle) 
  2882. 	 
  2883. 	-- found brute 
  2884. 	while not M06_trigger.factory_brute.hit do 
  2885. 		thread_yield() 
  2886. 	end 
  2887. 	 
  2888. 	delay(4.0) 
  2889. 	audio_play_persona_line(M06_current_Pierce, "M06_Clone_Room_04") 
  2890. 	 
  2891. 	-- killed the brute 
  2892. 	while not M06_group.factory_brute.brute_killed do 
  2893. 		thread_yield() 
  2894. 	end	 
  2895.  
  2896. end 
  2897.  
  2898. function m06_monster_closet_add() 
  2899. 	M06_MONSTER_TALLY = M06_MONSTER_TALLY + 1 
  2900. 	if M06_MONSTER_TALLY > 0 then 
  2901. 		if not door_is_open(M06_mover.closet) then 
  2902. 			door_open(M06_mover.closet, false) 
  2903. 		end 
  2904. 	end 
  2905. end 
  2906.  
  2907. function m06_monster_closet_remove() 
  2908. 	M06_MONSTER_TALLY = M06_MONSTER_TALLY - 1 
  2909. 	if M06_MONSTER_TALLY < 1 then 
  2910. 		if door_is_open(M06_mover.closet) then 
  2911. 			door_close(M06_mover.closet, false) 
  2912. 		end 
  2913. 	end 
  2914. end 
  2915.  
  2916. function m06_oleg_go0() -- Move to base of stairs 
  2917. 	ai_do_scripted_move(M06_group.top_floor_homies.oleg, M06_Oleg_path.stair, true, false) 
  2918. 	while (not ai_scripted_action_is_complete(M06_group.top_floor_homies.oleg)) do 
  2919. 		thread_yield() 
  2920. 	end 
  2921. 	-- npc_leash_to_nav(M06_group.top_floor_homies.oleg, "Oleg_floor_nav3", 0) 
  2922. end 
  2923.  
  2924. function m06_oleg_go1() -- climb up stairs to office door 
  2925. 	-- npc_leash_remove(M06_group.top_floor_homies.oleg) 
  2926. 	ai_do_scripted_move(M06_group.top_floor_homies.oleg, M06_Oleg_path.climbs, true, false) 
  2927. 	while (not ai_scripted_action_is_complete(M06_group.top_floor_homies.oleg)) do 
  2928. 		thread_yield() 
  2929. 	end 
  2930. 	-- npc_leash_to_nav(M06_group.top_floor_homies.oleg, "Oleg_stairs_nav4", 0) 
  2931. end 
  2932.  
  2933. function m06_oleg_go2() -- go through door to next staircase 
  2934. 	-- npc_leash_remove(M06_group.top_floor_homies.oleg) 
  2935. 	ai_do_scripted_move(M06_group.top_floor_homies.oleg, M06_Oleg_path.offices, true, false) 
  2936. 	while (not ai_scripted_action_is_complete(M06_group.top_floor_homies.oleg)) do 
  2937. 		thread_yield() 
  2938. 	end 
  2939. end 
  2940.  
  2941. -- make sure each player gets their rifle or they will not animate properly 
  2942. function m06_check_weapon_thread() 
  2943. 	-- handle problem child first 
  2944. 	if coop_is_active() then 
  2945. 		while not inv_item_is_firearm_equipped(REMOTE_PLAYER) do 
  2946. 			inv_weapon_add_temporary(REMOTE_PLAYER, M06_PLAYER_RIFLE, 1, true) 
  2947. 			inv_item_equip( M06_PLAYER_RIFLE, REMOTE_PLAYER ) 
  2948. 			delay(0.3) 
  2949. 		end 
  2950. 	end 
  2951. 	 
  2952. 	while not inv_item_is_firearm_equipped(LOCAL_PLAYER) do 
  2953. 		inv_weapon_add_temporary(LOCAL_PLAYER, M06_PLAYER_RIFLE, 1, true) 
  2954. 		inv_item_equip( M06_PLAYER_RIFLE, LOCAL_PLAYER ) 
  2955. 		delay(0.3) 
  2956. 	end 
  2957. end 
  2958.