sr2lua/rn08.lua

  1. -- rn08.lua 
  2. -- SR2 mission script 
  3. -- 3/28/07 
  4.  
  5. -- Global constants ( ALL_CAPS means that they shouldn't be modified in running code, except for maybe in a setup function ) 
  6.  
  7. 	-- Coop mission? 
  8. 	IN_COOP	= false 
  9.  
  10. 	-- GROUPS -- 
  11.  
  12. 		-- the arms dealer group 
  13. 		GROUP_ARMS_DEALER				= "rn08_$Garms_dealer" 
  14. 	 
  15. 		-- Ronin soldiers on the ground floor 
  16. 		GROUP_SOLDIERS_GROUND		= "rn08_$Gsoldiers_ground" 
  17. 		GROUP_SOLDIERS_GROUND_COOP = "rn08_$Gsoldiers_ground_coop" 
  18. 		GROUP_SOLDIERS_GROUND_2		= "rn08_$Gsoldiers_ground_2" 
  19.  
  20. 		-- Civilians on the ground floor 
  21. 		GROUP_CIVILIANS_GROUND		= "rn08_$Gcivilians_ground" 
  22.  
  23. 		-- Gat's group 
  24. 		GROUP_GAT					= "rn08_$Gmission" 
  25.  
  26. 		-- courtesy vehicle groups 
  27. 		GROUP_COURTESY_CAR			= "rn08_$Gcourtesy_car" 
  28. 		GROUP_COURTESY_CAR_COOP		= "rn08_$Gcourtesy_car_coop" 
  29.  
  30. 		-- Ronin soldiers kth top floor (k-1 == flors above where elevator teleports to) 
  31. 		GROUP_SOLDIERS_TOP_1			= "rn08_$Gsoldiers_top_1" 
  32. 		GROUP_SOLDIERS_TOP_1_COOP	= "rn08_$Gsoldiers_top_1_coop" 
  33. 		GROUP_SOLDIERS_TOP_2			= "rn08_$Gsoldiers_top_2" 
  34. 		GROUP_SOLDIERS_TOP_2_COOP	= "rn08_$Gsoldiers_top_2_coop" 
  35. 		GROUP_SOLDIERS_TOP_3			= "rn08_$Gsoldiers_top_3" 
  36. 		GROUP_SOLDIERS_TOP_3_COOP	= "rn08_$Gsoldiers_top_3_coop" 
  37. 		GROUP_SOLDIERS_TOP_4			= "rn08_$Gsoldiers_top_4" 
  38. 		GROUP_SOLDIERS_TOP_4_COOP	= "rn08_$Gsoldiers_top_4_coop" 
  39. 		GROUP_SOLDIERS_TOP_5			= "rn08_$Gsoldiers_top_5" 
  40. 		GROUP_SOLDIERS_TOP_5_COOP	= "rn08_$Gsoldiers_top_5_coop" 
  41.  
  42. 		-- Ronin reinforcements (attack after 2nd to last floor cleared) 
  43. 		GROUP_REINFORCEMENTS			= "rn08_$Greinforcements" 
  44.  
  45. 		-- Ronin lieutenants in the suite 
  46. 		GROUP_LIEUTENANTS				= "rn08_$Glieutenants" 
  47. 		GROUP_LIEUTENANTS_COOP		= "rn08_$Glieutenants_coop" 
  48.  
  49. 		-- Ronin soldiers spawned adjacent to bombs in final explosion 
  50. 		GROUP_BODY_COUNT				= "rn08_$Gbody_count" 
  51.  
  52. 		-- Bombs 
  53. 		GROUP_BOMBS						= "rn08_$Gbombs" 
  54. 	 
  55. 	-- GROUP MEMBER TABLES --  
  56.  
  57. 		TABLE_SOLDIERS_GROUND	= {	"rn08_$Csoldiers_ground_00", "rn08_$Csoldiers_ground_01", "rn08_$Csoldiers_ground_02",  
  58. 												"rn08_$Csoldiers_ground_03", "rn08_$Csoldiers_ground_04"} 
  59.  
  60. 		TABLE_SOLDIERS_GROUND_COOP	= {"rn08_$Csoldiers_ground_coop_00", "rn08_$Csoldiers_ground_coop_01"} 
  61.  
  62. 		TABLE_SOLDIERS_TOP_1		= {	"rn08_$Csoldiers_top_00", "rn08_$Csoldiers_top_01", "rn08_$Csoldiers_top_02", 
  63. 												"rn08_$Csoldiers_top_03", "rn08_$Csoldiers_top_04"} 
  64.  
  65. 		TABLE_SOLDIERS_TOP_2		= {	"rn08_$Csoldiers_top_2_00", "rn08_$Csoldiers_top_2_01", "rn08_$Csoldiers_top_2_02", 
  66. 												"rn08_$Csoldiers_top_2_03", "rn08_$Csoldiers_top_2_04", "rn08_$Csoldiers_top_2_05"} 
  67. 		TABLE_SOLDIERS_TOP_2_COOP={	"rn08_$Csoldiers_top_2_coop_00", "rn08_$Csoldiers_top_2_coop_01"} 
  68.  
  69. 		TABLE_SOLDIERS_TOP_3		= {	"rn08_$Csoldiers_top_3_00", "rn08_$Csoldiers_top_3_01", "rn08_$Csoldiers_top_3_02", 
  70. 												"rn08_$Csoldiers_top_3_03", "rn08_$Csoldiers_top_3_04", "rn08_$Csoldiers_top_3_05", 
  71. 												"rn08_$Csoldiers_top_3_06"} 
  72. 		TABLE_SOLDIERS_TOP_3_COOP={	"rn08_$Csoldiers_top_3_coop_00"} 
  73.  
  74. 		TABLE_SOLDIERS_TOP_4		= {	"rn08_$Csoldiers_top_4_00", "rn08_$Csoldiers_top_4_01", "rn08_$Csoldiers_top_4_02", 
  75. 												"rn08_$Csoldiers_top_4_03"} 
  76. 		TABLE_SOLDIERS_TOP_4_COOP={	"rn08_$Csoldiers_top_4_coop_00", "rn08_$Csoldiers_top_4_coop_01"} 
  77.  
  78. 		TABLE_SOLDIERS_TOP_5		= {	"rn08_$Csoldiers_top_5_00", "rn08_$Csoldiers_top_5_01", "rn08_$Csoldiers_top_5_02", 
  79. 												"rn08_$Csoldiers_top_5_03", "rn08_$Csoldiers_top_5_04", "rn08_$Csoldiers_top_5_05", 
  80. 												"rn08_$Csoldiers_top_5_06"} 
  81. 		TABLE_SOLDIERS_TOP_5_COOP={	"rn08_$Csoldiers_top_5_coop_00", "rn08_$Csoldiers_top_5_coop_01", 
  82. 												"rn08_$Csoldiers_top_5_coop_02"} 
  83.  
  84. 		TABLE_LIEUTENANTS			= {	"rn08_$Clieutenants_00", "rn08_$Clieutenants_01", "rn08_$Clieutenants_02", 
  85. 												"rn08_$Clieutenants_03", "rn08_$Clieutenants_04", "rn08_$Clieutenants_05"} 
  86.  
  87. 		TABLE_LIEUTENANTS_COOP	= {	"rn08_$Clieutenants_coop_00", "rn08_$Clieutenants_coop_01"} 
  88.  
  89. 		TABLE_REINFORCEMENTS		= {	"rn08_$c004", "rn08_$c005", "rn08_$c006", "rn08_$c007", "rn08_$c008", 
  90. 												"rn08_$c009", "rn08_$c010", "rn08_$c011"} 
  91.  
  92. 	-- TRIGGERS --  
  93.  
  94. 		-- the arms dealer trigger 
  95. 		TRIGGER_ARMS_DEALER		= "rn08_$Tarms_dealer" 
  96.  
  97. 		-- the Ronin Hotel exit/entrance 
  98. 		TRIGGER_HOTEL				= "rn08_$Thotel" 
  99.  
  100. 		-- the Ronin Hotel foyer 
  101. 		TRIGGER_FOYER				= "rn08_$Thotel_foyer" 
  102.  
  103. 		-- the Ronin HQ ground floor elevator trigger 
  104. 		TRIGGER_ELEVATOR			= "rn08_$Televator" 
  105.  
  106. 		TABLE_TRIGGER_TO_BOMB	= 
  107. 		{  
  108. 			["rn08_$Tbombs_top_1_00"] = "rn08_$i000", 
  109. 			["rn08_$Tbombs_top_1_01"] = "rn08_$i001", 
  110. 			["rn08_$Tbombs_top_2_00"] = "rn08_$i002", 
  111. 			["rn08_$Tbombs_top_2_01"] = "rn08_$i003", 
  112. 			["rn08_$Tbombs_top_3_00"] = "rn08_$i004", 
  113. 			["rn08_$Tbombs_top_3_01"] = "rn08_$i005", 
  114. 			["rn08_$Tbombs_top_4_00"] = "rn08_$i006", 
  115. 			["rn08_$Tbombs_top_4_01"] = "rn08_$i007", 
  116. 			["rn08_$Tbombs_top_5_00"] = "rn08_$i008", 
  117. 			["rn08_$Tbombs_top_5_01"] = "rn08_$i009", 
  118. 			["rn08_$Tbombs_top_5_02"] = "rn08_$i010", 
  119. 			["rn08_$Tbombs_top_5_03"] = "rn08_$i011", 
  120. 		} 
  121.  
  122. 		TABLE_BOMBS_TOP_1			= {	"rn08_$Tbombs_top_1_00", "rn08_$Tbombs_top_1_01"} 
  123.  
  124. 		TABLE_BOMBS_TOP_2			= {	"rn08_$Tbombs_top_2_00", "rn08_$Tbombs_top_2_01"}	 
  125.  
  126. 		TABLE_BOMBS_TOP_3			= {	"rn08_$Tbombs_top_3_00", "rn08_$Tbombs_top_3_01"} 
  127.  
  128. 		TABLE_BOMBS_TOP_4			= {	"rn08_$Tbombs_top_4_00", "rn08_$Tbombs_top_4_01"}	 
  129.  
  130. 		TABLE_BOMBS_TOP_5			= {	"rn08_$Tbombs_top_5_00"} 
  131.  
  132. 		TABLE_BOMBS_FREE_FALL_TOP = {	"rn08_$Tbomb_free_fall_top_00", "rn08_$Tbomb_free_fall_top_01", "rn08_$Tbomb_free_fall_top_02", 
  133. 												"rn08_$Tbomb_free_fall_top_03", "rn08_$Tbomb_free_fall_top_04", "rn08_$Tbomb_free_fall_top_05"} 
  134.  
  135. 		TABLE_BOMBS_FREE_FALL_MID = {"rn08_$Tbomb_free_fall_mid_00", "rn08_$Tbomb_free_fall_mid_01", "rn08_$Tbomb_free_fall_mid_02", 
  136. 												"rn08_$Tbomb_free_fall_mid_03", "rn08_$Tbomb_free_fall_mid_04"} 
  137.  
  138. 		TABLE_BOMBS_FREE_FALL_BOTTOM = {	"rn08_$Tbomb_free_fall_bottom_00", "rn08_$Tbomb_free_fall_bottom_01", "rn08_$Tbomb_free_fall_bottom_02", 
  139. 												"rn08_$Tbomb_free_fall_bottom_03", "rn08_$Tbomb_free_fall_bottom_04", "rn08_$Tbomb_free_fall_bottom_05"} 
  140.  
  141. 		-- If the players hit this after using the elevator, but before killing off the ltnts, then we fail 
  142. 		-- the mission because they left the hotel too early. 
  143. 		TRIGGER_EARLY_JUMP		= "rn08_$Tearly_jump" 
  144. 		 
  145. 		-- the location where the player needs to jump from to complete the mission 
  146. 		TRIGGER_JUMP				= "rn08_$Tjump" 
  147.  
  148. 		-- the topmost free fall bomb explosion trigger 
  149. 		TRIGGER_FREE_FALL_1		= "rn08_$Tfree_fall_top_1" 
  150.  
  151. 		-- the next free fall bomb explosion trigger 
  152. 		TRIGGER_FREE_FALL_2		= "rn08_$Tfree_fall_top_4" 
  153.  
  154. 		-- anothre free fall bomb explosion trigger 
  155. 		TRIGGER_FREE_FALL_3		= "rn08_$Tfree_fall_mid" 
  156.  
  157. 		-- the entire ground floor (for triggering mission success) 
  158. 		TRIGGER_GROUND_FLOOR		= "rn08_$Tground_floor" 
  159. 		 
  160. 		-- Door-to-stairwell icon navpoints 
  161. 		TRIGGER_NORTH_TOP_2	= "rn08_$Tdoor_north_top_2" 
  162. 		TRIGGER_SOUTH_TOP_2	= "rn08_$Tdoor_south_top_2" 
  163. 		TRIGGER_NORTH_TOP_3	= "rn08_$Tdoor_north_top_3" 
  164. 		TRIGGER_SOUTH_TOP_3	= "rn08_$Tdoor_south_top_3" 
  165. 		TRIGGER_NORTH_TOP_4	= "rn08_$Tdoor_north_top_4" 
  166. 		TRIGGER_SOUTH_TOP_4	= "rn08_$Tdoor_south_top_4" 
  167. 		TRIGGER_NORTH_TOP_5	= "rn08_$Tdoor_north_top_5" 
  168.  
  169. 		-- Triggers inside stairwell just adjacent to the door 
  170. 		TRIGGER_STAIRWELL_NORTH_TOP_3 = "rn08_$Tstairwell_north_top_3" 
  171. 		TRIGGER_STAIRWELL_NORTH_TOP_4 = "rn08_$Tstairwell_north_top_4" 
  172. 		TRIGGER_STAIRWELL_NORTH_TOP_5 = "rn08_$Tstairwell_north_top_5" 
  173. 		TRIGGER_STAIRWELL_SOUTH_TOP_3 = "rn08_$Tstairwell_south_top_3" 
  174. 		TRIGGER_STAIRWELL_SOUTH_TOP_4 = "rn08_$Tstairwell_south_top_4" 
  175.  
  176. 		-- List of all triggers, makes cleaning up more convenient 
  177. 		TABLE_ALL_TRIGGERS		= {	TRIGGER_ARMS_DEALER, TRIGGER_HOTEL, TRIGGER_ELEVATOR, TRIGGER_JUMP,  
  178. 												TRIGGER_FREE_FALL_1, TRIGGER_FREE_FALL_2, TRIGGER_FREE_FALL_3, TRIGGER_NORTH_TOP_2, 
  179. 												TRIGGER_NORTH_TOP_3, TRIGGER_NORTH_TOP_4, TRIGGER_NORTH_TOP_5, 
  180. 												TRIGGER_SOUTH_TOP_2, TRIGGER_SOUTH_TOP_3, TRIGGER_SOUTH_TOP_4, 
  181. 												TRIGGER_STAIRWELL_NORTH_TOP_3, TRIGGER_STAIRWELL_NORTH_TOP_4, 
  182. 												TRIGGER_STAIRWELL_NORTH_TOP_5, TRIGGER_STAIRWELL_SOUTH_TOP_3, 
  183. 												TRIGGER_STAIRWELL_SOUTH_TOP_4}		 
  184.  
  185. 	-- VEHICLES -- 
  186.  
  187. 		-- convenience vehicle 
  188. 		VEHICLE_GIFT_CAR			= "rn08_$Vgift_car" 
  189.  
  190. 	-- CHARACTERS -- 
  191.  
  192. 		-- shady arms dealer 
  193. 		CHARACTER_ARMS_DEALER	= "rn08_$Carms_dealer" 
  194. 	 
  195. 		-- Gat 
  196. 		CHARACTER_GAT				= "rn08_$Cgat" 
  197.  
  198.  
  199. 	-- CONVERSATIONS -- 
  200.  
  201. 	   INTRO_CONVERSATION = 
  202. 		{ 
  203. 			{ "RON8_ANTICIPATION_L1", CHARACTER_GAT, 0.25 }, 
  204. 			{ "PLAYER_RON8_ANTICIPATION_L2", LOCAL_PLAYER, 0.25 }, 
  205. 			{ "RON8_ANTICIPATION_L3", CHARACTER_GAT, 0.25 }, 
  206. 		} 
  207.  
  208. 		DEALER_CONVERSATION = 
  209. 		{ 
  210. 			{ "PLAYER_RON8_GET_BOMBS_L1", LOCAL_PLAYER, 1 }, 
  211. 			{ "RON8_GET_BOMBS_L2", CHARACTER_ARMS_DEALER, 1 }, 
  212. 		} 
  213.  
  214. 	-- NAVPOINTS 
  215.  
  216. 		-- the Ronin HQ elevator 
  217. 		NAVPOINT_ELEVATOR			= "rn08_$Nelevator" 
  218.  
  219. 		-- the Ronin HQ elevator that Gat needs to take 
  220. 		NAVPOINT_ELEVATOR_GAT	= "rn08_$Nelevator_gat" 
  221.  
  222. 		-- the Ronin HQ elevator exit for player 2 
  223. 		NAVPOINT_ELEVATOR_PLAYER_2 =	"rn08_$Nelevator_player_2" 
  224.  
  225. 		-- the Ronin HQ arrival trigger 
  226. 		NAVPOINT_HOTEL				= "rn08_$Thotel" 
  227.  
  228. 		-- the Ronin HQ checkpoint start location for player 2 
  229. 		NAVPOINT_HOTEL_PLAYER_2 = "rn08_$Nronin_hq_player2" 
  230.  
  231. 		-- the Ronin HQ checkpoint start location for Gat 
  232. 		NAVPOINT_HOTEL_GAT		= "rn08_$Nronin_hq_gat" 
  233.  
  234. 		-- the start location for Player 1 
  235. 		NAVPOINT_LOCATION_START							= "mission_start_sr2_city_$rn08" 
  236.  
  237. 		-- the start location for Player 2		 
  238. 		NAVPOINT_LOCATION_START_PLAYER_2				= "rn08_$Nplayer2_start" 
  239. 		 
  240. 		-- the navpoints that the player are teleported to when the mission ends 
  241. 		NAVPOINT_MISSION_END_1							= "rn08_$Nplayer1_end" 
  242. 		NAVPOINT_MISSION_END_2							= "rn08_$Nplayer2_end" 
  243.  
  244.  
  245. 	-- MOVERS 
  246.  
  247. 		-- Stairwell Doors 
  248. 		DOOR_FRONT_1		= "rn08_$MMfront_door1" 
  249. 		DOOR_FRONT_2		= "rn08_$MMfront_door2" 
  250. 		DOOR_NORTH_TOP_2	= "rn08_$MMdoor_north_top_2" 
  251. 		DOOR_SOUTH_TOP_2	= "rn08_$MMdoor_south_top_2" 
  252. 		DOOR_NORTH_TOP_3	= "rn08_$MMdoor_north_top_3" 
  253. 		DOOR_SOUTH_TOP_3	= "rn08_$MMdoor_south_top_3" 
  254. 		DOOR_NORTH_TOP_4	= "rn08_$MMdoor_north_top_4" 
  255. 		DOOR_SOUTH_TOP_4	= "rn08_$MMdoor_south_top_4" 
  256. 		DOOR_NORTH_TOP_5	= "rn08_$MMdoor_north_top_5" 
  257. 	 
  258. 		-- Suite doors 
  259. 		DOOR_SUITE_OUTER_1	= "rn08_$MMdoor_suite_outer_1" 
  260. 		DOOR_SUITE_OUTER_2	= "rn08_$MMdoor_suite_outer_2" 
  261.  
  262. 	-- HELPTEXT 
  263. 		HELPTEXT_GAT_DIED						= "rn08_gat_died" 
  264. 		HELPTEXT_ARMS_DEALER_DIED			= "rn08_arms_dealer_died" 
  265. 		HELPTEXT_ARMS_DEALER					= "rn08_arms_dealer"				-- ## Drive to the arms dealer. 
  266. 		HELPTEXT_RONIN_HQ						= "rn08_ronin_hq"					-- ## Head to the Ronin hideout. 
  267.  
  268. 		HELPTEXT_FAIL_JUMP_EARLY			= "rn08_fail_jump_early"		-- You left the upper floors without finishing the job 
  269. 		HELPTEXT_BOMBS							= "rn08_bombs"						-- ## Place the bombs one floor at a time. 
  270. 		HELPTEXT_SUITE							= "rn08_suite"						-- ## Head to the suite and kill all the Ronin lieutenants. 
  271. 		HELPTEXT_JUMP							= "rn08_jump"						-- ## Jump down the atrium and get out of the hotel! 
  272. 		HELPTEXT_JUMP_APPROACH				= "rn08_jump_approach"			-- ## Head to the atrium. 
  273. 		HELPTEXT_GAT_DISMISSED				= "rn08_gat_dismissed"			-- ## Johnny Gat was abandoned. 
  274. 		HELPTEXT_OBJECTIVE_BOMBS			= "rn08_objective_bombs"		-- ## Bombs planted: 
  275. 		HELPTEXT_OBJECTIVE_RONIN			= "rn08_objective_ronin"		-- ## Ronin killed: 
  276. 		HELPTEXT_BOMB_FAILURE				= "rn08_bomb_failure"			-- ## Bombs detonated before you escaped. 
  277. 		HELPTEXT_BOMB_FINISH					= "rn08_bomb_finish"				-- ## Finish planting bombs on this floor. 
  278. 		HELPTEXT_NEXT_FLOOR					= "rn08_next_floor"				-- ## Move on to the next floor. 
  279. 		HELPTEXT_DETONATION_WARN			= "rn08_detonation_warn"		-- ## 30 seconds until detonation. 
  280. 		HELPTEXT_COUNTDOWN					= "rn08_countdown"				-- ## Countdown activated. 
  281. 		HELPTEXT_GROUND_FLOOR				= "rn08_ground_floor"			-- ## Eliminate Ronin soldiers on the ground floor. 
  282.  
  283. 		--HELPTEXT_ELEVATOR			= "rn08_elevator" 
  284. 		HELPTEXT_BOMBS_HURRY					=	"rn08_bomb_hurry"				-- "## Hurry, the detonation timers have been activated!" 
  285. 		HELPTEXT_GROUND_FLOOR_CLEAR		=	"rn08_ground_floor_clear"	-- "## You're done here, get to the elevator. 
  286.  
  287. 	-- CHECKPOINTS 
  288. 		CHECKPOINT_START						= MISSION_START_CHECKPOINT -- defined in ug_lib.lua 
  289. 		CHECKPOINT_BOMBS						= "rn08_checkpoint_bombs"  -- player has cleared out the 1st and 2nd floor of the hotel  
  290.  
  291. 	-- MISC. 
  292.  
  293. 		-- Bomb detonation time in seconds 
  294. 		BOMB_TIME_S				= 240 
  295.  
  296. 		-- Mission Gang Name 
  297. 		MISSION_GANG_NAME		= "Ronin" 
  298.  
  299. 		-- The number of bombs to plant 
  300. 		NUMBER_BOMBS_TO_PLANT = 0 
  301. 		 
  302. 		--Number of players that have cleared the jump, in co-op 
  303. 		NUMBER_PLAYERS_JUMPED = 0 
  304.  
  305. 		-- Lieutenant health multiplier 
  306. 		LIEUTENANT_HEALTH_MULTIPLIER = 2.0 
  307.  
  308. 		-- Bomb planting sound effect 
  309. 		FOLEY_BOMB_PLANT	= "SFX_RON08_SET_DETONATOR" 
  310.  
  311. 		-- Possible locations for the reinforcements to spawn 
  312. 		TABLE_REINFORCEMENT_NAVPOINTS =	 
  313. 			{	"rn08_$n000", "rn08_$n016", "rn08_$n001", "rn08_$n015", "rn08_$n002", "rn08_$n014", 
  314. 				"rn08_$n003", "rn08_$n013", "rn08_$n004", "rn08_$n012", "rn08_$n005", "rn08_$n011", 
  315. 				"rn08_$n006", "rn08_$n010", "rn08_$n007", "rn08_$n009", "rn08_$n008"} 
  316.  
  317. 		-- Number of reinforcements 
  318. 		NUMBER_REINFORCEMENTS		= 6; 
  319. 		NUMBER_REINFORCEMENTS_COOP	= 8; 
  320.  
  321. 	-- GUARD PATROL ROUTES 
  322.  
  323. 		DIR_FORWARD = 1 
  324. 		DIR_REVERSE = 2 
  325. 		DIR_EITHER = 3 
  326.  
  327. 		-- Rather than define separate routes for each guard, I've setup interconnecting segments of 
  328. 		-- patrol routes. Segments can transition onto other segments at any point. If a guard reaches 
  329. 		-- the end of a segment, then they'll return to their original spawn location. 
  330. 		GUARD_INITIAL_PATH_SEGMENTS =  
  331. 		{	-- FIRST FLOOR 
  332. 			["rn08_$Csoldiers_ground_00"] =			{	{1,DIR_FORWARD,1}, 
  333. 																	{1,DIR_REVERSE,5}, 
  334. 																	{2,DIR_FORWARD,1}, 
  335. 																	{5,DIR_FORWARD,1}, 
  336. 																}, 
  337. 			["rn08_$Csoldiers_ground_01"] =			{	{1,DIR_FORWARD,3}, 
  338. 																	{1,DIR_REVERSE,2}, 
  339. 																}, 
  340. 			["rn08_$Csoldiers_ground_03"] =			{	{3,DIR_REVERSE,1}, 
  341. 																}, 
  342. 			["rn08_$Csoldiers_ground_04"] =			{	{1,DIR_FORWARD,1}, 
  343. 																	{1,DIR_REVERSE,5}, 
  344. 																	{2,DIR_FORWARD,1}, 
  345. 																	{5,DIR_FORWARD,1}, 
  346. 																}, 
  347. 			["rn08_$Csoldiers_ground_coop_00"] =	{	{2, DIR_REVERSE, 1}, 
  348. 																	{2, DIR_FORWARD, 2}, 
  349. 																}, 
  350. 			["rn08_$Csoldiers_ground_coop_01"] =	{	{2, DIR_REVERSE, 1}, 
  351. 																	{2, DIR_FORWARD, 2}, 
  352. 																}, 
  353. 			-- FIRST UPPER FLOOR 
  354. 			["rn08_$Csoldiers_top_00"]	=				{	{6, DIR_FORWARD, 1}, 
  355. 																	{6, DIR_REVERSE, 6}, 
  356. 																}, 
  357. 			["rn08_$Csoldiers_top_01"]	=				{	{6, DIR_FORWARD, 3}, 
  358. 																	{6, DIR_REVERSE, 1}, 
  359. 																}, 
  360. 			["rn08_$Csoldiers_top_02"]	=				{	{6, DIR_FORWARD, 5}, 
  361. 																	{6, DIR_REVERSE, 4}, 
  362. 																}, 
  363. 			["rn08_$Csoldiers_top_03"]	=				{	{6, DIR_FORWARD, 4}, 
  364. 																	{6, DIR_REVERSE, 3}, 
  365. 																}, 
  366. 			["rn08_$Csoldiers_top_04"]	=				{	{6, DIR_FORWARD, 2}, 
  367. 																	{6, DIR_REVERSE, 1}, 
  368. 																}, 
  369. 			-- SECOND UPPER FLOOR 
  370. 			["rn08_$Csoldiers_top_2_00"] =			{	{9, DIR_FORWARD, 2}, 
  371. 																}, 
  372. 			["rn08_$Csoldiers_top_2_01"] =			{	{8, DIR_REVERSE, 1}, 
  373. 																	{8, DIR_FORWARD, 2}, 
  374. 																}, 
  375. 			["rn08_$Csoldiers_top_2_02"] =			{	{7, DIR_REVERSE, 5}, 
  376. 																	{7, DIR_FORWARD, 6}, 
  377. 																}, 
  378. 			["rn08_$Csoldiers_top_2_03"] =			{	{7, DIR_REVERSE, 5}, 
  379. 																	{7, DIR_FORWARD, 6}, 
  380. 																}, 
  381. 			["rn08_$Csoldiers_top_2_04"] =			{	{7, DIR_REVERSE, 2}, 
  382. 																	{7, DIR_FORWARD, 3}, 
  383. 																}, 
  384. 			["rn08_$Csoldiers_top_2_05"] =			{	{9, DIR_REVERSE, 1}, 
  385. 																	{9, DIR_FORWARD, 2}, 
  386. 																}, 
  387. 			["rn08_$Csoldiers_top_2_coop_00"] =		{	{8, DIR_REVERSE, 1}, 
  388. 																	{8, DIR_FORWARD, 2}, 
  389. 																}, 
  390. 			["rn08_$Csoldiers_top_2_coop_01"] =		{	{9, DIR_FORWARD, 2}, 
  391. 																}, 
  392. 			-- THIRD UPPER FLOOR 
  393. 			["rn08_$Csoldiers_top_3_00"] =			{	{10, DIR_FORWARD, 3}, 
  394. 																	{10, DIR_REVERSE, 1}, 
  395. 																}, 
  396. 			["rn08_$Csoldiers_top_3_01"] =			{	{10, DIR_FORWARD, 5}, 
  397. 																	{10, DIR_REVERSE, 4}, 
  398. 																}, 
  399. 			["rn08_$Csoldiers_top_3_02"] =			{	{10, DIR_FORWARD, 5}, 
  400. 																	{10, DIR_REVERSE, 4}, 
  401. 																}, 
  402. 			["rn08_$Csoldiers_top_3_03"] =			{	{10, DIR_FORWARD, 2}, 
  403. 																	{10, DIR_REVERSE, 6}, 
  404. 																}, 
  405. 			["rn08_$Csoldiers_top_3_04"] =			{	{11, DIR_FORWARD, 2}, 
  406. 																	{11, DIR_REVERSE, 1}, 
  407. 																},		 
  408. 			["rn08_$Csoldiers_top_3_05"] =			{	{11, DIR_FORWARD, 2}, 
  409. 																	{11, DIR_REVERSE, 1}, 
  410. 																},		 
  411. 			["rn08_$Csoldiers_top_3_06"] =			{	{11, DIR_FORWARD, 2}, 
  412. 																	{11, DIR_REVERSE, 1}, 
  413. 																},		 
  414. 			["rn08_$Csoldiers_top_3_coop_00"] =		{	{10, DIR_FORWARD, 2}, 
  415. 																	{10, DIR_REVERSE, 1}, 
  416. 																},	 
  417.  
  418. 			-- FOURTH UPPER FLOOR 
  419. 			["rn08_$Csoldiers_top_4_00"] =			{	{13, DIR_REVERSE, 1}, 
  420. 																	{13, DIR_FORWARD, 2}, 
  421. 																}, 
  422. 			["rn08_$Csoldiers_top_4_01"] =			{	{13, DIR_REVERSE, 1}, 
  423. 																	{13, DIR_FORWARD, 2}, 
  424. 																}, 
  425. 			["rn08_$Csoldiers_top_4_02"] =			{	{13, DIR_REVERSE, 4}, 
  426. 																	{13, DIR_FORWARD, 5}, 
  427. 																}, 
  428. 			["rn08_$Csoldiers_top_4_03"] =			{	{13, DIR_FORWARD, 4}, 
  429. 																	{13, DIR_REVERSE, 3}, 
  430. 																}, 
  431. 			["rn08_$Csoldiers_top_4_coop_00"] =		{	{13, DIR_FORWARD, 1}, 
  432. 																	{13, DIR_REVERSE, 6}, 
  433. 																	{14, DIR_FORWARD, 1}, 
  434. 																},	 
  435. 			["rn08_$Csoldiers_top_4_coop_01"] =		{	{13, DIR_FORWARD, 3}, 
  436. 																	{13, DIR_REVERSE, 1}, 
  437. 																	{15, DIR_FORWARD, 1}, 
  438. 																},	 
  439.  
  440. 		} 
  441.  
  442. 		-- Note, each navpoint can only belong to one path segment. 
  443. 		GUARD_PATH_SEGMENTS =  
  444. 		{	-- FIRST FLOOR 
  445. 			[1] = {"rn08_$n017", "rn08_$n018", "rn08_$n019", "rn08_$n020", "rn08_$n021", "rn08_$n022"}, 
  446. 			[2] = {"rn08_$n023", "rn08_$n024"}, 
  447. 			[3] = {"rn08_$n025", "rn08_$n026"}, 
  448. 			[4] = {"rn08_$n027", "rn08_$n028"}, 
  449. 			[5] = {"rn08_$n029", "rn08_$n030"}, 
  450.  
  451. 			-- FIRST UPPER FLOOR 
  452. 			[6] = {"rn08_$n031", "rn08_$n032", "rn08_$n033", "rn08_$n034", "rn08_$n035", "rn08_$n036"}, 
  453.  
  454. 			-- SECOND UPPER FLOOR 
  455. 			[7] = {"rn08_$n037", "rn08_$n038", "rn08_$n039", "rn08_$n040", "rn08_$n041", "rn08_$n042"}, 
  456. 			[8] = {"rn08_$n043", "rn08_$n044"}, 
  457. 			[9] = {"rn08_$n045", "rn08_$n046"}, 
  458.  
  459. 			-- THIRD UPPER FLOOR 
  460. 			[10] = {"rn08_$n047", "rn08_$n048", "rn08_$n049", "rn08_$n050", "rn08_$n051", "rn08_$n052"}, 
  461. 			[11] = {"rn08_$n053", "rn08_$n054"}, 
  462. 			[12] = {"rn08_$n055", "rn08_$n056"}, 
  463.  
  464. 			-- FOURTH UPPER FLOOR 
  465. 			[13] = {"rn08_$n057", "rn08_$n058", "rn08_$n059", "rn08_$n060", "rn08_$n061", "rn08_$n062"}, 
  466. 			[14] = {"rn08_$n063", "rn08_$n064"}, 
  467. 			[15] = {"rn08_$n065", "rn08_$n066"}, 
  468. 		} 
  469.  
  470. 		-- Is the path a loop? 
  471. 		GUARD_PATH_IS_LOOP =  
  472. 		{	[1] = true, 
  473. 			[2] = false, 
  474. 			[3] = false, 
  475. 			[4] = false, 
  476. 			[5] = false, 
  477. 		} 
  478.  
  479. 		-- ["current_node"] = {[current_direction] = {{next_path, direction, index of first node on next path, }} 
  480. 		GUARD_SEGMENT_TRANSITIONS =  
  481. 		{	 
  482. 			["rn08_$n017"]	=	{	[DIR_REVERSE]	=	{	{2, DIR_FORWARD, 1}, 
  483. 																	{5, DIR_FORWARD, 1}, 
  484. 																}, 
  485. 									}, 
  486. 			["rn08_$n018"]	=	{	[DIR_EITHER]	=	{	{4, DIR_FORWARD, 1}, 
  487. 																}, 
  488. 									}, 
  489. 			["rn08_$n019"]	=	{	[DIR_EITHER]	=	{	{4, DIR_REVERSE, 2}, 
  490. 																}, 
  491. 									}, 
  492. 			["rn08_$n020"]	=	{	[DIR_FORWARD]	=	{	{3, DIR_FORWARD, 1}, 
  493. 																	{5, DIR_REVERSE, 2}, 
  494. 																}, 
  495. 									}, 
  496. 			["rn08_$n021"]	=	{	[DIR_REVERSE]	=	{	{3, DIR_FORWARD, 1}, 
  497. 																	{5, DIR_REVERSE, 2}, 
  498. 																}, 
  499. 									}, 
  500. 			["rn08_$n022"]	=	{	[DIR_FORWARD]	=	{	{2, DIR_FORWARD, 1}, 
  501. 																	{5, DIR_FORWARD, 1}, 
  502. 																}, 
  503. 									}, 
  504. 			["rn08_$n023"]	=	{	[DIR_REVERSE]	=	{	{1, DIR_FORWARD, 1}, 
  505. 																	{1, DIR_FORWARD, 6}, 
  506. 																	{5, DIR_FORWARD, 1}, 
  507. 																}, 
  508. 									}, 
  509. 			["rn08_$n025"]	=	{	[DIR_REVERSE]	=	{	{1, DIR_FORWARD, 5}, 
  510. 																	{1, DIR_REVERSE, 4}, 
  511. 																	{5, DIR_REVERSE, 2}, 
  512. 																}, 
  513. 									}, 
  514. 			["rn08_$n027"]	=	{	[DIR_REVERSE]	=	{	{1, DIR_FORWARD, 2}, 
  515. 																	{1, DIR_REVERSE, 2}, 
  516. 																}, 
  517. 									}, 
  518. 			["rn08_$n028"]	=	{	[DIR_FORWARD]	=	{	{1, DIR_FORWARD, 3}, 
  519. 																	{1, DIR_REVERSE, 3} 
  520. 																}, 
  521. 									}, 
  522. 			["rn08_$n029"]	=	{	[DIR_REVERSE]	=	{	{1, DIR_FORWARD, 1}, 
  523. 																	{1, DIR_REVERSE, 6}, 
  524. 																	{2, DIR_FORWARD, 1} 
  525. 																}, 
  526. 									}, 
  527. 			["rn08_$n030"]	=	{	[DIR_REVERSE]	=	{	{1, DIR_FORWARD, 5}, 
  528. 																	{1, DIR_REVERSE, 4}, 
  529. 																	{3, DIR_FORWARD, 1} 
  530. 																}, 
  531. 									}, 
  532. 			["rn08_$n037"]	=	{	[DIR_FORWARD]	=	{	{8, DIR_FORWARD, 1}, 
  533. 																}, 
  534. 									}, 
  535. 			["rn08_$n038"]	=	{	[DIR_REVERSE]	=	{	{8, DIR_FORWARD, 1}, 
  536. 																}, 
  537. 									}, 
  538. 			["rn08_$n039"]	=	{	[DIR_FORWARD]	=	{	{9, DIR_FORWARD, 1}, 
  539. 																}, 
  540. 									}, 
  541. 			["rn08_$n040"]	=	{	[DIR_REVERSE]	=	{	{9, DIR_FORWARD, 1}, 
  542. 																}, 
  543. 									}, 
  544. 			["rn08_$n043"]	=	{	[DIR_REVERSE]	=	{	{7, DIR_FORWARD, 2}, 
  545. 																	{7, DIR_REVERSE, 1}, 
  546. 																}, 
  547. 									}, 
  548. 			["rn08_$n045"]	=	{	[DIR_REVERSE]	=	{	{7, DIR_FORWARD, 4}, 
  549. 																	{7, DIR_REVERSE, 3}, 
  550. 																}, 
  551. 									}, 
  552. 			["rn08_$n047"]	=	{	[DIR_REVERSE]	=	{	{11, DIR_FORWARD, 1}, 
  553. 																}, 
  554. 									}, 
  555. 			["rn08_$n048"]	=	{	[DIR_FORWARD]	=	{	{12, DIR_FORWARD, 1}, 
  556. 																}, 
  557. 									}, 
  558. 			["rn08_$n049"]	=	{	[DIR_REVERSE]	=	{	{12, DIR_FORWARD, 1}, 
  559. 																}, 
  560. 									}, 
  561. 			["rn08_$n052"]	=	{	[DIR_FORWARD]	=	{	{11, DIR_FORWARD, 1}, 
  562. 																}, 
  563. 									}, 
  564. 			["rn08_$n053"]	=	{	[DIR_REVERSE]	=	{	{10, DIR_FORWARD, 1}, 
  565. 																	{10, DIR_REVERSE, 6}, 
  566. 																}, 
  567. 									}, 
  568. 			["rn08_$n055"]	=	{	[DIR_REVERSE]	=	{	{10, DIR_FORWARD, 3}, 
  569. 																	{10, DIR_REVERSE, 2}, 
  570. 																}, 
  571. 									}, 
  572. 			["rn08_$n057"]	=	{	[DIR_REVERSE]	=	{	{14, DIR_FORWARD, 1}, 
  573. 																}, 
  574. 									}, 
  575. 			["rn08_$n058"]	=	{	[DIR_FORWARD]	=	{	{15, DIR_FORWARD, 1}, 
  576. 																}, 
  577. 									}, 
  578. 			["rn08_$n059"]	=	{	[DIR_REVERSE]	=	{	{15, DIR_FORWARD, 1}, 
  579. 																}, 
  580. 									}, 
  581. 			["rn08_$n062"]	=	{	[DIR_FORWARD]	=	{	{14, DIR_FORWARD, 1}, 
  582. 																}, 
  583. 									}, 
  584. 			["rn08_$n063"]	=	{	[DIR_REVERSE]	=	{	{13, DIR_FORWARD, 1}, 
  585. 																	{13, DIR_REVERSE, 6}, 
  586. 																}, 
  587. 									}, 
  588. 			["rn08_$n065"]	=	{	[DIR_REVERSE]	=	{	{13, DIR_FORWARD, 3}, 
  589. 																	{13, DIR_REVERSE, 2}, 
  590. 																}, 
  591. 									}, 
  592. 		} 
  593.  
  594.  
  595. 	PLAYER_SYNC = { [LOCAL_PLAYER] = SYNC_LOCAL, [REMOTE_PLAYER] = SYNC_REMOTE } 
  596.  
  597.  
  598. 	RN08_RONIN_ATTACK_PERSONAS	= { 
  599. 		["AM_Ron2"]	=	"AMRON2", 
  600.  
  601. 		["AF_Ron1"]	=	"AFRON1", 
  602. 		["AF_Ron3"]	=	"AFRON3", 
  603.  
  604. 		["WM_Ron1"]	=	"WMRON1", 
  605.  
  606. 		["WF_Ron1"]	=	"WFRON1", 
  607. 		["WF_Ron2"]	=	"WFRON2", 
  608. 	} 
  609.  
  610.  
  611. -- Global Variables (First letter caps == Global Variable) 
  612. 	Arms_dealer_reached		= false 
  613. 	Elevator_reached			= false 
  614. 	--[[ 
  615. 	Soldiers_top_1_cleared	= false 
  616. 	Soldiers_top_2_cleared	= false 
  617. 	Soldiers_top_3_cleared	= false 
  618. 	Soldiers_top_4_cleared	= false 
  619. 	Soldiers_top_5_cleared	= false 
  620. 	]] 
  621. 	Lieutenants_cleared		= false 
  622. 	All_bombs_placed			= false 
  623. 	Jump_location_reached	= false 
  624. 	Exit_reached				= false 
  625. 	Target_floor_reached		= false 
  626. 	Enemy_set_cleared			= false 
  627. 	Rn08_ronin_hq_reached	= false 
  628.  
  629. 	Soldiers_top_1_living	= 0 
  630. 	Soldiers_top_2_living	= 0 
  631. 	Soldiers_top_3_living	= 0 
  632. 	Soldiers_top_4_living	= 0 
  633. 	Soldiers_top_5_living	= 0 
  634. 	Bombs_to_place				= 0 
  635. 	Lieutenants_living		= 0 
  636. 	Lieutenants_to_kill		= 0 
  637. 	Total_bombs_placed		= 0 
  638. 	Enemies_living				= 0 
  639. 	Enemies_to_kill			= 0 
  640.  
  641. 	Enemy_set_objective_helptext = "" 
  642.  
  643. 	Bomb_timer_started		= false 
  644. 	Bomb_effect_handles		= {} 
  645. 	Bombs_placed				= {} 
  646.  
  647. 	-- Doorway triggers mark the transition from stairwell to the floor proper 
  648. 	Doorway_trigger_1		= "" 
  649. 	Doorway_trigger_2		= "" 
  650.  
  651. 	-- Stairwell triggers are in the stairwell, just adjacent to the doors 
  652. 	Stairwell_trigger_1	= "" 
  653. 	Stairwell_trigger_2	= "" 
  654.  
  655. -- THREADS 
  656. 	Thread_gat_take_elevator	= -1 
  657. 	Thread_countdown_monitor	= -1 
  658. 	 
  659. 		 
  660.  
  661. -- Functions 
  662.  
  663. -- Called when the mission starts 
  664. function rn08_start(rn08_checkpoint, is_restart) 
  665. 	 
  666. 	rn08_initialize(rn08_checkpoint, is_restart) 
  667.  
  668. 	if (rn08_checkpoint == CHECKPOINT_START) then 
  669.  
  670. 		-- Setup the lower levels of the hotel. This doesn't need to be blocking. 
  671. 		thread_new("rn08_setup_hotel_lower_levels") 
  672.  
  673. 		-- Player departs arms dealer and heads to Ronin HQ 
  674. 		rn08_reach_ronin_hq() 
  675. 		 
  676. 		-- Player passes through hotel lobby to the elevator 
  677. 		rn08_reach_lobby_elevator() 
  678.  
  679. 		-- CHECKPOINT! 
  680. 		mission_set_checkpoint(CHECKPOINT_BOMBS) 
  681. 		rn08_checkpoint = CHECKPOINT_BOMBS 
  682.  
  683. 	end -- ends CHECKPOINT_START 
  684.  
  685. 	if (rn08_checkpoint == CHECKPOINT_BOMBS) then 
  686.  
  687. 		group_create_hidden(GROUP_BOMBS, true) 
  688. 		 
  689. 		-- Player plants bombs at each of the top 5 levels of the hotel 
  690. 		-- also spawns Lieutenants 
  691. 		rn08_bomb_placement() 
  692.  
  693. 		-- Player enters the suite and kills off all of the Lieutenants 
  694. 		rn08_process_lieutenants() 
  695.  
  696. 		-- Player parachutes down the lobby atrium to the ground floor. 
  697. 		rn08_leave_hotel() 
  698.  
  699. 		-- Wait a bit so that the player gets to see the coolness. 
  700. 		delay(2.0) 
  701.  
  702. 		-- Win the mission 
  703. 		rn08_complete() 
  704.  
  705. 	end -- end of CHECKPOINT_BOMBS 
  706.  
  707. end 
  708.  
  709. -- Load groups for the hotles lower levels, have the guards patrol 
  710. function rn08_setup_hotel_lower_levels() 
  711.  
  712. 	-- load the Ground floor soldiers 
  713. 	rn08_group_create_maybe_coop(GROUP_SOLDIERS_GROUND,GROUP_SOLDIERS_GROUND_COOP, false) 
  714. 	-- Prep guards 
  715. 	for i,guard in pairs(TABLE_SOLDIERS_GROUND) do 
  716. 		patrol("rn08_guard_patrol", guard) 
  717. 	end 
  718.  
  719. 	-- load the second floor soldiers 
  720. 	group_create(GROUP_SOLDIERS_GROUND_2, false) 
  721.  
  722. 	-- load the ground floor civilians 
  723. 	group_create(GROUP_CIVILIANS_GROUND, false) 
  724.  
  725. end 
  726.  
  727. function rn08_initialize(checkpoint, is_restart) 
  728.  
  729. 	mission_start_fade_out(0.0) 
  730.  
  731. 	-- Load up initial groups, maybe play the initial cutscene 
  732. 	if (checkpoint == CHECKPOINT_START) then 
  733.  
  734. 		local start_groups = {GROUP_GAT, GROUP_COURTESY_CAR} 
  735. 		if (coop_is_active()) then 
  736. 			start_groups = {GROUP_GAT, GROUP_COURTESY_CAR, GROUP_COURTESY_CAR_COOP} 
  737. 		end 
  738.  
  739. 		-- If this is a restart from the beginning, teleport to start and reload initial groups 
  740. 		if (is_restart) then 
  741. 			teleport_coop(NAVPOINT_LOCATION_START, NAVPOINT_LOCATION_START_PLAYER_2, true) 
  742. 			for i,group in pairs(start_groups) do 
  743. 				group_create(group,true) 
  744. 			end 
  745. 		-- If it is the first time playing from the start, play the cutscene then show the initial groups. 
  746. 		else 
  747. 			cutscene_play("ro08-01", start_groups, {NAVPOINT_LOCATION_START, NAVPOINT_LOCATION_START_PLAYER_2}, false) 
  748. 			for i,group in pairs(start_groups) do 
  749. 				group_show(group) 
  750. 			end 
  751. 		end 
  752. 		fade_out(0) 
  753. 	end 
  754.  
  755. 	rn08_initialize_common() 
  756. 	rn08_initialize_checkpoint(checkpoint) 
  757.  
  758. 	mission_start_fade_in() 
  759.  
  760. end 
  761.  
  762. function rn08_initialize_common() 
  763.  
  764. 	set_mission_author("Phillip Alexander") 
  765.  
  766. 	if (coop_is_active()) then 
  767. 		IN_COOP = true 
  768. 	end 
  769.  
  770. 	-- A few Global constants need to be set up, but shouldn't be changed after this function 
  771. 	rn08_setup_global_constants() 
  772.  
  773. 	-- No notoriety spawning 
  774. 	notoriety_force_no_spawn(MISSION_GANG_NAME, true) 
  775.  
  776. 	-- No target/driver for base jumping 
  777. 	base_jumping_enable(false) 
  778.  
  779. 	-- Override Ronin Attack peronas 
  780. 	persona_override_group_start(RN08_RONIN_ATTACK_PERSONAS,POT_SITUATIONS[POT_ATTACK], "RO08_ATTACK") 
  781.  
  782. 	-- Make sure tha the player can use the parachute 
  783. 	parachute_enable() 
  784. 	 
  785. 	--Make sure the front doors are unlocked. 
  786. 	door_lock(DOOR_FRONT_1, false) 
  787. 	door_lock(DOOR_FRONT_2, false) 
  788.  
  789.  
  790. end 
  791.  
  792. function rn08_initialize_checkpoint(checkpoint) 
  793.  
  794. 	if(checkpoint == CHECKPOINT_START) then 
  795.  
  796. 		-- Remove any followers and make Gat a follower of the local player 
  797. 		party_add(CHARACTER_GAT,LOCAL_PLAYER) 
  798.  
  799. 		-- Handle Gat's death 
  800. 		on_death("rn08_gat_death_failure", CHARACTER_GAT) 
  801. 		on_dismiss("rn08_gat_dismiss_failure", CHARACTER_GAT) 
  802.  
  803. 		-- Override Gat's persona 
  804. 		persona_override_character_start(CHARACTER_GAT, POT_SITUATIONS[POT_ATTACK], "GAT_RON08_ATTACK") 
  805. 		persona_override_character_start(CHARACTER_GAT, POT_SITUATIONS[POT_TAKE_DAMAGE], "GAT_RON08_TAKEDAM") 
  806.  
  807. 	elseif (checkpoint == CHECKPOINT_BOMBS) then 
  808.  
  809. 		-- Fail the mission if a player jumps too early. 
  810. 		on_trigger("rn08_early_jump_failure", TRIGGER_EARLY_JUMP) 
  811. 		trigger_enable(TRIGGER_EARLY_JUMP, true) 
  812.  
  813. 		-- make sure that the mission parachute override is enabled 
  814. 		parachute_enable() 
  815.  
  816. 		-- Spawn all soldiers on top floors, local all hotel doors. 
  817. 		rn08_group_create_maybe_coop(GROUP_SOLDIERS_TOP_2,GROUP_SOLDIERS_TOP_2_COOP,true) 
  818. 		rn08_group_create_maybe_coop(GROUP_SOLDIERS_TOP_3,GROUP_SOLDIERS_TOP_3_COOP,false) 
  819. 		for i,guard in pairs(TABLE_SOLDIERS_TOP_2) do 
  820. 			patrol("rn08_guard_patrol", guard) 
  821. 		end 
  822. 		for i,guard in pairs(TABLE_SOLDIERS_TOP_3) do 
  823. 			patrol("rn08_guard_patrol", guard) 
  824. 		end 
  825. 		-- lock all hotel doors, do this here so we don't see door activation ui elements popping 
  826. 		rn08_close_and_lock_doors() 
  827.  
  828. 		-- Delay an extra second so that the bomb's smoke has time to clear. 
  829. 		delay(1.0) 
  830.  
  831. 	end 
  832.  
  833. end 
  834.  
  835. function rn08_arms_dealer() 
  836.  
  837. 	-- spawn the dealer and his vehicle 
  838. 	group_create(GROUP_ARMS_DEALER, true) 
  839.  
  840. 	-- Handle The arms dealer's death 
  841. 	on_death("rn08_arms_dealer_failure", CHARACTER_ARMS_DEALER) 
  842.  
  843. 	-- enable the arms dealer trigger, add a minimap icon, glow effect, and callback 
  844. 	trigger_enable(TRIGGER_ARMS_DEALER,true) 
  845. 	marker_add_trigger(TRIGGER_ARMS_DEALER,MINIMAP_ICON_LOCATION,INGAME_EFFECT_LOCATION,SYNC_ALL) 
  846. 	on_trigger("rn08_arms_dealer_reached",TRIGGER_ARMS_DEALER) 
  847.  
  848. 	-- add a waypoint to the dealer's location 
  849. 	mission_waypoint_add( TRIGGER_ARMS_DEALER, SYNC_ALL ) 
  850.  
  851. 	-- display helptext: "drive to the arms dealer." 
  852. 	mission_help_table(HELPTEXT_ARMS_DEALER) 
  853.  
  854. 	-- delay a bit, play the intro dialogue 
  855. 	audio_play_conversation(INTRO_CONVERSATION) 
  856.  
  857. 	-- wait for player to arrive at the dealer 
  858. 	while (not Arms_dealer_reached) do 
  859. 		thread_yield() 
  860. 	end 
  861.  
  862. 	-- 
  863. 	on_death("", CHARACTER_ARMS_DEALER) 
  864.  
  865. 	-- when player arrives at glowy trigger, play dealer's dialogue line  
  866. 	 
  867. 	audio_play_conversation(DEALER_CONVERSATION) 
  868.  
  869. 	parachute_enable() 
  870.  
  871. 	-- release the arms dealer group 
  872. 	release_to_world(GROUP_ARMS_DEALER) 
  873.  
  874. end 
  875.  
  876. function rn08_reach_ronin_hq() 
  877.  
  878. 	-- delay a bit, play the intro dialogue 
  879. 	local thread_intro_conversation = thread_new("rn08_play_intro_conversation") 
  880.  
  881. 	-- display minimap icon, glowy trigger for Downtown hotel  
  882. 	on_trigger("rn08_hotel_reached",TRIGGER_HOTEL) 
  883. 	trigger_enable(TRIGGER_HOTEL,true) 
  884. 	marker_add_trigger(TRIGGER_HOTEL,MINIMAP_ICON_LOCATION,INGAME_EFFECT_VEHICLE_LOCATION,SYNC_ALL) 
  885.  
  886. 	-- add a waypoint to the hotel's location 
  887. 	mission_waypoint_add( TRIGGER_HOTEL, SYNC_ALL ) 
  888.  
  889. 	-- display helptext "Drive to the Yakuza headquarters."  
  890. 	mission_help_table (HELPTEXT_RONIN_HQ) 
  891.  
  892. 	-- wait for player to arrive at the Hotel 
  893. 	while (not Rn08_ronin_hq_reached) do 
  894. 		thread_yield() 
  895. 	end 
  896.  
  897. end 
  898.  
  899. function rn08_play_intro_conversation() 
  900.  
  901. 	delay(15) 
  902. 	while(get_dist(CHARACTER_GAT, LOCAL_PLAYER) > 15) do 
  903. 		thread_yield() 
  904. 	end 
  905.  
  906. 	if (not Rn08_ronin_hq_reached) then 
  907. 		audio_play_conversation(INTRO_CONVERSATION) 
  908. 	end 
  909.  
  910. end 
  911.  
  912.  
  913. function rn08_reach_lobby_elevator() 
  914.  
  915. 	-- Have the player take out the first and second floor guards 
  916. 	rn08_process_enemy_set(TABLE_SOLDIERS_GROUND, HELPTEXT_GROUND_FLOOR, HELPTEXT_OBJECTIVE_RONIN) 
  917. 	rn08_group_release_maybe_coop(GROUP_SOLDIERS_GROUND,GROUP_SOLDIERS_GROUND_COOP) 
  918.  
  919. 	-- Send Gat on his merry way 
  920. 	audio_play_for_character("GAT_RON8_SPLIT_01", CHARACTER_GAT, "voice", false, false) 
  921. 	npc_stop_following(CHARACTER_GAT) 
  922. 	set_unrecruitable_flag(CHARACTER_GAT, true) 
  923. 	turn_invulnerable(CHARACTER_GAT,true) 
  924. 		 
  925. 	-- display the objective text for bomb placement 
  926. 	objective_text(0, HELPTEXT_OBJECTIVE_BOMBS, Total_bombs_placed, NUMBER_BOMBS_TO_PLANT) 
  927. 	mission_help_table(HELPTEXT_GROUND_FLOOR_CLEAR) 
  928. 	 
  929. 	Thread_gat_take_elevator = patrol("rn08_take_elevator", CHARACTER_GAT) 
  930.  
  931. 	-- display minimap icon, glowy trigger for lobby elevator  
  932. 	on_trigger("rn08_elevator_reached",TRIGGER_ELEVATOR) 
  933. 	trigger_enable(TRIGGER_ELEVATOR,true) 
  934. 	marker_add_trigger(TRIGGER_ELEVATOR,MINIMAP_ICON_LOCATION,INGAME_EFFECT_LOCATION,SYNC_ALL) 
  935.  
  936. 	-- wait for player to reach the elevator ( the elevator trigger call back spawns the next group of soldiers) 
  937. 	while (not Elevator_reached) do 
  938. 		thread_yield() 
  939. 	end 
  940.  
  941. end 
  942.  
  943. function rn08_bomb_placement() 
  944.  
  945. 	-- tell the player to place the bombs 
  946. 	mission_help_table(HELPTEXT_BOMBS) 
  947.  
  948. 	-- handle placing of bombs 
  949. 	rn08_process_bomb_set(TABLE_BOMBS_TOP_2) 
  950.  
  951. 	-- Tell the player to move on to the next floor 
  952. 	mission_help_table_nag(HELPTEXT_NEXT_FLOOR) 
  953.  
  954. 	-- Unlock this floor's doors 
  955. 	door_lock(DOOR_NORTH_TOP_2,false) 
  956. 	door_lock(DOOR_SOUTH_TOP_2,false) 
  957.  
  958. 	-- Show this floor's entries into the stairwell 
  959. 	rn08_stairwell_entry(TRIGGER_NORTH_TOP_2,TRIGGER_SOUTH_TOP_2) 
  960.  
  961. 	group_destroy(GROUP_SOLDIERS_GROUND_2) 
  962. 	group_destroy(GROUP_CIVILIANS_GROUND) 
  963.  
  964. 	-- unlock the next floor's doors 
  965. 	door_lock(DOOR_NORTH_TOP_3,false) 
  966. 	door_lock(DOOR_SOUTH_TOP_3,false) 
  967.  
  968. 	-- Gid rid of the ground floor soldiers 
  969. 	release_to_world(GROUP_SOLDIERS_TOP_1) 
  970.  
  971. 	rn08_group_create_maybe_coop(GROUP_SOLDIERS_TOP_4,GROUP_SOLDIERS_TOP_4_COOP,false) 
  972. 	for i,guard in pairs(TABLE_SOLDIERS_TOP_4) do 
  973. 		patrol("rn08_guard_patrol", guard) 
  974. 	end 
  975.  
  976. 	rn08_process_bomb_set(	TABLE_BOMBS_TOP_3, TRIGGER_STAIRWELL_NORTH_TOP_3, TRIGGER_NORTH_TOP_3,  
  977. 							TRIGGER_STAIRWELL_SOUTH_TOP_3, TRIGGER_SOUTH_TOP_3) 
  978. 	 
  979. 	-- Tell the player to move on to the next floor 
  980. 	delay(2.0) 
  981. 	mission_help_table(HELPTEXT_NEXT_FLOOR) 
  982. 	rn08_stairwell_entry(TRIGGER_NORTH_TOP_3,TRIGGER_SOUTH_TOP_3) 
  983.  
  984. 	door_lock(DOOR_NORTH_TOP_4,false) 
  985. 	door_lock(DOOR_SOUTH_TOP_4,false) 
  986. 	release_to_world(GROUP_SOLDIERS_TOP_2) 
  987. 	rn08_group_create_maybe_coop(GROUP_SOLDIERS_TOP_5,GROUP_SOLDIERS_TOP_5_COOP,false) 
  988.  
  989. 	-- Start streaming in reinforcements 
  990. 	group_create_hidden(GROUP_REINFORCEMENTS) 
  991.  
  992. 	rn08_process_bomb_set(TABLE_BOMBS_TOP_4) 
  993.  
  994. 	-- Spawn reinforcements 
  995. 	rn08_spawn_reinforcements() 
  996.  
  997. 	-- Tell the player to move on to the next floor 
  998. 	delay(2.0) 
  999. 	mission_help_table(HELPTEXT_NEXT_FLOOR) 
  1000. 	rn08_stairwell_entry(TRIGGER_NORTH_TOP_4) 
  1001.  
  1002. 	door_lock(DOOR_NORTH_TOP_5,false) 
  1003. 	-- load the lieutenats and assign callbacks 
  1004. 	release_to_world(GROUP_SOLDIERS_TOP_3) 
  1005. 	rn08_group_create_maybe_coop(GROUP_LIEUTENANTS,GROUP_LIEUTENANTS_COOP, false) 
  1006. 	for i,guard in pairs(TABLE_SOLDIERS_TOP_5) do 
  1007. 		patrol("rn08_guard_patrol", guard) 
  1008. 	end 
  1009.  
  1010. 	rn08_process_bomb_set(TABLE_BOMBS_TOP_5) 
  1011. 	delay(2.0) 
  1012.  
  1013. end 
  1014.  
  1015. -- Guard patrol thread 
  1016. Path_segment_occupied			= {} 
  1017. function rn08_guard_patrol(guard) 
  1018.  
  1019. 	if (GUARD_INITIAL_PATH_SEGMENTS[guard] == nil) then 
  1020. 		return 
  1021. 	end 
  1022.  
  1023. 	local num_initial_path_segments = sizeof_table(GUARD_INITIAL_PATH_SEGMENTS[guard]) 
  1024. 	local current_segment_index = 0 
  1025. 	local current_direction = DIR_FORWARD 
  1026. 	local current_node_index = 0 
  1027. 	local current_segment_num_nodes = 0 
  1028.  
  1029. 	-- Pathfind to the initial location 
  1030.  
  1031. 	local at_spawn_location = true 
  1032.  
  1033.  
  1034. 	-- Start patrolling 
  1035. 	while(true) do 
  1036.  
  1037. 		-- While we are at the spawn location, maybe decide to go for a little stroll 
  1038. 		if (at_spawn_location) then 
  1039.  
  1040. 			-- Select a path segment randomly from our list of possible initial paths 
  1041. 			local transition_info = GUARD_INITIAL_PATH_SEGMENTS[guard][rand_int(1,num_initial_path_segments)] 
  1042. 			local path_segment_index = transition_info[1] 
  1043.  
  1044. 			-- If the path is not occupied, start pathfinding 
  1045. 			if ( Path_segment_occupied[path_segment_index] ~= true) then 
  1046.  
  1047. 				--Path_segment_occupied[path_segment_index] = true 
  1048. 				at_spawn_location = false 
  1049. 				current_segment_index = path_segment_index 
  1050.  
  1051. 				current_direction = transition_info[2] 
  1052. 				if(current_direction == DIR_EITHER) then 
  1053. 					local dir_roll = rand_int(1,2) 
  1054. 					if (dir_roll == 1) then 
  1055. 						current_direction = DIR_FORWARD 
  1056. 					else 
  1057. 						current_direction = DIR_REVERSE 
  1058. 					end 
  1059. 				end 
  1060.  
  1061. 				current_node_index =  transition_info[3] 
  1062. 				current_segment_num_nodes = sizeof_table(GUARD_PATH_SEGMENTS[current_segment_index]) 
  1063.  
  1064. 				move_to(guard, GUARD_PATH_SEGMENTS[current_segment_index][current_node_index]) 
  1065. 				 
  1066. 			end 
  1067.  
  1068. 		-- Otherwise, already on patrol 
  1069. 		else 
  1070. 			 
  1071. 			-- Maybe check for a transition into another patrol 
  1072. 			local transition_found = false 
  1073. 			local transition_info = nil 
  1074. 			if (rand_float(0.0,1.0) < 0.5) then 
  1075.  
  1076. 				local current_node = GUARD_PATH_SEGMENTS[current_segment_index][current_node_index] 
  1077.  
  1078. 				if (GUARD_SEGMENT_TRANSITIONS[current_node] ~= nil) then 
  1079.  
  1080. 					local num_transitions_in_dir = 0 
  1081. 					if (GUARD_SEGMENT_TRANSITIONS[current_node][current_direction] ~= nil) then 
  1082. 						num_transitions_in_dir = 
  1083. 							sizeof_table(GUARD_SEGMENT_TRANSITIONS[current_node][current_direction]) 
  1084. 					end 
  1085.  
  1086. 					local num_transitions_in_either = 0 
  1087. 					if (GUARD_SEGMENT_TRANSITIONS[current_node][DIR_EITHER] ~= nil) then 
  1088. 						num_transitions_in_either = 
  1089. 							sizeof_table(GUARD_SEGMENT_TRANSITIONS[current_node][DIR_EITHER]) 
  1090. 					end 
  1091.  
  1092. 					if (num_transitions_in_either + num_transitions_in_dir > 0) then 
  1093.  
  1094. 						local rand_transition = rand_int (1, num_transitions_in_dir + num_transitions_in_either) 
  1095.  
  1096. 						if (rand_transition > num_transitions_in_dir) then 
  1097. 							rand_transition = rand_transition - num_transitions_in_dir 
  1098. 							transition_info = GUARD_SEGMENT_TRANSITIONS[current_node][DIR_EITHER][rand_transition] 
  1099. 						else 
  1100. 							transition_info = GUARD_SEGMENT_TRANSITIONS[current_node][current_direction][rand_transition] 
  1101. 						end 
  1102. 						 
  1103. 						if (Path_segment_occupied[transition_info[1]] ~= true) then 
  1104. 							transition_found = true 
  1105. 						end 
  1106. 					end 
  1107. 				end 
  1108. 			end 
  1109.  
  1110. 			if (transition_found == true) then 
  1111.  
  1112. 				current_direction = transition_info[2] 
  1113. 				if(current_direction == DIR_EITHER) then 
  1114. 					if (rand_int(1,2) == 1) then 
  1115. 						current_direction = DIR_FORWARD 
  1116. 					else 
  1117. 						current_direction = DIR_REVERSE 
  1118. 					end 
  1119. 				end 
  1120. 				current_node_index =  transition_info[3] 
  1121.  
  1122. 				local transition_segment_index = transition_info[1] 
  1123. 				local transition_node_index = transition_info[2] 
  1124. 				move_to(guard, GUARD_PATH_SEGMENTS[transition_segment_index][transition_node_index]) 
  1125.  
  1126. 				Path_segment_occupied[current_segment_index] = false 
  1127. 				--Path_segment_occupied[transition_segment_index] = true 
  1128. 				current_segment_index = transition_segment_index 
  1129. 				current_segment_num_nodes = sizeof_table(GUARD_PATH_SEGMENTS[current_segment_index]) 
  1130.  
  1131. 			else 
  1132. 				 
  1133. 				-- Get the index of the next node to pathfind to 
  1134. 				if(current_direction == DIR_FORWARD) then 
  1135. 					current_node_index = current_node_index + 1 
  1136. 					if (current_node_index > current_segment_num_nodes) then 
  1137. 						current_node_index = 1 
  1138. 					end 
  1139. 				else 
  1140. 					current_node_index = current_node_index - 1 
  1141. 					if (current_node_index == 0) then 
  1142. 						current_node_index = current_segment_num_nodes 
  1143. 					end 
  1144. 				end 
  1145. 			 
  1146. 				move_to(guard, GUARD_PATH_SEGMENTS[current_segment_index][current_node_index]) 
  1147.  
  1148. 			end 
  1149. 		end -- ends else(not at spawn location) 
  1150.  
  1151. 		thread_yield() 
  1152.  
  1153. 	end -- end while(true) 
  1154.  
  1155. end 
  1156.  
  1157. function rn08_spawn_reinforcements() 
  1158. 	local spawn_count = NUMBER_REINFORCEMENTS 
  1159. 	if (IN_COOP) then 
  1160. 		spawn_count = NUMBER_REINFORCEMENTS_COOP 
  1161. 	end 
  1162. 		 
  1163. 	for i=1, spawn_count, 1 do 
  1164. 		local spawn_navpoint = rn08_get_reinforcement_navpoint() 
  1165. 		if (spawn_navpoint ~= nil) then 
  1166. 			local ronin = TABLE_REINFORCEMENTS[i] 
  1167. 			if (ronin ~= nil) then 
  1168. 				teleport(ronin, spawn_navpoint) 
  1169. 				character_show(ronin) 
  1170. 				attack(ronin) 
  1171. 			end 
  1172. 		end 
  1173. 	end 
  1174.  
  1175. end 
  1176.  
  1177. rn08_next_spawn_navpoint = 1 
  1178. function rn08_get_reinforcement_navpoint() 
  1179.  
  1180. 	local return_navpoint = nil 
  1181.  
  1182. 	for i = rn08_next_spawn_navpoint, sizeof_table(TABLE_REINFORCEMENT_NAVPOINTS), 1 do 
  1183.  
  1184. 		rn08_next_spawn_navpoint = rn08_next_spawn_navpoint + 1 
  1185. 		local current_navpoint = TABLE_REINFORCEMENT_NAVPOINTS[i] 
  1186.  
  1187. 		if (not rn08_navpoint_in_fov(current_navpoint)) then 
  1188. 			return_navpoint = current_navpoint 
  1189. 			break 
  1190. 		end		 
  1191. 	end 
  1192.  
  1193. 	return return_navpoint 
  1194.  
  1195. end 
  1196.  
  1197. function rn08_navpoint_in_fov(navpoint) 
  1198.  
  1199. 	local navpoint_in_local_fov = navpoint_in_player_fov(navpoint, LOCAL_PLAYER) 
  1200. 	local navpoint_in_remote_fov = false 
  1201. 	if (IN_COOP) then 
  1202. 		navpoint_in_remote_fov = navpoint_in_player_fov(navpoint, REMOTE_PLAYER) 
  1203. 	end 
  1204.  
  1205. 	return (navpoint_in_local_fov or navpoint_in_remote_fov) 
  1206.  
  1207. end 
  1208.  
  1209. function rn08_process_lieutenants() 
  1210.  
  1211. 	-- Unlock suite doors 
  1212. 	door_lock(DOOR_SUITE_OUTER_1,false) 
  1213. 	door_lock(DOOR_SUITE_OUTER_2,false) 
  1214.  
  1215. 	-- Increase LTNT. hit points 
  1216. 	for i, target in pairs(TABLE_LIEUTENANTS) do 
  1217. 		if(not character_is_dead(target)) then 
  1218. 			local hit_points = get_current_hit_points(target) 
  1219. 			hit_points = hit_points * LIEUTENANT_HEALTH_MULTIPLIER  
  1220. 			set_max_hit_points(target, hit_points, true) 
  1221. 		end 
  1222. 	end 
  1223. 	 
  1224. 	rn08_process_enemy_set(TABLE_LIEUTENANTS, HELPTEXT_SUITE, HELPTEXT_OBJECTIVE_RONIN) 
  1225.  
  1226. end 
  1227.  
  1228. function rn08_leave_hotel() 
  1229.  
  1230. 	group_create(GROUP_BODY_COUNT) 
  1231.  
  1232. 	mission_help_table(HELPTEXT_JUMP) 
  1233.  
  1234. 	-- Jumping from the lower levels should no longer fail the mission. 
  1235. 	on_trigger("rn08_jump_reached", TRIGGER_EARLY_JUMP) 
  1236. 	trigger_enable(TRIGGER_EARLY_JUMP, true) 
  1237.  
  1238. 	on_trigger("rn08_jump_reached",TRIGGER_JUMP) 
  1239. 	trigger_enable(TRIGGER_JUMP,true) 
  1240. 	marker_add_trigger(TRIGGER_JUMP,MINIMAP_ICON_LOCATION,INGAME_EFFECT_LOCATION,SYNC_ALL) 
  1241.  
  1242. 	while (not Jump_location_reached) do  
  1243. 		thread_yield() 
  1244. 	end 
  1245.  
  1246. 	if(Thread_countdown_monitor ~= -1) then 
  1247. 		thread_kill(Thread_countdown_monitor) 
  1248. 	end 
  1249.  
  1250. 	-- Enable the hotel ground floor trigger 
  1251. 	on_trigger("rn08_exit_reached",TRIGGER_GROUND_FLOOR) 
  1252. 	trigger_enable(TRIGGER_GROUND_FLOOR,true) 
  1253.  
  1254. 	-- Disable the elevator up 
  1255. 	on_trigger("",TRIGGER_ELEVATOR) 
  1256. 	trigger_enable(TRIGGER_ELEVATOR,false) 
  1257.  
  1258. 	-- Enable free fall explosion triggers 
  1259. 	on_trigger("rn08_free_fall_1_reached",TRIGGER_FREE_FALL_1) 
  1260. 	trigger_enable(TRIGGER_FREE_FALL_1,true) 
  1261.  
  1262. 	on_trigger("rn08_free_fall_2_reached",TRIGGER_FREE_FALL_2) 
  1263. 	trigger_enable(TRIGGER_FREE_FALL_2,true) 
  1264.  
  1265. 	on_trigger("rn08_free_fall_3_reached",TRIGGER_FREE_FALL_3) 
  1266. 	trigger_enable(TRIGGER_FREE_FALL_3,true) 
  1267.  
  1268. 	-- wait for player to clear the soldiers off of this level 
  1269. 	while (not Exit_reached) do 
  1270. 		thread_yield() 
  1271. 	end 
  1272.  
  1273. end 
  1274.  
  1275. function rn08_close_and_lock_doors() 
  1276.  
  1277. 	rn08_close_and_lock_door(DOOR_NORTH_TOP_2) 
  1278. 	rn08_close_and_lock_door(DOOR_NORTH_TOP_3) 
  1279. 	rn08_close_and_lock_door(DOOR_NORTH_TOP_4) 
  1280. 	rn08_close_and_lock_door(DOOR_NORTH_TOP_5) 
  1281.  
  1282. 	rn08_close_and_lock_door(DOOR_SOUTH_TOP_2) 
  1283. 	rn08_close_and_lock_door(DOOR_SOUTH_TOP_3) 
  1284. 	rn08_close_and_lock_door(DOOR_SOUTH_TOP_4) 
  1285.  
  1286. 	rn08_close_and_lock_door(DOOR_SUITE_OUTER_1) 
  1287. 	rn08_close_and_lock_door(DOOR_SUITE_OUTER_2) 
  1288. end 
  1289.  
  1290. function rn08_close_and_lock_door(door) 
  1291. 	door_close(door) 
  1292. 	door_lock(door,true) 
  1293. end 
  1294.  
  1295. function rn08_bomb_placed(placer,bomb) 
  1296.  
  1297. 	turn_invulnerable(placer, false) 
  1298. 	character_prevent_explosion_fling(placer, true) 
  1299. 	player_controls_disable(placer) 
  1300. 	local player_weapon = inv_item_get_equipped_item(placer) 
  1301. 	inv_item_equip("brass_knuckles",placer) 
  1302. 	inv_weapon_enable_or_disable_all_slots(false, PLAYER_SYNC[placer]) 
  1303.  
  1304. 	local crouch_forced = false 
  1305.  
  1306. 	if not crouch_is_crouching(placer) then 
  1307. 		crouch_start(placer) 
  1308. 		crouch_forced = true 
  1309. 		delay(1) 
  1310. 	end 
  1311. 	set_animation_state(placer, "crouch plant bomb")				 
  1312.  
  1313. 	-- keep track of the bombs that have actually been placed 
  1314. 	local index_offset = sizeof_table(Bombs_placed) 
  1315. 	Bombs_placed[index_offset+1] = bomb 
  1316. 	Bombs_to_place = Bombs_to_place -1 
  1317. 	Total_bombs_placed = Total_bombs_placed + 1 
  1318. 	if (Bombs_to_place < 1) then 
  1319. 		All_bombs_placed = true 
  1320. 	end 
  1321. 	if (Total_bombs_placed < NUMBER_BOMBS_TO_PLANT) then 
  1322. 		objective_text(0, HELPTEXT_OBJECTIVE_BOMBS, Total_bombs_placed, NUMBER_BOMBS_TO_PLANT) 
  1323. 	else 
  1324. 		objective_text_clear(0) 
  1325. 	end 
  1326.  
  1327. 	delay(1) 
  1328.  
  1329. 	audio_play_for_navpoint(FOLEY_BOMB_PLANT, bomb, "foley") 
  1330. 	clear_animation_state(placer) 
  1331. 	inv_item_equip(player_weapon,placer) 
  1332. 	if crouch_forced then 
  1333. 		crouch_stop(placer) 
  1334. 	end		 
  1335.  
  1336. 	inv_weapon_enable_or_disable_all_slots(true, PLAYER_SYNC[placer]) 
  1337. 	player_controls_enable(placer) 
  1338. 	character_prevent_explosion_fling(placer, false) 
  1339. 	turn_vulnerable(placer) 
  1340.  
  1341. 	-- if the bomb timer isn't started, get it going 
  1342. 	if (Bomb_timer_started == false) then 
  1343. 		mission_help_table_nag(HELPTEXT_BOMBS_HURRY) 
  1344. 		hud_timer_set(1, BOMB_TIME_S*1000,"rn08_bomb_timer_expired") 
  1345. 		Bomb_timer_started = true 
  1346. 		Thread_countdown_monitor = thread_new("rn08_monitor_bomb_timer") 
  1347. 	end 
  1348.  
  1349. 	item_show(TABLE_TRIGGER_TO_BOMB[bomb]) 
  1350. 	on_trigger("",bomb) 
  1351. 	trigger_enable(bomb,false) 
  1352. 	marker_remove_trigger(bomb,SYNC_ALL) 
  1353.  
  1354. end 
  1355.  
  1356. function rn08_arms_dealer_reached() 
  1357. 	--if (get_char_in_vehicle(VEHICLE_GIFT_CAR,0)=="#PLAYER#") then 
  1358. 		on_trigger("",TRIGGER_ARMS_DEALER) 
  1359. 		trigger_enable(TRIGGER_ARMS_DEALER,false) 
  1360. 		marker_remove_trigger(TRIGGER_ARMS_DEALER,SYNC_ALL) 
  1361. 		mission_waypoint_remove() 
  1362. 		Arms_dealer_reached = true 
  1363. 	--end 
  1364. end 
  1365.  
  1366. function rn08_hotel_reached() 
  1367.  
  1368. 	on_trigger("",TRIGGER_HOTEL) 
  1369. 	trigger_enable(TRIGGER_HOTEL,false) 
  1370. 	marker_remove_trigger(TRIGGER_HOTEL,SYNC_ALL) 
  1371. 	mission_waypoint_remove() 
  1372. 	Rn08_ronin_hq_reached = true 
  1373. end 
  1374.  
  1375. Player_who_jumped = "" 
  1376.  
  1377. function rn08_jump_reached(player) 
  1378. 	local sync = SYNC_LOCAL 
  1379. 	 
  1380. 	if (player == REMOTE_PLAYER) then 
  1381. 		sync = SYNC_REMOTE 
  1382. 	end 
  1383. 	 
  1384. 	if (not (IN_COOP) or ((Player_who_jumped ~= "") and (Player_who_jumped ~= player))) then	 
  1385. 		on_trigger("",TRIGGER_JUMP) 
  1386. 		trigger_enable(TRIGGER_JUMP,false) 
  1387. 		marker_remove_trigger(TRIGGER_JUMP,sync) 
  1388. 		Jump_location_reached = true 
  1389. 	else 
  1390. 		Player_who_jumped = player 
  1391. 		marker_remove_trigger(TRIGGER_JUMP,sync) 
  1392. 	end 
  1393. end 
  1394.  
  1395. function rn08_exit_reached() 
  1396. 	on_trigger("",TRIGGER_GROUND_FLOOR) 
  1397. 	trigger_enable(TRIGGER_GROUND_FLOOR,false) 
  1398. 	rn08_process_explosions_with_physics(TABLE_BOMBS_FREE_FALL_BOTTOM, "Plane") 
  1399. 	Exit_reached = true 
  1400. end 
  1401.  
  1402. function rn08_elevator_reached(triggerer,trigger) 
  1403.  
  1404. 	-- Turn off the trigger, remove its indicator 
  1405. 	on_trigger("",trigger) 
  1406. 	trigger_enable(trigger,false) 
  1407. 	minimap_icon_remove_trigger(TRIGGER_ELEVATOR, SYNC_ALL) 
  1408.  
  1409. 	-- Start fading out, disable controls 
  1410. 	fade_out(1.0, {0,0,0}, SYNC_ALL) 
  1411. 	player_controls_disable(LOCAL_PLAYER) 
  1412. 	if(IN_COOP) then 
  1413. 		player_controls_disable(REMOTE_PLAYER) 
  1414. 	end 
  1415.  
  1416. 	-- spawn ALL soldiers on all elevator + floors, only block on first group 
  1417. 	if (Elevator_reached == false) then 
  1418. 		rn08_group_create_maybe_coop(GROUP_SOLDIERS_TOP_2,GROUP_SOLDIERS_TOP_2_COOP,true) 
  1419. 		rn08_group_create_maybe_coop(GROUP_SOLDIERS_TOP_3,GROUP_SOLDIERS_TOP_3_COOP,false) 
  1420. 		for i,guard in pairs(TABLE_SOLDIERS_TOP_2) do 
  1421. 			patrol("rn08_guard_patrol", guard) 
  1422. 		end 
  1423. 		for i,guard in pairs(TABLE_SOLDIERS_TOP_3) do 
  1424. 			patrol("rn08_guard_patrol", guard) 
  1425. 		end 
  1426. 		-- lock all hotel doors, do this here so we don't see door activation ui elements popping 
  1427. 		rn08_close_and_lock_doors() 
  1428. 	end 
  1429.  
  1430. 	-- Wait for fading to finish, then teleport to upper levels 
  1431. 	fade_out_block() 
  1432.  
  1433. 	teleport_coop(NAVPOINT_ELEVATOR, NAVPOINT_ELEVATOR_PLAYER_2, true) 
  1434.  
  1435. 	-- Fail the mission if a player jumps too early. 
  1436. 	on_trigger("rn08_early_jump_failure", TRIGGER_EARLY_JUMP) 
  1437. 	trigger_enable(TRIGGER_EARLY_JUMP, true) 
  1438.  
  1439. 	-- Fade in, reenable player controls 
  1440. 	fade_in(1.0, SYNC_ALL) 
  1441. 	delay(1.0) 
  1442. 	player_controls_enable(LOCAL_PLAYER) 
  1443. 	if(IN_COOP) then 
  1444. 		player_controls_enable(REMOTE_PLAYER) 
  1445. 	end 
  1446.  
  1447. 	Elevator_reached = true 
  1448. end 
  1449.  
  1450. function rn08_early_jump_failure() 
  1451. 	mission_end_failure("rn08", HELPTEXT_FAIL_JUMP_EARLY) 
  1452. end 
  1453.  
  1454. -- Send Gat on his merry way via the hotel elevator 
  1455. function rn08_take_elevator(name) 
  1456. 	if (not character_is_dead(CHARACTER_GAT)) then 
  1457. 		move_to(CHARACTER_GAT,NAVPOINT_ELEVATOR_GAT,2,true,true) 
  1458. 		group_destroy(GROUP_GAT) 
  1459. 	end 
  1460. end 
  1461.  
  1462. -- Cleanup mission 
  1463. function rn08_cleanup() 
  1464.  
  1465. 	-- Kill bomb effects 
  1466. 	for bomb,effect_handle in pairs(Bomb_effect_handles) do 
  1467. 		effect_stop(effect_handle) 
  1468. 	end 
  1469.  
  1470. 	--turn off bomb timer 
  1471. 	hud_timer_stop(1) 
  1472. 	 
  1473. 	-- Make sure no one is inulnerable from placing a bomb 
  1474. 	turn_vulnerable(LOCAL_PLAYER) 
  1475. 	inv_weapon_enable_or_disable_all_slots(true, SYNC_ALL) 
  1476. 	if (coop_is_active()) then 
  1477. 		turn_vulnerable(REMOTE_PLAYER) 
  1478. 	end 
  1479.  
  1480. 	-- Stop persona overrides 
  1481. 	persona_override_group_stop(RONIN_PERSONAS,POT_SITUATIONS[POT_ATTACK]) 
  1482.  
  1483. 	-- Disable the mission parachute override 
  1484. 	parachute_disable() 
  1485.  
  1486. 	-- Remove markers, callbacks from all enemies 
  1487. 	for i,enemy in pairs(TABLE_SOLDIERS_GROUND) do 
  1488. 		marker_remove_npc(enemy) 
  1489. 		on_death("",enemy) 
  1490. 	end 
  1491. 	for i,enemy in pairs(TABLE_LIEUTENANTS) do 
  1492. 		marker_remove_npc(enemy) 
  1493. 		on_death("",enemy) 
  1494. 	end 
  1495.  
  1496. 	if (Thread_gat_take_elevator ~= -1) then 
  1497. 		thread_kill(Thread_gat_take_elevator) 
  1498. 	end 
  1499.  
  1500. 	if (Thread_countdown_monitor ~= -1) then 
  1501. 		thread_kill(Thread_countdown_monitor) 
  1502. 	end 
  1503.  
  1504. 	-- Remove the callback for Gat's death 
  1505. 	on_death("", CHARACTER_GAT) 
  1506. 	on_dismiss("", CHARACTER_GAT) 
  1507.  
  1508. 	-- get Gat to stop following me around 
  1509. 	if (npc_is_in_party(CHARACTER_GAT)) then 
  1510. 		npc_stop_following(CHARACTER_GAT) 
  1511. 	end 
  1512.  
  1513. 	-- disable all triggers, remove callbacks 
  1514. 	for i, trigger in pairs(TABLE_ALL_TRIGGERS) do 
  1515. 		on_trigger("",trigger) 
  1516. 		trigger_enable(trigger,false) 
  1517. 	end 
  1518.  
  1519. 	-- Allow notoriety spawning again 
  1520. 	notoriety_force_no_spawn(MISSION_GANG_NAME,false) 
  1521.  
  1522. 	-- No target/driver for base jumping 
  1523. 	base_jumping_enable(true) 
  1524.  
  1525. end 
  1526.  
  1527. function rn08_success() 
  1528. 	 
  1529. 	--Lock the front doors after the mission is over so players can't get back inside 
  1530. 	door_lock(DOOR_FRONT_1, true) 
  1531. 	door_lock(DOOR_FRONT_2, true) 
  1532. end 
  1533.  
  1534. function rn08_complete() 
  1535.  
  1536. 	-- End the mission with success 
  1537. 	mission_end_success("rn08", "ro08-02", {NAVPOINT_LOCATION_START, NAVPOINT_LOCATION_START_PLAYER_2}) 
  1538. end 
  1539.  
  1540. function rn08_local_failure() 
  1541. 	-- End the mission since the local player died 
  1542. 	mission_end_failure("rn08")--, "rn08_failure") 
  1543. end 
  1544.  
  1545. function rn08_remote_failure() 
  1546. 	-- End the mission since the local player died 
  1547. 	mission_end_failure("rn08")--, "rn08_failure") 
  1548. end 
  1549.  
  1550. function rn08_arms_dealer_failure() 
  1551. 	-- End the mission, The arms dealer died before the weapons were picked up 
  1552. 	mission_end_failure("rn08", HELPTEXT_ARMS_DEALER_DIED) 
  1553. end 
  1554.  
  1555. function rn08_gat_death_failure() 
  1556. 	-- End the mission, Gat died 
  1557. 	mission_end_failure("rn08", HELPTEXT_GAT_DIED) 
  1558. end 
  1559.  
  1560. function rn08_gat_dismiss_failure() 
  1561. 	-- End the mission, Gat was abandoned or dismissed 
  1562. 	mission_end_failure("rn08", HELPTEXT_GAT_DISMISSED) 
  1563. end 
  1564.  
  1565. function rn08_bomb_failure() 
  1566. 	-- End the mission since the bombs exploded before the player finished 
  1567. 	mission_end_failure("rn08", HELPTEXT_BOMB_FAILURE) 
  1568. end 
  1569.  
  1570.  
  1571. function rn08_setup_global_constants() 
  1572. -- Make sure our list of ALL triggers really contains all triggers 
  1573. 	rn08_table_concat(TABLE_ALL_TRIGGERS, TABLE_BOMBS_TOP_1) 
  1574. 	rn08_table_concat(TABLE_ALL_TRIGGERS, TABLE_BOMBS_TOP_2) 
  1575. 	rn08_table_concat(TABLE_ALL_TRIGGERS, TABLE_BOMBS_TOP_3) 
  1576. 	rn08_table_concat(TABLE_ALL_TRIGGERS, TABLE_BOMBS_TOP_4) 
  1577. 	rn08_table_concat(TABLE_ALL_TRIGGERS, TABLE_BOMBS_TOP_5) 
  1578.  
  1579. 	NUMBER_BOMBS_TO_PLANT = sizeof_table(TABLE_BOMBS_TOP_2) + sizeof_table(TABLE_BOMBS_TOP_3)  
  1580. 									+ sizeof_table(TABLE_BOMBS_TOP_4) + sizeof_table(TABLE_BOMBS_TOP_5)  
  1581.  
  1582. 	-- Check for coop being active 
  1583. 	if (coop_is_active()) then 
  1584. 		IN_COOP	= true 
  1585. 		rn08_table_concat(TABLE_LIEUTENANTS, TABLE_LIEUTENANTS_COOP) 
  1586. 		rn08_table_concat(TABLE_SOLDIERS_GROUND,TABLE_SOLDIERS_GROUND_COOP) 
  1587. 		rn08_table_concat(TABLE_SOLDIERS_TOP_2,TABLE_SOLDIERS_TOP_2_COOP) 
  1588. 		rn08_table_concat(TABLE_SOLDIERS_TOP_3,TABLE_SOLDIERS_TOP_3_COOP) 
  1589. 		rn08_table_concat(TABLE_SOLDIERS_TOP_4,TABLE_SOLDIERS_TOP_4_COOP) 
  1590. 		rn08_table_concat(TABLE_SOLDIERS_TOP_5,TABLE_SOLDIERS_TOP_5_COOP) 
  1591. 	end 
  1592. end 
  1593.  
  1594. -- add all entries of the tail table onto the end of the head table 
  1595. function rn08_table_concat(head_table, tail_table) 
  1596. 	local offset = sizeof_table(head_table) 
  1597. 	for i, tail_entry_i in pairs(tail_table) do 
  1598. 		head_table[offset+i] = tail_entry_i 
  1599. 	end 
  1600. end 
  1601.  
  1602. function rn08_process_bomb_set(bomb_table, stairwell_trigger_1, doorway_trigger_1, stairwell_trigger_2, doorway_trigger_2) 
  1603. 	All_bombs_placed			= false 
  1604. 	Bombs_to_place				= sizeof_table(bomb_table) 
  1605. 	for i, bomb in pairs(bomb_table) do 
  1606. 		on_trigger("rn08_bomb_placed",bomb) 
  1607. 		trigger_enable(bomb,true) 
  1608. 		marker_add_trigger(bomb,MINIMAP_ICON_LOCATION,INGAME_EFFECT_LOCATION,SYNC_ALL) 
  1609. 		--trigger_set_use_message(bomb,HELPTEXT_USE_BOMB) 
  1610. 	end 
  1611.  
  1612. 	Target_floor_reached = true; 
  1613.  
  1614. 	if (doorway_trigger_1) then 
  1615. 		Target_floor_reached = false 
  1616. 		Doorway_trigger_1 = doorway_trigger_1 
  1617. 		on_trigger_exit("rn08_target_floor_reached",doorway_trigger_1) 
  1618. 		trigger_enable(doorway_trigger_1,true) 
  1619. 	end 
  1620. 	if (doorway_trigger_2) then 
  1621. 		Target_floor_reached = false 
  1622. 		Doorway_trigger_2 = doorway_trigger_2 
  1623. 		on_trigger_exit("rn08_target_floor_reached",doorway_trigger_2) 
  1624. 		trigger_enable(doorway_trigger_2,true) 
  1625. 	end 
  1626.  
  1627. 	-- wait for the player to enter the target floor 
  1628. 	while (not Target_floor_reached) do 
  1629. 		thread_yield() 
  1630. 	end 
  1631.  
  1632. 	-- reset the flag 
  1633. 	Target_floor_reached = false 
  1634.  
  1635. 	-- setup messages to be displayed to the player if they attempt to leave the floor before placing all bombs 
  1636. 	if(stairwell_trigger_1) then 
  1637. 		Stairwell_trigger_1 = stairwell_trigger_1 
  1638. 		on_trigger("rn08_floor_exit_early",stairwell_trigger_1) 
  1639. 		trigger_enable(stairwell_trigger_1, true) 
  1640. 	end 
  1641. 	if(stairwell_trigger_2) then 
  1642. 		Stairwell_trigger_2 = stairwell_trigger_2 
  1643. 		on_trigger("rn08_floor_exit_early",stairwell_trigger_2) 
  1644. 		trigger_enable(stairwell_trigger_2, true) 
  1645. 	end 
  1646.  
  1647. 	-- wait for player to place all of the bombs 
  1648. 	while (not All_bombs_placed) do 
  1649. 		thread_yield() 
  1650. 	end 
  1651.  
  1652. 	-- disable triggers 
  1653. 		Stairwell_trigger_1 = "" 
  1654. 		if(stairwell_trigger_1) then 
  1655. 		on_trigger("",stairwell_trigger_1) 
  1656. 		trigger_enable(stairwell_trigger_1, false) 
  1657. 	end 
  1658. 	if(stairwell_trigger_2) then 
  1659. 		Stairwell_trigger_2 = "" 
  1660. 		on_trigger("",stairwell_trigger_2) 
  1661. 		trigger_enable(stairwell_trigger_2, false) 
  1662. 	end 
  1663. end 
  1664.  
  1665. function rn08_bomb_timer_expired() 
  1666. 	rn08_detonate_placed_bombs() 
  1667. 	rn08_bomb_failure() 
  1668. end 
  1669.  
  1670. function rn08_monitor_bomb_timer() 
  1671. 	while(hud_timer_get_remainder(1) > 30000) do 
  1672. 		thread_yield() 
  1673. 	end 
  1674. 	mission_help_table_nag(HELPTEXT_DETONATION_WARN) 
  1675. end 
  1676.  
  1677. function rn08_detonate_placed_bombs() 
  1678. 	-- only set off bombs that have actually been placed 
  1679. 	--rn08_process_explosions(Bombs_placed, "exp_plane", false) 
  1680. 	rn08_process_explosions_with_physics(Bombs_placed, "Plane") 
  1681. 	rn08_process_explosions(Bombs_placed, "Mission_RO8_exp", true) 
  1682. end 
  1683.  
  1684. function rn08_process_enemy_set(enemy_table, mission_helptext, objective_helptext) 
  1685. 	 
  1686. 	Enemy_set_cleared = false 
  1687. 	Enemies_to_kill = 0 
  1688.  
  1689. 	-- Assign enemy callbacks 
  1690. 	for i, enemy in pairs(enemy_table) do 
  1691. 		if(not character_is_dead(enemy)) then 
  1692. 			on_death("rn08_enemy_killed", enemy) 
  1693. 			marker_add_npc(enemy, MINIMAP_ICON_KILL, INGAME_EFFECT_KILL, SYNC_ALL)  
  1694. 			Enemies_to_kill = Enemies_to_kill + 1 
  1695. 		end 
  1696. 	end 
  1697.  
  1698. 	-- Setup kill tracking numbers 
  1699. 	Enemies_living =  Enemies_to_kill 
  1700.  
  1701. 	-- Display the help text 
  1702. 	if(mission_helptext) then 
  1703. 		mission_help_table(mission_helptext) 
  1704. 	end 
  1705.  
  1706. 	-- Display the objective text 
  1707. 	if(objective_helptext) then 
  1708. 		Enemy_set_objective_helptext = objective_helptext 
  1709. 		objective_text(0, Enemy_set_objective_helptext, Enemies_to_kill - Enemies_living, Enemies_to_kill) 
  1710. 	end 
  1711. 	 
  1712. 	while (not Enemy_set_cleared) do 
  1713. 		thread_yield() 
  1714. 	end 
  1715.  
  1716. end 
  1717.  
  1718. function rn08_enemy_killed(enemy) 
  1719. 	marker_remove_npc(enemy) 
  1720. 	on_death("",enemy) 
  1721. 	Enemies_living = Enemies_living - 1 
  1722. 	if (Enemies_living < 1) then 
  1723. 		Enemy_set_cleared = true 
  1724. 		objective_text_clear(0) 
  1725. 		Enemy_set_objective_helptext = "" 
  1726. 	else 
  1727. 		if (Enemy_set_objective_helptext ~= "") then 
  1728. 			objective_text(0, Enemy_set_objective_helptext, Enemies_to_kill - Enemies_living, Enemies_to_kill) 
  1729. 		end 
  1730. 	end 
  1731. end 
  1732.  
  1733. function rn08_free_fall_1_reached() 
  1734. 	hud_timer_stop(1) 
  1735. 	rn08_detonate_placed_bombs() 
  1736. end 
  1737.  
  1738. function rn08_free_fall_2_reached() 
  1739. 	rn08_process_explosions(TABLE_BOMBS_FREE_FALL_TOP, "Mission_RO8_exp",false) 
  1740. end 
  1741.  
  1742. function rn08_free_fall_3_reached() 
  1743. 	rn08_process_explosions(TABLE_BOMBS_FREE_FALL_MID, "Mission_RO8_exp",false) 
  1744. end 
  1745.  
  1746. function rn08_process_explosions(bomb_table, effect, looping) 
  1747. 	for i, bomb in pairs(bomb_table) do 
  1748. 		if (Bomb_effect_handles[bomb] == nil) then 
  1749. 			Bomb_effect_handles[bomb] = effect_play(effect,bomb,looping) 
  1750. 			delay(rand_float(0.0,0.4)) 
  1751. 		end 
  1752. 	end 
  1753. end 
  1754.  
  1755. function rn08_process_explosions_with_physics(bomb_table, explosion, looping) 
  1756. 	for i, bomb in pairs(bomb_table) do 
  1757. 		explosion_create(explosion, bomb) 
  1758. 		delay(rand_float(0.0,0.4)) 
  1759. 	end 
  1760. end 
  1761.  
  1762. function rn08_group_create_maybe_coop(group_always,group_coop, blocking) 
  1763. 	group_create(group_always, blocking) 
  1764. 	if (IN_COOP) then 
  1765. 		group_create(group_coop, blocking) 
  1766. 	end 
  1767. end 
  1768.  
  1769. function rn08_group_release_maybe_coop(group_always, group_coop) 
  1770. 	release_to_world(group_always) 
  1771. 	if (IN_COOP) then 
  1772. 		release_to_world(group_coop) 
  1773. 	end 
  1774. end 
  1775.  
  1776. function rn08_stairwell_entry(trigger1,trigger2) 
  1777.  
  1778. 	Doorway_trigger_1 = trigger1 
  1779. 	trigger_enable(trigger1, true) 
  1780. 	marker_add_trigger(trigger1,MINIMAP_ICON_LOCATION,INGAME_EFFECT_LOCATION,SYNC_ALL) 
  1781. 	on_trigger("rn08_stairwell_reached",trigger1) 
  1782.  
  1783. 	if (trigger2 ~= nil) then 
  1784. 		Doorway_trigger_2 = trigger2 
  1785. 		trigger_enable(trigger2, true) 
  1786. 		marker_add_trigger(trigger2,MINIMAP_ICON_LOCATION,INGAME_EFFECT_LOCATION,SYNC_ALL) 
  1787. 		on_trigger("rn08_stairwell_reached",trigger2) 
  1788. 	end 
  1789.  
  1790. 	while (Doorway_trigger_1 ~= "") do 
  1791. 		thread_yield() 
  1792. 	end 
  1793. end 
  1794.  
  1795. function rn08_stairwell_reached() 
  1796. 	trigger_enable(Doorway_trigger_1, false) 
  1797. 	marker_remove_trigger(Doorway_trigger_1,SYNC_ALL) 
  1798. 	on_trigger("",Doorway_trigger_1) 
  1799. 	Doorway_trigger_1 = "" 
  1800. 	if (Doorway_trigger_2 ~= "") then 
  1801. 		trigger_enable(Doorway_trigger_2, false) 
  1802. 		marker_remove_trigger(Doorway_trigger_2,SYNC_ALL) 
  1803. 		on_trigger("",Doorway_trigger_2) 
  1804. 		Doorway_trigger_2 = "" 
  1805. 	end 
  1806. end 
  1807.  
  1808. function rn08_floor_exit_early() 
  1809. 	-- Display the message 
  1810. 	mission_help_table_nag(HELPTEXT_BOMB_FINISH)	 
  1811.  
  1812. 	-- Disable triggers so that we're only displaying the message once per floor 
  1813. 	trigger_enable(Stairwell_trigger_1, false) 
  1814. 	on_trigger("",Stairwell_trigger_1) 
  1815. 	Stairwell_trigger_1 = "" 
  1816. 	if (Stairwell_trigger_2 ~= "") then 
  1817. 		trigger_enable(Stairwell_trigger_2, false) 
  1818. 		on_trigger("",Stairwell_trigger_2) 
  1819. 		Stairwell_trigger_2 = "" 
  1820. 	end 
  1821. end 
  1822.  
  1823. function rn08_target_floor_reached(triggerer,trigger) 
  1824. 	trigger_enable(Doorway_trigger_1, false) 
  1825. 	on_trigger_exit("",Doorway_trigger_1) 
  1826. 	Doorway_trigger_1 = "" 
  1827. 	if (Doorway_trigger_2 ~= "") then 
  1828. 		trigger_enable(Doorway_trigger_2, false) 
  1829. 		on_trigger_exit("",Doorway_trigger_2) 
  1830. 		Doorway_trigger_2 = "" 
  1831. 	end 
  1832. 	Target_floor_reached = true 
  1833. end 
  1834.