./m07.lua

  1.  
  2. --[[ 
  3. 	m07.lua 
  4. 	SR3 Mission Script 
  5. 	DATE: 6/15/10 
  6. 	AUTHOR:	Albert McDaniel & Nick Heilmann 
  7. ]]-- 
  8.  
  9. M07_status = { 
  10. 	player_vehicle_type = VT_NONE, 
  11. 	player_for_convo = LOCAL_PLAYER, 
  12. 	reached_goal = false, 
  13. 	interrogation_in_progress = false, 
  14. 	club_owner_grabbed = false, 
  15. 	num_enemies_alive = 0, 
  16. 	outside_casino_reached = false, 
  17. 	inside_casino_reached = false, 
  18. 	convo_is_playing = false, 
  19. 	temp_weapon_local = "", 
  20. 	temp_weapon_remote = "", 
  21. 	phonecall_finished = false, 
  22. 	casino_brutes_dead = 0, 
  23. } 
  24.  
  25. M07_timed_lines = { 
  26. 	bdsm = { 
  27. 		situation = "m07_bdsm_club_domes", 
  28. 		situation2 = "m07_bdsm_club_subs", 
  29. 		delay = 10.0, 
  30. 		callback = "m07_bdsm_detect_cb", 
  31. 		timer = INVALID_THREAD_HANDLE 
  32. 	}, 
  33. 	 
  34. 	deckers = { 
  35. 		situation = "m07_attack", 
  36. 		delay = 10.0, 
  37. 		callback = "m07_decker_attack_cb", 
  38. 		timer = INVALID_THREAD_HANDLE 
  39. 	} 
  40.  
  41. } 
  42.  
  43. M07_CTE_free_kinzie = { 
  44. 	name = "M07_FREE_KINZIE", 
  45. 	CTE_NPC_NAV = { 
  46. 		host	= "Nav Barge CTE Local", 
  47. 		remote	= "Nav Barge CTE Remote", 
  48. 		shaundi = "Nav Barge CTE Shaundi", 
  49. 		pierce	= "Nav Barge CTE Pierce", 
  50. 	},	 
  51. } 
  52.  
  53. M07_navpoint = { 
  54. 	cp_starts = { 
  55. 		start = { 
  56. 			player_local = "Nav Player Local Start CP", 
  57. 			player_remote = "Nav Player Remote Start CP", 
  58. 		}, 
  59.  
  60. 		barge = { 
  61. 			player_local = "Nav Player Local Barge CP", 
  62. 			player_remote = "Nav Player Remote Barge CP", 
  63. 			pierce = "Nav Player Pierce Barge CP", 
  64. 		}, 
  65.  
  66. 		bdsm = { 
  67. 			player_local = "Nav Player Local BDSM CP", 
  68. 			player_remote = "Nav Player Remote BDSM CP", 
  69. 		}, 
  70.  
  71. 		pony_cart = { 
  72. 			player_local = "Nav Player Local Pony Cart CP", 
  73. 			player_remote = "Nav Player Remote Pony Cart CP", 
  74. 		}, 
  75.  
  76. 		casino = { 
  77. 			player_local = "Nav Player Local Casino CP", 
  78. 			player_remote = "Nav Player Remote Casino CP", 
  79. 		}, 
  80.  
  81. 		brute = { 
  82. 			player_local = "Nav Player Local Brute CP", 
  83. 			player_remote = "Nav Player Remote Brute CP", 
  84. 		}, 
  85.  
  86. 		defense = { 
  87. 			player_local = "Nav Player Local Defense CP", 
  88. 			player_remote = "Nav Player Remote Defense CP", 
  89. 			angel = "Nav Angel Defense CP", 
  90. 			oleg = "Nav Oleg Defense CP", 
  91. 			pierce = "Nav Pierce Defense CP", 
  92. 			zimos = "Nav Zimos Defense CP", 
  93. 		}, 
  94. 	}, 
  95.  
  96. 	mission_end_navs = { "Mission End Nav Local", "Mission End Nav Remote"}, 
  97. 	 
  98. 	kinzie_leash = "Nav Kinzie Leash", 
  99. 	 
  100. 	pony_cart_start = "Nav pony cart start", 
  101. 	zimos_car_tp = "Nav Zimos Car", 
  102. 	 
  103. 	angel_defense_location_1 = "Nav Angel Defense 001", 
  104. 	angel_defense_location_2 = "Nav Angel Defense 002", 
  105. 	pierce_defense_location = "Nav Pierce Defense", 
  106. 	zimos_defense_location = "Nav Zimos Defense", 
  107. 	 
  108. 	casino_arriving_1 = "Nav Arriving Dest 001", 
  109. 	casino_arriving_2 = "Nav Arriving Dest 002", 
  110. 	casino_arriving_3 = "Nav Arriving Dest 003", 
  111. 	casino_door = "Nav Casino Door", 
  112. 	casino_entry_1 = "Nav Casino Entry 001", 
  113. 	casino_entry_2 = "Nav Casino Entry 002", 
  114. 	casino_stairs = "Nav Casino Stairs", 
  115. 	casino_balcony_e_1 = "Nav Casino Balcony E 001", 
  116. 	casino_balcony_e_2 = "Nav Casino Balcony E 002", 
  117. 	casino_balcony_e_3 = "Nav Casino Balcony E 003", 
  118. 	casino_balcony_n = "Nav Casino Balcony N", 
  119. 	casino_balcony_s = "Nav Casino Balcony S", 
  120. 	casino_balcony_w = "Nav Casino Balcony W", 
  121. } 
  122.  
  123. M07_scripted_path = { 
  124. 	barge_boat_patrol = { "BBP Path 001", "BBP Path 002", "BBP Path 003" }, 
  125. 	barge_deck_patrol = "BDP Path", 
  126. 	pony_cart_path = "Pony Cart Path", 
  127. } 
  128.  
  129. M07_spawn_region = { 
  130. 	casino_front_1 = "SR Casino Front 001", 
  131. 	casino_front_2 = "SR Casino Front 002", 
  132. 	casino_front_n = "SR Casino Front N",	-- Currently unused 
  133. 	casino_front_s = "SR Casino Front S",	-- Currently unused 
  134. 	casino_rear_n = "SR Casino Rear N", 
  135. 	casino_rear_s = "SR Casino Rear S", 
  136. 	casino_stairs_e = "SR Casino Stairs E",	-- Currently unused 
  137. 	casino_stairs_w = "SR Casino Stairs W",	-- Currently unused 
  138. 	casino_upper_front_n = "SR Casino Upper Front N", 
  139. 	casino_upper_front_s = "SR Casino Upper Front S", 
  140. 	casino_upper_rear_n = "SR Casino Upper Rear N", 
  141. } 
  142.  
  143. M07_trigger = { 
  144. 	barge_dock = "Trigger Barge Dock", 
  145. 	barge_jetskis = "Trigger Release Jetskis", 
  146. 	barge_enemies01 = "Barge_Trigger 001", 
  147. 	barge_enemies02 = "Barge_Trigger 002", 
  148. 	barge_wheelhouse = "Trigger Barge Wheelhouse", 
  149. 	kinzie_tied_up = "Trigger Untie Kinzie", 
  150. 	bdsm_club = "Trigger BDSM Club", 
  151. 	bdsm_traffic = { "Trigger BDSM Traffic 001", "Trigger BDSM Traffic 002", "Trigger BDSM Traffic 003", "Trigger BDSM Traffic 004" }, 
  152. 	bdsm_action_nodes = "Trigger BDSM Action Nodes", 
  153. 	club_owner = "Trigger Club Owner", 
  154. 	club_owner_interrogate = "Trigger grab club owner", 
  155. 	pony_stairs = "Trigger Pony Stairs", 
  156. 	pony_stairs_two = "Trigger Pony Stairs Two", 
  157. 	pony_barn = "Trigger Pony Barn", 
  158. 	pony_carts = "Trigger Pony Carts", 
  159. 	outside_casino = "Trigger Outside Casino", 
  160. 	inside_casino = "Trigger Inside Casino", 
  161. 	casino_lobby = "Trigger Casino Lobby", 
  162. 	mgr_breadcrumb = "Trigger Mgr Breadcrumb", 
  163.  
  164. 	bdsm_interrogate = {  
  165. 		[1] =	{ "Trigger BDSM Int 001", "Trigger BDSM Int 012" }, 
  166. 		[2] = { "Trigger BDSM Int 003", "Trigger BDSM Int 005", "Trigger BDSM Int 010" }, 
  167. 	}, 
  168. } 
  169.  
  170. M07_mover = { 
  171. 	door_bdsm_front = "BDSM Front Door", 
  172. 	door_bdsm_locked01 = "BDSM Locked Door 01", 
  173. 	door_bdsm_locked02 = "BDSM Locked Door 02", 
  174. 	door_bdsm_locked03 = "BDSM Locked Door 03", 
  175. 	door_bdsm_owner = "Door BDSM Owner", 
  176. 	door_bdsm_hall_stair_open = "Door BDSM Hall Stair Open", 
  177. 	door_bdsm_hall_stairs = "Door BDSM Hall Stairs", 
  178. 	door_bdsm_office_stairs = "Door BDSM Office Stairs", 
  179. 	door_casino = "Door Casino", 
  180. 	door_pony = "Barn Door", 
  181. 	door_pony_exit = "Pony Door", 
  182. 	upper_bdsm_doors = { "BDSM upper door 001", "BDSM upper door 002", "BDSM upper door 003", "BDSM upper door 004", "BDSM upper door 005" }, 
  183. } 
  184.  
  185. M07_group = { 
  186. 	pierce =	{ 
  187. 		name = "GRP Pierce", 
  188. 		chars = { "Pierce" }, 
  189. 	}, 
  190.  
  191. 	kinzie =	{ 
  192. 		name = "GRP Kinzie", 
  193. 		chars = { "Kinzie" }, 
  194. 	}, 
  195.  
  196. 	zimos = { 
  197. 		name = "GRP Zimos", 
  198. 		chars = { "Zimos" }, 
  199. 	}, 
  200.  
  201. 	oleg = { 
  202. 		name = "GRP Oleg", 
  203. 		chars = { "Oleg" }, 
  204. 	}, 
  205.  
  206. 	angel	= { 
  207. 		name = "GRP Angel", 
  208. 		chars = { "Angel" }, 
  209. 	}, 
  210.  
  211. 	shaundi = { 
  212. 		name = "GRP Shaundi", 
  213. 		chars = { "Shaundi" }, 
  214. 	}, 
  215.  
  216. 	boat_to_barge = { 
  217. 		name = "GRP Boat To Barge", 
  218. 		vehicles = { "Veh Boat To Barge", "Veh Start" }, 
  219. 	}, 
  220.  
  221. 	bbp_guards = { 
  222. 		name = "GRP BBP Guards", 
  223. 		chars = { 
  224. 			{ "BBP 001", "BBP 002" }, 
  225. 			{ "BBP 003", "BBP 004" }, 
  226. 			{ "BBP 005", "BBP 006" }, 
  227. 		}, 
  228. 		vehicles = { "BBP Veh 001", "BBP Veh 002", "BBP Veh 003" }, 
  229. 	}, 
  230. 	 
  231. 	bbp_riders = { 
  232. 		chars = { "BBP 001", "BBP 002", "BBP 003", "BBP 004", "BBP 005", "BBP 006" }, 
  233. 	}, 
  234.  
  235. 	bdp_guards = { 
  236. 		name = "GRP BDP Guards", 
  237. 		chars = { "BDP 001", "BDP 002", "BDP 003", "BDP 004" }, 
  238. 	}, 
  239.  
  240. 	bds_guards = { 
  241. 		name = "GRP BDS Guards", 
  242. 		chars = { "BDS 001", "BDS 002", "BDS 003", "BDS 004", "BDS 005", "BDS 006", "BDS 007", "BDS 008", "BDS 009", "BDS 010", 
  243. 				   "BDS 011", "BDS 012", "BDS 013", "BDS 014", "BDS 015", "BDS 016", "BDS 017", "BDS 018", "BDS 019", "BDS 020", } 
  244. 	}, 
  245.  
  246. 	barge1 = { 
  247. 		members = { "BDS 003", "BDS 006", "BDS 002", "BDS 005" }, 
  248. 		navpoints = { "Barge_Nav 001", "Barge_Nav 002", "Barge_Nav 003", "Barge_Nav 004" } 
  249. 	}, 
  250.  
  251. 	barge2 = { 
  252. 		members = { "BDS 001", "BDS 007", "BDS 014", "BDS 010" }, 
  253. 		navpoints = { "Barge_Nav 005", "Barge_Nav 006", "Barge_Nav 007", "Barge_Nav 008" } 
  254. 	}, 
  255.  
  256. 	barge3 = { 
  257. 		members = { "BDS 017", "BDS 011", "BDS 019", "BDS 020", "BDS 018" }, 
  258. 		navpoints = { "Barge_Nav 009", "Barge_Nav 013", "Barge_Nav 011", "Barge_Nav 012", "Barge_Nav 010" } 
  259. 	}, 
  260.  
  261. 	barge_cp_player_veh = { 
  262. 		name = "GRP Barge CP", 
  263. 		vehicles = { "Veh Barge CP" }, 
  264. 	}, 
  265.  
  266. 	bdsm_ambient = {	 
  267. 		name = "GRP BDSM Ambient", 
  268. 		members = { "BDSM Gimp 006", "BDSM Gimp 001", "BDSM Gimp 002", 
  269. 					"BDSM Gimp 003", "BDSM Gimp 004", "BDSM Gimp 005",  
  270. 					"BDSM Gimp 011", "BDSM Gimp 016", "BDSM Gimp 017",  
  271. 					"Ho 001", "Ho 002", "Ho 003", "Ho 004", 
  272. 					"Cage Dancer 001", "Cage Dancer 002", "Cage Dancer 005", "Cage Dancer 007", 
  273. 					"BDSM Prostitute 002", "BDSM Prostitute 003", "BDSM Prostitute 005", }, 
  274. 		nodes = { "Drinker", "Dancer", "Drinker", 
  275. 				"Smoker", "Dancer", "Drinker",  
  276. 				"Dancer", "Dancer", "Drinker",  
  277. 				"Drinker", "Drinker", "Dancer", "Dancer",  
  278. 				"CageDancer", "CageDancer", "CageDancer", "CageDancer", 
  279. 				"Drinker", "Dancer", "Dancer", }, 
  280. 		doms = {"Ho 001", "Ho 002", "Ho 003", "Ho 004"}, 
  281. 		subsm = {"BDSM Gimp 001", "BDSM Gimp 002", "BDSM Gimp 005",  
  282. 				"BDSM Gimp 003", "BDSM Gimp 004", "BDSM Gimp 017", }, 
  283. 		subsf = {"BDSM Gimp 011", "BDSM Gimp 016", }, 
  284. 	}, 
  285.  
  286. 	bdsm_gimps = { 
  287. 		name = "GRP BDSM Gimps", 
  288. 		members = { "BDSM Gimp 001", "BDSM Gimp 001"}, 
  289. 	}, 
  290.  
  291. 	bdsm_goons = { 
  292. 		name = "GRP BDSM Goons", 
  293. 	}, 
  294.  
  295. 	bdsm_patrons = { 
  296. 		name = "GRP BDSM Patrons", 
  297. 		chars = {  
  298. 			[1] = { "BDSM Patron 001", "BDSM Patron 012" }, 
  299. 			[2] = { "BDSM Patron 003", "BDSM Patron 005", "BDSM Patron 010" }, 
  300. 		}, 
  301. 	}, 
  302.  
  303. 	bdsm_prostitutes = { 
  304. 		name = "GRP BDSM Prostitutes", 
  305. 		members = {"BDSM Prostitute 001", "BDSM Prostitute 002", "BDSM Prostitute 003", "BDSM Prostitute 004", 
  306. 		"BDSM Prostitute 005", "BDSM Prostitute 006", "BDSM Prostitute 009", "BDSM Prostitute 011" } 
  307. 	}, 
  308.  
  309. 	bdsm_cage_dancers = { 
  310. 		name = "GRP BDSM Cage Dancers", 
  311. 		members = { "Cage Dancer 001", "Cage Dancer 002", "Cage Dancer 005", "Cage Dancer 007" }, 
  312. 	}, 
  313.  
  314. 	bdsm_rooms = { 
  315. 		floors = { 
  316. 			[1] = { 
  317. 				{ 
  318. 					node_type = {"BDSM_KissFeet", "BDSM_KissMyFeet"}, 
  319. 					members = { "BDSM Patron 001", "BDSM Prostitute 001"}, 
  320. 					triggers = { "Trigger BDSM Int 001" }, 
  321. 					num_patrons = 1, 
  322. 					patrons_alive = { true }, 
  323. 					alive = true, 
  324. 				}, 
  325. 				{ 
  326. 					node_type = {"BDSM_Whipped", "BDSM_Whipper"}, 
  327. 					members = { "BDSM Patron 012", "BDSM Prostitute 011"}, 
  328. 					triggers = { "Trigger BDSM Int 012" }, 
  329. 					num_patrons = 1, 
  330. 					patrons_alive = { true }, 
  331. 					alive = true, 
  332. 				}, 
  333. 			}, 
  334. 			[2] = { 
  335. 				{ 
  336. 					node_type = {"BDSM_KissFeet", "BDSM_KissMyFeet"}, 
  337. 					members = { "BDSM Patron 003", "BDSM Prostitute 004"}, 
  338. 					triggers = { "Trigger BDSM Int 003" }, 
  339. 					num_patrons = 1, 
  340. 					patrons_alive = { true }, 
  341. 					alive = true, 
  342. 				}, 
  343. 				{ 
  344. 					node_type = {"BDSM_Whipped", "BDSM_Whipper"}, 
  345. 					members = { "BDSM Patron 005", "BDSM Prostitute 006"}, 
  346. 					triggers = { "Trigger BDSM Int 005" }, 
  347. 					num_patrons = 1, 
  348. 					patrons_alive = { true }, 
  349. 					alive = true, 
  350. 				}, 
  351. 				{ 
  352. 					node_type = {"BDSM_Whipped", "BDSM_Whipper"}, 
  353. 					members = { "BDSM Patron 010", "BDSM Prostitute 009"}, 
  354. 					triggers = { "Trigger BDSM Int 010" }, 
  355. 					num_patrons = 1, 
  356. 					patrons_alive = { true }, 
  357. 					alive = true, 
  358. 				}, 
  359. 			}, 
  360. 		}, 
  361. 	}, 
  362. 	 
  363. 	 
  364. 	club_owner = { 
  365. 		name = "GRP Club Owner", 
  366. 		chars = { "Club Owner" }, 
  367. 	}, 
  368.  
  369. 	pony_cart = { 
  370. 		name = "GRP Pony Cart Zimos", 
  371. 		vehicles = { "Veh Pony Cart Zimos" }, 
  372. 	}, 
  373.  
  374. 	pony_cart_enemies = { 
  375. 		name = "GRP Pony Cart Enemies", 
  376. 		chars = { 
  377. 			{ "Pony Cart Enemy 001", "Pony Cart Enemy 002" }, 
  378. 			{ "Pony Cart Enemy 003", "Pony Cart Enemy 004" }, 
  379. 			{ "Pony Cart Enemy 005", "Pony Cart Enemy 006" }, 
  380. 		}, 
  381. 		vehicles = { "Veh Pony Cart Enemy 001", "Veh Pony Cart Enemy 002", "Veh Pony Cart Enemy 003" }, 
  382. 	}, 
  383.  
  384. 	pony_cart_drivers = { 
  385. 		name = "GRP Pony Cart Drivers", 
  386. 		chars = { "Pony Cart Driver 001", "Pony Cart Driver 002", "Pony Cart Driver 003" }, 
  387. 	}, 
  388.  
  389. 	casino_vehicle = { 
  390. 		name = "GRP Casino CP", 
  391. 		vehicles = { "Veh Casino CP" }, 
  392. 	}, 
  393.  
  394. 	luchadores_outside = { 
  395. 		name = "GRP Luchadores Outside", 
  396. 		chars = { "Luch Out 001", "Luch Out 002", "Luch Out 003", "Luch Out 004", "Luch Out 005", "Luch Out 006", "Luch Out 007", "Luch Out 008", 
  397. 					 "Luch Out 009", "Luch Out 010", "Luch Out 011", "Luch Out 012" }, 
  398. 		brute = "Luch Out Brute", 
  399. 	}, 
  400.  
  401. 	outside_cover_vehicles = { 
  402. 		name = "GRP Outside Cover Vehicles", 
  403. 		vehicles = { "Luch Cover Veh 001", "Luch Cover Veh 002", "Luch Cover Veh 003", "Luch Cover Veh 004", "Angel Cover Veh" }, 
  404. 	}, 
  405.  
  406. 	luchadores_arriving = { 
  407. 		name = "GRP Arriving", 
  408. 		chars = { "Luch Arriving 001" }, 
  409. 		vehicles = { "Veh Arriving 001" }, 
  410. 	}, 
  411.  
  412. 	balcony_enemies = { 
  413. 		name = "GRP Balcony Enemies", 
  414. 		chars = { "m07_luch_balcony 001", "m07_luch_balcony 002", "m07_luch_balcony 003", "m07_luch_balcony 004", "m07_luch_balcony 005", "m07_luch_balcony 006", 
  415. 					 "m07_luch_balcony 007", "m07_luch_balcony 008", "m07_luch_balcony 009", "m07_luch_balcony 010", "m07_luch_balcony 011" }, 
  416. 	}, 
  417.  
  418. 	grenadier = { 
  419. 		name = "GRP Grenadier", 
  420. 		chars = { "Grenadier", "Luch Soldier 001", "Luch Soldier 002", "Luch Soldier 003" }, 
  421. 		vehicles = { "Veh Grenadier" }, 
  422. 	}, 
  423.  
  424. 	brute_melee = { 
  425. 		name = "GRP Brute", 
  426. 		chars = { "Cas Def Brute" }, 
  427. 	}, 
  428.  
  429. 	brute_flamer_1 = { 
  430. 		name = "GRP Brute Flamer 001", 
  431. 		chars = { "Cas Def Brute Flamer 001" }, 
  432. 	}, 
  433.  
  434. 	brute_flamer_2 = { 
  435. 		name = "GRP Brute Flamer 002", 
  436. 		chars = { "Cas Def Brute Flamer 002" }, 
  437. 	}, 
  438.  
  439. 	brute_minigun = { 
  440. 		name = "GRP Brute Minigun", 
  441. 		chars = { "Cas Def Brute Minigun" }, 
  442. 	}, 
  443. 	cte_npc = {  
  444. 		name	= "GRP CTE Untie Kinzie", 
  445. 		chars	= {  
  446. 			CTE_Pierce	= "CTE_Pierce_NPC", 
  447. 			CTE_Shaundi	= "CTE_Shaundi_NPC", 
  448. 			CTE_Kinzie	= "CTE_Kinzie_NPC", 
  449. 		} 
  450. 	}, 
  451. } 
  452.  
  453. M07_spawn_group = { 
  454. 	wave_a =	{ name = "GRP Wave A" }, 
  455. 	wave_b =	{ name = "GRP Wave B" }, 
  456. 	wave_c =	{ name = "GRP Wave C" }, 
  457. 	wave_d =	{ name = "GRP Wave D" }, 
  458. 	brute_minigun = M07_group.brute_minigun, 
  459. 	brute_flamer_1 = M07_group.brute_flamer_1, 
  460. 	brute_flamer_2 = M07_group.brute_flamer_2, 
  461. 	grenadier = M07_group.grenadier, 
  462. } 
  463.  
  464. M07_char = { 
  465. 	pierce = M07_group.pierce.chars[1], 
  466. 	kinzie = M07_group.kinzie.chars[1], 
  467. 	zimos = M07_group.zimos.chars[1], 
  468. 	oleg = M07_group.oleg.chars[1], 
  469. 	angel = M07_group.angel.chars[1], 
  470. 	shaundi = M07_group.shaundi.chars[1], 
  471.  
  472. 	club_owner = M07_group.club_owner.chars[1], 
  473. 	brute_melee = M07_group.brute_melee.chars[1], 
  474. 	brute_flamer_1 = M07_group.brute_flamer_1.chars[1], 
  475. 	brute_flamer_2 = M07_group.brute_flamer_2.chars[1], 
  476. 	brute_minigun = M07_group.brute_minigun.chars[1], 
  477. 	grenadier = M07_group.grenadier.chars[1], 
  478. } 
  479.  
  480. M07_text = { 
  481. 	reach_barge = "M07_OBJ_REACH_BARGE", 
  482. 	find_kinzie = "M07_OBJ_FIND_KINZIE", 
  483. 	untie_kinzie = "M07_OBJ_UNTIE_KINZIE", 
  484. 	go_to_club = "M07_OBJ_GO_TO_CLUB", 
  485. 	interrogate_patron = "M07_OBJ_INTERROGATE_PATRONS", 
  486. 	find_owner = "M07_OBJ_FIND_OWNER", 
  487. 	grab_owner = "M07_OBJ_GRAB_OWNER", 
  488. 	go_to_zimos = "M07_OBJ_GO_TO_ZIMOS", 
  489. 	fight_off_morningstar = "M07_OBJ_KILL_MORNINGSTAR", 
  490. 	find_angel = "M07_OBJ_FIND_ANGEL", 
  491. 	kill_luchadores = "M07_OBJ_KILL_LUCHADORES", 
  492. 	protect_angel = "M07_OBJ_PROTECT_ANGEL", 
  493.  
  494. 	failure_death = { 
  495. 		[M07_char.oleg]			= "m07_failure_oleg_died", 
  496. 		[M07_char.zimos]			= "m07_failure_zimos_died", 
  497. 		[M07_char.angel]			= "m07_failure_angel_died", 
  498. 		[M07_char.pierce]			= "m07_failure_pierce_died", 
  499. 		[M07_char.kinzie]			= "m07_failure_kinzie_died", 
  500. 		[M07_char.shaundi]		= "m07_failure_shaundi_died", 
  501. 		[M07_char.club_owner]	= "m07_failure_club_owner_died", 
  502. 	}, 
  503. } 
  504.  
  505. M07_lines = { 
  506. 	pierce_casino_fight = "M07_Casino_Fight_01", 
  507. 	angel_casino_fight = "M07_Casino_Fight_02", 
  508. 	oleg_casino_fight = "M07_Casino_Fight_03",-- 
  509. 	angel_casino_fight2 = "M07_Casino_Fight_04", 
  510.  
  511. 	notice_brute = "M07_Notice_Brute_01", 
  512. 	 
  513. 	--played by oleg, zimos, angel 
  514. 	going_upstairs = "M07_Go_Upstairs", 
  515. 	--angel 
  516. 	flamethrowers = "M07_Flamer_Brute_01",-- 
  517. 	--zimos, angel, oleg 
  518. 	need_help = "M07_Need_Help",-- 
  519. 	--player 
  520. 	mission_end = "M07_Mission_End",-- 
  521. } 
  522.  
  523. M07_convo = { 
  524. 	-- Player, Pierce, Shaundi 
  525. 	mission_start = {-- 
  526. 		name = "m07_convo_1", 
  527. 		handle = INVALID_CONVERSATION_HANDLE, 
  528. 	}, 
  529.  
  530. 	-- Player, Shaundi, Pierce 
  531. 	encounter_deckers = {-- 
  532. 		name = "M07_Encounter_Deckers", 
  533. 		handle = INVALID_CONVERSATION_HANDLE, 
  534. 	}, 
  535. 	 
  536. 	kinzie_door = { 
  537. 		name = "M07_Open_Door_To_Kinzie", 
  538. 		handle = INVALID_CONVERSATION_HANDLE, 
  539. 		kinzie_persona_name = "Kinzie", 
  540. 		kinzie_persona_id = INVALID_PERSONA_HANDLE, 
  541. 	}, 
  542.  
  543. 	-- Player, Kinzie, Shaundi, Pierce 
  544. 	untie_kinzie = {--no, commented out, odd possibly in CTE? 
  545. 		name = "M07_Untie_Kinzie", 
  546. 		handle = INVALID_CONVERSATION_HANDLE, 
  547. 		kinzie_persona_name = "Kinzie", 
  548. 		kinzie_persona_id = INVALID_PERSONA_HANDLE, 
  549. 	}, 
  550.  
  551. 	--Player, Kinzie 
  552. 	kinzie_thanks = {-- 
  553. 		name = "M07_Kinzie_Call_Say_Thanks", 
  554. 		handle = INVALID_CONVERSATION_HANDLE, 
  555. 		kinzie_persona_name = "Kinzie", 
  556. 		kinzie_persona_id = INVALID_PERSONA_HANDLE, 
  557. 	}, 
  558. 	 
  559. 	-- Player, Pierce 
  560. 	drive_bdsm = {-- 
  561. 		name = "M07_Drive_To_BDSM_Club", 
  562. 		handle = INVALID_CONVERSATION_HANDLE, 
  563. 	}, 
  564.  
  565. 	-- Player, Pierce 
  566. 	enter_bdsm = {-- 
  567. 		name = "m07_convo_3", 
  568. 		handle = INVALID_CONVERSATION_HANDLE, 
  569. 	}, 
  570.  
  571. 	-- Player, Interrogation 
  572. 	int_1_2 = {-- 
  573. 		name = "m07_convo_6", 
  574. 		handle = INVALID_CONVERSATION_HANDLE, 
  575. 	}, 
  576.  
  577. 	-- Player, Interrogation 
  578. 	int_2_2 = {-- 
  579. 		name = "M07_Interrogate_Upstairs_2", 
  580. 		handle = INVALID_CONVERSATION_HANDLE, 
  581. 	}, 
  582.  
  583. 	-- Player, Interrogation 
  584. 	interrogate = {-- 
  585. 		name = "m07_convo_4", 
  586. 		handle = INVALID_CONVERSATION_HANDLE, 
  587. 	}, 
  588.  
  589. 	-- Player, Pierce 
  590. 	pony_barn = {-- 
  591. 		name = "M07_Head_To_Pony_Barn", 
  592. 		handle = INVALID_CONVERSATION_HANDLE, 
  593. 	}, 
  594.  
  595. 	-- Player, Pierce 
  596. 	pony_2 = {-- 
  597. 		name = "M07_Pony_Cart_Chase_2", 
  598. 		handle = INVALID_CONVERSATION_HANDLE, 
  599. 	}, 
  600.  
  601. 	-- Player, Zimos 
  602. 	rescue_zimos = {-- 
  603. 		name = "M07_Rescue_Zimos", 
  604. 		handle = INVALID_CONVERSATION_HANDLE, 
  605. 	}, 
  606. 	 
  607. 	-- Player, Kinzie (cell) 
  608. 	kinzie_call = {-- 
  609. 		name = "m07_convo_13", 
  610. 		handle = INVALID_CONVERSATION_HANDLE, 
  611. 		kinzie_persona_name = "Kinzie", 
  612. 		kinzie_persona_id = INVALID_PERSONA_HANDLE, 
  613. 	}, 
  614. 	 
  615. 	-- Player, Pierce, Zimos 
  616. 	mount_rescue = {-- 
  617. 		name = "M07_Take_Zimos_To_Casino", 
  618. 		handle = INVALID_CONVERSATION_HANDLE, 
  619. 	}, 
  620.  
  621. 	-- Player, Kinzie (cell) 
  622. 	kinzie_nag = {-- 
  623. 		name = "m07_convo_17", 
  624. 		handle = INVALID_CONVERSATION_HANDLE, 
  625. 		kinzie_persona_name = "Kinzie", 
  626. 		kinzie_persona_id = INVALID_PERSONA_HANDLE, 
  627. 	}, 
  628. 	 
  629. 	-- Player, Zimos, Oleg 
  630. 	oleg_arrives = {-- 
  631. 		name = "M07_Exterior_Brute_Dead", 
  632. 		handle = INVALID_CONVERSATION_HANDLE, 
  633. 	}, 
  634.  
  635. 	-- Oleg, Zimos, angel, player 
  636. 	first_wave = {-- 
  637. 		name = "m07_convo_14", 
  638. 		handle = INVALID_CONVERSATION_HANDLE, 
  639. 	}, 
  640.  
  641. 	-- Oleg, Brute 
  642. 	brute_grapple = {-- 
  643. 		name = "m07_convo_18", 
  644. 		handle = INVALID_CONVERSATION_HANDLE, 
  645. 	}, 
  646.  
  647. 	-- Player, Oleg, Zimos 
  648. 	zimos_bitch = {-- 
  649. 		name = "m07_convo_16", 
  650. 		handle = INVALID_CONVERSATION_HANDLE, 
  651. 	}, 
  652. 	 
  653. 	-- Player, Zimos 
  654. 	brute_minigun = {-- 
  655. 		name = "m07_convo_22", 
  656. 		handle = INVALID_CONVERSATION_HANDLE, 
  657. 	}, 
  658.  
  659. 	-- Player, Zimos 
  660. 	pickup_minigun = {-- 
  661. 		name = "m07_convo_20", 
  662. 		handle = INVALID_CONVERSATION_HANDLE, 
  663. 	}, 
  664.  
  665. 	-- Player, Angel (end) 
  666. 	brutes_dead = {-- 
  667. 		name = "m07_Brutes_Dead", 
  668. 		handle = INVALID_CONVERSATION_HANDLE, 
  669. 	}, 
  670. 	 
  671. 	-- Player, Kinzie 
  672. 	kinzie_development = { 
  673. 		name = "m07_convo_10", 
  674. 		handle = INVALID_CONVERSATION_HANDLE, 
  675. 	}, 
  676. 	 
  677. 	-- Player, Angel (development) 
  678. 	angel_talk = {-- 
  679. 		name = "m07_convo_12", 
  680. 		handle = INVALID_CONVERSATION_HANDLE, 
  681. 	}, 
  682. } 
  683.  
  684. M07_thread = { 
  685. 	zimos_pony_cart = INVALID_THREAD_HANDLE, 
  686. 	nodes = INVALID_THREAD_HANDLE, 
  687. 	luchadores_arriving_1 = INVALID_THREAD_HANDLE, 
  688. 	luchadores_arriving_2 = INVALID_THREAD_HANDLE, 
  689. 	luchadores_arriving_3 = INVALID_THREAD_HANDLE, 
  690. 	kinzie_nag = INVALID_THREAD_HANDLE, 
  691. 	angel_flee = INVALID_THREAD_HANDLE, 
  692. 	brute_attack = INVALID_THREAD_HANDLE, 
  693. 	delay_thread = INVALID_THREAD_HANDLE, 
  694.  
  695. 	patrol = { 
  696. 		[1] = INVALID_THREAD_HANDLE, 
  697. 		[2] = INVALID_THREAD_HANDLE, 
  698. 		[3] = INVALID_THREAD_HANDLE, 
  699. 	}, 
  700. 	 
  701. 	carts = { 
  702. 		[1] = INVALID_THREAD_HANDLE, 
  703. 		[2] = INVALID_THREAD_HANDLE, 
  704. 		[3] = INVALID_THREAD_HANDLE, 
  705. 	}, 
  706. } 
  707.  
  708. M07_checkpoint = { 
  709. 	start = MISSION_START_CHECKPOINT,									-- defined in ug_lib.lua 
  710. 	barge = "barge", 
  711. 	zimos_part_one = "zimos part 1", 
  712. 	zimos_part_two = "zimos part 2", 
  713. 	angel = "angel", 
  714. 	brute = "brute", 
  715. 	defense = "defense", 
  716. } 
  717. 	 
  718. M07_cutscene = { 
  719. 	mission_intro = "07_In", 
  720. 	zimos_pre_pony_cart = "07_Z01", 
  721. 	zimos_post_pony_cart = "07_Z02", 
  722. 	angel_mid_checkpoint = "07_Z03", 
  723. 	mission_outro = "07_out", 
  724. } 
  725.  
  726.  
  727. -------------------------------------------------------------------------------------------------- 
  728.  
  729. 											--[[********************]]-- 
  730. 											--[[                    ]]-- 
  731. 											--[[ Standard functions ]]-- 
  732. 											--[[                    ]]-- 
  733. 											--[[********************]]-- 
  734.  
  735.  
  736.  
  737. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  738. -- at the specified checkpoint. 
  739. -- CALLED FROM CODE 
  740. -- 
  741. -- m07_checkpoint:	(string) The checkpoint the mission should begin at 
  742. -- is_restart:			(bool) TRUE if the mission is restarting, FALSE otherwise 
  743. -- 
  744. function m07_start(m07_checkpoint, is_restart) 
  745. 	-- Debug override 
  746. 	--m07_checkpoint = M07_checkpoint.zimos_part_two 
  747.  
  748. 	-- Check if this mission starting from the beginning 
  749. 	if (m07_checkpoint == M07_checkpoint.start) then 
  750. 		if (not is_restart) then 
  751. 			-- First time playing mission 
  752. 			 
  753. 			-- TODO: Play an intro cutscene 
  754. 			if (M07_cutscene.mission_intro ~= "") then 
  755. 				cutscene_play(M07_cutscene.mission_intro, nil, {M07_navpoint.cp_starts.start.player_local, M07_navpoint.cp_starts.start.player_remote}, false) 
  756. 			else 
  757. 				bink_play("07_In_v2") 
  758. 				-- BD: I added this because the mission is automatically started after mission 06 and  
  759. 				-- the mission was not teleporting the players properly when played in sequence 
  760. 				teleport_coop(M07_navpoint.cp_starts.start.player_local, M07_navpoint.cp_starts.start.player_remote, true) 
  761. 			end 
  762. 		else 
  763. 			teleport_coop(M07_navpoint.cp_starts.start.player_local, M07_navpoint.cp_starts.start.player_remote, true) 
  764. 		end 
  765. 		fade_out(0) 
  766. 	end 
  767.  
  768. 	-- Disable traffic around the BDSM (must be done before the area loads to avoid existing cars) 
  769. 	for i,trigger in pairs(M07_trigger.bdsm_traffic) do 
  770. 		traffic_disable_lanes(trigger, true) 
  771. 	end 
  772.  
  773. 	-- Handle mission initialization for the current checkpoint 
  774. 	m07_initialize(m07_checkpoint) 
  775.  
  776. 	-- Run the mission from the current checkpoint 
  777. 	m07_run(m07_checkpoint) 
  778. end 
  779.  
  780. -- This is the primary function responsible for running the entire mission from start to finish. 
  781. -- 
  782. -- first_checkpoint:	(string) The first checkpoint to begin running the mission at 
  783. -- 
  784. function m07_run(first_checkpoint) 
  785. 	local current_checkpoint = first_checkpoint 
  786.  
  787. 	-- Run the mission from the beginning 
  788. 	if (current_checkpoint == M07_checkpoint.start) then 
  789. 		m07_get_to_the_barge() 
  790. 		m07_rescue_kinzie() 
  791. 		 
  792. 		-- Now move on to the next checkpoint 
  793. 		current_checkpoint = M07_checkpoint.barge 
  794. 		mission_set_checkpoint(M07_checkpoint.barge, true) 
  795. 	end 
  796.  
  797. 	if (current_checkpoint == M07_checkpoint.barge) then 
  798. 		m07_get_to_bdsm() 
  799. 		 
  800. 		-- Now move on to the next checkpoint 
  801. 		current_checkpoint = M07_checkpoint.zimos_part_one 
  802. 		mission_set_checkpoint(M07_checkpoint.zimos_part_one, true) 
  803. 	end 
  804.  
  805. 	if (current_checkpoint == M07_checkpoint.zimos_part_one) then 
  806. 		m07_zimos_part_one_run() 
  807. 		 
  808. 		-- Now move on to the next checkpoint 
  809. 		current_checkpoint = M07_checkpoint.zimos_part_two 
  810. 		mission_set_checkpoint(M07_checkpoint.zimos_part_two, true) 
  811. 	end 
  812.  
  813. 	if (current_checkpoint == M07_checkpoint.zimos_part_two) then 
  814. 		m07_zimos_part_two_run() 
  815. 		 
  816. 		-- Now move on to the next checkpoint 
  817. 		current_checkpoint = M07_checkpoint.angel 
  818. 		mission_set_checkpoint(M07_checkpoint.angel, true) 
  819. 	end 
  820.  
  821. 	if (current_checkpoint == M07_checkpoint.angel) then 
  822. 		m07_angel_part_one_find_angel() 
  823.  
  824. 		current_checkpoint = M07_checkpoint.brute 
  825. 		mission_set_checkpoint(M07_checkpoint.brute, true) 
  826. 	end 
  827.  
  828. 	if (current_checkpoint == M07_checkpoint.brute) then 
  829. 		m07_angel_defeat_luchadores() 
  830. 		m07_angel_mid_checkpoint_cutscene() 
  831.  
  832. 		current_checkpoint = M07_checkpoint.defense 
  833. 		mission_set_checkpoint(M07_checkpoint.defense, true) 
  834. 	end 
  835.  
  836. 	if (current_checkpoint == M07_checkpoint.defense) then 
  837. 		m07_angel_part_two_casino_defense() 
  838. 	end 
  839.  
  840. 	-- Call mission success 
  841. 	if (M07_cutscene.mission_outro ~= "") then 
  842. 		mission_end_success("m07", M07_cutscene.mission_outro, M07_navpoint.mission_end_navs) 
  843. 	else 
  844. 		-- TODO: Remove this when there's a cutscene 
  845. 		bink_play("07_Out_v3") 
  846. 		mission_end_success("m07") 
  847. 	end 
  848. end 
  849.  
  850. -- This is the primary function responsible for cleaning up the entire mission 
  851. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++) 
  852. -- 
  853. function m07_cleanup() 
  854. 	notoriety_force_no_spawn("luchadores", false) 
  855. 	notoriety_force_no_spawn("deckers", false) 
  856. 	notoriety_force_no_spawn("morningstar", false) 
  857. 	notoriety_force_no_spawn("police", false) 
  858. 	notoriety_force_no_spawn("stag", false) 
  859. 	notoriety_set_can_decay(true) 
  860. 	 
  861. 	-- crib access is now allowed 
  862. 	crib_disable_interface( false ) 
  863. 	 
  864. 	set_ped_density(1.00) 
  865. 	mission_waypoint_remove() 
  866. 	cleanup_threads(M07_thread) 
  867. 	m07_cleanup_triggers(M07_trigger) 
  868. 	cleanup_callbacks({ M07_char, LOCAL_PLAYER, REMOTE_PLAYER, M07_group.luchadores_outside.brute, M07_group.luchadores_outside.chars, M07_group.pony_cart_enemies.chars,  
  869. 						M07_group.bbp_riders.chars, M07_group.bdp_guards.chars, M07_group.bds_guards.chars, M07_group.bdsm_ambient.members, M07_group.bdsm_gimps.members}) 
  870. 	cleanup_spawn_regions(M07_spawn_region) 
  871. 	cleanup_spawn_groups(M07_spawn_group) 
  872. 	cleanup_groups(M07_group) 
  873. 	cleanup_conversations(M07_convo) 
  874. 	--cleanup the rooms 
  875. 	for i,floor_rooms in pairs (M07_group.bdsm_rooms.floors) do 
  876. 		for j,room in pairs(floor_rooms) do 
  877. 			for k,npc in pairs(room.members) do 
  878. 				on_death("", npc) 
  879. 				on_character_grabbed("", npc) 
  880. 			end 
  881. 		end 
  882. 	end 
  883.  
  884. 	-- Restore traffic around the BDSM 
  885. 	for i,trigger in pairs(M07_trigger.bdsm_traffic) do 
  886. 		traffic_disable_lanes(trigger, false) 
  887. 	end 
  888.  
  889. 	--kill phonecalls 
  890. 	audio_remove_mission_cellphone(M07_convo.kinzie_nag.name) 
  891. 	audio_remove_mission_cellphone(M07_convo.kinzie_call.name) 
  892. 	audio_remove_mission_cellphone(M07_convo.kinzie_thanks.name) 
  893. 	 
  894. 	-- Unload personas 
  895. 	if (M07_convo.kinzie_call.kinzie_persona_id ~= INVALID_PERSONA_HANDLE) then 
  896. 		audio_persona_remove_2d(M07_convo.kinzie_call.kinzie_persona_id) 
  897. 		M07_convo.kinzie_call.kinzie_persona_id = INVALID_PERSONA_HANDLE 
  898. 	end 
  899. 	 
  900. 	persona_clear_global_situation_override() 
  901. 	 
  902. 	-- Re-enable controls 
  903. 	player_controls_enable(LOCAL_PLAYER) 
  904. 	set_player_can_enter_exit_vehicles(LOCAL_PLAYER, true) 
  905. 	if (coop_is_active()) then 
  906. 		player_controls_enable(REMOTE_PLAYER) 
  907. 		set_player_can_enter_exit_vehicles(REMOTE_PLAYER, true) 
  908. 	end 
  909.  
  910. 	if (M07_status.temp_weapon_local ~= "") then 
  911. 		inv_weapon_remove_temporary(LOCAL_PLAYER, M07_status.temp_weapon_local) 
  912. 	end 
  913. 	if (M07_status.temp_weapon_remote ~= "") then 
  914. 		inv_weapon_remove_temporary(REMOTE_PLAYER, M07_status.temp_weapon_remote) 
  915. 	end 
  916. 	inv_weapon_disable_all_slots(false) 
  917. 	 
  918. 	for i,npc_group in pairs(M07_group.pony_cart_enemies.chars) do 
  919. 		on_death("", M07_group.pony_cart_drivers.chars[i]) 
  920. 	end 
  921. 	 
  922. 	--make sure to clear the don't set on fire flag 
  923. 	character_set_never_catch_fire(LOCAL_PLAYER, false) 
  924. 	if (coop_is_active()) then 
  925. 		character_set_never_catch_fire(REMOTE_PLAYER, false) 
  926. 	end 
  927. 	 
  928. 	-- Remove the barge zone swaps 
  929. 	city_zone_swap("barge", DISABLE) 
  930. 	-- city_zone_swap("is2", DISABLE) 
  931. 	 
  932. end 
  933.  
  934. -- Called when the mission has ended with success 
  935. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  936. -- 
  937. function m07_success() 
  938. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
  939. 	 
  940. end 
  941.  
  942. -------------------------------------------------------------------------------------------------- 
  943.  
  944. 											--[[*****************]]-- 
  945. 											--[[                 ]]-- 
  946. 											--[[ Local functions ]]-- 
  947. 											--[[                 ]]-- 
  948. 											--[[*****************]]-- 
  949.  
  950.  
  951.  
  952. -- Initialize the mission for the specified checkpoint 
  953. -- 
  954. -- checkpoint:		Checkpoint to initialize the mission to 
  955. -- 
  956. function m07_initialize(checkpoint) 
  957. 	-- Make sure the screen is completly faded out 
  958. 	mission_start_fade_out(0.0) 
  959.  
  960. 	-- Set the mission author 
  961. 	set_mission_author("Albert McDaniel") 
  962.  
  963. 	-- Ensure the requisite zones are swapped in 
  964. 	city_zone_swap("barge", true) 
  965. 	-- city_zone_swap("is2", true) -- this is the mega brothel zone swap 
  966.  
  967. 	-- Force notoriety off; the mission will handle spawning 
  968. 	notoriety_force_no_spawn("luchadores", true) 
  969. 	notoriety_force_no_spawn("deckers", true) 
  970. 	notoriety_force_no_spawn("morningstar", true) 
  971. 	notoriety_force_no_spawn("police", true) 
  972. 	notoriety_force_no_spawn("stag", true) 
  973. 	notoriety_set_can_decay(false) 
  974. 	 
  975. 	-- crib access is not allowed 
  976. 	crib_disable_interface( true ) 
  977.  
  978. 	-- Checkpoint specific initialization 
  979. 	m07_initialize_checkpoint(checkpoint) 
  980.  
  981. 	-- Start fading in  
  982. 	mission_start_fade_in() 
  983. end 
  984.  
  985.  
  986. -------------------------------------------------------------------------------------------------- 
  987.  
  988. 									--[[*********************************]]-- 
  989. 									--[[                                 ]]-- 
  990. 									--[[ m03_initialize Helper Functions ]]-- 
  991. 									--[[                                 ]]-- 
  992. 									--[[*********************************]]-- 
  993.  
  994.  
  995. -- Checkpoint specific initialization 
  996. -- 
  997. -- checkpoint:	The checkpoint to be initialized 
  998. -- 
  999. function m07_initialize_checkpoint(checkpoint) 
  1000. 	if (checkpoint == M07_checkpoint.start) then 
  1001.  
  1002. 		-- Teleport the players first to ensure correct party adding in coop 
  1003. 		--teleport_coop(M07_navpoint.cp_starts.start.player_local, M07_navpoint.cp_starts.start.player_remote, true) 
  1004.  
  1005. 		group_create(M07_group.shaundi.name, true) 
  1006. 		on_death("m07_homie_death_fail_cb", M07_char.shaundi) 
  1007. 		group_create(M07_group.pierce.name, true) 
  1008. 		on_death("m07_homie_death_fail_cb", M07_char.pierce) 
  1009.  
  1010. 		-- Add everyone to the party 
  1011. 		party_add(M07_char.pierce, LOCAL_PLAYER) 
  1012. 		if (coop_is_active()) then 
  1013. 			party_add(M07_char.shaundi, REMOTE_PLAYER) 
  1014. 		else 
  1015. 			party_add(M07_char.shaundi, LOCAL_PLAYER) 
  1016. 		end 
  1017. 		follower_set_can_abandon(M07_char.shaundi, true) 
  1018. 		follower_set_can_abandon(M07_char.pierce, true) 
  1019. 		on_dismiss("m07_failure_dismissed_cb", M07_char.shaundi) 
  1020. 		on_dismiss("m07_failure_dismissed_cb", M07_char.pierce) 
  1021.  
  1022. 		-- Spawn the first objective before the fade-in 
  1023. 		m07_spawn_barge() 
  1024.  
  1025. 	elseif (checkpoint == M07_checkpoint.barge) then 
  1026.  
  1027. 		group_create(M07_group.pierce.name, true) 
  1028. 		on_death("m07_homie_death_fail_cb", M07_char.pierce) 
  1029. 		party_add(M07_char.pierce, LOCAL_PLAYER) 
  1030. 		follower_set_can_abandon(M07_char.pierce, true) 
  1031. 		on_dismiss("m07_failure_dismissed_cb", M07_char.pierce) 
  1032.  
  1033. 		teleport_coop(M07_navpoint.cp_starts.barge.player_local, M07_navpoint.cp_starts.barge.player_remote, true) 
  1034. 		teleport(M07_char.pierce, M07_navpoint.cp_starts.barge.pierce, true) 
  1035.  
  1036. 	elseif (checkpoint == M07_checkpoint.zimos_part_one) then 
  1037.  
  1038. 		change_mission_enemy_team("Morningstar") 
  1039. 		set_ped_density(0.01) 
  1040. 		group_create(M07_group.pierce.name, true) 
  1041. 		on_death("m07_homie_death_fail_cb", M07_char.pierce) 
  1042. 		party_add(M07_char.pierce, LOCAL_PLAYER) 
  1043. 		follower_set_can_abandon(M07_char.pierce, true) 
  1044. 		on_dismiss("m07_failure_dismissed_cb", M07_char.pierce) 
  1045.  
  1046. 		teleport_coop(M07_navpoint.cp_starts.bdsm.player_local, M07_navpoint.cp_starts.bdsm.player_remote, true) 
  1047.  
  1048. 		-- Go ahead and spawn the guard gimps; the rest can wait until you arrive 
  1049. 		group_create(M07_group.bdsm_gimps.name, true) 
  1050. 		for i,char in pairs(M07_group.bdsm_gimps.members) do 
  1051. 			on_detection(M07_timed_lines.bdsm.callback, char) 
  1052. 		end 
  1053. 	elseif (checkpoint == M07_checkpoint.zimos_part_two) then 
  1054.  
  1055. 		change_mission_enemy_team("Morningstar") 
  1056. 		group_create(M07_group.pierce.name, true) 
  1057. 		on_death("m07_homie_death_fail_cb", M07_char.pierce) 
  1058. 		party_add(M07_char.pierce, LOCAL_PLAYER) 
  1059. 		follower_set_can_abandon(M07_char.pierce, true) 
  1060. 		on_dismiss("m07_failure_dismissed_cb", M07_char.pierce) 
  1061.  
  1062. 		-- Move everybody up to the pony carts 
  1063. 		teleport_coop(M07_navpoint.cp_starts.pony_cart.player_local, M07_navpoint.cp_starts.pony_cart.player_remote, true) 
  1064.  
  1065. 		-- Create Zimos after the teleport so the vehicle streams in fully 
  1066. 		group_create(M07_group.zimos.name, true) 
  1067. 		npc_suppress_persona(M07_char.zimos, true) 
  1068. 		turn_invulnerable(M07_char.zimos) 
  1069. 		on_death("m07_homie_death_fail_cb", M07_char.zimos) 
  1070. 		group_create(M07_group.pony_cart.name, true) 
  1071. 		vehicle_enter_teleport(M07_char.zimos, M07_group.pony_cart.vehicles[1], 0, true) 
  1072. 		vehicle_suppress_npc_exit(M07_group.pony_cart.vehicles[1]) 
  1073. 		set_ignore_ai_flag(M07_char.zimos, true) 
  1074.  
  1075. 		-- Get ready for the pony cart chase 
  1076. 		m07_setup_pony_carts() 
  1077.  
  1078. 	elseif (checkpoint == M07_checkpoint.angel) then 
  1079.  
  1080. 		teleport_coop(M07_navpoint.cp_starts.casino.player_local, M07_navpoint.cp_starts.casino.player_remote, true) 
  1081. 		change_mission_enemy_team("Luchadores") 
  1082. 		group_create(M07_group.zimos.name, true) 
  1083. 		on_death("m07_homie_death_fail_cb", M07_char.zimos) 
  1084. 		on_incapacitated("m07_homie_dbno_cb", M07_char.zimos) 
  1085.  
  1086. 		-- Add everyone to the player's party 
  1087. 		party_add(M07_char.zimos, LOCAL_PLAYER) 
  1088. 		follower_set_can_abandon(M07_char.zimos, true) 
  1089. 		on_dismiss("m07_failure_dismissed_cb", M07_char.zimos) 
  1090. 		teleport (M07_char.zimos, M07_navpoint.zimos_car_tp) 
  1091. 		group_create(M07_group.casino_vehicle.name, true) 
  1092. 		vehicle_set_team(M07_group.casino_vehicle.vehicles[1], "Playas") 
  1093.  
  1094. 	elseif (checkpoint == M07_checkpoint.brute) then 
  1095. 		teleport_coop(M07_navpoint.cp_starts.brute.player_local, M07_navpoint.cp_starts.brute.player_remote, true) 
  1096.  
  1097. 		change_mission_enemy_team("Luchadores") 
  1098. 		group_create(M07_group.zimos.name, true) 
  1099. 		on_death("m07_homie_death_fail_cb", M07_char.zimos) 
  1100. 		on_incapacitated("m07_homie_dbno_cb", M07_char.zimos) 
  1101.  
  1102. 		-- Add everyone to the player's party 
  1103. 		party_add(M07_char.zimos, LOCAL_PLAYER) 
  1104. 		follower_set_can_abandon(M07_char.zimos, true) 
  1105. 		on_dismiss("m07_failure_dismissed_cb", M07_char.zimos) 
  1106.  
  1107. 		 
  1108. 		-- Spawn the casino exterior enemies 
  1109. 		m07_angel_setup_casino_exterior() 
  1110.  
  1111. 	elseif (checkpoint == M07_checkpoint.defense) then 
  1112. 		teleport_coop(M07_navpoint.cp_starts.defense.player_local, M07_navpoint.cp_starts.defense.player_remote, true) 
  1113. 		 
  1114. 		change_mission_enemy_team("Luchadores") 
  1115. 		group_create(M07_group.zimos.name, true) 
  1116. 		on_death("m07_homie_death_fail_cb", M07_char.zimos) 
  1117. 		on_incapacitated("m07_homie_dbno_cb", M07_char.zimos) 
  1118. 		group_create(M07_group.angel.name, true) 
  1119. 		on_death("m07_homie_death_fail_cb", M07_char.angel) 
  1120. 		on_incapacitated("m07_homie_dbno_cb", M07_char.angel) 
  1121. 		group_create(M07_group.oleg.name, true) 
  1122. 		on_death("m07_homie_death_fail_cb", M07_char.oleg) 
  1123. 		on_incapacitated("m07_homie_dbno_cb", M07_char.oleg) 
  1124.  
  1125. 		-- Add everyone to the player's party 
  1126. 		if (coop_is_active()) then 
  1127. 			party_add(M07_char.zimos, M07_char.angel, LOCAL_PLAYER) 
  1128. 			party_add(M07_char.oleg, REMOTE_PLAYER) 
  1129. 		else 
  1130. 			party_add(M07_char.zimos, M07_char.oleg, M07_char.angel, LOCAL_PLAYER) 
  1131. 		end 
  1132. 		follower_set_can_abandon(M07_char.zimos, true) 
  1133. 		follower_set_can_abandon(M07_char.angel, true) 
  1134. 		follower_set_can_abandon(M07_char.oleg, true) 
  1135. 		on_dismiss("m07_failure_dismissed_cb", M07_char.zimos) 
  1136. 		on_dismiss("m07_failure_dismissed_cb", M07_char.angel) 
  1137. 		on_dismiss("m07_failure_dismissed_cb", M07_char.oleg) 
  1138.  
  1139. 		-- Leave followers in separate locations; do not follow the player around 
  1140. 		follower_make_independent(M07_char.oleg, true) 
  1141. 		follower_make_independent(M07_char.angel, true) 
  1142. 		--follower_make_independent(M07_char.pierce, true)	-- POC2: Remove Pierce 
  1143. 		follower_make_independent(M07_char.zimos, true) 
  1144.  
  1145. 		--teleport(M07_char.pierce, M07_navpoint.cp_starts.defense.pierce, true)	-- POC2: Remove Pierce 
  1146. 		teleport(M07_char.zimos, M07_navpoint.cp_starts.defense.zimos, true) 
  1147. 		teleport(M07_char.angel, M07_navpoint.cp_starts.defense.angel, true) 
  1148. 		teleport(M07_char.oleg, M07_navpoint.cp_starts.defense.oleg, true) 
  1149.  
  1150. 	end 
  1151. end 
  1152.  
  1153. -------------------------------------------------------------------------------------------------- 
  1154.  
  1155. 									--[[**************************]]-- 
  1156. 									--[[                          ]]-- 
  1157. 									--[[ m07_run Helper Functions ]]-- 
  1158. 									--[[                          ]]-- 
  1159. 									--[[**************************]]-- 
  1160.  
  1161.  
  1162. 									--------------------------------- 
  1163. 									--[[								  ]]-- 
  1164. 									--[[ 1ST CHECKPOINT (KINZIE) ]]-- 
  1165. 									--[[								  ]]-- 
  1166.  
  1167. -- Kinzie is on a barge, player needs to find a boat or helicopter and get to the barge. 
  1168. -- 
  1169. function m07_spawn_barge() 
  1170. 	-- Force team to Deckers 
  1171. 	mission_set_enemy_team("Deckers") 
  1172.  
  1173. 	-- Spawn the enemies 
  1174. 	group_create(M07_group.bdp_guards.name, true) 
  1175. 	group_create(M07_group.bds_guards.name, true) 
  1176.  
  1177. 	-- Put the guards on a patrol 
  1178. 	group_create(M07_group.bbp_guards.name, true) 
  1179. 	for i,npc_group in pairs(M07_group.bbp_guards.chars) do 
  1180. 		vehicle_enter_group_teleport(npc_group, M07_group.bbp_guards.vehicles[i]) 
  1181.  
  1182. 		-- Send the boats on a patrol around the barge 
  1183. 		vehicle_speed_override(M07_group.bbp_guards.vehicles[i], 20) 
  1184. 		M07_thread.patrol[i] = thread_new("m07_vehicle_path_thread", M07_group.bbp_guards.vehicles[i], M07_scripted_path.barge_boat_patrol[i]) 
  1185. 	end 
  1186. 	 
  1187. 	--setup attack callbacks 
  1188. 	for i,char in pairs(M07_group.bds_guards.chars) do 
  1189. 		on_attack_performed(M07_timed_lines.deckers.callback, char) 
  1190. 	end 
  1191. 	for i,char in pairs(M07_group.bbp_riders.chars) do 
  1192. 		on_attack_performed(M07_timed_lines.deckers.callback, char) 
  1193. 	end 
  1194. 	for i,char in pairs(M07_group.bdp_guards.chars) do 
  1195. 		on_attack_performed(M07_timed_lines.deckers.callback, char) 
  1196. 	end 
  1197. 	-- Spawn Kinzie 
  1198. 	group_create(M07_group.kinzie.name, true) 
  1199. 	set_ignore_ai_flag(M07_char.kinzie, true) 
  1200. 	character_allow_ragdoll(M07_char.kinzie, false) 
  1201. 	character_set_immune_to_explosion_vomit(M07_char.kinzie, true) 
  1202. 	inv_item_remove_all(M07_char.kinzie) 
  1203. 	set_dont_attack_me_on_sight_flag(M07_char.kinzie, true) 
  1204. 	npc_leash_to_nav(M07_char.kinzie, M07_navpoint.kinzie_leash, 0) 
  1205. 	on_death("m07_homie_death_fail_cb", M07_char.kinzie) 
  1206.  
  1207. 	-- Spawn a boat to get to the barge 
  1208. 	group_create(M07_group.boat_to_barge.name, true) 
  1209. 	vehicle_set_team(M07_group.boat_to_barge.vehicles[1], "Playas") 
  1210. 	vehicle_set_team(M07_group.boat_to_barge.vehicles[2], "Playas") 
  1211. end 
  1212.  
  1213. -- Kinzie is on a barge, player needs to find a boat or helicopter and get to the barge. 
  1214. -- 
  1215. function m07_get_to_the_barge() 
  1216. 	-- Start the conversation so the objective can update in the middle of it 
  1217. 	M07_convo.mission_start.handle = audio_conversation_load(M07_convo.mission_start.name) 
  1218. 	audio_conversation_play(M07_convo.mission_start.handle) 
  1219. 	delay(2) 
  1220.  
  1221. 	-- Tell the player to get to the barge 
  1222. 	objective_text(0, M07_text.reach_barge, nil, nil, SYNC_ALL, OI_ASSET_LOCATION) 
  1223.  
  1224. 	-- Mark the provided boat 
  1225. 	marker_add(M07_group.boat_to_barge.vehicles[1], MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1226. 	mission_waypoint_add(M07_group.boat_to_barge.vehicles[1]) 
  1227.  
  1228. 	-- Wait for the player to get in any boat or helicopter, or to get within 100m of the barge 
  1229. 	M07_status.player_vehicle_type = get_char_vehicle_type(LOCAL_PLAYER) 
  1230. 	on_vehicle_enter("m07_player_entered_vehicle_cb", LOCAL_PLAYER) 
  1231. 	if (coop_is_active()) then 
  1232. 		on_vehicle_enter("m07_player_entered_vehicle_cb", REMOTE_PLAYER) 
  1233. 	end 
  1234. 	while ((M07_status.player_vehicle_type ~= VT_WATERCRAFT) and (M07_status.player_vehicle_type ~= VT_HELICOPTER) and (M07_status.player_vehicle_type ~= VT_AIRPLANE) and (get_dist_closest_player_to_object(M07_trigger.barge_dock) > 100)) do 
  1235. 		thread_yield() 
  1236. 	end 
  1237. 	on_vehicle_enter("", LOCAL_PLAYER) 
  1238. 	if (coop_is_active()) then 
  1239. 		on_vehicle_enter("", REMOTE_PLAYER) 
  1240. 	end 
  1241.  
  1242. 	mission_waypoint_remove() 
  1243. 	marker_remove(M07_group.boat_to_barge.vehicles[1], SYNC_ALL) 
  1244.  
  1245. 	-- Set the barge as the next marked destination and wait for the player to reach it 
  1246. 	M07_status.reached_goal = false 
  1247. 	mission_waypoint_add(M07_trigger.barge_dock) 
  1248. 	trigger_enable(M07_trigger.barge_dock, true) 
  1249. 	marker_add_trigger(M07_trigger.barge_dock, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1250. 	on_trigger("m07_reached_goal_cb", M07_trigger.barge_dock) 
  1251. 	 
  1252. 	trigger_enable(M07_trigger.barge_jetskis, true) 
  1253. 	on_trigger("m07_release_jetskis", M07_trigger.barge_jetskis) 
  1254. 	 
  1255. 	while (not M07_status.reached_goal) do 
  1256. 		thread_yield() 
  1257. 	end 
  1258. 	mission_waypoint_remove() 
  1259.  
  1260. 	objective_text_clear(0) 
  1261. end 
  1262.  
  1263. function m07_release_jetskis() 
  1264. 	trigger_enable(M07_trigger.barge_jetskis, false) 
  1265. 	for i,thr in pairs(M07_thread.patrol) do 
  1266. 		thread_kill(M07_thread.patrol[i]) 
  1267. 		M07_thread.patrol[i] = INVALID_THREAD_HANDLE 
  1268. 	end 
  1269. end 
  1270.  
  1271. -- Kinzie is in the wheelhouse, player needs to go there and untie Kinzie. 
  1272. -- 
  1273. function m07_rescue_kinzie() 
  1274. 	-- Tell the player to get to Kinzie 
  1275. 	objective_text(0, M07_text.find_kinzie, nil, nil, SYNC_ALL, OI_ASSET_LOCATION) 
  1276. 	M07_status.reached_goal = false 
  1277. 	trigger_enable(M07_trigger.barge_wheelhouse, true) 
  1278. 	marker_add_trigger(M07_trigger.barge_wheelhouse, MINIMAP_ICON_LOCATION, "", OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1279. 	on_trigger("m07_reached_wheelhouse", M07_trigger.barge_wheelhouse) 
  1280. 	 
  1281. 	-- Provoke the Deckers to attack 
  1282. 	notoriety_set("deckers", 3) 
  1283. 	 
  1284. 	while not character_is_ready(M07_char.kinzie) do 
  1285. 		thread_yield() 
  1286. 	end 
  1287. 	set_animation_state(M07_char.kinzie, "Hostage Idle") 
  1288. 	npc_suppress_persona(M07_char.kinzie, true) 
  1289. 	character_prevent_flinching(M07_char.kinzie, true) 
  1290. 	character_prevent_bumping(M07_char.kinzie, true) 
  1291. 	 
  1292. 	-- This door no longer exists, not sure why we had it but if it comes back and we need it, it will be here 
  1293. 	-- Unlock the door 
  1294. 	-- door_lock(M07_mover.door_barge, false) 
  1295.  
  1296. 	delay(5) 
  1297. 	for i, guard in pairs(M07_group.barge1.members) do 
  1298. 		ai_do_scripted_move(guard, M07_group.barge1.navpoints[i]) 
  1299. 		delay(1) 
  1300. 	end 
  1301. 	trigger_enable(M07_trigger.barge_enemies01, true) 
  1302. 	on_trigger("m07_barge_enemies01", M07_trigger.barge_enemies01) 
  1303. 	trigger_enable(M07_trigger.barge_enemies02, true) 
  1304. 	on_trigger("m07_barge_enemies02", M07_trigger.barge_enemies02) 
  1305.  
  1306. 	-- Point out the Deckers 
  1307. 	M07_convo.encounter_deckers.handle = audio_conversation_load(M07_convo.encounter_deckers.name) 
  1308. 	audio_conversation_wait_for_end(M07_convo.mission_start.handle) 
  1309. 	M07_convo.mission_start.handle = INVALID_CONVERSATION_HANDLE 
  1310. 	audio_conversation_play(M07_convo.encounter_deckers.handle) 
  1311.  
  1312. 	-- More door stuff  
  1313. 	-- while (not door_is_open(M07_mover.door_barge)) do 
  1314. 		-- thread_yield() 
  1315. 	-- end 
  1316. 	 
  1317. 	-- Added this since we no longer have a door 
  1318. 	audio_conversation_wait_for_end(M07_convo.encounter_deckers.handle) 
  1319. 	while (not M07_status.reached_goal) do 
  1320. 		thread_yield() 
  1321. 	end 
  1322. 	 
  1323. 	trigger_enable(M07_trigger.barge_wheelhouse, false) 
  1324. 	marker_remove_trigger(M07_trigger.barge_wheelhouse, SYNC_ALL) 
  1325.  
  1326. 	objective_text_clear(0) 
  1327.  
  1328. 	-- Pre-load the untie conversation 
  1329. 	M07_convo.kinzie_door.handle = audio_conversation_load_player(M07_convo.kinzie_door.name, M07_status.player_for_convo) 
  1330. 	 
  1331. 	audio_conversation_play(M07_convo.kinzie_door.handle) 
  1332. 	-- Now that Kinzie has been found, tell the player to untie her 
  1333. 	objective_text(0, M07_text.untie_kinzie, nil, nil, SYNC_ALL, OI_ASSET_USE) 
  1334. 	marker_add(M07_char.kinzie, MINIMAP_ICON_USE, OI_ASSET_USE, OI_FLAGS_LOCATION, SYNC_ALL) 
  1335.  
  1336. 	M07_status.reached_goal = false 
  1337. 	trigger_enable(M07_trigger.kinzie_tied_up, true) 
  1338. 	on_trigger("m07_kinzie_untie_cb", M07_trigger.kinzie_tied_up) 
  1339. 	while (not M07_status.reached_goal) do 
  1340. 		thread_yield() 
  1341. 	end 
  1342. 	 
  1343. 	-- Clean up the objective 
  1344. 	clear_animation_state(M07_char.kinzie) 
  1345. 	notoriety_set("deckers", 0) 
  1346.  
  1347. 	--Fade to black to hide the behind the scenes teleports 
  1348. 	fade_out(0.5) 
  1349. 	fade_out_block()	 
  1350. 	--Set up cutscene aspect ratio and widescreen bars 
  1351. 	cutscene_in() 
  1352. 	 
  1353. 	-- Dismiss Shaundi, she's staying on the barge with Kinzie 
  1354. 	npc_leash_to_nav(M07_char.shaundi, M07_CTE_free_kinzie.CTE_NPC_NAV.shaundi, 3) 
  1355. 	party_dismiss(M07_char.shaundi) 
  1356. 	party_dismiss(M07_char.pierce) 
  1357. 	-- Hide existing Homies 
  1358. 	character_hide( M07_char.pierce ) 
  1359. 	group_destroy(M07_group.shaundi.name) 
  1360. 	group_destroy(M07_group.kinzie.name) 
  1361. 	 
  1362. 	group_create( M07_group.cte_npc.name, true ) 
  1363. 	inv_item_remove_all( M07_group.cte_npc.chars.CTE_Kinzie ) 
  1364. 	-- End the patrols 
  1365. 	for i,thr in pairs(M07_thread.patrol) do 
  1366. 		thread_kill(M07_thread.patrol[i]) 
  1367. 		M07_thread.patrol[i] = INVALID_THREAD_HANDLE 
  1368. 	end 
  1369.  
  1370. 	-- Release the script groups 
  1371. 	release_to_world(M07_group.bdp_guards.name, true) 
  1372. 	release_to_world(M07_group.bds_guards.name, true) 
  1373. 	release_to_world(M07_group.bbp_guards.name, true) 
  1374.  
  1375. 	-- Start the untie Kinzie conversation 
  1376. 	audio_conversation_wait_for_end(M07_convo.encounter_deckers.handle) 
  1377. 	M07_convo.encounter_deckers.handle = INVALID_CONVERSATION_HANDLE 
  1378. 	 
  1379. 	-- Any downed homies can die during CTEs, so revive them here if they're staying in the player's party. 
  1380. 	if human_is_downed(M07_char.pierce) then 
  1381. 		npc_revive(M07_char.pierce) 
  1382. 	end 
  1383. 	 
  1384. 	-- Play CTE 
  1385. 	cutscene_play(M07_CTE_free_kinzie.name, nil, {M07_navpoint.cp_starts.barge.player_local, M07_navpoint.cp_starts.barge.player_remote}, false) 
  1386. 	group_destroy( M07_group.cte_npc.name ) 
  1387. 	party_add(M07_char.pierce, LOCAL_PLAYER) 
  1388. 	character_show( M07_char.pierce ) 
  1389. 	teleport(M07_char.pierce, M07_navpoint.cp_starts.barge.pierce, true) 
  1390. 	cutscene_out() 
  1391. 	fade_in( 1.5 ) 
  1392. 	fade_in_block() 
  1393. 	-- Play the entire untie Kinzie conversation before continuing 
  1394. 	--audio_conversation_wait_for_end(M07_convo.untie_kinzie.handle) 
  1395. 	M07_convo.untie_kinzie.handle = INVALID_CONVERSATION_HANDLE 
  1396. end 
  1397.  
  1398.  
  1399. 							-------------------------------------- 
  1400. 							--[[                              ]]-- 
  1401. 							--[[ 2ND CHECKPOINT (GET TO BDSM) ]]-- 
  1402. 							--[[                              ]]-- 
  1403.  
  1404. -- Send the player to the BDSM Club 
  1405. function m07_get_to_bdsm() 
  1406. 	 
  1407. 	-- Change the default mission enemy to Morningstar so they'll randomize properly 
  1408. 	change_mission_enemy_team("Morningstar") 
  1409. 	mission_set_enemy_team("Morningstar") 
  1410. 	 
  1411. 	-- Provide a car 
  1412. 	group_create(M07_group.barge_cp_player_veh.name, true) 
  1413. 	vehicle_set_team(M07_group.barge_cp_player_veh.vehicles[1], "Playas") 
  1414.  
  1415. 	-- Go ahead and spawn the guard gimps; the rest can wait until you arrive 
  1416. 	group_create(M07_group.bdsm_gimps.name, true) 
  1417. 	for i,char in pairs(M07_group.bdsm_gimps.members) do 
  1418. 		on_detection(M07_timed_lines.bdsm.callback, char) 
  1419. 	end 
  1420. 	-- Tell the player to go to the BDSM club 
  1421. 	objective_text(0, M07_text.go_to_club, nil, nil, SYNC_ALL, OI_ASSET_LOCATION) 
  1422.  
  1423. 	M07_status.reached_goal = false 
  1424. 	mission_waypoint_add(M07_trigger.bdsm_club) 
  1425. 	trigger_enable(M07_trigger.bdsm_club, true) 
  1426. 	marker_add_trigger(M07_trigger.bdsm_club, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1427. 	on_trigger("m07_reached_goal_cb", M07_trigger.bdsm_club) 
  1428. 	M07_convo.kinzie_thanks.kinzie_persona_id = audio_persona_load_2d(M07_convo.kinzie_thanks.kinzie_persona_name) 
  1429. 	--Kinzie calls to say thanks 
  1430. 	delay(5) 
  1431. 	M07_status.phonecall_finished = false 
  1432. 	audio_play_for_mission_cellphone(M07_convo.kinzie_thanks.name, true, true, "", "m07_finish_phonecall") 
  1433. 	 
  1434. 	while (M07_status.phonecall_finished == false) do 
  1435. 		thread_yield() 
  1436. 	end 
  1437. 	audio_persona_remove_2d(M07_convo.kinzie_thanks.kinzie_persona_id) 
  1438. 	M07_convo.kinzie_thanks.kinzie_persona_id = INVALID_PERSONA_HANDLE 
  1439. 	-- Talk about the BDSM 
  1440. 	delay(6) 
  1441. 	M07_convo.drive_bdsm.handle = audio_conversation_load(M07_convo.drive_bdsm.name) 
  1442. 	audio_conversation_play(M07_convo.drive_bdsm.handle) 
  1443.  
  1444. 	-- Wait for them to arrive 
  1445. 	while (not M07_status.reached_goal) do 
  1446. 		thread_yield() 
  1447. 	end 
  1448.  
  1449. 	mission_waypoint_remove() 
  1450. 	objective_text_clear(0) 
  1451. end 
  1452.  
  1453.  
  1454. 							----------------------------------------- 
  1455. 							--[[                                 ]]-- 
  1456. 							--[[ 3RD CHECKPOINT (ZIMOS PART ONE) ]]-- 
  1457. 							--[[                                 ]]-- 
  1458. 									 
  1459. -- Sets up a player and a victim for an interrogation in the BDSM club. 
  1460. -- 
  1461. function m07_setup_player_and_victim_for_interrogation(player, victim) 
  1462. 	-- Player 
  1463. 	turn_invulnerable(player, false) 
  1464. 	character_prevent_explosion_fling(player, true) 
  1465. 	character_allow_ragdoll(player, false) 
  1466. 	character_prevent_flinching(player, true) 
  1467. 	character_prevent_bumping(player, true) 
  1468. 	character_set_never_catch_fire(player, true) 
  1469. 	player_movement_disable(player) 
  1470. 	player_actions_disable(player) 
  1471. 	 
  1472. 	-- Victim 
  1473. 	turn_invulnerable(victim, false) 
  1474. 	character_prevent_explosion_fling(victim, true) 
  1475. 	character_allow_ragdoll(victim, false) 
  1476. 	character_prevent_flinching(victim, true) 
  1477. 	character_prevent_bumping(victim, true) 
  1478. 	character_set_never_catch_fire(victim, true) 
  1479. end 
  1480.  
  1481. -- Cleans up anything we did in m07_setup_player_and_victim_for_interrogation. 
  1482. -- 
  1483. function m07_cleanup_player_and_victim_for_interrogation(player, victim) 
  1484. 	-- Player 
  1485. 	turn_vulnerable(player) 
  1486. 	character_prevent_explosion_fling(player, false) 
  1487. 	character_allow_ragdoll(player, true) 
  1488. 	character_prevent_flinching(player, false) 
  1489. 	character_prevent_bumping(player, false) 
  1490. 	character_set_never_catch_fire(player, false) 
  1491. 	player_movement_enable(player) 
  1492. 	player_actions_enable(player) 
  1493. 	 
  1494. 	-- Victim 
  1495. 	turn_vulnerable(victim) 
  1496. 	character_prevent_explosion_fling(victim, false) 
  1497. 	character_allow_ragdoll(victim, true) 
  1498. 	character_prevent_flinching(victim, false) 
  1499. 	character_prevent_bumping(victim, false) 
  1500. 	character_set_never_catch_fire(victim, false) 
  1501. end 
  1502.  
  1503. -- Spawn all the people in and around the BDSM club 
  1504. -- 
  1505. function m07_spawn_bdsm() 
  1506. 	-- Force team to Morningstar 
  1507. 	mission_set_enemy_team("Morningstar") 
  1508. 	mission_set_enemy_team("Morningstar") 
  1509.  
  1510. 	group_create(M07_group.bdsm_patrons.name, true) 
  1511. 	group_create(M07_group.bdsm_prostitutes.name, true) 
  1512. 	 
  1513. 	-- Lock the unneeded area off 
  1514. 	door_lock( M07_mover.door_bdsm_locked01, true) 
  1515. 	door_lock( M07_mover.door_bdsm_locked02, true) 
  1516. 	door_lock( M07_mover.door_bdsm_locked03, true) 
  1517.  
  1518. 	group_create(M07_group.bdsm_cage_dancers.name, false) 
  1519. 	 
  1520. 	group_create(M07_group.bdsm_ambient.name, false) 
  1521. 	for i,char in pairs(M07_group.bdsm_ambient.members) do 
  1522. 		on_detection(M07_timed_lines.bdsm.callback, char) 
  1523. 	end 
  1524. 	 
  1525. 	for i, dom in pairs(M07_group.bdsm_ambient.doms) do 
  1526. 		character_set_persona(dom, "TOUGH_WF") 
  1527. 	end 
  1528. 	 
  1529. 	for i, sub in pairs(M07_group.bdsm_ambient.subsm) do 
  1530. 		character_set_persona(sub, "ELDERLY_WM") 
  1531. 	end 
  1532. 	 
  1533. 	for i, sub in pairs(M07_group.bdsm_ambient.subsf) do 
  1534. 		character_set_persona(sub, "ELDERLY_WF") 
  1535. 	end 
  1536. 	 
  1537. 	M07_thread.nodes = thread_new("m07_force_action_nodes") 
  1538. 	 
  1539. 	group_create(M07_group.bdsm_goons.name, true) 
  1540.  
  1541. 	group_create(M07_group.club_owner.name, true) 
  1542. 	character_set_only_player_grabs(M07_char.club_owner, true) 
  1543. 	character_set_only_scripted_grabs(M07_char.club_owner, true) 
  1544. 	set_dont_attack_me_on_sight_flag(M07_char.club_owner, true)	-- Prevent homies from attacking 
  1545. 	character_prevent_flinching(M07_char.club_owner, true) 
  1546. 	character_prevent_bumping(M07_char.club_owner, true) 
  1547. 	on_death("m07_homie_death_fail_cb", M07_char.club_owner) 
  1548. 	persona_override_persona_start(M07_char.club_owner, "Interrogation") 
  1549. 	set_suppress_synced_melee_attacks_flag(M07_char.club_owner, true) 
  1550. 	 
  1551. 	-- We'll start these guys on patrols, put them in positions, playing animations, etc. 
  1552. 	-- But for now, let's just move on and get the rest of the scripting done 
  1553.  
  1554. 	-- Make them invulnerable until they are grabbed 
  1555. 	for i,npc_floor in pairs(M07_group.bdsm_patrons.chars) do 
  1556. 		for j,npc in pairs(npc_floor) do 
  1557. 			character_set_only_player_grabs(npc, true) 
  1558. 			--character_set_only_scripted_grabs(npc, true) 
  1559. 			persona_override_persona_start(npc, "Interrogation") 
  1560. 			set_suppress_synced_melee_attacks_flag(npc, true) 
  1561. 		end 
  1562. 	end 
  1563.  
  1564. 	--put patrons in action nodes 
  1565. 	trigger_enable(M07_trigger.bdsm_action_nodes, true) 
  1566. 	on_trigger("m07_bdsm_action_nodes_setup", M07_trigger.bdsm_action_nodes) 
  1567. 	on_trigger_exit("m07_bdsm_action_nodes_setup", M07_trigger.bdsm_action_nodes) 
  1568. 	 
  1569. 	-- Only mark the first floor 
  1570. 	for j,npc in pairs(M07_group.bdsm_patrons.chars[1]) do 
  1571. 		marker_add(npc, MINIMAP_ICON_USE, OI_ASSET_USE) 
  1572. 		character_set_only_scripted_grabs(npc, true) 
  1573. 		--on_character_grabbed("m07_bdsm_interrogate_cb", npc) 
  1574. 	end 
  1575. 	for j,trig in pairs(M07_trigger.bdsm_interrogate[1]) do 
  1576. 		trigger_enable(trig, true) 
  1577. 		on_trigger("m07_bdsm_interrogate_cb", trig) 
  1578. 	end 
  1579. end 
  1580.  
  1581. -- First part of Zimos BDSM Club 
  1582. -- 
  1583. function m07_zimos_part_one_run() 
  1584. 	-- Load the mission NPCs 
  1585. 	m07_spawn_bdsm() 
  1586. 	persona_set_global_situation_override(PS_OVERRIDE_MISSION07) 
  1587. 	 
  1588. 	ai_set_action_delay(M07_char.pierce, "throw grenade", 9999) 
  1589. 	 
  1590. 	notoriety_set("morningstar", 3) 
  1591. 	zscene_prep(M07_cutscene.zimos_pre_pony_cart) 
  1592. 	-- Play the BDSM entry conversation 
  1593. 	M07_convo.enter_bdsm.handle = audio_conversation_load(M07_convo.enter_bdsm.name) 
  1594. 	audio_conversation_wait_for_end(M07_convo.drive_bdsm.handle) 
  1595. 	M07_convo.drive_bdsm.handle = INVALID_CONVERSATION_HANDLE 
  1596. 	audio_conversation_play(M07_convo.enter_bdsm.handle) 
  1597.  
  1598. 	-- Tell the player to find the club owner 
  1599. 	objective_text(0, M07_text.interrogate_patron, nil, nil, SYNC_ALL, OI_ASSET_USE) 
  1600.  
  1601. 	on_trigger("m07_reached_goal_cb", M07_trigger.club_owner) 
  1602. 	M07_status.reached_goal = false 
  1603. 	while (not M07_status.reached_goal) do 
  1604. 		if (character_is_ready(M07_char.club_owner)) then 
  1605. 			if not check_animation_state(M07_char.club_owner, "cower stand") then 
  1606. 				set_animation_state(M07_char.club_owner, "cower stand") 
  1607. 			end 
  1608. 		end 
  1609. 		thread_yield() 
  1610. 	end 
  1611. 	 
  1612. 	-- Mark the owner 
  1613. 	marker_add(M07_char.club_owner, MINIMAP_ICON_USE, OI_ASSET_USE) 
  1614.  
  1615. 	-- Unlock the door 
  1616. 	door_lock(M07_mover.door_bdsm_owner, false) 
  1617. 	 
  1618. 	audio_conversation_wait_for_end(M07_convo.enter_bdsm.handle) 
  1619. 	M07_convo.enter_bdsm.handle = INVALID_CONVERSATION_HANDLE 
  1620.  
  1621. 	-- If we found the club owner, there's no need to interrogate anyone else 
  1622. 	cleanup_callbacks(M07_group.bdsm_patrons.chars) 
  1623. 	marker_remove(M07_group.bdsm_patrons.chars) 
  1624. 	objective_text_clear(0) 
  1625.  
  1626. 	-- Tell the player to grab the club owner 
  1627. 	objective_text(0, M07_text.grab_owner, nil, nil, SYNC_ALL, OI_ASSET_USE) 
  1628. 	M07_status.club_owner_grabbed = false 
  1629. 	while (not M07_status.club_owner_grabbed) do 
  1630. 		thread_yield() 
  1631. 	end 
  1632. 	 
  1633. 	-- Re-enable controls 
  1634. 	player_controls_enable(LOCAL_PLAYER) 
  1635. 	if (coop_is_active()) then 
  1636. 		player_controls_enable(REMOTE_PLAYER) 
  1637. 	end 
  1638.  
  1639. 	-- Once we've learned where Zimos is, we don't care about the club owner anymore 
  1640. 	on_death("", M07_char.club_owner) 
  1641. 	-- Stop the action node thread 
  1642. 	thread_kill(M07_thread.nodes) 
  1643. 	 
  1644. 	persona_override_persona_stop(M07_char.club_owner) 
  1645. 	-- Spawn Zimos 
  1646. 	group_create(M07_group.zimos.name, true) 
  1647. 	turn_invulnerable(M07_char.zimos) 
  1648. 	npc_suppress_persona(M07_char.zimos, true) 
  1649. 	on_death("m07_homie_death_fail_cb", M07_char.zimos) 
  1650. 	group_create(M07_group.pony_cart.name, true) 
  1651. 	vehicle_enter_teleport(M07_char.zimos, M07_group.pony_cart.vehicles[1], 0) 
  1652. 	vehicle_suppress_npc_exit(M07_group.pony_cart.vehicles[1]) 
  1653. 	set_ignore_ai_flag(M07_char.zimos, true) 
  1654.  
  1655. 	-- Unlock the stair doors and open the one by the player 
  1656. 	door_lock(M07_mover.door_bdsm_hall_stairs, false) 
  1657. 	door_lock(M07_mover.door_bdsm_office_stairs, false) 
  1658. 	door_open(M07_mover.door_bdsm_office_stairs) 
  1659. 	 
  1660.  
  1661. 	-- Tell the player to find Zimos 
  1662. 	objective_text(0, M07_text.go_to_zimos, nil, nil, SYNC_ALL, OI_ASSET_LOCATION) 
  1663. 	-- BD: Added this here to try to brute force this 
  1664. 	marker_remove(M07_char.club_owner) 
  1665. 	 
  1666. 	-- Wait for the player to enter the stairs 
  1667. 	M07_status.reached_goal = false 
  1668. 	trigger_enable(M07_trigger.pony_stairs, true)	 
  1669. 	on_trigger("m07_reached_goal_cb", M07_trigger.pony_stairs) 
  1670. 	marker_add_trigger(M07_trigger.pony_stairs, MINIMAP_ICON_LOCATION, "", OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1671. 	while (not M07_status.reached_goal) do 
  1672. 		thread_yield() 
  1673. 	end 
  1674. 	door_open(M07_mover.door_bdsm_hall_stair_open) 
  1675. 	 
  1676. 	-- Wait for the player to get near the pony barn door 
  1677. 	M07_status.reached_goal = false 
  1678. 	trigger_enable(M07_trigger.pony_stairs_two, true)	 
  1679. 	on_trigger("m07_reached_goal_cb", M07_trigger.pony_stairs_two) 
  1680. 	marker_add_trigger(M07_trigger.pony_stairs_two, MINIMAP_ICON_LOCATION, "", OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1681. 	while (not M07_status.reached_goal) do 
  1682. 		thread_yield() 
  1683. 	end 
  1684. 	door_open(M07_mover.door_bdsm_hall_stairs) 
  1685. 		 
  1686. 	-- door_open(M07_mover.door_pony) ADD THIS BACK IN WHEN ITS POSSIBLE TO GET THE BDSM_SM LAYER FILE 
  1687. 	 
  1688. 	-- Mark the barn entry as a waypoint 
  1689. 	M07_status.reached_goal = false 
  1690. 	trigger_enable(M07_trigger.pony_barn, true) 
  1691. 	marker_add_trigger(M07_trigger.pony_barn, MINIMAP_ICON_LOCATION, "", OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1692. 	on_trigger("m07_reached_goal_cb", M07_trigger.pony_barn) 
  1693. 	while (not M07_status.reached_goal) do 
  1694. 		thread_yield() 
  1695. 	end 
  1696.  
  1697. 	-- Remark about the pony barn 
  1698. 	M07_convo.pony_barn.handle = audio_conversation_load(M07_convo.pony_barn.name) 
  1699. 	audio_conversation_play(M07_convo.pony_barn.handle) 
  1700.  
  1701. 	-- Mark Zimos' location 
  1702. 	M07_status.reached_goal = false 
  1703. 	trigger_enable(M07_trigger.pony_carts, true) 
  1704. 	marker_add_trigger(M07_trigger.pony_carts, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  1705. 	on_trigger("m07_reached_goal_cb", M07_trigger.pony_carts) 
  1706. 	while (not M07_status.reached_goal) do 
  1707. 		thread_yield() 
  1708. 	end 
  1709.  
  1710. 	objective_text_clear(0) 
  1711.  
  1712. 	audio_conversation_end(M07_convo.pony_barn.handle) 
  1713. 	M07_convo.pony_barn.handle = INVALID_CONVERSATION_HANDLE 
  1714.  
  1715. 	persona_clear_global_situation_override() 
  1716. 	 
  1717. 	if (M07_cutscene.zimos_pre_pony_cart ~= "") then 
  1718. 		cutscene_play(M07_cutscene.zimos_pre_pony_cart, nil, {M07_navpoint.cp_starts.pony_cart.player_local, M07_navpoint.cp_starts.pony_cart.player_remote}) 
  1719. 		-- Cleanup all the stuff spawned for the inside portion of the BDSM club 
  1720. 		cleanup_groups({ M07_group.bdsm_prostitutes, M07_group.bdsm_cage_dancers, M07_group.bdsm_gimps, M07_group.bdsm_goons, M07_group.bdsm_patrons, M07_group.club_owner, M07_group.barge_cp_player_veh }) 
  1721.  
  1722. 		-- Get ready for the pony cart chase 
  1723. 		m07_setup_pony_carts() 
  1724. 	else 
  1725. 		-- TODO: Remove this once there is a real cutscene 
  1726. 		fade_out(0.5) 
  1727. 		fade_out_block() 
  1728.  
  1729. 		-- Cleanup all the stuff spawned for the inside portion of the BDSM club 
  1730. 		cleanup_groups({ M07_group.bdsm_prostitutes, M07_group.bdsm_cage_dancers, M07_group.bdsm_gimps, M07_group.bdsm_goons, M07_group.bdsm_patrons, M07_group.club_owner, M07_group.barge_cp_player_veh }) 
  1731.  
  1732. 		-- Move everybody up to the pony carts (before the bink so it has time to stream vehicles) 
  1733. 		teleport_coop(M07_navpoint.cp_starts.pony_cart.player_local, M07_navpoint.cp_starts.pony_cart.player_remote, true) 
  1734.  
  1735. 		--bink_play("07_z01") 
  1736.  
  1737. 		-- Get ready for the pony cart chase 
  1738. 		m07_setup_pony_carts() 
  1739.  
  1740. 		fade_in(0.5) 
  1741. 		fade_in_block() 
  1742. 	end 
  1743. end 
  1744.  
  1745. 							------------------------------------------ 
  1746. 							--[[                                  ]]-- 
  1747. 							--[[ 4th CHECKPOINT (ZIMOS PONY CART) ]]-- 
  1748. 							--[[                                  ]]-- 
  1749.  
  1750. -- Spawn the enemy carts and put everyone in place for the chase 
  1751. function m07_setup_pony_carts() 
  1752. 	-- Give the player infinite rifle ammo 
  1753. 	M07_status.temp_weapon_local = inv_item_in_slot(LOCAL_PLAYER, "rifle") 
  1754. 	if (M07_status.temp_weapon_local == "none") then 
  1755. 		M07_status.temp_weapon_local = "Rifle-Gang" 
  1756. 	end 
  1757. 	inv_weapon_add_temporary(LOCAL_PLAYER, M07_status.temp_weapon_local, 1, true, true, false, true) 
  1758.  
  1759. 	mesh_mover_hide(M07_mover.door_pony_exit) 
  1760. 	 
  1761. 	-- Put either the coop player or Pierce in the second seat 
  1762. 	if (coop_is_active()) then 
  1763. 		-- Give the player infinite rifle ammo 
  1764. 		M07_status.temp_weapon_remote = inv_item_in_slot(REMOTE_PLAYER, "rifle") 
  1765. 		if (M07_status.temp_weapon_remote == "none") then 
  1766. 			M07_status.temp_weapon_remote = "Rifle-Gang" 
  1767. 		end 
  1768. 		inv_weapon_add_temporary(REMOTE_PLAYER, M07_status.temp_weapon_remote, 1, true, true, false, true) 
  1769.  
  1770. 		-- Put them in the pony cart 
  1771. 		while not vehicle_enter_teleport(REMOTE_PLAYER, M07_group.pony_cart.vehicles[1], 2) do 
  1772. 			thread_yield() 
  1773. 		end 
  1774. 		set_player_can_enter_exit_vehicles(REMOTE_PLAYER, false) 
  1775.  
  1776. 		-- Disable Pierce 
  1777. 		follower_set_can_abandon(M07_char.pierce, false) 
  1778. 		character_hide(M07_char.pierce) 
  1779. 	else 
  1780. 		-- Put Pierce in the pony cart 
  1781. 		inv_item_equip(WEAPON_SLOT_RIFLE, M07_char.pierce) 
  1782. 		vehicle_enter_teleport(M07_char.pierce, M07_group.pony_cart.vehicles[1], 2) 
  1783. 	end 
  1784. 	inv_weapon_disable_all_but_this_slot(WEAPON_SLOT_RIFLE) 
  1785. 	-- Put the player in the pony cart (this must come second so Pierce doesn't block the co-op player) 
  1786. 	while not vehicle_enter_teleport(LOCAL_PLAYER, M07_group.pony_cart.vehicles[1], 1) do 
  1787. 		thread_yield() 
  1788. 	end 
  1789. 	set_player_can_enter_exit_vehicles(LOCAL_PLAYER, false) 
  1790. 	 
  1791. 	-- Set Zimos to be unjackable 
  1792. 	set_unjackable_flag(M07_group.pony_cart.vehicles[1], true) 
  1793.  
  1794. 	-- Spawn pony cart enemies 
  1795. 	group_create(M07_group.pony_cart_enemies.name, true) 
  1796. 	group_create(M07_group.pony_cart_drivers.name, true) 
  1797. 	M07_status.num_enemies_alive = 0 
  1798. 	for i,npc_group in pairs(M07_group.pony_cart_enemies.chars) do 
  1799. 		-- Put the driver in the first seat and track their death 
  1800. 		vehicle_enter_teleport(M07_group.pony_cart_drivers.chars[i], M07_group.pony_cart_enemies.vehicles[i], 0) 
  1801. 		on_death("m07_driver_killed_cb", M07_group.pony_cart_drivers.chars[i]) 
  1802.  
  1803. 		-- Put the enemies in the remaining seats and track their deaths 
  1804. 		for j,npc in pairs(npc_group) do 
  1805. 			if (character_exists(npc) and not character_is_dead(npc)) then 
  1806. 				-- Put them in the vehicle 
  1807. 				set_ignore_ai_flag(npc, true)	-- Prevent shooting for a short time 
  1808. 				vehicle_enter_teleport(npc, M07_group.pony_cart_enemies.vehicles[i], j) 
  1809. 				on_death("m07_pony_enemy_killed_cb", npc) 
  1810. 				marker_add(npc, MINIMAP_ICON_KILL, OI_ASSET_KILL) 
  1811. 				M07_status.num_enemies_alive = M07_status.num_enemies_alive + 1 
  1812. 				ai_set_action_delay(npc, "throw grenade", 9999) 
  1813. 			end 
  1814. 		end 
  1815.  
  1816. 		vehicle_suppress_npc_exit(M07_group.pony_cart_enemies.vehicles[i]) 
  1817. 	end 
  1818. end 
  1819.  
  1820. -- Second part Zimos section, PONY CART 
  1821. -- 
  1822. function m07_zimos_part_two_run() 
  1823. 	set_ped_density(1.00) 
  1824. 	 
  1825. 	-- can't be downed during ride, if you die, you fail the mission 
  1826. 	set_players_can_be_downed(LOCAL_PLAYER, false) 
  1827. 	if (coop_is_active() == true) then 
  1828. 		set_players_can_be_downed(REMOTE_PLAYER, false) 
  1829. 	end 
  1830.  
  1831. 	-- lock the carts down before we send them along their way 
  1832. 	for i, vehicle in pairs(M07_group.pony_cart_enemies.vehicles) do 
  1833. 		vehicle_disable_chase(vehicle, true) 
  1834. 		vehicle_disable_flee(vehicle, true) 
  1835. 	end 
  1836. 	 
  1837. 	-- Tell Zimos to start driving 
  1838. 	set_ignore_ai_flag(M07_char.zimos, false) 
  1839. 	vehicle_speed_override(M07_group.pony_cart.vehicles[1], 10) 
  1840. 	M07_thread.zimos_pony_cart = thread_new("m07_vehicle_path_thread", M07_group.pony_cart.vehicles[1], M07_scripted_path.pony_cart_path) 
  1841. 	turn_vulnerable(M07_char.zimos) 
  1842. 	 
  1843. 	zscene_prep(M07_cutscene.zimos_post_pony_cart) 
  1844. 	 
  1845. 	-- Allow shooting after a short delay 
  1846. 	for i,npc_group in pairs(M07_group.pony_cart_enemies.chars) do 
  1847. 		-- Start the cart on its way 
  1848. 		M07_thread.patrol[i] = thread_new("m07_pony_chase_thread", M07_group.pony_cart_enemies.vehicles[i], npc_group, i) 
  1849. 		M07_thread.carts[i] = thread_new("m07_pony_cart_alive_thread", M07_group.pony_cart_enemies.vehicles[i], npc_group) 
  1850. 		delay(0.5) 
  1851. 	end 
  1852.  
  1853. 	-- Tell the player to kill the chasers 
  1854. 	objective_text(0, M07_text.fight_off_morningstar, nil, nil, SYNC_ALL, OI_ASSET_KILL) 
  1855. 	while (M07_status.num_enemies_alive > 3) do 
  1856. 		thread_yield() 
  1857. 	end 
  1858.  
  1859. 	-- Remark after half the guys have died 
  1860. 	M07_convo.pony_2.handle = audio_conversation_load(M07_convo.pony_2.name) 
  1861. 	audio_conversation_play(M07_convo.pony_2.handle) 
  1862.  
  1863. 	-- Wait for the rest to die 
  1864. 	while (M07_status.num_enemies_alive > 0) do 
  1865. 		thread_yield() 
  1866. 	end 
  1867. 	objective_text_clear(0) 
  1868. 	inv_weapon_disable_all_slots(false) 
  1869. 	-- can't be downed during ride, if you die, you fail the mission 
  1870. 	set_players_can_be_downed(LOCAL_PLAYER, true) 
  1871. 	if (coop_is_active() == true) then 
  1872. 		set_players_can_be_downed(REMOTE_PLAYER, true) 
  1873. 	end 
  1874. 	 
  1875. 	--clear zimos's thread 
  1876. 	thread_kill(M07_thread.zimos_pony_cart) 
  1877. 	M07_thread.zimos_pony_cart = INVALID_THREAD_HANDLE 
  1878. 	 
  1879. 	-- End the patrols 
  1880. 	for i,thr in pairs(M07_thread.patrol) do 
  1881. 		thread_kill(M07_thread.patrol[i]) 
  1882. 		M07_thread.patrol[i] = INVALID_THREAD_HANDLE 
  1883. 	end 
  1884. 	for i, thr in pairs(M07_thread.carts) do 
  1885. 		if (M07_thread.carts[i] ~= INVALID_THREAD_HANDLE) then 
  1886. 			thread_kill(M07_thread.carts[i]) 
  1887. 			M07_thread.carts[i] = INVALID_THREAD_HANDLE 
  1888. 		end 
  1889. 	end 
  1890. 	 
  1891. 	 
  1892. 	-- Remove the death callbacks from the remaining drivers 
  1893. 	for i,npc in pairs(M07_group.pony_cart_drivers.chars) do 
  1894. 		if (character_exists(npc) and not character_is_dead(npc)) then 
  1895. 			on_death("", npc) 
  1896. 		end 
  1897. 	end 
  1898.  
  1899. 	audio_conversation_end(M07_convo.pony_2.handle) 
  1900. 	M07_convo.pony_2.handle = INVALID_CONVERSATION_HANDLE 
  1901. 	delay(1.5) 
  1902. 	 
  1903. 	-- Play a z-scene 
  1904. 	if (M07_cutscene.zimos_post_pony_cart ~= "") then 
  1905. 		cutscene_play(M07_cutscene.zimos_post_pony_cart, nil, {M07_navpoint.cp_starts.casino.player_local, M07_navpoint.cp_starts.casino.player_remote}) 
  1906. 	else 
  1907. 		-- TODO: Remove this once there is a real cutscene 
  1908. 		fade_out(0.5) 
  1909. 		fade_out_block() 
  1910. 	end 
  1911. 	 
  1912. 	-- Restore the players to normal 
  1913. 	set_player_can_enter_exit_vehicles(LOCAL_PLAYER, true) 
  1914. 	inv_weapon_remove_temporary(LOCAL_PLAYER, M07_status.temp_weapon_local) 
  1915. 	if (coop_is_active()) then 
  1916. 		set_player_can_enter_exit_vehicles(REMOTE_PLAYER, true) 
  1917. 		inv_weapon_remove_temporary(REMOTE_PLAYER, M07_status.temp_weapon_remote) 
  1918. 	end 
  1919. 	notoriety_set("morningstar", 0) 
  1920.  
  1921. 	-- Add Zimos as a homie 
  1922. 	party_dismiss(M07_char.pierce) 
  1923. 	party_add(M07_char.zimos, LOCAL_PLAYER) 
  1924. 	npc_suppress_persona(M07_char.zimos, false) 
  1925. 	teleport (M07_char.zimos, M07_navpoint.zimos_car_tp) 
  1926. 	 
  1927. 	-- Cleanup the pony carts 
  1928. 	cleanup_groups({ M07_group.pony_cart, M07_group.pony_cart_enemies, M07_group.pony_cart_drivers }) 
  1929.  
  1930. 	-- Spawn a car and move everybody there 
  1931. 	group_create(M07_group.casino_vehicle.name, true) 
  1932. 	vehicle_set_team(M07_group.casino_vehicle.vehicles[1], "Playas") 
  1933. 	if (M07_cutscene.zimos_post_pony_cart == "") then 
  1934. 		--bink_play("07_z02") 
  1935.  
  1936. 		teleport_coop(M07_navpoint.cp_starts.casino.player_local, M07_navpoint.cp_starts.casino.player_remote, true) 
  1937.  
  1938. 		fade_in(0.5) 
  1939. 		fade_in_block() 
  1940. 	end 
  1941. end 
  1942.  
  1943. 							--------------------------------------- 
  1944. 							--[[									     ]]-- 
  1945. 							--[[ 5TH CHECKPOINT (ANGEL CASINO) ]]-- 
  1946. 							--[[                               ]]-- 
  1947.  
  1948. -- Helper function to create enemies outside the casino 
  1949. function m07_angel_setup_casino_exterior() 
  1950. 	 
  1951. 	-- Change the default mission enemy to Luchadores so they'll randomize properly 
  1952. 	change_mission_enemy_team("Luchadores") 
  1953. 	 
  1954. 	-- Force team to Luchadores 
  1955. 	mission_set_enemy_team("Luchadores") 
  1956.  
  1957. 	-- Go ahead and create the NPCs so they are visible as the player drives up 
  1958. 	group_create(M07_group.luchadores_outside.name, true) 
  1959. 	group_create(M07_group.outside_cover_vehicles.name, true) 
  1960. 	group_create(M07_group.luchadores_arriving.name, true) 
  1961. 	vehicle_infinite_mass(M07_group.luchadores_arriving.vehicles[1], true)	-- Don't let other cars disrupt this one 
  1962. 	vehicle_enter_teleport(M07_group.luchadores_arriving.chars[1], M07_group.luchadores_arriving.vehicles[1]) 
  1963. 	vehicle_enter_teleport(M07_group.luchadores_outside.chars[1], M07_group.outside_cover_vehicles.vehicles[1]) 
  1964. 	vehicle_enter_teleport(M07_group.luchadores_outside.chars[2], M07_group.outside_cover_vehicles.vehicles[1], 1) 
  1965. 	vehicle_enter_teleport(M07_group.luchadores_outside.chars[3], M07_group.outside_cover_vehicles.vehicles[1], 2) 
  1966. 	--vehicle_enter_teleport(M07_group.luchadores_outside.chars[13], M07_group.outside_cover_vehicles.vehicles[1], 5) 
  1967.  
  1968. 	-- Spawn Angel and set him as invulnerable for this portion of the mission 
  1969. 	group_create(M07_group.angel.name, true) 
  1970. 	npc_suppress_persona(M07_char.angel, true) 
  1971. 	turn_invulnerable(M07_char.angel) 
  1972. 	on_death("m07_homie_death_fail_cb", M07_char.angel) 
  1973. 	on_incapacitated("m07_homie_dbno_cb", M07_char.angel) 
  1974.  
  1975. 	-- Spawn Oleg, but hide him until needed (this is to avoid load delays) 
  1976. 	group_create_hidden(M07_group.oleg.name) 
  1977.  
  1978. 	-- Keep them from killing each other before the player gets there 
  1979. 	set_ignore_ai_flag(M07_char.angel, true) 
  1980. 	for i,luch in pairs(M07_group.luchadores_outside.chars) do 
  1981. 		set_ignore_ai_flag(luch, true) 
  1982. 	end 
  1983. 	set_ignore_ai_flag(M07_group.luchadores_outside.brute, true) 
  1984. 	set_ignore_ai_flag(M07_group.luchadores_arriving.chars[1], true) 
  1985. end 
  1986.  
  1987. -- First part of Angel's casino checkpoint where the player finds Angel out in front 
  1988. -- of the casino, fighting off attacking Luchadores. 
  1989. -- 
  1990. function m07_angel_part_one_find_angel() 
  1991. 	-- Load the Kinzie call conversation 
  1992. 	M07_convo.kinzie_call.kinzie_persona_id = audio_persona_load_2d(M07_convo.kinzie_call.kinzie_persona_name) 
  1993. 	--M07_convo.kinzie_call.handle = audio_conversation_load(M07_convo.kinzie_call.name) 
  1994. 	on_death("", M07_char.pierce) 
  1995. 	-- Start the Kinzie phone call 
  1996. 	M07_status.phonecall_finished = false 
  1997. 	audio_play_for_mission_cellphone(M07_convo.kinzie_call.name, true, true, "", "m07_finish_phonecall") 
  1998.  
  1999. 	while (M07_status.phonecall_finished == false) do 
  2000. 		thread_yield() 
  2001. 	end 
  2002. 	 
  2003. 	-- Set the new objective 
  2004. 	M07_status.outside_casino_reached = false 
  2005. 	objective_text(0, M07_text.find_angel, nil, nil, SYNC_ALL, OI_ASSET_LOCATION) 
  2006. 	trigger_enable(M07_trigger.outside_casino, true) 
  2007. 	on_trigger("m07_outside_casino_reached_cb", M07_trigger.outside_casino) 
  2008. 	 
  2009. 	delay(2) 
  2010. 	 
  2011. 	--zimos thanks the player 
  2012. 	M07_convo.rescue_zimos.handle = audio_conversation_load(M07_convo.rescue_zimos.name) 
  2013. 	audio_conversation_play(M07_convo.rescue_zimos.handle) 
  2014. 	 
  2015. 	 
  2016. 	-- Spawn the enemies 
  2017. 	m07_angel_setup_casino_exterior() 
  2018.  
  2019. 	-- Add a waypoint and marker to Angel 
  2020. 	mission_waypoint_add(M07_char.angel) 
  2021. 	marker_add(M07_char.angel, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  2022.  
  2023. 	-- Make sure the conversation is finished and play another 
  2024. 	M07_convo.mount_rescue.handle = audio_conversation_load(M07_convo.mount_rescue.name) 
  2025. 	audio_conversation_wait_for_end(M07_convo.rescue_zimos.handle) 
  2026. 	M07_convo.rescue_zimos.handle = INVALID_CONVERSATION_HANDLE 
  2027. 	 
  2028. 	audio_persona_remove_2d(M07_convo.kinzie_call.kinzie_persona_id) 
  2029. 	M07_convo.kinzie_call.kinzie_persona_id = INVALID_PERSONA_HANDLE 
  2030. 	delay(4) 
  2031. 	audio_conversation_play(M07_convo.mount_rescue.handle) 
  2032.  
  2033. 	--make sure that conversation is done and play the newsclip 
  2034. 	audio_conversation_wait_for_end(M07_convo.mount_rescue.handle) 
  2035. 	M07_convo.mount_rescue.handle = INVALID_CONVERSATION_HANDLE 
  2036. 	 
  2037. 	delay(5) 
  2038. 	if is_syn_tower_destroyed() then 
  2039. 		radio_newsbreak("M06_Building_Gone") 
  2040. 	else 
  2041. 		radio_newsbreak("M06_Building_Stay") 
  2042. 	end 
  2043.  
  2044. 	-- Wait for the player to get to the outside of the casino 
  2045. 	while (not M07_status.outside_casino_reached) do 
  2046. 		thread_yield() 
  2047. 	end 
  2048.  
  2049. 	-- Remove the waypoint and mini-map icon from Angel 
  2050. 	mission_waypoint_remove() 
  2051. 	marker_remove(M07_char.angel) 
  2052.  
  2053. 	objective_text_clear(0) 
  2054. end 
  2055.  
  2056. 							------------------------------------------ 
  2057. 							--[[									        ]]-- 
  2058. 							--[[ 6TH CHECKPOINT (LUCHADORE FIGHT) ]]-- 
  2059. 							--[[                                  ]]-- 
  2060.  
  2061. -- Fight off attacking Luchadores. 
  2062. -- 
  2063. function m07_angel_defeat_luchadores() 
  2064. 	-- Set up the attacking Luchadores 
  2065. 	set_ignore_ai_flag(M07_char.angel, false) 
  2066. 	notoriety_set("luchadores", 3) 
  2067. 	for i,luch in pairs(M07_group.luchadores_outside.chars) do 
  2068. 		-- Make them attack Angel at first 
  2069. 		set_ignore_ai_flag(luch, false) 
  2070. 		ai_add_enemy_target(luch, M07_char.angel, ATTACK_NOW) 
  2071. 		--ai_add_enemy_target(luch, CLOSEST_PLAYER, ATTACK_ON_SIGHT) 
  2072. 	end 
  2073.  
  2074. 	-- Set up separate threads to tell the arriving vehicles where to go, then explode one of them 
  2075. 	M07_thread.luchadores_arriving_1 = thread_new("m07_luchadores_arriving_1_thread") 
  2076. 	M07_thread.luchadores_arriving_2 = thread_new("m07_luchadores_arriving_2_thread") 
  2077. 	M07_thread.luchadores_arriving_3 = thread_new("m07_luchadores_arriving_3_thread") 
  2078.  
  2079. 	-- Set the new objective to killing all the Luchadores 
  2080. 	objective_text(0, M07_text.kill_luchadores, nil, nil, SYNC_ALL, OI_ASSET_KILL) 
  2081. 	M07_status.num_enemies_alive = 0 
  2082. 	for i,npc in pairs(M07_group.luchadores_outside.chars) do 
  2083. 		if not character_is_dead(npc) then 
  2084. 			on_death("m07_enemy_killed_cb", npc) 
  2085. 			marker_add(npc, MINIMAP_ICON_KILL, OI_ASSET_KILL) 
  2086. 			M07_status.num_enemies_alive = M07_status.num_enemies_alive + 1 
  2087. 		end 
  2088. 	end 
  2089.  
  2090. 	-- Include the brute 
  2091. 	if not character_is_dead(M07_group.luchadores_outside.brute) then 
  2092. 		on_death("m07_enemy_killed_cb", M07_group.luchadores_outside.brute) 
  2093. 		marker_add(M07_group.luchadores_outside.brute, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAG_STICKY + OI_FLAG_DISPLAY_DISTANCE) 
  2094. 		M07_status.num_enemies_alive = M07_status.num_enemies_alive + 1 
  2095. 	end 
  2096.  
  2097. 	zscene_prep(M07_cutscene.angel_mid_checkpoint) 
  2098. 	 
  2099. 	-- Wait until the brute is dead 
  2100. 	while (not character_is_dead(M07_group.luchadores_outside.brute)) do 
  2101. 		thread_yield() 
  2102. 	end 
  2103.  
  2104. 	-- Once the brute has died, play a victory line (SP ADDED 11/7/10 for POC 2) 
  2105. 	delay(2) 
  2106. 	audio_play_persona_line(LOCAL_PLAYER, "M07_Exterior_Brute_Dead_01") 
  2107. 	delay(1.5)  -- Allow it to play out then wait a few seconds before playing the Zimos Bitch conversation 
  2108.  
  2109. 	M07_convo.zimos_bitch.handle = audio_conversation_load(M07_convo.zimos_bitch.name) 
  2110. 	delay(1) 
  2111.  
  2112. 	-- Play the Zimos bitch conversation 
  2113. 	audio_conversation_play(M07_convo.zimos_bitch.handle) 
  2114. 	audio_conversation_wait_for_end(M07_convo.zimos_bitch.handle) 
  2115. 	M07_convo.zimos_bitch.handle = INVALID_CONVERSATION_HANDLE 
  2116.  
  2117. 	-- Wait until most are dead, then send in Oleg 
  2118. 	while (M07_status.num_enemies_alive > 5) do 
  2119. 		thread_yield() 
  2120. 	end 
  2121.  
  2122. 	-- Set up a separate thread to send Angel into the casino 
  2123. 	M07_thread.angel_flee = thread_new("m07_angel_flee_thread") 
  2124.  
  2125. 	-- Reveal Oleg, set him as invulnerable for this portion of the mission, and add him to the player's party 
  2126. 	while (not(group_create_check_done(M07_group.oleg.name))) do 
  2127. 		thread_yield() 
  2128. 	end 
  2129. 	group_show(M07_group.oleg.name) 
  2130. 	turn_invulnerable(M07_char.oleg) 
  2131. 	on_death("m07_homie_death_fail_cb", M07_char.oleg) 
  2132. 	on_incapacitated("m07_homie_dbno_cb", M07_char.oleg) 
  2133. 	if (coop_is_active()) then 
  2134. 		party_add(M07_char.oleg, REMOTE_PLAYER) 
  2135. 	else 
  2136. 		party_add(M07_char.oleg, LOCAL_PLAYER) 
  2137. 	end 
  2138.  
  2139. 	-- Load the Oleg arrival conversation, wait for him to arrive, the play it 
  2140. 	--M07_convo.oleg_arrives.handle = audio_conversation_load(M07_convo.oleg_arrives.name) 
  2141. 	delay(4) 
  2142. 	audio_play_persona_line(LOCAL_PLAYER, "M07_Exterior_Brute_Dead_03") 
  2143. 	delay(4) 
  2144. 	audio_play_persona_line(M07_char.oleg, "M07_Exterior_Brute_Dead_04") 
  2145. 	--audio_conversation_play(M07_convo.oleg_arrives.handle) 
  2146. 	--audio_conversation_wait_for_end(M07_convo.oleg_arrives.handle) 
  2147. 	--M07_convo.oleg_arrives.handle = INVALID_CONVERSATION_HANDLE 
  2148. 	delay(2) 
  2149.  
  2150. 	-- Wait until all luchadores are dead 
  2151. 	while (M07_status.num_enemies_alive > 0) do 
  2152. 		thread_yield() 
  2153. 	end 
  2154. 	objective_text_clear(0) 
  2155.  
  2156. 	-- Once all luchadores are dead, tell the player to get into the casino 
  2157. 	delay(1) 
  2158. 	audio_play_persona_line(LOCAL_PLAYER, "M07_Exterior_Brute_Dead_05") 
  2159.  
  2160. 	M07_status.inside_casino_reached = false 
  2161. 	objective_text(0, M07_text.find_angel, nil, nil, SYNC_ALL, OI_ASSET_LOCATION) 
  2162. 	trigger_enable(M07_trigger.inside_casino, true) 
  2163. 	on_trigger("m07_inside_casino_reached_cb", M07_trigger.inside_casino) 
  2164. 	trigger_enable(M07_trigger.casino_lobby, true) 
  2165. 	marker_add_trigger(M07_trigger.casino_lobby, MINIMAP_ICON_LOCATION, "", OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  2166. 	on_trigger("m07_inside_casino_reached_cb", M07_trigger.casino_lobby) 
  2167.  
  2168. 	-- Set up a separate thread for Kinzie to nag the player if he doesn't enter the casino 
  2169. 	M07_thread.kinzie_nag = thread_new("m07_kinzie_nag_thread") 
  2170.  
  2171. 	while (not M07_status.inside_casino_reached) do 
  2172. 		thread_yield() 
  2173. 	end 
  2174. 	objective_text_clear(0) 
  2175.  
  2176. 	-- Stop Kinzie's call, if active 
  2177. 	audio_remove_mission_cellphone(M07_convo.kinzie_nag.name) 
  2178. 	--audio_conversation_end(M07_convo.kinzie_nag.handle) 
  2179. 	--M07_convo.kinzie_nag.handle = INVALID_CONVERSATION_HANDLE 
  2180. 	audio_persona_remove_2d(M07_convo.kinzie_nag.kinzie_persona_id) 
  2181. 	M07_convo.kinzie_nag.kinzie_persona_id = INVALID_PERSONA_HANDLE 
  2182.  
  2183. 	-- Stop the created threads 
  2184. 	thread_kill(M07_thread.luchadores_arriving_1) 
  2185. 	M07_thread.luchadores_arriving_1 = INVALID_THREAD_HANDLE 
  2186. 	thread_kill(M07_thread.luchadores_arriving_2) 
  2187. 	M07_thread.luchadores_arriving_2 = INVALID_THREAD_HANDLE 
  2188. 	thread_kill(M07_thread.luchadores_arriving_3) 
  2189. 	M07_thread.luchadores_arriving_3 = INVALID_THREAD_HANDLE 
  2190. 	thread_kill(M07_thread.angel_flee) 
  2191. 	M07_thread.angel_flee = INVALID_THREAD_HANDLE 
  2192. 	thread_kill(M07_thread.kinzie_nag) 
  2193. 	M07_thread.kinzie_nag = INVALID_THREAD_HANDLE 
  2194.  
  2195. 	-- Re-enable Angel's AI for the next sequence 
  2196. 	turn_vulnerable(M07_char.angel) 
  2197. 	set_ignore_ai_flag(M07_char.angel, false) 
  2198.  
  2199. 	-- Clear any unfinished commands 
  2200. 	ai_clear_scripted_action(M07_char.angel) 
  2201. 	ai_clear_scripted_action(M07_char.oleg) 
  2202. end 
  2203.  
  2204. -- Cutscene that occurs between parts one and two of Angel's casino checkpoint 
  2205. -- 
  2206. function m07_angel_mid_checkpoint_cutscene() 
  2207. 	-- Start the cutscene 
  2208. 	if (M07_cutscene.angel_mid_checkpoint ~= "") then 
  2209. 		cutscene_play(M07_cutscene.angel_mid_checkpoint, nil, {M07_navpoint.cp_starts.defense.player_local, M07_navpoint.cp_starts.defense.player_remote}) 
  2210. 	else 
  2211. 		-- TODO: Remove this once there is a real cutscene 
  2212. 		bink_play("07_Z03") 
  2213. 		fade_out(0.5) 
  2214. 		fade_out_block() 
  2215. 	end 
  2216.  
  2217. 	-- Add Angel to the player's party 
  2218. 	party_add(M07_char.angel, LOCAL_PLAYER) 
  2219. 	npc_suppress_persona(M07_char.angel, false) 
  2220. 	 
  2221. 	-- Prevent Oleg from doing anything until the enemies spawn 
  2222. 	set_ignore_ai_flag(M07_char.oleg, true) 
  2223.  
  2224. 	-- Leave followers in separate locations; do not follow the player around 
  2225. 	follower_make_independent(M07_char.oleg, true) 
  2226. 	follower_make_independent(M07_char.angel, true) 
  2227. 	--follower_make_independent(M07_char.pierce, true)	-- POC2: Remove Pierce 
  2228. 	follower_make_independent(M07_char.zimos, true) 
  2229.  
  2230. 	-- Teleport everybody to the right place for the cutscene 
  2231. 	if (M07_cutscene.angel_mid_checkpoint == "") then 
  2232. 		teleport_coop(M07_navpoint.cp_starts.defense.player_local, M07_navpoint.cp_starts.defense.player_remote, true) 
  2233. 	end 
  2234. 	--teleport(M07_char.pierce, M07_navpoint.cp_starts.defense.pierce)	-- POC2: Remove Pierce 
  2235. 	teleport(M07_char.zimos, M07_navpoint.cp_starts.defense.zimos) 
  2236. 	teleport(M07_char.angel, M07_navpoint.cp_starts.defense.angel) 
  2237. 	teleport(M07_char.oleg, M07_navpoint.cp_starts.defense.oleg) 
  2238.  
  2239. 	-- Cleanup the people and vehicles outside 
  2240. 	cleanup_groups({ M07_group.luchadores_outside, M07_group.outside_cover_vehicles }) 
  2241.  
  2242. 	-- TODO: Remove this once there is a real cutscene 
  2243. 	if (M07_cutscene.angel_mid_checkpoint == "") then 
  2244. 		fade_in(0.5) 
  2245. 		fade_in_block() 
  2246. 	end 
  2247. end 
  2248.  
  2249. 							--------------------------------------- 
  2250. 							--[[										  ]]-- 
  2251. 							--[[ 7TH CHECKPOINT (ANGEL CASINO) ]]-- 
  2252. 							--[[                               ]]-- 
  2253.  
  2254. -- Second part of Angel's casino checkpoint where the good guys are inside the casino fending 
  2255. -- off hordes of bad guys. Brutes are introduced here. 
  2256. -- 
  2257. function m07_angel_part_two_casino_defense() 
  2258. 	-- Leave followers in separate locations; do not follow the player around 
  2259. 	ai_set_personality(M07_char.angel, "gang defensive") 
  2260. 	--ai_set_personality(M07_char.pierce, "gang defensive")	-- POC2: Remove Pierce 
  2261. 	ai_set_personality(M07_char.zimos, "gang defensive") 
  2262. 	ai_do_scripted_move(M07_char.angel, M07_navpoint.angel_defense_location_1) 
  2263. 	--ai_do_scripted_move(M07_char.pierce, M07_navpoint.pierce_defense_location)	-- POC2: Remove Pierce 
  2264. 	--ai_do_scripted_move(M07_char.zimos, M07_navpoint.zimos_defense_location) 
  2265. 	npc_leash_to_nav(M07_char.angel, M07_navpoint.angel_defense_location_1, 15) 
  2266. 	--npc_leash_to_nav(M07_char.pierce, M07_navpoint.pierce_defense_location, 3)	-- POC2: Remove Pierce 
  2267. 	npc_leash_to_nav(M07_char.zimos, M07_navpoint.cp_starts.defense.zimos, 15) 
  2268.  
  2269. 	-- TODO: This is just a temp hack to make sure Oleg doesn't lose in brute-vs-brute 
  2270. 	set_max_hit_points(M07_char.oleg, 99999, true) 
  2271.  
  2272. 	-- Set the next objective 
  2273. 	objective_text(0, M07_text.protect_angel, nil, nil, SYNC_ALL, OI_ASSET_DEFEND) 
  2274. 	marker_add(M07_char.angel, MINIMAP_ICON_PROTECT_ACQUIRE, OI_ASSET_DEFEND) 
  2275.  
  2276. 	--==== WAVE 1 ====-- 
  2277.  
  2278. 	-- Force the first group of enemies to come through the front door 
  2279. 	spawn_region_enable(M07_spawn_region.casino_front_1, true) 
  2280. 	spawn_region_enable(M07_spawn_region.casino_front_2, true) 
  2281.  
  2282. 	-- Spawn the brute behind the luchadores and have him walk in-view for dramatic effect 
  2283. 	group_create(M07_group.brute_melee.name, true) 
  2284.  
  2285. 	-- Set up a separate thread to move the brute into view and send Oleg after him 
  2286. 	M07_thread.brute_attack = thread_new("m07_melee_brute_thread") 
  2287.  
  2288. 	zscene_prep(M07_cutscene.mission_outro) 
  2289. 	 
  2290. 	-- Start with only 2 groups; we can ramp up later 
  2291. 	delay(3) 
  2292. 	continuous_spawn_start(M07_spawn_group.wave_a.name) 
  2293. 	continuous_spawn_start(M07_spawn_group.wave_b.name) 
  2294.  
  2295. 	-- Once the first wave has spawned, enable the rest of the forward spawn regions; the "front" is the front 
  2296. 	delay(8.0) 
  2297. 	continuous_spawn_start(M07_spawn_group.wave_c.name) 
  2298.  
  2299. 	-- Wait until the brute has been disposed of 
  2300. 	while not character_is_dead(M07_char.brute_melee) do 
  2301. 		thread_yield() 
  2302. 	end 
  2303.  
  2304. 	-- Stop the brute attack thread 
  2305. 	thread_kill(M07_thread.brute_attack) 
  2306. 	M07_thread.brute_attack = INVALID_THREAD_HANDLE 
  2307.  
  2308. 	-- Re-enable Oleg's actions, just to be safe 
  2309. 	ai_set_action_delay(M07_char.oleg, "ALL", 0)	-- Allow all actions now 
  2310.  
  2311. 	-- Disable continuous spawns and wait a short time to provide a breather 
  2312. 	continuous_spawn_stop(M07_spawn_group.wave_a.name) 
  2313. 	continuous_spawn_stop(M07_spawn_group.wave_b.name) 
  2314. 	continuous_spawn_stop(M07_spawn_group.wave_c.name) 
  2315. 	spawn_region_enable(M07_spawn_region.casino_front_1, false) 
  2316. 	spawn_region_enable(M07_spawn_region.casino_front_2, false) 
  2317.  
  2318. 	-- Load the Angel intro conversation 
  2319. 	--audio_conversation_wait_for_end(M07_convo.brute_grapple.handle) 
  2320. 	--M07_convo.brute_grapple.handle = INVALID_CONVERSATION_HANDLE 
  2321. 	--M07_convo.angel_talk.handle = audio_conversation_load(M07_convo.angel_talk.name) 
  2322.  
  2323. 	-- Give the player enough time to clear the area out 
  2324. 	--delay(4.0) 
  2325.  
  2326. 	-- Play the Angel intro conversation 
  2327. 	--audio_conversation_play(M07_convo.angel_talk.handle) 
  2328. 	--delay(26) 
  2329.  
  2330. 	--==== WAVE 2 ====-- 
  2331.  
  2332. 	-- Load the next conversation 
  2333. 	M07_convo.pickup_minigun.handle = audio_conversation_load(M07_convo.pickup_minigun.name) 
  2334.  
  2335. 	-- Restrict Oleg to the ground floor 
  2336. 	npc_leash_to_nav(M07_char.oleg, M07_navpoint.cp_starts.defense.oleg, 18) 
  2337.  
  2338. 	-- Shift the front to the North side and the second floor 
  2339. 	spawn_region_enable(M07_spawn_region.casino_upper_front_n, true) 
  2340. 	spawn_region_enable(M07_spawn_region.casino_upper_front_s, true) 
  2341. 	--spawn_region_enable(M07_spawn_region.casino_upper_rear_n, true) 
  2342.  
  2343. 	-- Force the first group of enemies to come through the front door 
  2344. 	spawn_region_enable(M07_spawn_region.casino_front_1, true) 
  2345. 	spawn_region_enable(M07_spawn_region.casino_front_2, true) 
  2346.  
  2347. 	-- This time the players could be anywhere, so flag two possible spawn regions for the minigun brute 
  2348. 	-- NOTE: Since there's only two, they can both still be blocked, but eventually the luchadores will cause a player to revive a homie or fail, unblocking that region 
  2349. 	spawn_region_toggle_filter(M07_spawn_region.casino_upper_front_n, SRF_1)	-- NOTE: This still allows SRF_DEFAULT spawns! 
  2350. 	spawn_region_toggle_filter(M07_spawn_region.casino_upper_front_s, SRF_1)	-- NOTE: This still allows SRF_DEFAULT spawns! 
  2351. 	spawn_region_toggle_filter(M07_spawn_region.casino_upper_front_n, SRF_DEFAULT) 
  2352. 	spawn_region_toggle_filter(M07_spawn_region.casino_upper_front_s, SRF_DEFAULT) 
  2353.  
  2354. 	-- Spawn the minigun brute upstairs and have him walk to the balcony for dramatic effect 
  2355. 	continuous_spawn_start(M07_spawn_group.brute_minigun.name, 1, 0, "", SRF_1) 
  2356. 	while not character_exists(M07_char.brute_minigun) do 
  2357. 		thread_yield() 
  2358. 	end 
  2359. 	M07_status.casino_brutes_dead = 0 
  2360. 	 
  2361. 	on_death("m07_brute_killed_cb", M07_char.brute_minigun)	-- Since this is a continuous spawn NPC, we need to catch their death specifically to remove the marker 
  2362. 	 
  2363. 	-- Set up a separate thread to move the brute and homies around the second floor 
  2364. 	M07_thread.brute_attack = thread_new("m07_minigun_brute_thread") 
  2365. 	--audio_conversation_wait_for_end(M07_convo.angel_talk.handle) 
  2366. 	--M07_convo.angel_talk.handle = INVALID_CONVERSATION_HANDLE 
  2367.  
  2368. 	-- Wait until the brute has been disposed of 
  2369. 	while (M07_status.casino_brutes_dead < 1) do 
  2370. 		thread_yield() 
  2371. 	end 
  2372.  
  2373. 	-- Stop the brute attack thread 
  2374. 	thread_kill(M07_thread.brute_attack) 
  2375. 	M07_thread.brute_attack = INVALID_THREAD_HANDLE 
  2376.  
  2377. 	-- Send Oleg back downstairs 
  2378. 	npc_leash_remove(M07_char.oleg) 
  2379. 	ai_do_scripted_move(M07_char.oleg, M07_navpoint.cp_starts.defense.oleg, true, true) 
  2380.  
  2381. 	-- Disable continuous spawns and wait a short time to provide a breather 
  2382. 	continuous_spawn_stop(M07_spawn_group.wave_a.name) 
  2383. 	continuous_spawn_stop(M07_spawn_group.wave_b.name) 
  2384. 	--continuous_spawn_stop(M07_spawn_group.wave_c.name) 
  2385. 	continuous_spawn_stop(M07_spawn_group.brute_minigun.name) 
  2386. 	spawn_region_enable(M07_spawn_region.casino_upper_front_n, false) 
  2387. 	spawn_region_enable(M07_spawn_region.casino_upper_front_s, false) 
  2388. 	--spawn_region_enable(M07_spawn_region.casino_upper_rear_n, false) 
  2389. 	spawn_region_enable(M07_spawn_region.casino_front_1, false) 
  2390. 	spawn_region_enable(M07_spawn_region.casino_front_2, false) 
  2391. 	spawn_region_toggle_filter(M07_spawn_region.casino_upper_front_n, SRF_1)	-- NOTE: This still allows SRF_DEFAULT spawns! 
  2392. 	spawn_region_toggle_filter(M07_spawn_region.casino_upper_front_s, SRF_1)	-- NOTE: This still allows SRF_DEFAULT spawns! 
  2393. 	spawn_region_toggle_filter(M07_spawn_region.casino_upper_front_n, SRF_DEFAULT) 
  2394. 	spawn_region_toggle_filter(M07_spawn_region.casino_upper_front_s, SRF_DEFAULT) 
  2395.  
  2396. 	-- Inform the player of the gun 
  2397. 	delay(1) 
  2398. 	audio_conversation_play(M07_convo.pickup_minigun.handle) 
  2399. 	audio_conversation_wait_for_end(M07_convo.pickup_minigun.handle) 
  2400. 	M07_convo.pickup_minigun.handle = INVALID_CONVERSATION_HANDLE 
  2401. 	delay(4) 
  2402.  
  2403. 	--==== WAVE 3 ====-- 
  2404.  
  2405. 	-- Shift the front to the rear of the casino 
  2406. 	spawn_region_enable(M07_spawn_region.casino_rear_n, true) 
  2407. 	spawn_region_enable(M07_spawn_region.casino_rear_s, true) 
  2408. 	spawn_region_enable(M07_spawn_region.casino_upper_rear_n, true) 
  2409.  
  2410. 	-- Spawn the rest of the luchadores 
  2411. 	--continuous_spawn_start(M07_spawn_group.wave_a.name) 
  2412. 	--continuous_spawn_start(M07_spawn_group.wave_b.name) 
  2413. 	--continuous_spawn_start(M07_spawn_group.wave_c.name) 
  2414.  
  2415. 	-- This time the players could be anywhere, so flag multiple possible spawn regions for each flamer brute 
  2416. 	-- NOTE: Since there's only two, they can both still be blocked, but eventually the luchadores will cause a player to revive a homie or fail, unblocking that region 
  2417. 	spawn_region_toggle_filter(M07_spawn_region.casino_rear_n, SRF_2)	-- NOTE: This still allows SRF_DEFAULT spawns! 
  2418. 	spawn_region_toggle_filter(M07_spawn_region.casino_rear_s, SRF_3)	-- NOTE: This still allows SRF_DEFAULT spawns! 
  2419.  
  2420. 	-- Spawn one flamer brute downstairs in the rear and have him walk to the ring for dramatic effect 
  2421. 	continuous_spawn_start(M07_spawn_group.brute_flamer_1.name, 1, 0, "", SRF_2) 
  2422. 	while not character_exists(M07_char.brute_flamer_1) do 
  2423. 		thread_yield() 
  2424. 	end 
  2425. 	marker_add(M07_char.brute_flamer_1, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAG_STICKY + OI_FLAG_DISPLAY_DISTANCE, SYNC_ALL) 
  2426. 	on_death("m07_brute_killed_cb", M07_char.brute_flamer_1)	-- Since this is a continuous spawn NPC, we need to catch their death specifically to remove the marker 
  2427. 	ai_add_enemy_target(M07_char.brute_flamer_1, CLOSEST_PLAYER, ATTACK_NOW)	-- Send him immediately after the player 
  2428.  
  2429. 	-- Spawn another flamer brute downstairs in the rear and have him chase Oleg 
  2430. 	continuous_spawn_start(M07_spawn_group.brute_flamer_2.name, 1, 0, "", SRF_3) 
  2431. 	while not character_exists(M07_char.brute_flamer_2) do 
  2432. 		thread_yield() 
  2433. 	end 
  2434. 	marker_add(M07_char.brute_flamer_2, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAG_STICKY + OI_FLAG_DISPLAY_DISTANCE, SYNC_ALL) 
  2435. 	on_death("m07_brute_killed_cb", M07_char.brute_flamer_2)	-- Since this is a continuous spawn NPC, we need to catch their death specifically to remove the marker 
  2436. 	ai_add_enemy_target(M07_char.brute_flamer_2, M07_char.oleg, ATTACK_NOW_NEVER_LOSE, true)	-- Send him immediately after Oleg 
  2437.  
  2438. 	-- Announce the flamer brutes 
  2439. 	delay(2) 
  2440. 	audio_play_persona_line(M07_char.angel, "M07_Flamer_Brute_01") 
  2441.  
  2442. 	-- Load the Angel end conversation 
  2443. 	--M07_convo.brutes_dead.handle = audio_conversation_load(M07_convo.brutes_dead.name) 
  2444.  
  2445. 	-- Wait until both brutes have been disposed of 
  2446. 	while (M07_status.casino_brutes_dead < 3) do 
  2447. 		thread_yield() 
  2448. 	end 
  2449.  
  2450. 	-- Once both flamer brutes are dead, play a victory line (SP ADDED 11/7/10 for POC 2) 
  2451. 	delay(1) 
  2452. 	audio_play_persona_line(LOCAL_PLAYER, "M07_Mission_End") 
  2453. 	delay(3)  -- Wait a few seconds and allow it to play out before fading 
  2454.  
  2455. 	-- Play the Angel end conversation 
  2456. 	--delay(3) 
  2457. 	--audio_conversation_play(M07_convo.brutes_dead.handle) 
  2458. 	--audio_conversation_wait_for_end(M07_convo.brutes_dead.handle) 
  2459. 	--M07_convo.brutes_dead.handle = INVALID_CONVERSATION_HANDLE 
  2460.  
  2461. 	-- Reset spawn regions filters; mission clean-up will turn everything else off correctly 
  2462. 	spawn_region_toggle_filter(M07_spawn_region.casino_rear_n, SRF_3)	-- NOTE: This still allows SRF_DEFAULT spawns! 
  2463. 	spawn_region_toggle_filter(M07_spawn_region.casino_rear_s, SRF_3)	-- NOTE: This still allows SRF_DEFAULT spawns! 
  2464.  
  2465. 	marker_remove(M07_char.angel) 
  2466. 	objective_text_clear(0) 
  2467.  
  2468. 	-- Clear out notoriety for the Luchadores 
  2469. 	notoriety_set("luchadores", 0) 
  2470. 	 
  2471. end 
  2472.  
  2473. -------------------------------------------------------------------------------------------------- 
  2474.  
  2475. 								--[[************************************]]-- 
  2476. 								--[[                                    ]]-- 
  2477. 								--[[ Miscellaneous m07 Helper Functions ]]-- 
  2478. 								--[[                                    ]]-- 
  2479. 								--[[************************************]]-- 
  2480.  
  2481.  
  2482. 											------------------------- 
  2483. 											--[[                 ]]-- 
  2484. 											--[[ Cleanup Helpers ]]-- 
  2485. 											--[[                 ]]-- 
  2486.  
  2487. -- Cleanup all the triggers 
  2488. -- 
  2489. function m07_cleanup_triggers(trigger_table) 
  2490. 	for i,trigger in pairs(trigger_table) do 
  2491. 		if (type(trigger) == "string") then 
  2492. 			m07_clear_trigger(trigger) 
  2493. 		elseif (type(trigger) == "table") then 
  2494. 			m07_cleanup_triggers(trigger) 
  2495. 		end 
  2496. 	end 
  2497. end 
  2498.  
  2499. 											----------------------- 
  2500. 											--[[               ]]-- 
  2501. 											--[[ Other Helpers ]]-- 
  2502. 											--[[               ]]-- 
  2503.  
  2504. -- Disable trigger 
  2505. -- 
  2506. -- trigger:	(string) Name of the trigger 
  2507. -- 
  2508. function m07_clear_trigger(trigger) 
  2509. 	on_trigger("", trigger) 
  2510. 	on_trigger_exit("", trigger) 
  2511. 	trigger_enable(trigger, false) 
  2512. 	marker_remove_trigger(trigger, SYNC_ALL) 
  2513. end 
  2514.  
  2515. -------------------------------------------------------------------------------------------------- 
  2516.  
  2517. 											--[[********************]]-- 
  2518. 											--[[                    ]]-- 
  2519. 											--[[ Callback functions ]]-- 
  2520. 											--[[                    ]]-- 
  2521. 											--[[********************]]-- 
  2522.  
  2523. 											 
  2524. 											--[[ GENERAL CALLBACKS ]]-- 
  2525.  
  2526. -- Callback for finishing a phonecall 
  2527. function m07_finish_phonecall() 
  2528. 	M07_status.phonecall_finished = true 
  2529. end 
  2530. 			 
  2531. --attack callback 
  2532. function m07_decker_attack_cb(name)		 
  2533. 	-- don't play this if we have done this recently 
  2534. 	if (not thread_check_done(M07_timed_lines.deckers.timer)) then 
  2535. 		return 
  2536. 	end 
  2537. 	 
  2538. 	-- start timer 
  2539. 	M07_timed_lines.deckers.timer = thread_new("delay", M07_timed_lines.deckers.delay) 
  2540. 	-- play situation 
  2541. 	audio_play_persona_line(name, M07_timed_lines.deckers.situation) 
  2542.  
  2543. end 
  2544.  
  2545. --detect callback 
  2546. function m07_bdsm_detect_cb(name)		 
  2547. 	-- don't play this if we have done this recently 
  2548. 	if (not thread_check_done(M07_timed_lines.bdsm.timer)) then 
  2549. 		return 
  2550. 	end 
  2551. 	 
  2552. 	-- start timer 
  2553. 	M07_timed_lines.bdsm.timer = thread_new("delay", M07_timed_lines.bdsm.delay) 
  2554. 	-- play situation 
  2555. 	if(rand_int(1,2) == 1) then 
  2556. 		audio_play_persona_line(name, M07_timed_lines.bdsm.situation) 
  2557. 	else 
  2558. 		audio_play_persona_line(name, M07_timed_lines.bdsm.situation2) 
  2559. 	end 
  2560.  
  2561. end 
  2562. 			 
  2563. -- Callback for a homie dying 
  2564. -- 
  2565. -- char:			(string) name of the homie that died 
  2566. -- 
  2567. function m07_homie_death_fail_cb(char) 
  2568. 	on_death("", char) 
  2569. 	mission_end_failure("m07", M07_text.failure_death[char]) 
  2570. end 
  2571.  
  2572. -- Callback for a homie going DBNO 
  2573. -- 
  2574. -- char:			(string) name of the homie that went DBNO 
  2575. -- 
  2576. function m07_homie_dbno_cb(char) 
  2577. 	audio_play_persona_line(char, "M07_Need_Help") 
  2578. end 
  2579.  
  2580. function m07_failure_dismissed_cb() 
  2581. 	mission_end_failure("m07", "m06_failure_homie_dismissed") 
  2582. end 
  2583.  
  2584. -- Callback for when the player reaches the next goal 
  2585. -- 
  2586. function m07_reached_goal_cb(char, trigger) 
  2587. 	m07_clear_trigger(trigger) 
  2588. 	M07_status.reached_goal = true 
  2589. end 
  2590.  
  2591. function m07_reached_wheelhouse(char, trigger) 
  2592. 	if char == LOCAL_PLAYER or char == REMOTE_PLAYER then 
  2593. 		M07_status.player_for_convo = char 
  2594. 	end 
  2595. 	M07_status.reached_goal = true 
  2596. end 
  2597.  
  2598. function m07_barge_enemies01() 
  2599. 	trigger_enable(M07_trigger.barge_enemies01, false) 
  2600. 	for i, guard in pairs(M07_group.barge2.members) do 
  2601. 		ai_do_scripted_move(guard, M07_group.barge2.navpoints[i]) 
  2602. 		delay(1) 
  2603. 	end 
  2604. end 
  2605.  
  2606. function m07_barge_enemies02() 
  2607. 	trigger_enable(M07_trigger.barge_enemies02, false) 
  2608. 	for i, guard in pairs(M07_group.barge3.members) do 
  2609. 		ai_do_scripted_move(guard, M07_group.barge3.navpoints[i]) 
  2610. 		delay(2) 
  2611. 	end 
  2612. end 
  2613.  
  2614. function m07_kinzie_untie_cb(char, trigger) 
  2615. 	--play the untie animation 
  2616. 	m07_clear_trigger(trigger) 
  2617. 	objective_text_clear(0) 
  2618. 	marker_remove(M07_char.kinzie) 
  2619. 	clear_animation_state(M07_char.kinzie) 
  2620. 	action_play_synced(char, M07_char.kinzie, "Hostage Release") 
  2621. 	--clear_animation_state(M07_char.kinzie) 
  2622. 	 
  2623. 	--play conversation 
  2624. 	M07_thread.delay_thread = thread_new("delay", 15.0) 
  2625. 	 
  2626. 	while audio_conversation_playing(M07_convo.kinzie_door.handle) and thread_check_done(M07_thread.delay_thread) == false do 
  2627. 		thread_yield() 
  2628. 	end 
  2629. 	 
  2630. 	audio_conversation_end(M07_convo.kinzie_door.handle) 
  2631. 	 
  2632. 	thread_kill(M07_thread.delay_thread) 
  2633. 	M07_thread.delay_thread = INVALID_THREAD_HANDLE 
  2634. 	 
  2635.  
  2636. 	M07_convo.untie_kinzie.handle = audio_conversation_load_direct(M07_convo.untie_kinzie.name) 
  2637. 	audio_conversation_play(M07_convo.untie_kinzie.handle) 
  2638. 	 
  2639. 	-- We've seen this conversation fail to play and hang the script a couple times... 
  2640. 	-- so failsafe this sucka. 
  2641. 	M07_thread.delay_thread = thread_new("delay", 15.0) 
  2642. 	 
  2643. 	while audio_conversation_playing(M07_convo.untie_kinzie.handle) and thread_check_done(M07_thread.delay_thread) == false do 
  2644. 		thread_yield() 
  2645. 	end 
  2646. 	 
  2647. 	audio_conversation_end(M07_convo.untie_kinzie.handle) 
  2648. 	 
  2649. 	thread_kill(M07_thread.delay_thread) 
  2650. 	M07_thread.delay_thread = INVALID_THREAD_HANDLE 
  2651. 	 
  2652. 	M07_status.reached_goal = true 
  2653. end 
  2654.  
  2655.  
  2656. 											--[[ BARGE (MISSION START) ]]-- 
  2657.  
  2658. -- Callback for the player entering a vehicle (possibly a boat...helicopter works, too) 
  2659. -- 
  2660. -- char:			(string) name of the character that entered a vehicle 
  2661. -- 
  2662. function m07_player_entered_vehicle_cb(char) 
  2663. 	M07_status.player_vehicle_type = get_char_vehicle_type(char) 
  2664. end 
  2665.  
  2666. 												--[[ BDSM CLUB ]]-- 
  2667. 												 
  2668. -- Callback for the player grabbing a patron in the BDSM club to interrogate him 
  2669. -- 
  2670. function m07_bdsm_interrogate_cb(char, trigger) 
  2671. 	-- Find the index of the trigger that was activated, and the floor it is on 
  2672. 	local bdsm_floor = 0 
  2673. 	 
  2674. 	-- Don't let the player start an interrogation while in a vehicle... 
  2675. 	-- They can drive a motorcycle into the club. 
  2676. 	if character_is_in_vehicle(char) then 
  2677. 		return 
  2678. 	end 
  2679. 	 
  2680. 	-- One at a time! 
  2681. 	if M07_status.interrogation_in_progress == true then 
  2682. 		return 
  2683. 	end 
  2684. 	M07_status.interrogation_in_progress = true 
  2685. 	 
  2686. 	local victim = "" 
  2687. 	for i,patrons_by_floor in pairs(M07_trigger.bdsm_interrogate) do 
  2688. 		for j,trig in pairs(patrons_by_floor) do 
  2689. 			if (trig == trigger) then 
  2690. 				-- Grab the associated patron 
  2691. 				victim = M07_group.bdsm_patrons.chars[i][j] 
  2692. 				-- Store the floor number for use in a moment 
  2693. 				bdsm_floor = i 
  2694. 				break 
  2695. 			end 
  2696. 		end 
  2697. 		if (bdsm_floor ~= 0) then 
  2698. 			break 
  2699. 		end 
  2700. 	end 
  2701. 	if (bdsm_floor == 0) then 
  2702. 		return 
  2703. 	end 
  2704. 	trigger_enable(trigger, false) 
  2705. 	on_trigger("", trigger) 
  2706. 	 
  2707. 	-- make this dude invulnerable 
  2708. 	m07_setup_player_and_victim_for_interrogation(char, victim) 
  2709. 	 
  2710. 	persona_override_persona_start(victim, "Interrogation") 
  2711. 	 
  2712. 	if (bdsm_floor == 2) then 
  2713. 		player_take_human_shield(char, victim) 
  2714. 	end 
  2715.  
  2716. 	----figure out which room this guy belonged to 
  2717. 	for i,rooms_by_floor in pairs (M07_group.bdsm_rooms.floors) do 
  2718. 		for j, room in pairs (rooms_by_floor) do 
  2719. 			local correct_room = false 
  2720. 			for k, npc in pairs (room.members) do 
  2721. 				if (npc == victim) then 
  2722. 					correct_room = true 
  2723. 				end 
  2724. 			end 
  2725. 			if (correct_room == true) then 
  2726. 				for k, npc in pairs (room.members) do 
  2727. 					if (npc ~= victim) then 
  2728. 						--make everyone else flee 
  2729. 						set_ignore_ai_flag(npc, false) 
  2730. 						flee(npc, char) 
  2731. 						room.alive = false 
  2732. 					end 
  2733. 				end 
  2734. 			end 
  2735. 		end 
  2736. 	end 
  2737. 	 
  2738. 	-- Remove the triggers 
  2739. 	for j,trig in pairs(M07_trigger.bdsm_interrogate[bdsm_floor]) do 
  2740. 		trigger_enable(trig, false) 
  2741. 		on_trigger("", trig) 
  2742. 	end 
  2743.  
  2744. 	-- Clean up this floor 
  2745. 	for j,npc in pairs(M07_group.bdsm_patrons.chars[bdsm_floor]) do 
  2746. 		marker_remove(npc) 
  2747. 		on_character_grabbed("", npc) 
  2748. 		set_ignore_ai_flag(npc, false) 
  2749. 	end 
  2750. 	 
  2751. 	if (bdsm_floor == 2) then 
  2752. 		delay(1) 
  2753. 	end 
  2754. 	 
  2755. 	 
  2756. 	if (bdsm_floor == 1) then 
  2757. 		set_script_animation_state(victim, "Interrogation Idle") 
  2758. 		set_animation_state(victim, "Interrogation Idle") 
  2759. 		M07_convo.int_1_2.handle = audio_conversation_load_player(M07_convo.int_1_2.name, char) 
  2760. 		audio_conversation_play(M07_convo.int_1_2.handle) 
  2761. 		action_play_synced(char, victim, "Club Owner Interrogation") 
  2762. 		audio_conversation_wait_for_end(M07_convo.int_1_2.handle) 
  2763. 		M07_convo.int_1_2.handle = INVALID_CONVERSATION_HANDLE 
  2764.  
  2765. 		-- Mark the second floor 
  2766. 		for j,npc in pairs(M07_group.bdsm_patrons.chars[2]) do 
  2767. 			marker_add(npc, MINIMAP_ICON_USE, OI_ASSET_USE) 
  2768. 			character_set_only_scripted_grabs(npc, true) 
  2769. 			--on_character_grabbed("m07_bdsm_interrogate_cb", npc) 
  2770. 		end 
  2771. 		for j,trig in pairs(M07_trigger.bdsm_interrogate[2]) do 
  2772. 			trigger_enable(trig, true) 
  2773. 			on_trigger("m07_bdsm_interrogate_cb", trig) 
  2774. 		end 
  2775. 		for j,door in pairs(M07_mover.upper_bdsm_doors) do 
  2776. 			door_lock(door, false) 
  2777. 		end 
  2778.  
  2779. 	else 
  2780. 		action_play_synced_state(char, victim, "Gat Interrogation State") 
  2781. 		action_play_synced(char, victim, "Gat Interrogation Entry") 
  2782. 		M07_convo.int_2_2.handle = audio_conversation_load_player(M07_convo.int_2_2.name, char) 
  2783. 		audio_conversation_play(M07_convo.int_2_2.handle) 
  2784. 		audio_conversation_wait_for_end(M07_convo.int_2_2.handle) 
  2785. 		M07_convo.int_2_2.handle = INVALID_CONVERSATION_HANDLE 
  2786.  
  2787. 		-- Turn on the breadcrumb and wait for the player to reach it 
  2788. 		objective_text(0, M07_text.find_owner, nil, nil, SYNC_ALL, OI_ASSET_LOCATION) 
  2789. 		trigger_enable(M07_trigger.mgr_breadcrumb, true) 
  2790. 		marker_add_trigger(M07_trigger.mgr_breadcrumb, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  2791. 		on_trigger("m07_reached_goal_cb", M07_trigger.mgr_breadcrumb) 
  2792. 		M07_status.reached_goal = false 
  2793. 		 
  2794. 		--setup the trigger for grabbing the club owner 
  2795. 		trigger_enable(M07_trigger.club_owner_interrogate, true) 
  2796. 		on_trigger("m07_bdsm_owner_interrogate_cb", M07_trigger.club_owner_interrogate) 
  2797. 	end 
  2798.  
  2799. 	-- Wait for the previous conversation to end 
  2800. 	audio_conversation_wait_for_end(M07_convo.enter_bdsm.handle) 
  2801. 	M07_convo.enter_bdsm.handle = INVALID_CONVERSATION_HANDLE 
  2802. 	 
  2803. 	if (bdsm_floor == 2) then 
  2804. 		action_play_synced_state(char, victim, "HS_Stand") 
  2805. 		action_play_synced(char, victim, "Gat Interrogation Return") 
  2806. 		action_stop_synced_state(char, true) 
  2807. 	end 
  2808. 	 
  2809. 	-- Clean up this floor 
  2810. 	for j,npc in pairs(M07_group.bdsm_patrons.chars[bdsm_floor]) do 
  2811. 		-- Make them vulnerable again 
  2812. 		turn_vulnerable(npc) 
  2813. 		character_prevent_explosion_fling(npc, false) 
  2814. 		character_allow_ragdoll(npc, true) 
  2815. 		character_set_only_player_grabs(npc, false) 
  2816. 		persona_override_persona_stop(npc) 
  2817. 		character_prevent_flinching(npc, false) 
  2818. 		character_prevent_bumping(npc, false) 
  2819. 		character_set_never_catch_fire(npc, false) 
  2820. 		set_suppress_synced_melee_attacks_flag(npc, false) 
  2821. 		npc_leash_remove(npc) 
  2822. 		on_death("", npc) 
  2823. 	end 
  2824. 	 
  2825. 	--clean up the player who grabbed 
  2826. 	m07_cleanup_player_and_victim_for_interrogation(char, victim) 
  2827. 	 
  2828. 	M07_status.interrogation_in_progress = false 
  2829. 	 
  2830. 	while (not M07_status.reached_goal) do 
  2831. 		thread_yield() 
  2832. 	end 
  2833. end 
  2834.  
  2835. function m07_tutorial_cb() 
  2836. 	tutorial_start("human_shield", 0, true, true) 
  2837. end 
  2838.  
  2839. function m07_bdsm_owner_interrogate_cb(char, trigger)	 
  2840. 	-- Don't let the player start an interrogation while in a vehicle... 
  2841. 	-- They can drive a motorcycle into the club. 
  2842. 	if character_is_in_vehicle(char) then 
  2843. 		return 
  2844. 	end 
  2845. 	 
  2846. 	-- One at a time! 
  2847. 	if M07_status.interrogation_in_progress == true then 
  2848. 		return 
  2849. 	end 
  2850. 	M07_status.interrogation_in_progress = true 
  2851. 	 
  2852. 	trigger_enable(trigger, false) 
  2853. 	on_trigger("", trigger) 
  2854. 	marker_remove(M07_char.club_owner) 
  2855. 	objective_text_clear(0) 
  2856. 	 
  2857. 	m07_setup_player_and_victim_for_interrogation(char, M07_char.club_owner) 
  2858. 	 
  2859. 	persona_override_persona_start(M07_char.club_owner, "Interrogation") 
  2860. 	 
  2861. 	--put him in the interrogationstate 
  2862. 	player_take_human_shield(char, M07_char.club_owner) 
  2863. 	action_play_synced_state(char, M07_char.club_owner, "Gat Interrogation State") 
  2864. 	action_play_synced(char, M07_char.club_owner, "Gat Interrogation Entry") 
  2865. 	 
  2866. 	-- play conversation 
  2867. 	M07_convo.interrogate.handle = audio_conversation_load_player(M07_convo.interrogate.name, char) 
  2868. 	audio_conversation_play(M07_convo.interrogate.handle) 
  2869. 	audio_conversation_wait_for_end(M07_convo.interrogate.handle) 
  2870. 	M07_convo.interrogate.handle = INVALID_CONVERSATION_HANDLE 
  2871. 	 
  2872. 	--cleanup 
  2873. 	action_play_synced_state(char, M07_char.club_owner, "HS_Stand") 
  2874. 	action_play_synced(char, M07_char.club_owner, "Gat Interrogation Return") 
  2875. 	action_stop_synced_state(char, true) 
  2876. 	 
  2877. 	m07_cleanup_player_and_victim_for_interrogation(char, M07_char.club_owner) 
  2878. 	 
  2879. 	M07_status.club_owner_grabbed = true 
  2880. 	M07_status.interrogation_in_progress = false 
  2881. end 
  2882.  
  2883. --callback for when a patron dies, don't ever re-activate his action node 
  2884. function m07_patron_death_cb(victim) 
  2885. 	on_death("", victim) 
  2886. 	--on_character_grabbed("", victim) 
  2887. 	--figure out which room this guy belonged to 
  2888. 	for i,rooms_by_floor in pairs (M07_group.bdsm_rooms.floors) do 
  2889. 		local found_alive = false 
  2890. 		for j, room in pairs (rooms_by_floor) do 
  2891. 			for k, npc in pairs (room.members) do 
  2892. 				if (npc == victim) then 
  2893. 					--mark my room as dead so i don't try and reactivate the action node 
  2894. 					room.alive = false 
  2895. 					if (k <= room.num_patrons) then 
  2896. 						trigger_enable(room.triggers[k], false) 
  2897. 						on_trigger("", room.triggers[k]) 
  2898. 						room.patrons_alive[k] = false 
  2899. 					end 
  2900. 				end 
  2901. 			end 
  2902. 			if (found_alive == false) then 
  2903. 				for x, test_val in pairs (room.patrons_alive) do 
  2904. 					if (test_val == true) then 
  2905. 						found_alive = true 
  2906. 					end 
  2907. 				end 
  2908. 			end 
  2909. 		end 
  2910. 		if (found_alive == false) then 
  2911. 			--no one left to interrogate on this floor, we have failed the mission 
  2912. 			mission_end_failure("m07", "m07_failure_patrons_died") 
  2913. 		end 
  2914. 	end 
  2915. 	 
  2916. end 
  2917.  
  2918. --setup the BDSM action nodes 
  2919. function m07_bdsm_action_nodes_setup() 
  2920. 	for i,floor_rooms in pairs (M07_group.bdsm_rooms.floors) do 
  2921. 		for j,room in pairs(floor_rooms) do 
  2922. 			if (room.alive == true) then 
  2923. 				for k,npc in pairs(room.members) do 
  2924. 					npc_use_closest_action_node_of_type(npc, room.node_type[k]) 
  2925. 					on_death("m07_patron_death_cb", npc) 
  2926. 					set_ignore_ai_flag(npc, true) 
  2927. 				end 
  2928. 			end 
  2929. 		end 
  2930. 	end 
  2931. 	delay(5) 
  2932. 	thread_kill(M07_thread.nodes) 
  2933. end 
  2934.  
  2935. 												--[[ PONY CART ]]-- 
  2936.  
  2937. -- Callback for one of the Morningstar pony cart drivers being killed 
  2938. -- 
  2939. -- char:	(string) name of the guy that was killed 
  2940. -- 
  2941. function m07_driver_killed_cb(npc) 
  2942. 	on_death("", npc) 
  2943. 	local veh = get_char_vehicle_name(npc) 
  2944. 	if (veh ~= "") then 
  2945. 		vehicle_detonate(veh) 
  2946. 	end 
  2947. end 
  2948.  
  2949. -- Callback for one of the Morningstar pony cart riders being killed 
  2950. -- 
  2951. -- char:	(string) name of the guy that was killed 
  2952. -- 
  2953. function m07_enemy_killed_cb(npc) 
  2954. 	on_death("", npc) 
  2955. 	marker_remove(npc) 
  2956. 	M07_status.num_enemies_alive = M07_status.num_enemies_alive - 1 
  2957. end 
  2958.  
  2959. function m07_pony_enemy_killed_cb(npc) 
  2960. 	on_death("", npc) 
  2961. 	marker_remove(npc) 
  2962. 	-- vehicle_exit(npc) 
  2963. 	M07_status.num_enemies_alive = M07_status.num_enemies_alive - 1 
  2964. end 
  2965.  
  2966. 											--[[ ANGEL'S CASINO ]]-- 
  2967.  
  2968. -- Callback for reaching the outside of the casino in the first part of Angel's checkpoint 
  2969. -- 
  2970. function m07_outside_casino_reached_cb() 
  2971. 	--m07_clear_trigger(M07_trigger.outside_casino) 
  2972. 	on_trigger("", M07_trigger.outside_casino) 
  2973. 	trigger_enable(M07_trigger.outside_casino, false) 
  2974. 	M07_status.outside_casino_reached = true 
  2975. end 
  2976.  
  2977. -- Callback for any continuous spawn created brute being killed 
  2978. -- 
  2979. function m07_brute_killed_cb(npc) 
  2980. 	on_death("", npc) 
  2981. 	marker_remove(npc) 
  2982. 	M07_status.casino_brutes_dead = M07_status.casino_brutes_dead + 1 
  2983. end 
  2984.  
  2985. -- Callback for reaching the inside of the casino in the first part of Angel's checkpoint 
  2986. -- 
  2987. function m07_inside_casino_reached_cb() 
  2988. 	m07_clear_trigger(M07_trigger.inside_casino) 
  2989. 	m07_clear_trigger(M07_trigger.casino_lobby) 
  2990. 	M07_status.inside_casino_reached = true 
  2991. end 
  2992.  
  2993. -------------------------------------------------------------------------------------------------- 
  2994.  
  2995. 											--[[******************]]-- 
  2996. 											--[[                  ]]-- 
  2997. 											--[[ Thread functions ]]-- 
  2998. 											--[[                  ]]-- 
  2999. 											--[[******************]]-- 
  3000.  
  3001.  
  3002. 											--[[ BARGE (MISSION START) ]]-- 
  3003.  
  3004. -- Tell a vehicle to follow a specified looping path 
  3005. -- 
  3006. -- veh:		(string) name of the vehicle to move 
  3007. -- nav:		(string) name of the path to move along 
  3008. -- 
  3009. function m07_vehicle_path_thread(veh, path) 
  3010. 	-- Force the vehicle to keep following the path 
  3011. 	local driver = vehicle_get_driver(veh) 
  3012. 	while ((driver ~= nil) and (not character_is_player(driver))) do 
  3013. 		vehicle_pathfind_to(veh, path, true, false, true) 
  3014. 		thread_yield() 
  3015. 		driver = vehicle_get_driver(veh) 
  3016. 	end 
  3017. end 
  3018.  
  3019. 												--[[ BDSM CLUB ]]-- 
  3020.  
  3021. -- Tell a pony cart to leave the gbarn then chase the player 
  3022. -- 
  3023. -- veh:		(string) name of the vehicle to move 
  3024. -- 
  3025. function m07_pony_chase_thread(veh, npc_group, cart_num) 
  3026.  
  3027. 	--vehicle_speed_override(veh, 15) 
  3028. 	vehicle_pathfind_to(veh, M07_navpoint.pony_cart_start, true, false, true) 
  3029. 	 
  3030. 	-- Enable shooting 
  3031. 	for j,npc in pairs(npc_group) do 
  3032. 		if (character_exists(npc) and not character_is_dead(npc)) then 
  3033. 			set_ignore_ai_flag(npc, false) 
  3034. 		end 
  3035. 	end 
  3036. 	 
  3037. 	-- Once out of the barn, chase the player 
  3038. 	--vehicle_speed_cancel(veh) 
  3039. 	vehicle_disable_chase(veh, false) 
  3040. 	vehicle_disable_flee(veh, false) 
  3041. 	vehicle_chase(veh, LOCAL_PLAYER, false, false) 
  3042. end 
  3043.  
  3044. function m07_force_action_nodes() 
  3045. 	local j = 0 
  3046. 	while j < 1 do 
  3047. 		for i, npc in pairs(M07_group.bdsm_ambient.members) do 
  3048. 			if not character_is_dead(npc) then 
  3049. 				npc_use_closest_action_node_of_type(npc, M07_group.bdsm_ambient.nodes[i], 3) 
  3050. 			end 
  3051. 		end 
  3052. 		delay(2) 
  3053. 	end 
  3054. 	 
  3055. 	--set cage dancers to ignore AI 
  3056. 	for k, dancer in pairs(M07_group.bdsm_cage_dancers.members) do 
  3057. 		if not character_is_dead(dancer) then 
  3058. 			set_ignore_ai_flag(npc, true) 
  3059. 		end 
  3060. 	end 
  3061. end 
  3062.  
  3063. function m07_pony_cart_alive_thread(veh, passenger_group) 
  3064.  
  3065. 	for i, npc in pairs(passenger_group) do 
  3066. 		while not character_is_dead(npc) do 
  3067. 			thread_yield() 
  3068. 		end 
  3069. 	end 
  3070. 	 
  3071. 	--all characters in this veh are dead, stop the vehicle 
  3072. 	vehicle_stop(veh) 
  3073. end 
  3074.  
  3075.  
  3076. 												--[[ PONY CART ]]-- 
  3077.  
  3078.  
  3079. 											--[[ ANGEL'S CASINO ]]-- 
  3080.  
  3081. -- Thread to process the exploding Luchadore vehicle arriving at the casino 
  3082. -- 
  3083. function m07_luchadores_arriving_1_thread() 
  3084. 	-- Tell the explody vehicle where to go 
  3085. 	set_ignore_ai_flag(M07_group.luchadores_arriving.chars[1], false) 
  3086. 	marker_add(M07_group.luchadores_arriving.chars[1], MINIMAP_ICON_KILL, OI_ASSET_KILL, OI_FLAGS_DEFAULT, SYNC_ALL) 
  3087. 	vehicle_pathfind_to(M07_group.luchadores_arriving.vehicles[1], M07_navpoint.casino_arriving_1, true) 
  3088.  
  3089. 	-- Once the vehicle reaches the end location, explode it 
  3090. 	while not vehicle_pathfind_check_done(M07_group.luchadores_arriving.vehicles[1]) do 
  3091. 		thread_yield() 
  3092. 	end 
  3093. 	marker_remove(M07_group.luchadores_arriving.chars[1]) 
  3094. 	vehicle_detonate(M07_group.luchadores_arriving.vehicles[1]) 
  3095. end 
  3096.  
  3097. -- Thread to process the non-exploding Luchadore vehicle arriving at the casino 
  3098. -- 
  3099. function m07_luchadores_arriving_2_thread() 
  3100. 	-- Tell the non-explody arriving vehicle where to go 
  3101. 	vehicle_pathfind_to(M07_group.outside_cover_vehicles.vehicles[1], M07_navpoint.casino_arriving_2, true, true) 
  3102.  
  3103. 	-- Once the vehicle reaches the end location, everyone exit 
  3104. 	while not vehicle_pathfind_check_done(M07_group.outside_cover_vehicles.vehicles[1]) do 
  3105. 		thread_yield() 
  3106. 	end 
  3107. 	vehicle_exit(M07_group.luchadores_outside.chars[1]) 
  3108. 	vehicle_exit(M07_group.luchadores_outside.chars[2]) 
  3109. 	vehicle_exit(M07_group.luchadores_outside.chars[3]) 
  3110. 	--vehicle_exit(M07_group.luchadores_outside.brute) 
  3111.  
  3112. 	-- Leash everyone to the area 
  3113. 	for i,npc in pairs(M07_group.luchadores_outside.chars) do 
  3114. 		if (character_exists(npc) and not character_is_dead(npc)) then 
  3115. 			npc_leash_to_nav(npc, M07_navpoint.casino_arriving_2, 50) 
  3116. 		end 
  3117. 	end 
  3118. end 
  3119.  
  3120. -- Thread to process the brute arriving at the casino 
  3121. -- 
  3122. function m07_luchadores_arriving_3_thread() 
  3123.  
  3124. 	-- Tell the brute to go to the middle of the street 
  3125. 	set_ignore_ai_flag(M07_group.luchadores_outside.brute, false) 
  3126. 	ai_add_enemy_target(M07_group.luchadores_outside.brute, CLOSEST_PLAYER, ATTACK_NOW)	-- Target the player 
  3127. 	ai_do_scripted_move(M07_group.luchadores_outside.brute, M07_navpoint.casino_arriving_3, true, false) 
  3128.  
  3129. 	-- Wait until the player is close 
  3130. 	while (get_dist_closest_player_to_object(M07_group.luchadores_outside.brute) > 30) do 
  3131. 		thread_yield() 
  3132. 	end 
  3133.  
  3134. 	-- Announce the brute 
  3135. 	audio_conversation_wait_for_end(M07_convo.mount_rescue.handle) 
  3136. 	delay(2) 
  3137. 	audio_play_persona_line(M07_char.zimos, M07_lines.notice_brute) 
  3138.  
  3139. end 
  3140.  
  3141. -- Thread to process Angel fleeing into the casino 
  3142. -- 
  3143. function m07_angel_flee_thread() 
  3144. 	-- Change the Luchadores' target to the player 
  3145. 	for i,luch in pairs(M07_group.luchadores_outside.chars) do 
  3146. 		ai_add_enemy_target(luch, CLOSEST_PLAYER, ATTACK_NOW) 
  3147. 	end 
  3148.  
  3149. 	-- Send Angel to the casino door 
  3150. 	npc_leash_remove(M07_char.angel) 
  3151. 	ai_do_scripted_move(M07_char.angel, M07_navpoint.casino_door, true, false) 
  3152. 	while (not ai_scripted_action_is_complete(M07_char.angel)) do 
  3153. 		thread_yield() 
  3154. 	end 
  3155. 	npc_leash_to_nav(M07_char.angel, M07_navpoint.casino_door, 0) 
  3156.  
  3157. 	-- Wait until the player is in streaming range of the casino entry interior 
  3158. 	while (get_dist_closest_player_to_object(M07_navpoint.casino_entry_1) > 60) do 
  3159. 		thread_yield() 
  3160. 	end 
  3161. 	 
  3162. 	-- Open the door 
  3163. 	while (not door_is_open(M07_mover.door_casino)) do 
  3164. 		door_open(M07_mover.door_casino) 
  3165. 		thread_yield() 
  3166. 	end 
  3167.  
  3168. 	-- Send Angel into the casino entry 
  3169. 	npc_leash_remove(M07_char.angel) 
  3170. 	ai_do_scripted_move(M07_char.angel, M07_navpoint.casino_entry_1, true, false) 
  3171. 	while (not ai_scripted_action_is_complete(M07_char.angel)) do 
  3172. 		thread_yield() 
  3173. 	end 
  3174. 	npc_leash_to_nav(M07_char.angel, M07_navpoint.casino_entry_1, 0) 
  3175.  
  3176. 	-- Wait until the player is in streaming range of the full casino interior 
  3177. 	while (get_dist_closest_player_to_object(M07_navpoint.casino_entry_1) > 15) do 
  3178. 		thread_yield() 
  3179. 	end 
  3180.  
  3181. 	-- Send Angel to the ring in the casino 
  3182. 	npc_leash_remove(M07_char.angel) 
  3183. 	ai_do_scripted_move(M07_char.angel, M07_navpoint.cp_starts.defense.angel, true, false) 
  3184. 	while (not ai_scripted_action_is_complete(M07_char.angel)) do 
  3185. 		thread_yield() 
  3186. 	end 
  3187.  
  3188. 	-- Once Angel reaches the end location, disable his AI to prevent him from wandering back into combat 
  3189. 	set_ignore_ai_flag(M07_char.angel, true) 
  3190. end 
  3191.  
  3192.  
  3193. -- Thread to make Kinzie nag the player 
  3194. -- 
  3195. function m07_kinzie_nag_thread() 
  3196. 	-- Load the Kinzie nag conversation 
  3197. 	M07_convo.kinzie_nag.kinzie_persona_id = audio_persona_load_2d(M07_convo.kinzie_nag.kinzie_persona_name) 
  3198. 	--M07_convo.kinzie_nag.handle = audio_conversation_load(M07_convo.kinzie_nag.name) 
  3199.  
  3200. 	delay(30) 
  3201.  
  3202. 	-- Start the Kinzie phone call 
  3203. 	M07_status.phonecall_finished = false 
  3204. 	audio_play_for_mission_cellphone(M07_convo.kinzie_nag.name, true, true, "", "m07_finish_phonecall") 
  3205. 	 
  3206. 	-- Make sure the conversation is finished 
  3207. 	while (M07_status.phonecall_finished == false) do 
  3208. 		thread_yield() 
  3209. 	end 
  3210. 	audio_persona_remove_2d(M07_convo.kinzie_nag.kinzie_persona_id) 
  3211. 	M07_convo.kinzie_nag.kinzie_persona_id = INVALID_PERSONA_HANDLE 
  3212. end 
  3213.  
  3214. -- Thread to move the brute into view and send Oleg after him 
  3215. -- 
  3216. function m07_melee_brute_thread() 
  3217. 	-- Have Oleg ignore the enemies until the brute arrives 
  3218. 	set_ignore_ai_flag(M07_char.oleg, false) 
  3219. 	ai_set_action_delay(M07_char.oleg, "ALL", 60)	-- Disallow all actions for 60 seconds 
  3220. 	ai_set_action_delay(M07_char.oleg, "taunt", 4)			-- Allow taunt in a few seconds 
  3221.  
  3222. 	-- Have the brute walk to the top of the stairs for dramatic effect 
  3223. 	set_never_turn_on_player(M07_char.brute_melee, true) 
  3224. 	ai_set_action_delay(M07_char.brute_melee, "ALL", 30)	-- Disallow all actions for 20 seconds 
  3225. 	ai_set_action_delay(M07_char.brute_melee, "move scripted", 0)	-- allow scripted move 
  3226. 	ai_do_scripted_move(M07_char.brute_melee, M07_navpoint.casino_entry_1, false) 
  3227.  
  3228. 	-- Load and play the first wave conversation 
  3229. 	M07_convo.first_wave.handle = audio_conversation_load_direct(M07_convo.first_wave.name) 
  3230. 	delay(6) 
  3231. 	audio_conversation_play(M07_convo.first_wave.handle) 
  3232.  
  3233. 	-- Wait for the brute to reach the center 
  3234. 	while (ai_scripted_action_is_processing(M07_char.brute_melee)) do 
  3235. 		thread_yield() 
  3236. 	end 
  3237.  
  3238. 	-- Grabbing a human shield in this room is ineffective 
  3239. 	ai_set_action_delay(M07_char.brute_melee, "human shield grab", 30)	-- Disallow grabbing human shields for 30 seconds 
  3240.  
  3241. 	-- Send Oleg and the brute after each other 
  3242. 	ai_add_enemy_target(M07_char.oleg, M07_char.brute_melee, ATTACK_NOW_NEVER_LOSE, true)	-- Make enemy brute the priority target 
  3243. 	ai_set_action_delay(M07_char.oleg, "move chase", 0)			-- Allow chase now 
  3244. 	ai_set_action_delay(M07_char.oleg, "brute bull rush", 0)	-- Allow bull rush now 
  3245. 	ai_set_action_delay(M07_char.oleg, "brute attack brute", 0)	-- Allow brute on brute now 
  3246. 	 
  3247. 	ai_add_enemy_target(M07_char.brute_melee, M07_char.oleg, ATTACK_NOW_NEVER_LOSE, true)	-- Make Oleg the priority target 
  3248. 	ai_set_action_delay(M07_char.brute_melee, "move chase", 0)			-- Allow chase now 
  3249. 	ai_set_action_delay(M07_char.brute_melee, "brute bull rush", 0)		-- Allow bull rush now 
  3250. 	ai_set_action_delay(M07_char.brute_melee, "brute attack brute", 0)	-- Allow brute on brute now 
  3251.  
  3252. 	-- Make sure the prior conversation is finished 
  3253. 	audio_conversation_wait_for_end(M07_convo.first_wave.handle) 
  3254. 	M07_convo.first_wave.handle = INVALID_CONVERSATION_HANDLE 
  3255. 	M07_convo.brute_grapple.handle = audio_conversation_load_direct(M07_convo.brute_grapple.name) 
  3256.  
  3257. 	-- Play the brute grapple conversation 
  3258. 	delay(10) 
  3259. 	audio_conversation_play(M07_convo.brute_grapple.handle) 
  3260. 	audio_conversation_wait_for_end(M07_convo.brute_grapple.handle) 
  3261. 	M07_convo.brute_grapple.handle = INVALID_CONVERSATION_HANDLE 
  3262. end 
  3263.  
  3264. -- Thread to move the brute and homies around the second floor 
  3265. -- 
  3266. function m07_minigun_brute_thread() 
  3267. 	character_prevent_flinching(M07_char.brute_minigun, true) 
  3268. 	-- Load the brute call out 
  3269. 	M07_convo.brute_minigun.handle = audio_conversation_load(M07_convo.brute_minigun.name) 
  3270.  
  3271. 	-- Have the brute walk to the center of the balcony for dramatic effect 
  3272. 	ai_do_scripted_move(M07_char.brute_minigun, M07_navpoint.casino_balcony_e_1, false, true) 
  3273. 	npc_leash_to_nav(M07_char.brute_minigun, M07_navpoint.casino_balcony_e_1, 0) 
  3274.  
  3275. 	-- After the brute has time to move into view, announce his presence 
  3276. 	delay(12) 
  3277. 	marker_add(M07_char.brute_minigun, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAG_STICKY + OI_FLAG_DISPLAY_DISTANCE, SYNC_ALL) 
  3278. 	audio_conversation_play(M07_convo.brute_minigun.handle) 
  3279. 	audio_conversation_wait_for_end(M07_convo.brute_minigun.handle) 
  3280. 	M07_convo.brute_minigun.handle = INVALID_CONVERSATION_HANDLE 
  3281.  
  3282. 	-- Wait for the brute and to arrive at the balcony 
  3283. 	while (not ai_scripted_action_is_complete(M07_char.brute_minigun)) do 
  3284. 		thread_yield() 
  3285. 	end 
  3286.  
  3287. 	-- Have Oleg flee to the stairs 
  3288. 	delay(2) 
  3289. 	audio_play_persona_line(M07_char.oleg, "M07_Casino_Fight_03") 
  3290. 	npc_leash_remove(M07_char.oleg) 
  3291. 	ai_do_scripted_move(M07_char.oleg, M07_navpoint.casino_stairs, true, false)	-- Keep Oleg from walking leisurely while firing 
  3292.  
  3293. 	-- Spawn some more guys 
  3294. 	group_create(M07_group.balcony_enemies.name, true) 
  3295.  
  3296. 	-- Send them to their locations 
  3297. 	ai_do_scripted_move(M07_group.balcony_enemies.chars[4], M07_navpoint.casino_balcony_e_3, true, true) 
  3298. 	ai_do_scripted_move(M07_group.balcony_enemies.chars[6], M07_navpoint.casino_balcony_e_2, true, true) 
  3299.  
  3300. 	-- Once Oleg reaches the stairs, send the brute downstairs 
  3301. 	while (not ai_scripted_action_is_complete(M07_char.oleg)) do 
  3302. 		thread_yield() 
  3303. 	end 
  3304. 	npc_leash_remove(M07_char.brute_minigun) 
  3305. 	turn_invulnerable(M07_char.brute_minigun) 
  3306. 	human_gravity_enable(M07_char.brute_minigun, false) 
  3307. 	set_ignore_ai_flag(M07_char.brute_minigun, true) 
  3308. 	teleport(M07_char.brute_minigun, M07_navpoint.casino_balcony_e_1) 
  3309. 	action_play_non_blocking(M07_char.brute_minigun, "Balcony Drop", "Balcony Drop", true) 
  3310. 	repeat 
  3311. 		thread_yield() 
  3312. 	until action_play_is_finished(M07_char.brute_minigun, 0.10) 
  3313. 	audio_play_persona_line(M07_char.brute_minigun, "Brute_Charge") 
  3314. 	repeat 
  3315. 		thread_yield() 
  3316. 	until action_play_is_finished(M07_char.brute_minigun, 0.56) 
  3317. 	camera_shake_play("anim_shake_medium") 
  3318. 	repeat 
  3319. 		thread_yield() 
  3320. 	until action_play_is_finished(M07_char.brute_minigun) 
  3321. 	 
  3322. 	--wait for the land to finish 
  3323. 	delay(1) 
  3324. 	turn_vulnerable(M07_char.brute_minigun) 
  3325. 	set_ignore_ai_flag(M07_char.brute_minigun, false) 
  3326. 	human_gravity_enable(M07_char.brute_minigun, true) 
  3327. 	character_prevent_flinching(M07_char.brute_minigun, false) 
  3328. 	-- Resume spawning the luchadores 
  3329. 	--continuous_spawn_start(M07_spawn_group.wave_a.name) 
  3330. 	--continuous_spawn_start(M07_spawn_group.wave_b.name) 
  3331.  
  3332. 	-- Have Oleg head upstairs 
  3333. 	ai_do_scripted_move(M07_char.oleg, M07_navpoint.casino_balcony_n, true, false) 
  3334. 	npc_leash_to_nav(M07_char.oleg, M07_navpoint.casino_balcony_n, 10)	-- TODO: Make sure Oleg doesn't run off while waiting on the brute 
  3335. end 
  3336.