sr2lua/sh_rn_stripclub.lua

  1. --[[-------------------------------------------------------------- 
  2. -- sh_rn_stripclub.lua 
  3. -- ronin stronghold 1 - suburbs strip club "Technically Legal" 
  4. -- alvan monje 
  5.  
  6. TO DO: 
  7. 	- phone cutscene? 
  8. 	X	- for reinf cutscene, destroy cutscene group after 
  9. 	X	- add recurring attack function for reinf group, and triggers? 
  10. 	X	- add no flee flags for reinf group 
  11. 	X	- adjust sword reinf guys 
  12. 	- some weapon pickups don't work 
  13. 		- if i have ar50, can't get sniper and vice versa 
  14. 		- ar50 didn't have grenades in it 
  15. 		- couldn't drop more than one qty of satchel 
  16. 		- no respawning 
  17. 	X	- make RPGer attack more 
  18. 	- lower wall 
  19. 	- reinf cutscene -- sometimes guys crash into each other, go super fast, don't break soon enough 
  20.  
  21.  
  22. UNUSED: 
  23. reinforce_old = {"sh_rn_stripclub_$c-bike1", "sh_rn_stripclub_$c-bike2", "sh_rn_stripclub_$c-sedan1-1", "sh_rn_stripclub_$c-sedan1-2", "sh_rn_stripclub_$c008", 
  24. 					"sh_rn_stripclub_$c008 (0)", "sh_rn_stripclub_$c008 (1)", "sh_rn_stripclub_$c008 (2)", "sh_rn_stripclub_$c008 (3)", 
  25. 					"sh_rn_stripclub_$c008 (4)", "sh_rn_stripclub_$c008 (5)", "sh_rn_stripclub_$c008 (6)", "sh_rn_stripclub_$c008 (7)", 
  26. 					"sh_rn_stripclub_$c-sedan5", "sh_rn_stripclub_$c-bike6", "sh_rn_stripclub_$c008 (8)", "sh_rn_stripclub_$c008 (9)", 
  27. 					"sh_rn_stripclub_$c008 (10)", "sh_rn_stripclub_$c008 (11)"} 
  28. ----------------------------------------------------------------]] 
  29.  
  30.  
  31.  
  32. --Globals------- 
  33. floor1_gang = {"sh_rn_stripclub_$c002", "sh_rn_stripclub_$c003", "sh_rn_stripclub_$c010", "sh_rn_stripclub_$c010 (0)", "sh_rn_stripclub_$c010 (1)", 
  34. 						"sh_rn_stripclub_$c010 (2)", "sh_rn_stripclub_$c010 (3)", "sh_rn_stripclub_$c010 (4)", "sh_rn_stripclub_$c010 (5)", "sh_rn_stripclub_$c010 (6)"} 
  35. floor2_gang = {"sh_rn_stripclub_$c011", "sh_rn_stripclub_$c011 (0)", "sh_rn_stripclub_$c011 (1)", "sh_rn_stripclub_$c011 (2)"} 
  36. floor1_civ = {"sh_rn_stripclub_$c004", "sh_rn_stripclub_$c005", "sh_rn_stripclub_$c006", "sh_rn_stripclub_$c007", "sh_rn_stripclub_$c005 (0)", 
  37. 						"sh_rn_stripclub_$c005 (1)", "sh_rn_stripclub_$c005 (2)", "sh_rn_stripclub_$c005 (3)", "sh_rn_stripclub_$c009", "sh_rn_stripclub_$c009 (0)", 
  38. 						"sh_rn_stripclub_$c009 (1)"} 
  39. floor2_civ = {"sh_rn_stripclub_$c006 (0)", "sh_rn_stripclub_$c006 (1)", "sh_rn_stripclub_$c006 (2)", "sh_rn_stripclub_$c006 (3)"} 
  40. reinforce1 = {"sh_rn_stripclub_$c008", "sh_rn_stripclub_$c008 (0)", "sh_rn_stripclub_$c008 (1)", "sh_rn_stripclub_$c008 (2)", "sh_rn_stripclub_$c008 (3)", 
  41. 					"sh_rn_stripclub_$c008 (4)", "sh_rn_stripclub_$c008 (5)", "sh_rn_stripclub_$c008 (6)", "sh_rn_stripclub_$c008 (7)", 
  42. 					"sh_rn_stripclub_$c008 (8)", "sh_rn_stripclub_$c008 (9)", "sh_rn_stripclub_$c008 (10)", "sh_rn_stripclub_$c008 (11)"} 
  43. num_gang_flr1 = sizeof_table(floor1_gang) 
  44. num_gang_flr2 = sizeof_table(floor2_gang) 
  45. num_gang_reinforce = sizeof_table(reinforce1) 
  46. gang_flr1_killed = 0 
  47. gang_flr2_killed = 0 
  48. gang_reinf_killed = 0 
  49. player_used_exit_trigger = false 
  50.  
  51.  
  52.  
  53. --Functions------- 
  54. function sh_rn_stripclub_start(checkpoint, is_restart) 
  55. 	set_mission_author("David Bowring") 
  56. 	notoriety_force_no_spawn("ronin", true) 	 
  57. 	--group_create_hidden("sh_rn_stripclub_$G-flr1-gang") 
  58. 	--group_create_hidden("sh_rn_stripclub_$G-flr1-civ") 
  59. 	--fade_out(.5) 
  60. 	delay(.6) 
  61. 	mission_start_fade_out() 
  62.  
  63. 	teleport_coop("sh_rn_stripclub_$nstart","sh_rn_stripclub_$nstart (0)") 
  64. 	door_lock("sh_rn_stripclub_SD_WRCN_doorMM070", true) 
  65. 	door_lock("sh_rn_stripclub_SD_WRCN_doorMM080", true) 
  66. 	if (not is_restart) then 
  67. 		cutscene_play("sh_rn_stripclub_ct1","sh_rn_stripclub_$G-flr1-gang") 
  68. 		group_show("sh_rn_stripclub_$G-flr1-gang") 
  69. 		group_destroy("sh_rn_stripclub_$G-newcut") 
  70. 	else 
  71. 		group_create("sh_rn_stripclub_$G-flr1-gang",true) 
  72. 	end 
  73. 	trigger_enable("sh_rn_stripclub_$tfront-doortwo", true) 
  74. 	on_trigger("sh_rn_stripclub_secondfloor", "sh_rn_stripclub_$tsecond") 
  75. 	on_trigger("sh_rn_stripclub_frontdoor", "sh_rn_stripclub_$tfront-doortwo") 
  76. 	marker_add_navpoint("sh_rn_stripclub_$tfront-doortwo", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  77. 	group_create("sh_rn_stripclub_$G-flr1-civ") 
  78. 	release_to_world("sh_rn_stripclub_$G-flr1-civ")		 
  79. 	door_lock("sh_rn_stripclub_SD_WRCN_doorMM091", true) 
  80. 	--while ( (not group_is_loaded("sh_rn_stripclub_$G-flr1-gang")) or (not group_is_loaded("sh_rn_stripclub_$G-flr1-civ")) ) do 
  81. 	--	thread_yield() 
  82. 	--end 
  83. 	delay(2) 
  84. 	mission_help_table("sh_rn_stripclub_start") -- "Kill all the Ronin lieutenants!" 
  85. 	objective_text(0, "sh_rn_stripclub_lts_left", gang_flr1_killed, num_gang_flr1) 
  86. 	mission_start_fade_in() 
  87. end 
  88.  
  89. function sh_rn_stripclub_frontdoor() 
  90. 	trigger_enable("sh_rn_stripclub_$tfront-doortwo", false) 
  91. 	on_trigger("", "sh_rn_stripclub_$tfront-doortwo") 
  92. 	marker_remove_navpoint("sh_rn_stripclub_$tfront-doortwo")	 
  93. 	for i = 1, num_gang_flr1, 1 do 
  94. 		if character_is_dead(floor1_gang[i])==false then 
  95. 			marker_add_npc(floor1_gang[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  96. 			on_death("sh_rn_stripclub_killcount_gang_flr1", floor1_gang[i]) 
  97. 		end 
  98. 	end 
  99. end 
  100.  
  101. function sh_rn_stripclub_player_outside() 
  102. player_used_exit_trigger = true 
  103. marker_remove_navpoint("sh_rn_stripclub_$t-upper-roof") 
  104. trigger_enable("sh_rn_stripclub_$t-lower-roof", false) 
  105. trigger_enable("sh_rn_stripclub_$t-upper-roof", false) 
  106. trigger_enable("sh_rn_stripclub_$t-front-door", false) 
  107. --trigger_enable("sh_rn_stripclub_$t-reinf-attack1", true)		 
  108. on_trigger("", "sh_rn_stripclub_$t-lower-roof") 
  109. on_trigger("", "sh_rn_stripclub_$t-upper-roof") 
  110. on_trigger("", "sh_rn_stripclub_$t-front-door") 
  111. 	 
  112. 	for i = 1, num_gang_reinforce, 1 do 
  113. 		if character_is_dead(reinforce1[i]) == false then 
  114. 			marker_add_npc(reinforce1[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  115. 			on_death("sh_rn_stripclub_killcount_gang_reinf", reinforce1[i]) 
  116. 		end 
  117. 	end 
  118. end 
  119.  
  120.  
  121.  
  122. function sh_rn_stripclub_secondfloor() 
  123. 	trigger_enable("sh_rn_stripclub_$tsecond", false) 
  124. 	on_trigger("", "sh_rn_stripclub_$tsecond") 
  125. 	marker_remove_navpoint("sh_rn_stripclub_$tsecond")	 
  126. 	for i = 1, num_gang_flr2, 1 do 
  127. 		if  character_is_dead(floor2_gang[i]) == false then 
  128. 			marker_add_npc(floor2_gang[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  129. 			on_death("sh_rn_stripclub_killcount_gang_flr2", floor2_gang[i]) 
  130. 		end 
  131. 	end 
  132. end 
  133.  
  134. function sh_rn_stripclub_cleanup() 
  135. 	-- disable and unregister triggers 
  136. 	spawning_pedestrians(true) 
  137. 	marker_remove_navpoint("sh_rn_stripclub_$tfront-doortwo") 
  138. 	marker_remove_navpoint("sh_rn_stripclub_$t-upper-roof") 
  139. 	marker_remove_navpoint("sh_rn_stripclub_$tsecond") 
  140. 	trigger_enable("sh_rn_stripclub_$t-reinf-attack1", false) 
  141. 	trigger_enable("sh_rn_stripclub_$t-lower-roof", false) 
  142. 	trigger_enable("sh_rn_stripclub_$t-upper-roof", false) 
  143. 	trigger_enable("sh_rn_stripclub_$t-front-door", false) 
  144. 	on_trigger("", "sh_rn_stripclub_$tsecond") 
  145. 	on_trigger("", "sh_rn_stripclub_$tfront-doortwo") 
  146. 	on_trigger("", "sh_rn_stripclub_$t-reinf-attack1") 
  147. 	on_trigger("", "sh_rn_stripclub_$t-lower-roof") 
  148. 	on_trigger("", "sh_rn_stripclub_$t-upper-roof") 
  149. 	on_trigger("", "sh_rn_stripclub_$t-front-door") 
  150. 	trigger_enable("sh_rn_stripclub_$tfront-doortwo", false) 
  151. 	on_trigger("", "sh_rn_stripclub_$tfront-doortwo") 
  152. 	spawning_vehicles(true) 
  153. 	-- remove icons, unregister on_death functions 
  154. 	for i = 1, num_gang_flr1, 1 do 
  155. 		if group_is_loaded("sh_rn_stripclub_$G-flr1-gang") then 
  156. 			if character_is_dead(floor1_gang[i])== false then 
  157. 				marker_remove_npc(floor1_gang[i]) 
  158. 				on_death("", floor1_gang[i]) 
  159. 			end 
  160. 		end 
  161. 	end 
  162.  
  163. 	for i = 1, num_gang_flr2, 1 do 
  164. 		if group_is_loaded("sh_rn_stripclub_$G-flr2-gang") then 
  165. 			if character_is_dead(floor1_gang[i])== false then 
  166. 				marker_remove_npc(floor2_gang[i]) 
  167. 				on_death("", floor2_gang[i]) 
  168. 			end 
  169. 		end 
  170. 	end 
  171.  
  172. 	for i = 1, num_gang_reinforce, 1 do 
  173. 		if group_is_loaded("sh_rn_stripclub_$G-reinforce-game") then 
  174. 			if character_is_dead(reinforce1[i])== false then 
  175. 				marker_remove_npc(reinforce1[i]) 
  176. 				on_death("", reinforce1[i]) 
  177. 			end 
  178. 		end 
  179. 	end 
  180. 	 
  181. 	notoriety_set_min("ronin", 0) 
  182. 	notoriety_set_max("ronin", 5) 
  183. 	notoriety_set("ronin", 0) 
  184. 	notoriety_force_no_spawn("ronin", false) 
  185. 	-- release groups 
  186. 	release_to_world("sh_rn_stripclub_$G-flr1-gang") 
  187. 	release_to_world("sh_rn_stripclub_$G-flr1-civ") 
  188. 	release_to_world("sh_rn_stripclub_$G-reinforce-game") 
  189. 	release_to_world("sh_rn_stripclub_$G-reinforce-cutscene") 
  190. 	release_to_world("sh_rn_stripclub_$G-flr2-gang") 
  191. 	release_to_world("sh_rn_stripclub_$G-flr2-civ") 
  192. end 
  193.  
  194.  
  195.  
  196. function sh_rn_stripclub_success() 
  197.  
  198. end 
  199.  
  200.  
  201.  
  202. function sh_rn_stripclub_killcount_gang_flr1(npc) 
  203. 	gang_flr1_killed = gang_flr1_killed + 1 
  204. 	marker_remove_npc(npc) 
  205. 	objective_text(0, "sh_rn_stripclub_lts_left", gang_flr1_killed, num_gang_flr1) 
  206. 	release_to_world(npc) 
  207. 	 
  208. 	 
  209. 	if gang_flr1_killed == 1 then 
  210.  
  211. 	notoriety_set_max("ronin", 2) 
  212. 	notoriety_set_min("ronin", 2)  
  213. 	end 
  214.  
  215. 	if (gang_flr1_killed == num_gang_flr1) then 
  216. 		group_create("sh_rn_stripclub_$G-flr2-gang", true) 
  217. 		group_create("sh_rn_stripclub_$G-flr2-civ", true) 
  218.  
  219. 		for i = 1, num_gang_flr2, 1 do 
  220. 			--marker_add_npc(floor2_gang[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  221. 			on_death("sh_rn_stripclub_killcount_gang_flr2", floor2_gang[i]) 
  222. 		end 
  223.  
  224. 		delay(2) 
  225. 		mission_help_table("sh_rn_stripclub_upstairs")  -- "Head upstairs and finish off the rest of the Ronin lieutenants." 
  226. 		objective_text(0, "sh_rn_stripclub_lts_left2", gang_flr2_killed, num_gang_flr2) 
  227. 		trigger_enable("sh_rn_stripclub_$tsecond", true) 
  228. 		door_lock("sh_rn_stripclub_SD_WRCN_doorMM091", false) 
  229. 		marker_add_navpoint("sh_rn_stripclub_$tsecond", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  230. 	end 
  231. end 
  232.  
  233.  
  234.  
  235. function sh_rn_stripclub_killcount_gang_flr2(npc) 
  236. 	gang_flr2_killed = gang_flr2_killed + 1 
  237. 	marker_remove_npc(npc) 
  238. 	objective_text(0, "sh_rn_stripclub_lts_left2", gang_flr2_killed, num_gang_flr2) 
  239.  
  240. 	if (gang_flr2_killed == num_gang_flr2) then 
  241. 		group_destroy("sh_rn_stripclub_$G-flr1-civ") -- destroy previous civilian group so we don't run out of slots for new groups 
  242. 		group_create_hidden("sh_rn_stripclub_$G-reinforce-game") 
  243. 		door_open("sh_rn_stripclub_SD_WRCN_doorMM091") 
  244.  
  245. 		 
  246. 			 
  247. 		--cutscene_play("sh_rn_stripclub_ct2") 
  248. 		door_lock("sh_rn_stripclub_SD_WRCN_doorMM080", false) 
  249. 		-- destroy group used in cutscene 
  250. 		--if group_is_loaded("sh_rn_stripclub_$G-reinforce-cutscene") then 
  251. 			group_destroy("sh_rn_stripclub_$G-reinforce-cutscene") 
  252. 		--end 
  253.  
  254. 		-- make sure new group is loaded before proceeding 
  255. 		while (  not group_is_loaded("sh_rn_stripclub_$G-reinforce-game")  ) do 
  256. 			thread_yield() 
  257. 		end 
  258. 			group_show("sh_rn_stripclub_$G-reinforce-game") 
  259. 		 
  260. 		for i = 1, num_gang_reinforce, 1 do 
  261. 			if character_is_dead(reinforce1[i]) == false then 
  262. 			--marker_add_npc(reinforce1[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  263. 			on_death("sh_rn_stripclub_killcount_gang_reinf", reinforce1[i]) 
  264. 			end 
  265. 		end 
  266.  
  267. 		-- setup triggers 
  268. 		trigger_enable("sh_rn_stripclub_$t-lower-roof", true) 
  269. 		trigger_enable("sh_rn_stripclub_$t-upper-roof", true) 
  270. 		trigger_enable("sh_rn_stripclub_$t-front-door", true) 
  271. 		--trigger_enable("sh_rn_stripclub_$t-reinf-attack1", true)		 
  272. 		on_trigger("sh_rn_stripclub_recurring_attack", "sh_rn_stripclub_$t-lower-roof") 
  273. 		on_trigger("sh_rn_stripclub_recurring_attack", "sh_rn_stripclub_$t-upper-roof") 
  274. 		on_trigger("sh_rn_stripclub_recurring_attack", "sh_rn_stripclub_$t-front-door") 
  275. 		--on_trigger("sh_rn_stripclub_reinf_attack1", "sh_rn_stripclub_$t-reinf-attack1") 
  276. 		 
  277. 		--marker_add_navpoint("sh_rn_stripclub_$t-lower-roof",MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  278. 		delay(2) 
  279. 		sh_rn_stripclub_ctplay()		 
  280. 	end 
  281. end 
  282.  
  283.  
  284.  
  285. function sh_rn_stripclub_killcount_gang_reinf(npc) 
  286. 	gang_reinf_killed = gang_reinf_killed + 1 
  287. 	if player_used_exit_trigger == false then 
  288. 		sh_rn_stripclub_player_outside() 
  289. 	end 
  290. 	 
  291. 	marker_remove_npc(npc) 
  292. 	objective_text(0, "sh_rn_stripclub_reinforce_left", gang_reinf_killed, num_gang_reinforce) 
  293. 	release_to_world(npc) 
  294.  
  295. 	if (gang_reinf_killed == num_gang_reinforce) then 
  296. 		delay(3) 
  297. 		mission_end_success("sh_rn_stripclub") 
  298. 	end 
  299. end 
  300.  
  301.  
  302.  
  303. -- after reinforcements cutscene, if player goes back downstairs, make sword guys in long hallway attack player 
  304. function sh_rn_stripclub_reinf_attack1() 
  305. 	trigger_enable("sh_rn_stripclub_$t-reinf-attack1", false) 
  306. 	trigger_enable("sh_rn_stripclub_$t-lower-roof", false) 
  307. 	trigger_enable("sh_rn_stripclub_$t-upper-roof", false) 
  308. 	trigger_enable("sh_rn_stripclub_$t-front-door", false) 
  309. 	--marker_remove_navpoint("sh_rn_stripclub_$t-lower-roof") 
  310. 	marker_remove_navpoint("sh_rn_stripclub_$t-upper-roof")		 
  311. 	for i = 1, num_gang_reinforce, 1 do			 
  312. 		marker_add_npc(reinforce1[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  313. 		on_death("sh_rn_stripclub_killcount_gang_reinf", reinforce1[i]) 
  314. 	end 
  315. 	attack("sh_rn_stripclub_$c-reinf-in (1)") 
  316. 	attack("sh_rn_stripclub_$c-reinf-in (2)") 
  317. 	attack("sh_rn_stripclub_$c-reinf-in (5)") 
  318. end 
  319.  
  320.  
  321.  
  322. -- when player goes to either rooftop/outside, periodically call attack() on reinforce dudes, otherwise they might "time out" and forget about the PC/wander off somewhere and get lost 
  323. function sh_rn_stripclub_recurring_attack() 
  324. 	player_used_exit_trigger = true 
  325. 	trigger_enable("sh_rn_stripclub_$t-lower-roof", false) 
  326. 	trigger_enable("sh_rn_stripclub_$t-upper-roof", false) 
  327. 	trigger_enable("sh_rn_stripclub_$t-front-door", false) 
  328. 	marker_remove_navpoint("sh_rn_stripclub_$t-lower-roof") 
  329. 	marker_remove_navpoint("sh_rn_stripclub_$t-upper-roof") 
  330. 		 
  331. 	for i = 1, num_gang_reinforce, 1 do 
  332. 		marker_add_npc(reinforce1[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  333. 		on_death("sh_rn_stripclub_killcount_gang_reinf", reinforce1[i]) 
  334. 	end 
  335.  
  336. 	for i = 1, num_gang_reinforce, 1 do 
  337. 		set_always_sees_player_flag(reinforce1[i], true) 
  338. 	end 
  339. 	 
  340. 	while (1) do 
  341. 		delay(5) 
  342.  
  343. 		for i = 1, num_gang_reinforce, 1 do 
  344. 			attack(reinforce1[i]) 
  345. 			delay(1) 
  346. 		end 
  347. 	end 
  348. end 
  349.  
  350.  
  351. -- Real function 
  352. function sh_rn_stripclub_ctplay()	 
  353. 	if coop_is_active() then	 
  354. 	fade_out(.5) 
  355. 	fade_out_block() 
  356. 	teleport_coop("sh_rn_stripclub_$nSecond_Tele", "sh_rn_stripclub_$tsecond", true) 
  357. 	fade_in(.5) 
  358. 	end	 
  359. 	spawning_pedestrians(false) 
  360. 	spawning_vehicles(false) 
  361. 	cutscene_play("sh_rn_stripclub_ct2") 
  362. 	mission_help_table("sh_rn_stripclub_reinforce")  -- "Eliminate the Ronin reinforcements!" 
  363. 	objective_text(0, "sh_rn_stripclub_reinforce_left", gang_reinf_killed, num_gang_reinforce) 
  364. 	marker_add_navpoint("sh_rn_stripclub_$t-upper-roof",MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  365. end