sr2lua/ep03.lua

  1. -- ep03.lua 
  2. -- SR2 mission script 
  3. -- 3/28/07 
  4.  
  5. -- Groups -- 
  6. GROUP_ULTOR_BOATS =		"ep03_$ultor_patrol" 
  7. GROUP_WAVECRAFT =			"ep03_$wavecraft" 
  8. GROUP_WAVECRAFT_COOP =  "ep03_$wavecraft_coop" 
  9. GROUP_ULTOR_EXECS =		"ep03_$ultor_execs" 
  10. GROUP_GETAWAY_BOAT =		"ep03_$getaway_boat" 
  11. GROUP_FINAL_EXEC =		"ep03_$final_exec" 
  12. GROUP_SECURITY =			"ep03_$security" 
  13. GROUP_PARTYGOERS =		"ep03_$partygoers" 
  14. GROUP_CUTSCENE =			"ep03_$cutscene" 
  15. GROUP_HELI_ONE =			"ep03_$heli_one" 
  16. GROUP_HELI_TWO =			"ep03_$heli_two" 
  17.  
  18. HELICOPTER_GROUPS =		{ GROUP_HELI_ONE, GROUP_HELI_TWO } 
  19.  
  20. -- Navpoints -- 
  21. LOCAL_PLAYER_START			= "ep03_$player_start" 
  22. REMOTE_PLAYER_START			= "ep03_$remote_start" 
  23. NAV_YACHT =						"ep03_$yacht" 
  24. NAV_YACHT_ENTRY =				"ep03_$n003" 
  25. NAV_ULTOR_PATROL_1 =			"ep03_$patrol_1" 
  26. NAV_ULTOR_PATROL_2 =			"ep03_$patrol_2" 
  27. NAV_ULTOR_PATROL_3 =			"ep03_$patrol_3" 
  28. NAV_ULTOR_PATROL_4 =			"ep03_$patrol_4" 
  29. NAV_ULTOR_SAFETY =			"ep03_$n000" 
  30. NAV_ULTOR_SAFETY_HALFWAY = "ep03_$n001" 
  31. NAV_ULTOR_SAFETY_START =	"ep03_$n004" 
  32. NAV_PATROL =					{"ep03_$n005", "ep03_$n007", "ep03_$n009", "ep03_$n011",  
  33. 									"ep03_$n013", "ep03_$n015", "ep03_$n017",	"ep03_$n019",  
  34. 									"ep03_$n021",  "ep03_$n023",  "ep03_$n025", "ep03_$n027"} 
  35. YACHT_PATROL_PATHS = { "ep03_$Yacht_Patrol_01", "ep03_$Yacht_Patrol_02", 
  36. 							  "ep03_$Yacht_Patrol_03", "ep03_$Yacht_Patrol_04" } 
  37.  
  38. NAV_HELI_WARP =	"ep03_$heli_attack_player_warp" 
  39.  
  40. NEAR_WAVECRAFT = "ep03_$Near_Wavecraft" 
  41. NEAR_WAVECRAFT_REMOTE_PLAYER = "ep03_$Near_Wavecraft_Remote" 
  42.  
  43. -- Characters -- 
  44. TABLE_ULTOR_EXECS =				{ "ep03_$c001", "ep03_$c002", "ep03_$c003", "ep03_$c008", "ep03_$c009" } 
  45. TABLE_ULTOR_SECURITY =			{ "ep03_$c011", "ep03_$c012", "ep03_$c013", "ep03_$c014", "ep03_$c015", "ep03_$c016", "ep03_$c017", "ep03_$c019", 
  46. 										  "ep03_$c020", "ep03_$c021", "ep03_$c023", "ep03_$c024", "ep03_$c025", "ep03_$c026", "ep03_$c027", "ep03_$c028"	} 
  47. TABLE_PARTY_GOERS =				{ "ep03_$c029", "ep03_$c030", "ep03_$c031", "ep03_$c032", "ep03_$c033", "ep03_$c034" } 
  48. TABLE_ULTOR_GETAWAY_PARTY =	{ "ep03_$c010", "ep03_$c000" } 
  49. CHAR_FINAL_EXEC =					"ep03_$c000" 
  50. CHAR_ULTOR_PATROL =				{ "ep03_$c004", "ep03_$c005", "ep03_$c006", "ep03_$c007" } 
  51. CHAR_HELI_PILOTS =				{ {"ep03_$Pilot1_1", "ep03_$Pilot1_2"}, 
  52. 										  {"ep03_$Pilot2_1", "ep03_$Pilot2_2"} } 
  53.  
  54. -- Vehicles -- 
  55. WAVECRAFT =					"ep03_$jetski" 
  56. TABLE_ULTOR_BOATS =		{ "ep03_$Patrol_Boat1", "ep03_$Patrol_Boat2", 
  57. 								  "ep03_$Patrol_Boat3", "ep03_$Patrol_Boat4"} 
  58. GETAWAY_BOAT =				"ep03_$v000" 
  59. ULTOR_GETAWAY_BOAT =		"ep03_$v001" 
  60. ATTACK_HELICOPTERS =		{ "ep03_$heli_one", "ep03_$heli_two" } 
  61.  
  62. -- Triggers -- 
  63. TRIGGER_YACHT_ENTRY =				"ep03_$t000" 
  64. TRIGGER_YACHT_SECONDARY_ENTRY =	"ep03_$t002" 
  65. TRIGGER_YACHT_EXIT =					"ep03_$t001" 
  66.  
  67. -- Threads -- 
  68. HELI_THREADS = { -1, -1 } 
  69.  
  70. -- Other -- 
  71. IN_COOP =								false 
  72. YACHT_RADIUS =							50 
  73. THREAD_ENSURE_IN_WATERCRAFT =		-1 
  74. THREAD_ULTOR_GETAWAY =				-1 
  75. INITIAL_NUM_ULTOR_BOATS =			sizeof_table(TABLE_ULTOR_BOATS) 
  76. INITIAL_NUM_EXECS =					sizeof_table(TABLE_ULTOR_EXECS) 
  77. BOAT_HEALTH_THRESHOLD =				1500 
  78. BOAT_DISTANCE_THRESHOLD =			80 
  79. Num_ultor_boats_destroyed =		0 
  80. Num_execs_killed =					0 
  81. Ep03_final_chase_begun =			false 
  82.  
  83. Reached_wavecraft =				  false 
  84. Mission_ended_successfully =	  false 
  85.  
  86. -- Text -- 
  87. TEXT_HEALTH_BAR =						"ep03_health_bar" 
  88. TEXT_GET_JET_SKI =					"ep03_get_jet_ski" 
  89. TEXT_GET_TO_YACHT =					"ep03_get_to_yacht" 
  90. TEXT_DESTROY_BOATS =					"ep03_destroy_boats" 
  91. TEXT_ENTER_YACHT =					"ep03_enter_yacht" 
  92. TEXT_KILL_EXECS =						"ep03_kill_execs" 
  93. TEXT_CHASE_EXEC =						"ep03_chase_exec" 
  94. TEXT_EXEC_ESCAPED =					"ep03_exec_escaped" 
  95. TEXT_BOATS_DESTROYED =				"ep03_boats_destroyed" 
  96. TEXT_EXECS_KILLED =					"ep03_execs_killed" 
  97. TEXT_ULTOR_SENT_HELI =				"ep03_ultor_sent_heli" 
  98.  
  99. -- Cutscenes 
  100. CT_INTRO = "tsse03-01" 
  101. CT_OUTRO = "tsse03-02" 
  102.  
  103. function ep03_start(ep03_checkpoint, is_restart) 
  104. 	-- Start trigger is hit...the activate button was hit 
  105. --	set_mission_author("Aaron Hanson") 
  106. 	set_mission_author("Ryan Spencer") 
  107.  
  108. 	-- interior = false, blocking = true, temporary = true 
  109. 	city_chunk_swap("sr2_chunk111", "yacht", false, true, true ) 
  110. 	-- interior = true, blocking = true, temporary = true 
  111. 	city_chunk_swap("sr2_intsrmisyacht01empty", "yacht", true, true, true ) 
  112.  
  113. 	spawning_boats( false ) 
  114.  
  115. 	if coop_is_active() then 
  116. 		IN_COOP = true 
  117. 	end 
  118.  
  119. 	mission_start_fade_out() 
  120.  
  121. 	if (not is_restart) then 
  122. 		cutscene_play( CT_INTRO, "", {LOCAL_PLAYER_START, REMOTE_PLAYER_START}, false ) 
  123. 	else 
  124. 		-- Teleport the players where they need to start 
  125. 		teleport_coop( LOCAL_PLAYER_START, REMOTE_PLAYER_START ) 
  126. 	end 
  127.  
  128. 	-- Cap the notoriety to prevent attack helicopter spawning 
  129. 	notoriety_set_max( "Police", 3 ) 
  130.  
  131. 	mission_start_fade_in() 
  132.  
  133. 	for index, helicopter_group in pairs( HELICOPTER_GROUPS ) do 
  134. 		group_create_hidden( helicopter_group ) 
  135. 	end 
  136. 	group_create(GROUP_WAVECRAFT) 
  137. 	if (IN_COOP) then 
  138. 		group_create(GROUP_WAVECRAFT_COOP) 
  139. 	end 
  140. 	group_create_hidden( GROUP_ULTOR_EXECS ) 
  141.  
  142. 	ep03_get_on_wavecraft() 
  143. end 
  144.  
  145. function ep03_boat_jacked(boat) 
  146. 	on_vehicle_enter("", boat) 
  147. 	on_vehicle_destroyed("", boat) 
  148. 	Num_ultor_boats_destroyed = Num_ultor_boats_destroyed + 1 
  149. 	marker_remove_vehicle(boat, SYNC_ALL) 
  150. end 
  151.  
  152. function ep03_character_in_vehicle_of_correct_type( character_name ) 
  153. 	if ( get_char_vehicle_type(character_name) == VT_WATERCRAFT or 
  154. 		  get_char_vehicle_type(character_name) == VT_HELICOPTER or 
  155. 		  get_char_vehicle_type(character_name) == VT_AIRPLANE ) then 
  156. 		return true 
  157. 	end 
  158. 	return false 
  159. end 
  160.  
  161. function ep03_get_on_wavecraft() 
  162. 	marker_add_vehicle(WAVECRAFT, MINIMAP_ICON_LOCATION, INGAME_EFFECT_VEHICLE_INTERACT, SYNC_ALL) 
  163. 	waypoint_add(WAVECRAFT, SYNC_ALL) 
  164. 	mission_help_table(TEXT_GET_JET_SKI) 
  165.  
  166. 	repeat 
  167. 		thread_yield() 
  168. 	until( vehicle_is_destroyed( WAVECRAFT ) or 
  169. 			 ep03_character_in_vehicle_of_correct_type( LOCAL_PLAYER ) or 
  170. 			 ( coop_is_active() and ep03_character_in_vehicle_of_correct_type( REMOTE_PLAYER ) ) ) 
  171.  
  172. 	waypoint_remove( SYNC_ALL ) 
  173. 	Reached_wavecraft = true 
  174.  
  175. 	ep03_get_to_the_yacht() 
  176. end 
  177.  
  178. function ep03_get_to_the_yacht() 
  179. 	marker_remove_vehicle(WAVECRAFT) 
  180. 	mission_waypoint_remove() 
  181. 	marker_add_navpoint(NAV_YACHT, MINIMAP_ICON_LOCATION, "", SYNC_ALL) 
  182.  
  183. 	delay(2) 
  184. 	mission_help_table(TEXT_GET_TO_YACHT) 
  185.  
  186. 	group_create(GROUP_ULTOR_BOATS, true) 
  187. 	for i, boat in pairs(TABLE_ULTOR_BOATS) do 
  188. 		on_vehicle_destroyed("ep03_boat_destroyed", boat) 
  189. 	end 
  190.  
  191. 	group_create(GROUP_SECURITY, true) 
  192. 	group_create(GROUP_PARTYGOERS, true) 
  193. 	 
  194. 	ep03_send_attack_helicopter( 1 ) 
  195. 	delay(5) 
  196. 	 mission_help_table_nag( TEXT_ULTOR_SENT_HELI ) 
  197.  
  198. 	for i = 1, 4 do 
  199. 		vehicle_enter_teleport(CHAR_ULTOR_PATROL[i], TABLE_ULTOR_BOATS[i]) 
  200. 		set_unjackable_flag( TABLE_ULTOR_BOATS[i], true ) 
  201. 		npc_combat_enable(CHAR_ULTOR_PATROL[i], true) 
  202. 		vehicle_disable_flee( TABLE_ULTOR_BOATS[i], true ) 
  203. 		thread_new("ep03_yacht_patrol", i ) 
  204. 		on_vehicle_enter("ep03_boat_jacked", TABLE_ULTOR_BOATS[i] ) 
  205. 	end 
  206.  
  207. 	 	while ( get_dist_closest_player_to_object( NAV_YACHT ) > YACHT_RADIUS ) do 
  208. 		thread_yield() 
  209. 	end 
  210. 	if (THREAD_ENSURE_IN_WATERCRAFT ~= -1) then 
  211. 		thread_kill(THREAD_ENSURE_IN_WATERCRAFT) 
  212. 	end 
  213.  
  214. 	ep03_kill_ultor_execs() 
  215. 		 
  216. end 
  217.  
  218. function ep03_send_attack_helicopter( helicopter_index ) 
  219. 	group_show( HELICOPTER_GROUPS[helicopter_index] ) 
  220. 	vehicle_enter_group_teleport( CHAR_HELI_PILOTS[helicopter_index], ATTACK_HELICOPTERS[helicopter_index]) 
  221.  
  222. 	for index, npc in pairs( CHAR_HELI_PILOTS[helicopter_index] ) do 
  223. 		npc_combat_enable(npc, true) 
  224. 		set_attack_player_flag(npc, true) 
  225. 		attack_closest_player( npc ) 
  226. 	end 
  227. 	HELI_THREADS[helicopter_index] = thread_new("ep03_heli_chase", ATTACK_HELICOPTERS[helicopter_index]) 
  228. 	thread_new("ep03_heli_watch", ATTACK_HELICOPTERS[1], HELI_THREADS[helicopter_index]) 
  229. end 
  230.  
  231. function ep03_heli_watch(heli, thread) 
  232. 	while (thread ~= -1) do 
  233. 		thread_yield() 
  234. 		local Vehicle_smoke, Vehicle_fire = vehicle_get_smoke_and_fire_state(heli) 
  235. 		if Vehicle_fire or Vehicle_smoke or vehicle_is_destroyed(heli) then 
  236. 			thread_kill(thread) 
  237. 			thread = -1 
  238. 		end 
  239. 	end 
  240. end 
  241.  
  242. function ep03_heli_chase(heli) 
  243. 	while (not vehicle_is_destroyed(heli)) do 
  244. 		vehicle_chase(heli, LOCAL_PLAYER, false, false, false, false) 
  245. 		delay( 10.0 ) 
  246. 	end 
  247. end 
  248.  
  249. function ep03_kill_ultor_execs() 
  250. 	group_show( GROUP_ULTOR_EXECS ) 
  251.  
  252. 	marker_remove_navpoint(NAV_YACHT, SYNC_ALL) 
  253.  
  254. 	for i, npc in pairs(TABLE_ULTOR_EXECS) do 
  255. 		npc_combat_enable(npc, true) 
  256. 		marker_add_npc(npc, MINIMAP_ICON_KILL, INGAME_EFFECT_KILL, SYNC_ALL) 
  257. 		on_death("ep03_exec_killed", npc) 
  258. 		set_attack_player_flag(npc, false) 
  259. 		flee(npc, LOCAL_PLAYER, true, true) 
  260. 	end 
  261. 	 
  262. 	for i, npc in pairs(TABLE_ULTOR_SECURITY) do 
  263. 		attack(npc) 
  264. 	end 
  265.  
  266. 	for i, npc in pairs(TABLE_PARTY_GOERS) do 
  267. 		npc_combat_enable(npc, true) 
  268. 		set_attack_player_flag(npc, false) 
  269. 		flee(npc, LOCAL_PLAYER, false, true) 
  270. 	end 
  271. 	 
  272. 	mission_help_table(TEXT_KILL_EXECS) 
  273.  
  274. 	while ((INITIAL_NUM_EXECS - Num_execs_killed) > 0) do 
  275. 		thread_yield() 
  276. 		objective_text(0, TEXT_EXECS_KILLED, Num_execs_killed, INITIAL_NUM_EXECS) 
  277. 	end 
  278.  
  279. 	objective_text(0, TEXT_EXECS_KILLED, Num_execs_killed, INITIAL_NUM_EXECS) 
  280.  
  281. 	ep03_mid_mission_cutscene() 
  282. end 
  283.  
  284. function ep03_exec_flee(npc) 
  285. 	set_attack_player_flag(npc, false) 
  286. 	flee(npc, LOCAL_PLAYER, false, true) 
  287. end 
  288.  
  289. function ep03_mid_mission_cutscene() 
  290. 	objective_text_clear(0) 
  291. 	delay(2) 
  292. 	fade_out(3.0) 
  293. 	cutscene_play("IG_ep03_scene1") 
  294. 	group_hide(GROUP_CUTSCENE) 
  295.  
  296. 	ep03_board_getaway_boat() 
  297. end 
  298.  
  299. function ep03_board_getaway_boat() 
  300. 	delay(2) 
  301. 	mission_help_table(TEXT_CHASE_EXEC) 
  302.  
  303. 	trigger_enable(TRIGGER_YACHT_EXIT, true) 
  304. 	marker_add_trigger(TRIGGER_YACHT_EXIT, MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION, SYNC_ALL) 
  305. 	on_trigger("ep03_kill_final_exec", TRIGGER_YACHT_EXIT) 
  306.  
  307. 	while (not Ep03_final_chase_begun) do 
  308. 		thread_yield() 
  309. 	end 
  310. end 
  311.  
  312. function ep03_kill_final_exec() 
  313. 	Ep03_final_chase_begun = true 
  314. 	 
  315. 	on_trigger("",TRIGGER_YACHT_EXIT) 
  316. 	trigger_enable(TRIGGER_YACHT_EXIT,false) 
  317. 	marker_remove_trigger(TRIGGER_YACHT_EXIT, SYNC_ALL) 
  318.  
  319. 	player_controls_disable(LOCAL_PLAYER) 
  320. 	if ( coop_is_active() ) then 
  321. 		player_controls_disable(REMOTE_PLAYER) 
  322. 	end 
  323. 	 
  324. 	fade_out(2.0) 
  325.  
  326. 	while (fade_get_percent() < 1.0) do 
  327. 		thread_yield() 
  328. 	end 
  329.  
  330. 	group_create(GROUP_FINAL_EXEC, true) 
  331. 	 
  332. 	for i, npc in pairs(TABLE_ULTOR_GETAWAY_PARTY) do 
  333. 		vehicle_enter_teleport(npc, ULTOR_GETAWAY_BOAT, (i-1)) 
  334. 		npc_combat_enable(npc, true) 
  335. 	end 
  336. 	 
  337. 	on_death("ep03_success_final_exec_killed", CHAR_FINAL_EXEC) 
  338. 	on_vehicle_destroyed("ep03_getaway_boat_destroyed", ULTOR_GETAWAY_BOAT) 
  339. 	 
  340. 	group_create(GROUP_GETAWAY_BOAT, true)	 
  341. 		 
  342. 	vehicle_enter_teleport(LOCAL_PLAYER, GETAWAY_BOAT, 0) 
  343. 	if ( coop_is_active() ) then 
  344. 		vehicle_enter_teleport(REMOTE_PLAYER, GETAWAY_BOAT, 1) 
  345. 	end 
  346.  
  347. 	marker_add_npc( CHAR_FINAL_EXEC, MINIMAP_ICON_KILL, INGAME_EFFECT_KILL, SYNC_ALL ) 
  348. 	--marker_add_vehicle(ULTOR_GETAWAY_BOAT, MINIMAP_ICON_KILL, INGAME_EFFECT_VEHICLE_KILL, SYNC_ALL) 
  349.  
  350. 	local Current_hit_points = get_current_hit_points(ULTOR_GETAWAY_BOAT) 
  351. 	local New_hit_points = Current_hit_points * 2 
  352. 	set_max_hit_points(ULTOR_GETAWAY_BOAT, New_hit_points) 
  353. 	set_current_hit_points(ULTOR_GETAWAY_BOAT, New_hit_points) 
  354. 	vehicle_disable_chase( ULTOR_GETAWAY_BOAT ) 
  355. 	vehicle_disable_flee( ULTOR_GETAWAY_BOAT ) 
  356. 	vehicle_suppress_npc_exit( ULTOR_GETAWAY_BOAT, true ) 
  357.  
  358. 	damage_indicator_on( 0, ULTOR_GETAWAY_BOAT, 0, TEXT_HEALTH_BAR, get_current_hit_points(ULTOR_GETAWAY_BOAT) ) 
  359. 	 
  360. 	fade_in(2.0) 
  361. 	 
  362. 	while (fade_get_percent() > 0.5) do 
  363. 		thread_yield() 
  364. 	end 
  365.  
  366. 	player_controls_enable(LOCAL_PLAYER) 
  367. 	if ( coop_is_active() ) then 
  368. 		player_controls_enable(REMOTE_PLAYER) 
  369. 	end 
  370.  
  371. 	delay(2) 
  372.  
  373. 	THREAD_ULTOR_GETAWAY = thread_new("ep03_ultor_getaway") 
  374.  
  375. 	-- If the first attack helicopter is dead, send a replacement 
  376. 	if ( vehicle_is_destroyed( ATTACK_HELICOPTERS[1] ) ) then 
  377. 		ep03_send_attack_helicopter( 2 ) 
  378. 		delay( 2.0 ) 
  379. 		teleport_vehicle( ATTACK_HELICOPTERS[2], NAV_HELI_WARP ) 
  380. 	end 
  381.  
  382. 	while ((get_dist_vehicle_to_nav(ULTOR_GETAWAY_BOAT, NAV_ULTOR_SAFETY) > 10) and not character_is_dead(CHAR_FINAL_EXEC)) do 
  383. 		thread_yield() 
  384. 	end 
  385.  
  386. 	if (THREAD_ULTOR_GETAWAY ~= -1) then 
  387. 		thread_kill(THREAD_ULTOR_GETAWAY) 
  388. 	end 
  389.  
  390. 	if (not character_is_dead(CHAR_FINAL_EXEC)) then 
  391. 		ep03_failure_ultor_safety() 
  392. 	end 
  393. end 
  394.  
  395. function ep03_getaway_boat_destroyed() 
  396. 	delay(1) 
  397. 	character_kill(CHAR_FINAL_EXEC) 
  398. end 
  399.  
  400. function ep03_ultor_getaway() 
  401. 	vehicle_speed_override(ULTOR_GETAWAY_BOAT, 30) 
  402.  
  403. 	while (1) do 
  404. 		thread_yield() 
  405. 		 
  406. 		vehicle_pathfind_to(ULTOR_GETAWAY_BOAT, NAV_ULTOR_SAFETY_START, NAV_ULTOR_SAFETY_HALFWAY, NAV_ULTOR_SAFETY, true, true) 
  407. 	end 
  408. end 
  409.  
  410. function ep03_exec_killed(npc) 
  411. 	on_death("", npc) 
  412. 	 
  413. 	Num_execs_killed = Num_execs_killed + 1 
  414. 	 
  415. 	marker_remove_npc(npc) 
  416. end 
  417.  
  418. function ep03_boat_destroyed(boat) 
  419. 	on_vehicle_destroyed("", boat) 
  420. 	on_vehicle_enter("", boat) 
  421. 	 
  422. 	Num_ultor_boats_destroyed = Num_ultor_boats_destroyed + 1 
  423. 	 
  424. 	marker_remove_vehicle(boat, SYNC_ALL) 
  425. end 
  426.  
  427. function ep03_yacht_patrol(boat_index) 
  428. 	local boat = TABLE_ULTOR_BOATS[boat_index] 
  429.  
  430. 	local THREAD_PATROL = thread_new("ep03_yacht_patrol_pathfind", boat, YACHT_PATROL_PATHS[boat_index] ) 
  431.  
  432. 	while ( vehicle_is_destroyed( boat ) == false and 
  433. 			  ( get_current_hit_points(boat) > BOAT_HEALTH_THRESHOLD or get_dist_char_to_vehicle(LOCAL_PLAYER, boat) > BOAT_DISTANCE_THRESHOLD ) ) do 
  434. 		thread_yield() 
  435. 	end 
  436.  
  437. 	thread_kill(THREAD_PATROL) 
  438. 	 
  439. 	while (not vehicle_is_destroyed(boat)) do 
  440. 		thread_yield() 
  441. 		vehicle_chase(boat, LOCAL_PLAYER, false, false, true, false) 
  442. 	end 
  443. end 
  444.  
  445. function ep03_yacht_patrol_pathfind( boat, path ) 
  446. 	while (1) do 
  447. 		thread_yield() 
  448. 		vehicle_pathfind_to(boat, path, true, false) 
  449. 	end 
  450. end 
  451.  
  452. function ep03_end_patrol_start_chase(boat) 
  453. 	vehicle_chase(boat, LOCAL_PLAYER, false, false, true, false) 
  454. end 
  455.  
  456. function ep03_failure_ultor_safety() 
  457. 	mission_end_failure("ep03", TEXT_EXEC_ESCAPED) 
  458. end 
  459.  
  460. function ep03_success_final_exec_killed() 
  461. 	damage_indicator_off( 0 ) 
  462. 	on_death("", CHAR_FINAL_EXEC) 
  463. 	if (THREAD_ULTOR_GETAWAY ~= -1) then 
  464. 		thread_kill(THREAD_ULTOR_GETAWAY) 
  465. 	end 
  466. --	delay(3) 
  467. 	Mission_ended_successfully = true 
  468. 	local all_groups_minus_getaway_boat = { GROUP_ULTOR_BOATS, GROUP_WAVECRAFT, GROUP_WAVECRAFT_COOP, 
  469. 														 GROUP_ULTOR_EXECS, GROUP_FINAL_EXEC, GROUP_SECURITY, 
  470. 														 GROUP_PARTYGOERS, GROUP_CUTSCENE, GROUP_HELI_ONE, 
  471. 														 GROUP_HELI_TWO } 
  472.  
  473. 	for index, group_name in pairs( all_groups_minus_getaway_boat ) do 
  474. 		if ( group_is_loaded( group_name ) ) then 
  475. 			release_to_world( group_name ) 
  476. 		end 
  477. 	end 
  478. 	mission_end_success("ep03", "tsse03-02") 
  479. end 
  480.  
  481. function ep03_cleanup() 
  482. 	-- Cleanup mission here 
  483. 	if THREAD_ULTOR_GETAWAY ~= -1 then 
  484. 		thread_kill(THREAD_ULTOR_GETAWAY) 
  485. 	end 
  486.  
  487. 	if THREAD_ENSURE_IN_WATERCRAFT ~= -1 then 
  488. 		thread_kill(THREAD_ENSURE_IN_WATERCRAFT) 
  489. 	end 
  490.  
  491. 	marker_remove_npc( CHAR_FINAL_EXEC, SYNC_ALL ) 
  492. 	--marker_remove_vehicle(ULTOR_GETAWAY_BOAT, SYNC_ALL) 
  493.  
  494. 	on_death("", CHAR_FINAL_EXEC) 
  495.  
  496. 	for i, boat in pairs(TABLE_ULTOR_BOATS) do 
  497. 		on_vehicle_destroyed("", boat) 
  498. 		on_vehicle_enter("", boat) 
  499. 		marker_remove_vehicle(boat, SYNC_ALL) 
  500. 	end 
  501.  
  502. 	for i, npc in pairs(TABLE_ULTOR_EXECS) do 
  503. 		on_death("", npc) 
  504. 		marker_remove_npc(npc, SYNC_ALL) 
  505. 	end 
  506.  
  507. 	spawning_boats( true ) 
  508.  
  509. 	-- Teleport players who are near the yachts back to the wavecraft 
  510. 	if ( get_dist(LOCAL_PLAYER, NAV_YACHT) < 300 ) then 
  511. 		if ( group_is_loaded( GROUP_GETAWAY_BOAT ) and character_is_in_vehicle( LOCAL_PLAYER, GETAWAY_BOAT ) ) then 
  512. 			group_destroy( GROUP_GETAWAY_BOAT ) 
  513. 		end 
  514. 		teleport( LOCAL_PLAYER, NEAR_WAVECRAFT, true ) 
  515. 	end 
  516. 	if ( coop_is_active() and (get_dist(REMOTE_PLAYER, NAV_YACHT) < 300) ) then 
  517. 		if ( group_is_loaded( GROUP_GETAWAY_BOAT ) and character_is_in_vehicle( REMOTE_PLAYER, GETAWAY_BOAT ) ) then 
  518. 			group_destroy( GROUP_GETAWAY_BOAT ) 
  519. 		end 
  520. 		teleport( REMOTE_PLAYER, NEAR_WAVECRAFT_REMOTE_PLAYER, true ) 
  521. 	end 
  522.  
  523. 	-- Remove the notoriety cap 
  524. 	notoriety_set_max( "Police", MAX_NOTORIETY_LEVEL ) 
  525.  
  526. 	-- interior = false, blocking = true, temporary = true 
  527. 	city_chunk_swap("sr2_chunk111", "normal", false, true, true ) 
  528. 	-- interior = true, blocking = true, temporary = true 
  529. 	city_chunk_swap("sr2_intsrmisyacht01empty", "normal", true, true, true ) 
  530. end 
  531.  
  532. function ep03_success() 
  533. 	-- Called when the mission has ended with success 
  534. 	-- Post the news event 
  535. 	radio_post_event("JANE_NEWS_TSSE03", true) 
  536. end 
  537.