sr2lua/ep02.lua

  1. -- ep02.lua 
  2. -- SR2 mission script 
  3. -- 3/28/07 
  4.  
  5. -- Groups -- 
  6. 	GROUP_GAT =									"ep02_$gat" 
  7. 	GROUP_BILLBOARD_HELI =					"ep02_$billboard_heli" 
  8. 	GROUP_ULTOR_BILLBOARD =					"ep02_$ultor_billboard" 
  9. 	GROUP_DELIVERY_TRUCK =					"ep02_$delivery_truck" 
  10. 	GROUP_ULTOR_TRUCK =						{"ep02_$ultor_truck", "ep02_$ultor_truck_2", "ep02_$ultor_truck_3", "ep02_$ultor_truck_4"} 
  11. 	GROUP_ULTOR_MALL =						"ep02_$ultor_mall" 
  12. 	GROUP_ULTOR_BASE =						"ep02_$ultor_base" 
  13. 	GROUP_ESCAPE =								"ep02_$escape" 
  14. 	GROUP_APC_KEYS =							"ep02_$apc_keys" 
  15. 	GROUP_COURTESY_CAR =						"ep02_$courtesy_car" 
  16. 	GROUP_COURTESY_CAR_COOP =				"ep02_$courtesy_car_coop" 
  17. 	GROUP_CTE =									"ep02_$GCTE" 
  18. 	GROUP_BOMBS =								"ep02_$Gbombs" 
  19.  
  20. -- Navpoints -- 
  21. 	NAV_LOCAL_START =							"ep02_$n000" 
  22. 	NAV_REMOTE_START =						"ep02_$n001" 
  23. 	NAV_SAINTS_ROW	=							"ep02_$n021" 
  24. 	NAV_BILLBOARD =							"ep02_$n002" 
  25. 	NAV_BILLBOARD_GROUND =					"ep02_$n003" 
  26. 	--NAV_DELIVERY_TRUCK_ROUTE =				{"ep02_$n004", "ep02_$n005", "ep02_$n006", "ep02_$n007", "ep02_$n008", 
  27. 	--												"ep02_$n009", "ep02_$n010", "ep02_$n011", "ep02_$n012"} 
  28. 	NAV_DELIVERY_TRUCK_ROUTE =				{"ep02_$n004", "ep02_$n005", "ep02_$n006", "ep02_$n007", "ep02_$n008", 
  29. 													"ep02_$n013"} 
  30. 	NAV_STORE =									{"ep02_$n014", "ep02_$n015"} 
  31. 	NAV_WASTE_TUNNEL =						"ep02_$n017" 
  32. 	NAV_ESCAPE_FINISH =						"ep02_$n018" 
  33. 	NAV_ULTOR_TRUCK_CENTERS =				{"ep02_$n019", "ep02_$n011", "ep02_$n008", "ep02_$n020"} 
  34.  
  35. 	NAV_ALARM_SOURCES =						"ep02_$n022" 
  36.  
  37. 	NAV_BOMBS_PLANTED_LOCAL_START	=		"ep02_$n024" 
  38. 	NAV_BOMBS_PLANTED_REMOTE_START	=	"ep02_$n025" 
  39.  
  40. 	NAV_CUTSCENE_LOCAL_START =				"ep02_$Ncutscene_local_start" 
  41. 	NAV_CUTSCENE_REMOTE_START =			"ep02_$Ncutscene_remote_start" 
  42.  
  43. -- Triggers -- 
  44. 	TRIGGER_ELEVATOR =						"university_$t-ug-ultorbase-in" 
  45. 	TRIGGER_NEAR_BASE_ENTRANCE	=			"ep02_$t001" 
  46. 	TRIGGERS_BASE_ENTRY_BREADCRUMBS =	{"ep02_$t005", "ep02_$t004", "ep02_$t002", "ep02_$t003"} 
  47. 	--TRIGGERS_KEY_BREADCRUMBS =				{"ep02_$t006", "ep02_$t007", "ep02_$t008"} 
  48. 	TRIGGERS_KEY_BREADCRUMBS =				{"ep02_$t006", "ep02_$t007", "ep02_$t011"} 
  49. 	TRIGGERS_BOMBS =							{"ep02_$t000", "ep02_$t009", "ep02_$t010"} 
  50. 	TRIGGER_BASE_LAB_DOOR_1 =				"ep02_$Tdoor_lab_1" 
  51. 	TRIGGER_BASE_LAB_DOOR_2 =				"ep02_$Tdoor_lab_2" 
  52. 	TRIGGER_BASE_LAB_DOOR_3 =				"ep02_$Tdoor_lab_3" 
  53. 	TRIGGER_CTES =								{"ep02_$Tcte_1", "ep02_$Tcte_2", "ep02_$Tcte_3"} 
  54.  
  55. 	TRIGGER_BASE_TELEPORT_ENTER =			"university_$t-ug-ultorbase-out" 
  56. 	TRIGGER_BASE_TELEPORT_EXIT =			"university_$t-ug-ultorbase-in" 
  57.  
  58. 	TRIGGER_WRONG_EXIT_WARNING =			"ep02_$Twrong_exit_warning" 
  59. 	TRIGGER_WRONG_EXIT_FAIL =				"ep02_$Twrong_exit_fail" 
  60.  
  61. -- Characters -- 
  62. 	CHAR_GAT =									"ep02_$c000" 
  63. 	CHAR_ULTOR_BILLBOARD_HELI =			{"ep02_$c001", "ep02_$c002"} 
  64. 	--CHAR_DELIVERY_TRUCK =					{"ep02_$c003", "ep02_$c004"} 
  65. 	CHAR_DELIVERY_TRUCK =					{"ep02_$c003"} 
  66. 	CHAR_ULTOR_TRUCK_CHASERS =				{{{"ep02_$c005", "ep02_$c006"}, {"ep02_$c007", "ep02_$c008"}}, 
  67. 													 {{"ep02_$c016", "ep02_$c017"}, {"ep02_$c018", "ep02_$c019"}}, 
  68. 													 {{"ep02_$c020", "ep02_$c021"}, {"ep02_$c022", "ep02_$c023"}}, 
  69. 													 {{"ep02_$c024", "ep02_$c025"}, {"ep02_$c026", "ep02_$c027"}}} 
  70. 	CHAR_ULTOR_MALL =							{"ep02_$c009", "ep02_$c010", "ep02_$c011", "ep02_$c012"} 
  71. 	CHAR_APC_GUARDS =							{"ep02_$c013", "ep02_$c014", "ep02_$c015"} 
  72.  
  73. -- Vehicles -- 
  74. 	VEH_BILLBOARD_HELI =						"ep02_$v000" 
  75. 	VEH_ULTOR_BILLBOARD_HELI =				"ep02_$v001" 
  76. 	VEH_DELIVERY_TRUCK =						"ep02_$v002" 
  77. 	VEH_ULTOR_TRUCK_CHASERS =				{{"ep02_$v003", "ep02_$v004"}, 
  78. 													 {"ep02_$v006", "ep02_$v007"}, 
  79. 													 {"ep02_$v008", "ep02_$v009"}, 
  80. 													 {"ep02_$v010", "ep02_$v011"}} 
  81. 	VEH_APC =									"ep02_$v005" 
  82.  
  83. -- Items -- 
  84. 	ITEM_ELEVATOR_KEYS =						"ep02_$i000" 
  85. 	ITEM_APC_KEYS =							"ep02_$i001" 
  86.  
  87. -- Threads -- 
  88. 	THREAD_BILLBOARD =						-1 
  89. 	THREAD_TRUCK =								-1 
  90. 	THREAD_MALL =								-1 
  91. 	THREAD_HELI_CHASE =						-1 
  92.  
  93. -- Checkpoints -- 
  94. 	CHECKPOINT_ULTOR_BASE =					"ep02_ultor_base" 
  95. 	CHECKPOINT_BOMBS_PLANTED =				"ep02_bombs_planted" 
  96.  
  97. -- Cutscenes -- 
  98. 	CUTSCENE_IN =						"tsse02-1.bik" 
  99. 	CUTSCENE_OUT =						"tsse02-2.bik" 
  100.  
  101. -- Animations -- 
  102.  
  103. -- Mesh Movers -- 
  104. 	 
  105. 	MM_BASE_ESCAPE_DOOR =					"ep02_$MMdoor_apc" 
  106. 	MM_BASE_LAB_DOOR_1 =						"ep02_$MMdoor_lab_1" 
  107. 	MM_BASE_LAB_DOOR_2 =						"ep02_$MMdoor_lab_2" 
  108. 	MM_BASE_LAB_DOOR_3 =						"ep02_$MMdoor_lab_3" 
  109.  
  110. -- Text -- 
  111. 	TEXT_GO_TO_SAINTS_ROW =					"ep02_go_to_saints_row"		-- Head to Saints Row. 
  112. 	TEXT_ULTOR_NOTORIETY =					"ep02_ultor_notoriety"		-- Get your Ultor notoriety up to 4 stars. 
  113. 	TEXT_NOTORIETY_ZERO =					"ep02_notoriety_zero"		-- Eliminate your notoriety at a Forgive & Forget. 
  114. 	TEXT_GO_TO_BASE =							"ep02_go_to_base"				-- Enter the Ultor base while they're distracted. 
  115. 	TEXT_MEET_GAT =							"ep02_meet_gat"				-- Use the secret entrance and meet Gat in the base. 
  116. 	TEXT_GET_KEY =								"ep02_get_key"					-- Get the keycard to the lab doors. 
  117. 	TEXT_DESTROY_LABS =						"ep02_destroy_labs"			-- Plant bombs in each of the labs upstairs. 
  118. 	TEXT_GET_OUT =								"ep02_get_out"					-- Exit the base before the bombs detonate. 
  119. 	TEXT_EXIT_SEALED =						"ep02_exit_sealed"			-- The door has been shut, find another way out. 
  120. 	TEXT_GAT_DIED =							"ep02_gat_died"				-- Gat died. 
  121. 	TEXT_DIDNT_ESCAPE =						"ep02_didnt_escape"			-- You did not escape the Ultor base in time. 
  122.  
  123. 	TEXT_RETURN_SAINTS_ROW =				"ep02_return_saints_row"	-- Get back to Saints Row. 
  124. 	TEXT_FAIL_OUT_OF_ROW =					"ep02_fail_out_of_row"		-- You did not get back to Saints Row in time. 
  125. 	 
  126. 	TEXT_WARN_WRONG_EXIT =					"ep02_warn_wrong_exit" 
  127. 	TEXT_FAIL_WRONG_EXIT =					"ep02_fail_wrong_exit" 
  128.  
  129. -- Other -- 
  130. 	IN_COOP =									false 
  131. 	SAINTS_ROW_DISTRICT_NAME =				"Saints Row" 
  132. 	OUT_OF_ROW_TIME_MS =						20 * 1000 
  133.  
  134. 	Timing_out_of_row =						{ [LOCAL_PLAYER] = false, [REMOTE_PLAYER] = false } 
  135. 	Saints_row_reached =						{ [LOCAL_PLAYER] = false, [REMOTE_PLAYER] = false } 
  136. 	Elevator_keys_acquired =				false 
  137.  
  138. 	Ultor_notoriety_vehicles =				4 
  139. 	Ultor_notoriety_vehicles_coop	=		6 
  140.  
  141. 	PLAYER_TIMER	=	{	[LOCAL_PLAYER] = 0, [REMOTE_PLAYER] = 1 } 
  142.  
  143. 	PLAYER_SYNC		=	{	[LOCAL_PLAYER]	= SYNC_LOCAL, 
  144. 								[REMOTE_PLAYER] = SYNC_REMOTE, 
  145. 							} 
  146.  
  147. 	OTHER_PLAYER	=	{	[LOCAL_PLAYER]	= REMOTE_PLAYER, 
  148. 								[REMOTE_PLAYER] = LOCAL_PLAYER, 
  149. 							} 
  150.  
  151. function ep02_start(ep02_checkpoint, is_restart) 
  152.  
  153. 	if (ep02_checkpoint == MISSION_START_CHECKPOINT) then 
  154.  
  155. 		local group_list = {GROUP_GAT, GROUP_COURTESY_CAR} 
  156. 		if (coop_is_active()) then 
  157. 			group_list = {GROUP_GAT, GROUP_COURTESY_CAR, GROUP_COURTESY_CAR_COOP} 
  158. 		end 
  159. 				 
  160. 		if (is_restart) then 
  161. 			for i,group in pairs(group_list) do 
  162. 				group_create(group, true) 
  163. 			end 
  164. 			teleport_coop(NAV_LOCAL_START, NAV_REMOTE_START) 
  165. 		else 
  166. 			cutscene_play("tsse02-01", group_list, {NAV_LOCAL_START, NAV_REMOTE_START}, false ) 
  167. 			for i,group in pairs(group_list) do 
  168. 				group_show(group) 
  169. 			end 
  170. 		end 
  171. 	end 
  172.  
  173. 	ep02_initialize(ep02_checkpoint, is_restart) 
  174.  
  175. 	-- Stage 1: Player(s) go to Saints Row and get their Ultor(Police) notoriety up to 4 stars 
  176. 	if ep02_checkpoint == MISSION_START_CHECKPOINT then 
  177. 		ep02_piss_off_the_ultor() 
  178.  
  179. 	-- Stage 2: Player(s) drop notoriety to 0, then head into the ultor base. Inside the base, they 
  180. 	-- obtain a key to some research labs where they have to plant bombs. 
  181. 	elseif ep02_checkpoint == CHECKPOINT_ULTOR_BASE then 
  182. 		ep02_ultor_base() 
  183.  
  184. 	-- Stage 3: Players flee the base in an APC 
  185. 	elseif ep02_checkpoint == CHECKPOINT_BOMBS_PLANTED then 
  186. 		ep02_escape() 
  187. 	end 
  188. end 
  189.  
  190. function ep02_initialize(checkpoint, is_restart) 
  191.  
  192. 	mission_start_fade_out(0.0) 
  193.  
  194. 	-- A few Global constants need to be set up, but shouldn't be changed after this function 
  195. 	-- ep02_setup_global_constants() 
  196.  
  197. 	ep02_initialize_common() 
  198.  
  199. 	ep02_initialize_checkpoint(checkpoint, is_restart) 
  200.  
  201. 	mission_start_fade_in() 
  202.  
  203. end 
  204.  
  205. -- Initialization code shared by all checkpoints. 
  206. function ep02_initialize_common() 
  207.  
  208. 	-- Start trigger is hit...the activate button was hit 
  209. 	set_mission_author("Phillip Alexander and Aaron Hanson (aka Father Zucosos)") 
  210.  
  211. 	if coop_is_active() then 
  212. 		IN_COOP = true 
  213. 	end 
  214.  
  215. 	-- Disable the teleport triggers that take the player into and out of the Ultor base 
  216. 	trigger_enable(TRIGGER_BASE_TELEPORT_ENTER, false) 
  217. 	trigger_enable(TRIGGER_BASE_TELEPORT_EXIT, false) 
  218.  
  219. 	trigger_enable(TRIGGER_ELEVATOR, false) 
  220. 	on_mission_item_pickup("") 
  221. 	on_mission_item_drop("") 
  222.  
  223. 	-- Don't allow players to call Gat during this mission. 
  224. 	homie_mission_lock("Johnny_Gat") 
  225.  
  226. end 
  227.  
  228. -- Initialization code specific to the checkpoint. 
  229. function ep02_initialize_checkpoint(checkpoint, is_restart) 
  230.  
  231. 	if ( checkpoint == MISSION_START_CHECKPOINT ) then 
  232.  
  233. 		set_unrecruitable_flag(CHAR_GAT, true) 
  234. 		on_death("ep02_failure_gat_died", CHAR_GAT) 
  235. 		on_dismiss("ep02_failure_gat_dismissed", CHAR_GAT) 
  236.  
  237. 	elseif ( checkpoint == CHECKPOINT_ULTOR_BASE ) then 
  238. 		on_death("ep02_failure_gat_died", CHAR_GAT) 
  239. 		on_dismiss("ep02_failure_gat_dismissed", CHAR_GAT) 
  240. 	elseif ( checkpoint == CHECKPOINT_BOMBS_PLANTED) then 
  241. 		on_death("ep02_failure_gat_died", CHAR_GAT) 
  242. 		on_dismiss("ep02_failure_gat_dismissed", CHAR_GAT) 
  243.  
  244. 		on_trigger(	"ep02_open_lab_door", TRIGGER_BASE_LAB_DOOR_1) 
  245. 		on_trigger(	"ep02_open_lab_door", TRIGGER_BASE_LAB_DOOR_2) 
  246. 		on_trigger(	"ep02_open_lab_door", TRIGGER_BASE_LAB_DOOR_3) 
  247. 		trigger_enable(TRIGGER_BASE_LAB_DOOR_1, true) 
  248. 		trigger_enable(TRIGGER_BASE_LAB_DOOR_2, true) 
  249. 		trigger_enable(TRIGGER_BASE_LAB_DOOR_3, true) 
  250.  
  251. 		teleport_coop(NAV_BOMBS_PLANTED_LOCAL_START, NAV_BOMBS_PLANTED_REMOTE_START) 
  252. 	end 
  253.  
  254. 	if (checkpoint ~= CHECKPOINT_BOMBS_PLANTED) then 
  255. 		door_lock(MM_BASE_LAB_DOOR_1, true) 
  256. 		door_lock(MM_BASE_LAB_DOOR_2, true) 
  257. 		door_lock(MM_BASE_LAB_DOOR_3, true) 
  258. 	end 
  259. end 
  260.  
  261. function ep02_district_changed(player, new_district_name, prev_district_name) 
  262.  
  263. 	local timer = PLAYER_TIMER[player] 
  264. 	local sync = PLAYER_SYNC[player] 
  265.  
  266. 	-- If we've entered the row 
  267. 	if ( new_district_name == SAINTS_ROW_DISTRICT_NAME ) then 
  268.  
  269. 		Saints_row_reached[player] = true 
  270. 		-- Tell this player to get their Ultor notoriety up to 4. 
  271. 		if ( not (notoriety_get("Police") == 4)) then 
  272. 			mission_help_table(TEXT_ULTOR_NOTORIETY, "", "", sync) 
  273. 		end 
  274.  
  275. 		-- Update the ui and don't allow notoriety to decay 
  276. 		hud_timer_stop(timer) 
  277. 		Timing_out_of_row[player] = false 
  278. 		district_set_pulsing( SAINTS_ROW_DISTRICT_NAME, false, sync) 
  279. 		marker_remove_navpoint(NAV_SAINTS_ROW, sync) 
  280. 		mission_waypoint_remove(sync) 
  281. 		notoriety_set_can_decay(false) 
  282. 	end 
  283.  
  284. 	-- If we were in the row and we left 
  285. 	if (	(Saints_row_reached[player] == true) and  
  286. 			(new_district_name ~= SAINTS_ROW_DISTRICT_NAME) and 
  287. 			(not Timing_out_of_row[player]) 
  288. 		) then 
  289.  
  290. 		-- Update the UI 
  291. 		district_set_pulsing( SAINTS_ROW_DISTRICT_NAME, true, sync) 
  292. 		marker_add_navpoint(NAV_SAINTS_ROW, MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, sync) 
  293. 		mission_waypoint_add(NAV_SAINTS_ROW, sync)	 
  294. 		notoriety_set_can_decay(true) 
  295. 		Timing_out_of_row[player] = true 
  296.  
  297. 		-- Tell the player to get back to the Row, start a timer. 
  298. 		hud_timer_set(timer, OUT_OF_ROW_TIME_MS,"ep02_failure_out_of_row", false, sync) 
  299. 		mission_help_table_nag(TEXT_RETURN_SAINTS_ROW, "", "", sync) 
  300. 	end 
  301.  
  302. end 
  303.  
  304. function ep02_piss_off_the_ultor() 
  305.  
  306. 	-- Make the district pulse, add destination to the minimap. 
  307.    district_set_pulsing( SAINTS_ROW_DISTRICT_NAME, true, SYNC_ALL ) 
  308. 	marker_add_navpoint(NAV_SAINTS_ROW, MINIMAP_ICON_LOCATION, INGAME_EFFECT_VEHICLE_LOCATION, SYNC_ALL) 
  309. 	mission_waypoint_add(NAV_SAINTS_ROW, SYNC_ALL)	 
  310.  
  311. 	 -- Set up district-tracking callbacks 
  312. 	if ( IN_COOP ) then 
  313. 		on_district_changed( "ep02_district_changed", REMOTE_PLAYER ) 
  314. 	end 
  315. 	on_district_changed( "ep02_district_changed", LOCAL_PLAYER ) 
  316.  
  317. 	-- Tell the player(s) to head to Saints Row 
  318. 	mission_help_table(TEXT_GO_TO_SAINTS_ROW) 
  319.  
  320. 	-- Wait for either player to enter saint's row 
  321. 	while ( not (Saints_row_reached[LOCAL_PLAYER] or Saints_row_reached[REMOTE_PLAYER]) ) do 
  322. 		thread_yield() 
  323. 	end 
  324.  
  325. 	-- Up the number of desired Ultor when their notoriety reaches 2. 
  326. 	while( notoriety_get("Police") < 2) do 
  327. 		thread_yield() 
  328. 	end 
  329. 	local num_vehicles = Ultor_notoriety_vehicles 
  330. 	if (IN_COOP) then 
  331. 		num_vehicles = Ultor_notoriety_vehicles_coop 
  332. 	end 
  333. 	notoriety_set_desired_vehicle_count("Ultor", num_vehicles) 
  334. 	notoriety_set_desired_vehicle_count("Police", num_vehicles) 
  335. 	gang_force_spawn("Ultor", true) 
  336.  
  337. 	-- Wait for Ultor notoriety to reach 4. 
  338. 	while( notoriety_get("Police") < 4) do 
  339. 		thread_yield() 
  340. 	end 
  341.  
  342. 	-- Eliminate district change callbacks 
  343. 	if ( IN_COOP ) then 
  344. 		on_district_changed( "", REMOTE_PLAYER ) 
  345. 	end 
  346. 	on_district_changed( "", LOCAL_PLAYER ) 
  347.  
  348. 	-- Reset notoriety spawning 
  349. 	notoriety_set_desired_vehicle_count("Ultor", -1) 
  350. 	notoriety_set_desired_vehicle_count("Police", -1) 
  351. 	gang_force_spawn("Ultor", false) 
  352. 	notoriety_set_can_decay(true) 
  353.  
  354. 	-- Make sure that timers are stopped, district is not pulsing 
  355. 	hud_timer_stop(PLAYER_TIMER[LOCAL_PLAYER]) 
  356. 	hud_timer_stop(PLAYER_TIMER[REMOTE_PLAYER]) 
  357. 	district_set_pulsing( SAINTS_ROW_DISTRICT_NAME, false, SYNC_ALL) 
  358. 	marker_remove_navpoint(NAV_SAINTS_ROW, SYNC_ALL) 
  359. 	mission_waypoint_remove(SYNC_ALL) 
  360.  
  361. 	-- Send the players to the ultor base 
  362. 	ep02_enter_ultor_base() 
  363.  
  364. end 
  365.  
  366. function ep02_enter_ultor_base() 
  367.  
  368. 	-- Send the players to the ultor base's secret entrance, but require them to have 0 notoriety. 
  369. 	ep02_send_to_location(	TRIGGER_NEAR_BASE_ENTRANCE,  
  370. 									INGAME_EFFECT_VEHICLE_LOCATION,  
  371. 									TEXT_GO_TO_BASE, 
  372. 									true,  
  373. 									{	{ep02_prereq_low_notoriety, TEXT_NOTORIETY_ZERO}, 
  374. 									} 
  375. 								) 
  376.  
  377. 	-- Breadcrumb down to the base proper 
  378. 	ep02_breadcrumb_to_location(	TRIGGERS_BASE_ENTRY_BREADCRUMBS, INGAME_EFFECT_LOCATION, TEXT_MEET_GAT) 
  379. 	--mesh_mover_reset_to_action_end(MM_BASE_TUNNEL_DOOR, "start1") 
  380. 	 
  381. 	--check to make sure Player's notoriety is less than 2 
  382. 	local notoriety_low = (notoriety_get_decimal("Police") < 2) 
  383. 	 
  384. 	if (notoriety_low == true) then 
  385. 		set_unrecruitable_flag(CHAR_GAT, false) 
  386. 		party_add(CHAR_GAT) 
  387. 		on_death("ep02_failure_gat_died", CHAR_GAT) 
  388. 		on_dismiss("ep02_failure_gat_dismissed", CHAR_GAT) 
  389. 	 
  390. 		-- If Gat is told to follow the client, it could be awhile before he actually 
  391. 		-- joins the party. Don't create a checkpoint until he's actually added or he 
  392. 		-- won't be recreated when restarting from the checkpoint. 
  393. 		while(not npc_is_in_party(CHAR_GAT)) do 
  394. 			thread_yield() 
  395. 		end 
  396. 		mission_set_checkpoint(CHECKPOINT_ULTOR_BASE) 
  397. 		ep02_ultor_base() 
  398. 	end 
  399. 	 
  400. end 
  401.  
  402. Bombs_planted = 0 
  403. function ep02_ultor_base() 
  404.  
  405. 	-- Breadcrumb to the keys 
  406. 	ep02_breadcrumb_to_location(	TRIGGERS_KEY_BREADCRUMBS, INGAME_EFFECT_LOCATION, TEXT_GET_KEY) 
  407. 	group_create(GROUP_ULTOR_BASE, true) 
  408. 	on_pickup("ep02_elevator_keys_acquired", ITEM_ELEVATOR_KEYS) 
  409.  
  410. 	group_create_hidden(GROUP_BOMBS, true) 
  411.  
  412. 	while (not Elevator_keys_acquired) do 
  413. 		thread_yield() 
  414. 	end 
  415.  
  416. 	trigger_enable(TRIGGER_BASE_LAB_DOOR_1, true) 
  417. 	trigger_enable(TRIGGER_BASE_LAB_DOOR_2, true) 
  418. 	trigger_enable(TRIGGER_BASE_LAB_DOOR_3, true) 
  419. 	on_trigger(	"ep02_open_lab_door", TRIGGER_BASE_LAB_DOOR_1) 
  420. 	on_trigger(	"ep02_open_lab_door", TRIGGER_BASE_LAB_DOOR_2) 
  421. 	on_trigger(	"ep02_open_lab_door", TRIGGER_BASE_LAB_DOOR_3) 
  422.  
  423. 	mission_help_table(TEXT_DESTROY_LABS) 
  424.  
  425. 	for i, bomb_trigger in pairs(TRIGGERS_BOMBS) do 
  426. 		marker_add_trigger(bomb_trigger, MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, SYNC_ALL) 
  427. 		trigger_enable(bomb_trigger, true) 
  428. 		on_trigger("ep02_plant_bomb", bomb_trigger) 
  429. 	end 
  430.  
  431. 	local num_bombs = sizeof_table(TRIGGERS_BOMBS) 
  432. 	while(Bombs_planted < num_bombs) do  
  433. 		thread_yield() 
  434. 	end 
  435.  
  436. 	mission_set_checkpoint(CHECKPOINT_BOMBS_PLANTED) 
  437. 	ep02_escape() 
  438. end 
  439.  
  440. function ep02_plant_bomb(triggerer, trigger) 
  441.  
  442. 	local trigger_to_bomb =  
  443. 		{ 
  444. 			["ep02_$t000"] = "ep02_$i003", 
  445. 			["ep02_$t009"] = "ep02_$i002", 
  446. 			["ep02_$t010"] = "ep02_$i004", 
  447. 		} 
  448.  
  449. 	-- Disable trigger, remove markers 
  450. 	on_trigger("", trigger) 
  451. 	trigger_enable(trigger, false) 
  452. 	marker_remove_trigger(trigger, SYNC_ALL) 
  453.  
  454. 	-- Make sure that player can't be damaged/moved while planting the bomb 
  455. 	turn_invulnerable(triggerer, false) 
  456. 	character_prevent_explosion_fling(triggerer, true) 
  457.  
  458. 	-- Take over player controls 
  459. 	player_controls_disable(triggerer) 
  460. 	inv_weapon_enable_or_disable_all_slots(false, PLAYER_SYNC[triggerer]) 
  461.  
  462. 	-- Make sure that the player is crouching 
  463. 	local crouch_forced = false 
  464. 	if not crouch_is_crouching(triggerer) then 
  465. 		crouch_start(triggerer) 
  466. 		crouch_forced = true 
  467. 		delay(1) 
  468. 	end 
  469.  
  470. 	-- Play the bomb planting animation and sound 
  471. 	set_animation_state(triggerer, "crouch plant bomb")				 
  472. 	local bomb_planting_audio = audio_play_for_navpoint("SFX_DON_BOMBPLANTING", trigger, "foley") 
  473. 	delay(1) 
  474. 	audio_stop(bomb_planting_audio) 
  475. 	audio_play_for_navpoint("SFX_DON_BOMBPLANTED", trigger, "foley") 
  476.  
  477. 	-- Return player to normal 
  478. 	clear_animation_state(triggerer) 
  479. 	if crouch_forced then 
  480. 		crouch_stop(triggerer) 
  481. 	end		 
  482. 	inv_weapon_enable_or_disable_all_slots(true, PLAYER_SYNC[triggerer]) 
  483. 	player_controls_enable(triggerer) 
  484. 	character_prevent_explosion_fling(triggerer, false) 
  485. 	turn_vulnerable(triggerer) 
  486.  
  487. 	item_show(trigger_to_bomb[trigger]) 
  488. 	Bombs_planted = Bombs_planted + 1 
  489.  
  490. end 
  491.  
  492. function ep02_open_lab_door(triggerer, trigger) 
  493.  
  494. 	on_trigger("", trigger) 
  495. 	trigger_enable(trigger, false) 
  496.  
  497. 	local trigger_to_door =  
  498. 		{ 
  499. 			[TRIGGER_BASE_LAB_DOOR_1] = MM_BASE_LAB_DOOR_1, 
  500. 			[TRIGGER_BASE_LAB_DOOR_2] = MM_BASE_LAB_DOOR_2, 
  501. 			[TRIGGER_BASE_LAB_DOOR_3] = MM_BASE_LAB_DOOR_3, 
  502. 		} 
  503.  
  504. 	local mm_door = trigger_to_door[trigger] 
  505. 	door_open(mm_door) 
  506. 	--mesh_mover_play_action(mm_door, "start1") 
  507. 	--delay(2.0) 
  508. 	--mesh_mover_hide(mm_door) 
  509.  
  510. end 
  511.  
  512. function ep02_cutscene() 
  513.  
  514. 	hud_timer_pause(0, true) 
  515.  
  516. 	for i,cte_trigger in pairs(TRIGGER_CTES) do 
  517. 		on_trigger("", cte_trigger) 
  518. 		trigger_enable(cte_trigger, false) 
  519. 	end 
  520.  
  521. 	marker_remove_navpoint(NAV_WASTE_TUNNEL, SYNC_ALL) 
  522.  
  523. 	mission_start_fade_out(0.0) 
  524. 	cutscene_play("IG_ep02_scene1", "", {NAV_CUTSCENE_LOCAL_START, NAV_CUTSCENE_REMOTE_START}, false) 
  525. 	mesh_mover_reset_to_action_end(MM_BASE_ESCAPE_DOOR, "start1") 
  526. 	group_destroy(GROUP_CTE) 
  527. 	 
  528. 	mission_start_fade_in() 
  529. 	Cutscene_triggered = true 
  530. 	hud_timer_pause(0, false) 
  531. 	 
  532. end 
  533.  
  534. Cutscene_triggered = false 
  535. function ep02_escape() 
  536.  
  537. 	for i,cte_trigger in pairs(TRIGGER_CTES) do 
  538. 		on_trigger("ep02_cutscene", cte_trigger) 
  539. 		trigger_enable(cte_trigger, true) 
  540. 	end 
  541.  
  542. 	on_trigger("", TRIGGER_WRONG_EXIT_WARNING) 
  543. 	trigger_enable(TRIGGER_WRONG_EXIT_WARNING, false) 
  544. 	trigger_set_delay_between_activations(TRIGGER_WRONG_EXIT_WARNING,0) 
  545.  
  546. 	on_trigger("", TRIGGER_WRONG_EXIT_FAIL) 
  547. 	trigger_enable(TRIGGER_WRONG_EXIT_FAIL, false) 
  548.  
  549.  
  550. 	audio_play_for_navpoint("SFX_ALARM_5", NAV_ALARM_SOURCES, "foley") 
  551. 	 
  552. 	city_chunk_set_all_civilians_fleeing("sr2_UG_chunk095_UB01", true) 
  553. 	city_chunk_set_all_civilians_fleeing("sr2_UG_chunk095_UB02", true) 
  554. 		 
  555. 	hud_timer_set(0, 105000, "ep02_failure_bomb_timer", true) 
  556.  
  557. 	marker_add_navpoint(NAV_WASTE_TUNNEL, MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, SYNC_ALL) 
  558. 	mission_help_table(TEXT_GET_OUT) 
  559.  
  560. 	group_create_hidden(GROUP_ESCAPE, true) 
  561.  
  562. 	while(not Cutscene_triggered) do 
  563. 		thread_yield() 
  564. 	end 
  565. 	 
  566. 	-- Eanble the wrong exit triggers 
  567. 	on_trigger("ep02_wrong_exit_warning", TRIGGER_WRONG_EXIT_WARNING) 
  568. 	trigger_enable(TRIGGER_WRONG_EXIT_WARNING, true) 
  569.  
  570. 	on_trigger("ep02_failure_wrong_exit", TRIGGER_WRONG_EXIT_FAIL) 
  571. 	trigger_enable(TRIGGER_WRONG_EXIT_FAIL, true) 
  572.  
  573. 	audio_play_for_navpoint("SFX_ALARM_5", NAV_ALARM_SOURCES, "foley") 
  574. 	city_chunk_set_all_civilians_fleeing("sr2_UG_chunk095_UB01", true) 
  575. 	city_chunk_set_all_civilians_fleeing("sr2_UG_chunk095_UB02", true) 
  576.  
  577. 	group_show(GROUP_ESCAPE) 
  578. --	set_unjackable_flag(VEH_APC, true) 
  579.  
  580. 	mission_help_table(TEXT_GET_OUT) 
  581. 	delay(2) 
  582. 	marker_add_vehicle(VEH_APC, MINIMAP_ICON_LOCATION, INGAME_EFFECT_VEHICLE_INTERACT, SYNC_ALL) 
  583.  
  584. 	while not character_is_in_vehicle(LOCAL_PLAYER, VEH_APC) do 
  585. 		thread_yield() 
  586. 	end 
  587. 	while (IN_COOP and (not character_is_in_vehicle(REMOTE_PLAYER, VEH_APC)) ) do 
  588. 		thread_yield() 
  589. 	end 
  590. 	 
  591. 	marker_remove_vehicle(VEH_APC, SYNC_ALL) 
  592.  
  593. 	local function all_characters_in_vehicle() 
  594. 		if (not character_is_in_vehicle(LOCAL_PLAYER, VEH_APC)) then 
  595. 			return false 
  596. 		end 
  597. 		if ( IN_COOP and (not character_is_in_vehicle(REMOTE_PLAYER, VEH_APC)) ) then 
  598. 			return false 
  599. 		end 
  600. 		if ( character_is_dead(CHAR_GAT) or (not character_is_in_vehicle(CHAR_GAT)) ) then 
  601. 			return false 
  602. 		end 
  603. 		return true 
  604. 	end 
  605.  
  606. 	while not (all_characters_in_vehicle() and get_dist_char_to_nav(LOCAL_PLAYER, NAV_ESCAPE_FINISH) <= 5) do 
  607. 		thread_yield() 
  608. 	end 
  609.  
  610. 	hud_timer_stop(0) 
  611.  
  612. 	ep02_success_base_escaped() 
  613. end 
  614.  
  615. Wrong_exit_warning_played = {[LOCAL_PLAYER] = false, [REMOTE_PLAYER] = false} 
  616.  
  617. function ep02_wrong_exit_warning(triggerer) 
  618. 	if(not Wrong_exit_warning_played[triggerer]) then 
  619. 		mission_help_table_nag(TEXT_WARN_WRONG_EXIT, "", "", PLAYER_SYNC[triggerer]) 
  620. 		Wrong_exit_warning_played[triggerer] = true 
  621. 	end 
  622. end 
  623.  
  624. function ep02_elevator_keys_acquired() 
  625. 	on_pickup("", ITEM_ELEVATOR_KEYS) 
  626. 	Elevator_keys_acquired = true 
  627. 	notoriety_set_max("Police",3) 
  628. 	notoriety_set_min("Police",3) 
  629. end 
  630.  
  631. function ep02_prereq_low_notoriety() 
  632.  
  633. 	-- Is notoriety above 1? 
  634. 	local notoriety_low = (notoriety_get_decimal("Police") < 2) 
  635.  
  636. 	-- Updates the gps of one player 
  637. 	local function update_confessional_gps(player) 
  638.  
  639. 		if(not notoriety_low) then 
  640. 			local new_confessional = confessionals_get_nearest_trigger(player) 
  641. 			ep02_update_waypoint(new_confessional, player) 
  642. 		end 
  643.  
  644. 	end 
  645.  
  646. 	-- Update both players' gps 
  647. 	update_confessional_gps(LOCAL_PLAYER) 
  648. 	if (IN_COOP) then 
  649. 		update_confessional_gps(REMOTE_PLAYER) 
  650. 	end 
  651.  
  652. 	-- Return true if the prereq is met, false else 
  653. 	return notoriety_low 
  654.  
  655. end 
  656.  
  657. Gps_waypoint = {[LOCAL_PLAYER] = "", [REMOTE_PLAYER] = ""} 
  658. function ep02_update_waypoint(waypoint, player) 
  659. 	if(Gps_waypoint[player] ~= waypoint) then 
  660. 		 
  661. 		Gps_waypoint[player] = waypoint 
  662. 		mission_waypoint_remove(PLAYER_SYNC[player]) 
  663. 		 
  664. 		if(waypoint ~= "") then 
  665. 			mission_waypoint_add(waypoint, PLAYER_SYNC[player]) 
  666. 		end 
  667. 		 
  668. 	end 
  669. end 
  670.  
  671. ep02_location_reached			= false 
  672. function ep02_send_to_location(trigger, effect, helptext, use_waypoint, prereq_list, time, time_failure_function) 
  673.  
  674. 	-- Location not yet reached 
  675. 	ep02_location_reached = false 
  676.  
  677. 	-- enable the trigger, add a minimap icon, glow effect, and callback 
  678. 	trigger_enable(trigger,true) 
  679. 	marker_add_trigger(trigger,MINIMAP_ICON_LOCATION,effect) 
  680. 	on_trigger("ep02_toggle_location_reached",trigger) 
  681.  
  682. 	-- Maybe add waypoint 
  683. 	if (use_waypoint) then 
  684. 		ep02_update_waypoint(trigger, LOCAL_PLAYER) 
  685. 		if(IN_COOP) then 
  686. 			ep02_update_waypoint(trigger, REMOTE_PLAYER) 
  687. 		end 
  688. 	end 
  689.  
  690. 	-- Maybe add failure function 
  691. 	if (time and time_failure_function) then 
  692. 		hud_timer_set(1, time, time_failure_function) 
  693. 	end 
  694.  
  695. 	-- wait for player(s) to arrive 
  696. 	local initial_pass = true 
  697. 	local failed_prereq = 0 
  698. 	while (not ep02_location_reached) do 
  699.  
  700. 		-- Maybe check to see if player needs to do something else before heading to location 
  701. 		if(prereq_list ~= nil) then 
  702.  
  703. 			local new_failed_prereq = 0 
  704.  
  705. 			-- Prereqs are listed in order of importance, so we can't use pairs() 
  706. 			for i=1, sizeof_table(prereq_list), 1 do 
  707.  
  708. 				local prereq_function = prereq_list[i][1] 
  709. 				local prereq_helptext = prereq_list[i][2] 
  710.  
  711. 				if(not prereq_function()) then 
  712.  
  713. 					-- If we just began failing the prereq... 
  714. 					if ( i ~= failed_prereq ) then 
  715.  
  716. 						-- Eliminate any leftover waypoints from lower-priority prereqs failing 
  717. 						ep02_update_waypoint( "", LOCAL_PLAYER) 
  718. 						if (IN_COOP) then 
  719. 							ep02_update_waypoint( "", REMOTE_PLAYER) 
  720. 						end 
  721.  
  722. 						--Disable destination location 
  723. 						if(failed_prereq == 0) then 
  724. 							trigger_enable(trigger,false) 
  725. 							marker_remove_trigger(trigger) 
  726. 						end 
  727.  
  728. 						-- Tell the player what they need to do 
  729. 						if( prereq_helptext ) then 
  730. 							mission_help_table(prereq_helptext) 
  731. 						end 
  732. 					end 
  733.  
  734. 					-- We don't need to check any more prereqs 
  735. 					new_failed_prereq = i 
  736. 					break; 
  737.  
  738. 				end -- Ends prereq function fulfillment 
  739. 			end -- Ends loop over prereqs 
  740.  
  741. 			-- If the players weren't meeting prereqs and now they are then reenable the destination 
  742. 			if ( (new_failed_prereq == 0) and (failed_prereq ~= 0) ) then 
  743. 	 
  744. 				ep02_update_waypoint( "", LOCAL_PLAYER) 
  745. 				if (IN_COOP) then 
  746. 					ep02_update_waypoint( "", REMOTE_PLAYER) 
  747. 				end 
  748.  
  749. 				-- Reenable trigger, add minimap location and waypoint 
  750. 				trigger_enable(trigger,true) 
  751. 				marker_add_trigger(trigger,MINIMAP_ICON_LOCATION,effect,SYNC_ALL) 
  752. 				if (use_waypoint) then 
  753. 					ep02_update_waypoint( trigger, LOCAL_PLAYER) 
  754. 					if (IN_COOP) then 
  755. 						ep02_update_waypoint( trigger, REMOTE_PLAYER) 
  756. 					end 
  757. 				end 
  758.  
  759. 				-- Remind players what the original goal was 
  760. 				if (helptext) then 
  761. 					mission_help_table(helptext) 
  762. 				end 
  763.  
  764. 			-- On the initial pass, if no prereqs were failed then display the helptext 
  765. 			elseif( new_failed_prereq == 0 and initial_pass) then 
  766. 				if (helptext) then 
  767. 					mission_help_table(helptext) 
  768. 				end 
  769. 			end 
  770.  
  771. 			failed_prereq = new_failed_prereq 
  772.  
  773. 		end -- Ends prereq list processing 
  774.  
  775. 		initial_pass = false 
  776.  
  777. 		thread_yield() 
  778. 	end 
  779.  
  780. 	-- Maybe turn off timer 
  781. 	if (time and time_failure_function) then 
  782. 			hud_timer_stop(1) 
  783. 	end 
  784. end 
  785.  
  786. function ep02_toggle_location_reached(triggerer,trigger) 
  787. 	ep02_location_reached = true		 
  788. 	trigger_enable(trigger, false) 
  789. 	marker_remove_trigger(trigger, SYNC_ALL) 
  790. 	on_trigger("",trigger) 
  791. 	ep02_update_waypoint("", LOCAL_PLAYER) 
  792. 	if (IN_COOP) then 
  793. 		ep02_update_waypoint("", REMOTE_PLAYER) 
  794. 	end 
  795. end 
  796.  
  797. Ep02_final_breadcrumb_reached	= false 
  798. Ep02_current_breadcrumb			= 1 
  799. Ep02_breadcrumb_triggers		= {} 
  800. Ep02_breadcrumb_helptext		= {} 
  801. Ep02_breadcrumb_effect			= "" 
  802. function ep02_breadcrumb_to_location(trigger, effect, helptext, time, time_failure_function) 
  803.  
  804. 	Ep02_final_breadcrumb_reached = false 
  805. 	Ep02_breadcrumb_effect = false 
  806. 	if (effect) then 
  807. 		Ep02_breadcrumb_effect = effect 
  808. 	end 
  809. 	Ep02_current_breadcrumb = 1 
  810. 	Ep02_breadcrumb_triggers = {} 
  811. 	Ep02_breadcrumb_helptext = {} 
  812.  
  813. 	-- Place triggers into a global table variable 
  814. 	if ((type(trigger) == "table")) then 
  815. 		Ep02_breadcrumb_triggers = trigger 
  816. 	else 
  817. 		Ep02_breadcrumb_triggers[1] = trigger 
  818. 	end 
  819.  
  820. 	-- Same for helptext 
  821. 	if ((type(helptext) == "table")) then 
  822. 		Ep02_breadcrumb_helptext = helptext 
  823. 	else 
  824. 		Ep02_breadcrumb_helptext[1] = helptext 
  825. 	end 
  826.  
  827. 	-- Add callbacks for all triggers, special callback for final trigger 
  828. 	local num_breadcrumbs = sizeof_table(Ep02_breadcrumb_triggers) 
  829. 	for i,breadcrumb in pairs(Ep02_breadcrumb_triggers) do 
  830. 		trigger_enable(breadcrumb,true) 
  831. 		if (i == num_breadcrumbs) then 
  832. 			on_trigger("ep02_final_breadcrumb_triggered",breadcrumb)					 
  833. 		else 
  834. 			on_trigger("ep02_breadcrumb_reached", breadcrumb) 
  835. 		end 
  836. 	end 
  837.  
  838. 	if (effect) then 
  839. 		marker_add_trigger(Ep02_breadcrumb_triggers[Ep02_current_breadcrumb],MINIMAP_ICON_LOCATION,effect,SYNC_ALL) 
  840. 		mission_waypoint_add( Ep02_breadcrumb_triggers[Ep02_current_breadcrumb], SYNC_ALL ) 
  841. 	end 
  842.  
  843. 	-- Setup the time restraint if there is one. 
  844. 	if (time and time_failure_function) then 
  845. 		hud_timer_set(0, time, time_failure_function) 
  846. 	end 
  847.  
  848. 	-- Display helptext 
  849. 	if (Ep02_breadcrumb_helptext[1]) then 
  850. 		mission_help_table(Ep02_breadcrumb_helptext[1]) 
  851. 	end 
  852.  
  853. 	-- Wait for player to arrive at the location 
  854. 	while (not Ep02_final_breadcrumb_reached) do 
  855. 		thread_yield() 
  856. 	end 
  857. 	hud_timer_stop(0) 
  858.  
  859. 	Ep02_final_breadcrumb_reached = false 
  860. end 
  861.  
  862. function ep02_breadcrumb_reached(triggerer, trigger) 
  863.  
  864. 	-- Disable all breadcrumbs up to and including the one that we just hit 
  865. 	for i = Ep02_current_breadcrumb, sizeof_table(Ep02_breadcrumb_triggers), 1 do 
  866. 		local breadcrumb = Ep02_breadcrumb_triggers[i] 
  867. 		trigger_enable(breadcrumb,false) 
  868. 		on_trigger("",trigger) 
  869. 		marker_remove_trigger(trigger, SYNC_ALL) 
  870. 		Ep02_current_breadcrumb = i+1 
  871. 		if(Ep02_breadcrumb_triggers[i] == trigger) then 
  872. 			break 
  873. 		end 
  874. 	end 
  875.  
  876. 	-- Display helptext for the just-hit trigger. 
  877. 	if (Ep02_breadcrumb_helptext[trigger]) then 
  878. 		mission_help_table(Ep02_breadcrumb_helptext[trigger]) 
  879. 	end 
  880.  
  881. 	mission_waypoint_remove() 
  882.  
  883. 	-- Add an effect to the next trigger 
  884. 	if (Ep02_breadcrumb_effect) then 
  885. 		marker_add_trigger(Ep02_breadcrumb_triggers[Ep02_current_breadcrumb],MINIMAP_ICON_LOCATION,Ep02_breadcrumb_effect,SYNC_ALL) 
  886. 		mission_waypoint_add( Ep02_breadcrumb_triggers[Ep02_current_breadcrumb], SYNC_ALL ) 
  887. 	end 
  888. end 
  889.  
  890. function ep02_final_breadcrumb_triggered(triggerer,trigger) 
  891.  
  892. 	-- disable all breadcrumb triggers 
  893. 	for i = Ep02_current_breadcrumb, sizeof_table(Ep02_breadcrumb_triggers), 1 do 
  894. 		local breadcrumb = Ep02_breadcrumb_triggers[i] 
  895. 		trigger_enable(breadcrumb,false) 
  896. 		on_trigger("",trigger) 
  897. 		marker_remove_trigger(trigger, SYNC_ALL) 
  898. 	end 
  899.  
  900. 	Ep02_final_breadcrumb_reached = true		 
  901.  
  902. 	mission_waypoint_remove() 
  903. end 
  904.  
  905. function ep02_failure_out_of_row() 
  906. 	mission_end_failure("ep02", TEXT_FAIL_OUT_OF_ROW) 
  907. end 
  908.  
  909. function ep02_failure_bomb_timer() 
  910. 	hud_bar_off(0) 
  911. 	mission_end_failure("ep02", TEXT_DIDNT_ESCAPE) 
  912. end 
  913.  
  914. function ep02_failure_gat_dismissed() 
  915. 	mission_end_failure("ep02", TEXT_GAT_DIED) 
  916. end 
  917.  
  918. function ep02_failure_gat_died() 
  919. 	mission_end_failure("ep02", TEXT_GAT_DIED) 
  920. end 
  921.  
  922. function ep02_failure_wrong_exit() 
  923. 	mission_end_failure("ep02", TEXT_FAIL_WRONG_EXIT) 
  924. end 
  925.  
  926. function ep02_success_base_escaped() 
  927. 	mission_end_success("ep02", "tsse02-02") 
  928. end 
  929.  
  930. function ep02_cleanup() 
  931.  
  932. 	IN_COOP = coop_is_active() 
  933.  
  934. 	-- Reenable the teleport triggers that take the player into and out of the Ultor base 
  935. 	trigger_enable(TRIGGER_BASE_TELEPORT_ENTER, true) 
  936. 	trigger_enable(TRIGGER_BASE_TELEPORT_EXIT, true) 
  937.  
  938. 	-- Allow players to summon Gat normally if he's been unlocked. 
  939. 	homie_mission_unlock("Johnny_Gat") 
  940.  
  941. 	inv_weapon_enable_or_disable_all_slots(true, SYNC_ALL) 
  942. 	turn_vulnerable(LOCAL_PLAYER) 
  943. 	clear_animation_state(LOCAL_PLAYER) 
  944. 	if (IN_COOP) then 
  945. 		turn_vulnerable(REMOTE_PLAYER) 
  946. 		clear_animation_state(REMOTE_PLAYER) 
  947. 	end 
  948.  
  949. 	-- Cleanup mission here 
  950. 	group_destroy(GROUP_ULTOR_BASE) 
  951.  
  952. 	-- Cleanup notoriety changes 
  953. 	notoriety_set_desired_vehicle_count("Ultor", -1) 
  954. 	notoriety_set_desired_vehicle_count("Police", -1) 
  955. 	gang_force_spawn("Ultor", false) 
  956. 	notoriety_set_can_decay(true) 
  957.  
  958. 	-- Cleanup UI 
  959. 	hud_timer_stop(PLAYER_TIMER[LOCAL_PLAYER]) 
  960. 	hud_timer_stop(PLAYER_TIMER[REMOTE_PLAYER]) 
  961. 	district_set_pulsing( SAINTS_ROW_DISTRICT_NAME, false, SYNC_ALL) 
  962. 	marker_remove_navpoint(NAV_SAINTS_ROW, SYNC_ALL) 
  963. 	mission_waypoint_remove(SYNC_ALL) 
  964. 	marker_remove_navpoint(NAV_WASTE_TUNNEL) 
  965. 	if (vehicle_exists(VEH_APC) ) then 
  966. 		marker_remove_vehicle(VEH_APC) 
  967. 	end 
  968. 	for i, bomb_trigger in pairs(TRIGGERS_BOMBS) do 
  969. 		marker_remove_trigger(bomb_trigger) 
  970. 	end 
  971. 	for i, trigger in pairs(TRIGGERS_BASE_ENTRY_BREADCRUMBS) do 
  972. 		marker_remove_trigger(trigger) 
  973. 	end 
  974. 	for i, trigger in pairs(TRIGGERS_KEY_BREADCRUMBS) do 
  975. 		marker_remove_trigger(trigger) 
  976. 	end 
  977. 	marker_remove_trigger(TRIGGER_NEAR_BASE_ENTRANCE) 
  978.  
  979. 	persona_override_character_stop(CHAR_GAT, POT_SITUATIONS[POT_ATTACK]) 
  980. 	persona_override_character_stop(CHAR_GAT, POT_SITUATIONS[POT_TAKE_DAMAGE]) 
  981.  
  982. 	trigger_enable(TRIGGER_ELEVATOR, true) 
  983.  
  984. 	 -- Remove district-tracking callbacks 
  985. 	if ( IN_COOP ) then 
  986. 		on_district_changed( "", REMOTE_PLAYER ) 
  987. 	end 
  988. 	on_district_changed( "", LOCAL_PLAYER ) 
  989.  
  990. end 
  991.  
  992. function ep02_success() 
  993. 	-- Called when the mission has ended with success 
  994. 	--bink_play_movie(CUTSCENE_OUT) 
  995.  
  996. 	-- Post the news event 
  997. 	radio_post_event("JANE_NEWS_TSSE02", true) 
  998. end 
  999.