sr2lua/sh_tss_ugmall.lua

  1.  
  2.  
  3. ---Groups 
  4.  
  5. execs = {"sh_tss_ugmall_$c000", "sh_tss_ugmall_$c000 (0)", "sh_tss_ugmall_$c000 (1)", "sh_tss_ugmall_$c000 (2)", "sh_tss_ugmall_$c000 (3)", "sh_tss_ugmall_$c000 (4)", "sh_tss_ugmall_$c000 (5)", "sh_tss_ugmall_$c000 (6)", "sh_tss_ugmall_$c000 (7)"} 
  6. chase = {"sh_tss_ugmall_$n000", "sh_tss_ugmall_$n001", "sh_tss_ugmall_$n002", "sh_tss_ugmall_$n003", "sh_tss_ugmall_$n004", "sh_tss_ugmall_$n005", "sh_tss_ugmall_$n006", "sh_tss_ugmall_$n000", "sh_tss_ugmall_$n001", "sh_tss_ugmall_$n002", "sh_tss_ugmall_$n003", "sh_tss_ugmall_$n004", "sh_tss_ugmall_$n005", "sh_tss_ugmall_$n006", "sh_tss_ugmall_$n007", "sh_tss_ugmall_$n008", "sh_tss_ugmall_$n009", "sh_tss_ugmall_$n010", "sh_tss_ugmall_$n011", "sh_tss_ugmall_$n012", "sh_tss_ugmall_$n013", "sh_tss_ugmall_$n014", "sh_tss_ugmall_$n015", "sh_tss_ugmall_$n016", "sh_tss_ugmall_$n017", "sh_tss_ugmall_$n018", "sh_tss_ugmall_$n019", "sh_tss_ugmall_$n020", "sh_tss_ugmall_$n021", "sh_tss_ugmall_$n022", "sh_tss_ugmall_$n023", "sh_tss_ugmall_$n024", "sh_tss_ugmall_$n025", "sh_tss_ugmall_$n026", "sh_tss_ugmall_$n027", "sh_tss_ugmall_$n028", "sh_tss_ugmall_$n029", "sh_tss_ugmall_$n030", "sh_tss_ugmall_$n031", "sh_tss_ugmall_$n032", "sh_tss_ugmall_$n033", "sh_tss_ugmall_$n034", "sh_tss_ugmall_$n035", "sh_tss_ugmall_$n036", "sh_tss_ugmall_$n037", "sh_tss_ugmall_$n038", "sh_tss_ugmall_$n039", "sh_tss_ugmall_$n040", "sh_tss_ugmall_$n041", "sh_tss_ugmall_$n042", "sh_tss_ugmall_$n043", "sh_tss_ugmall_$n044", "sh_tss_ugmall_$n045", "sh_tss_ugmall_$n046", "sh_tss_ugmall_$n047", "sh_tss_ugmall_$n007", "sh_tss_ugmall_$n008", "sh_tss_ugmall_$n009", "sh_tss_ugmall_$n010", "sh_tss_ugmall_$n011", "sh_tss_ugmall_$n012", "sh_tss_ugmall_$n013", "sh_tss_ugmall_$n014", "sh_tss_ugmall_$n015", "sh_tss_ugmall_$n016", "sh_tss_ugmall_$n017", "sh_tss_ugmall_$n018", "sh_tss_ugmall_$n019", "sh_tss_ugmall_$n020", "sh_tss_ugmall_$n021", "sh_tss_ugmall_$n022", "sh_tss_ugmall_$n023", "sh_tss_ugmall_$n024", "sh_tss_ugmall_$n025", "sh_tss_ugmall_$n026", "sh_tss_ugmall_$n027", "sh_tss_ugmall_$n028", "sh_tss_ugmall_$n029", "sh_tss_ugmall_$n030", "sh_tss_ugmall_$n031", "sh_tss_ugmall_$n032", "sh_tss_ugmall_$n033", "sh_tss_ugmall_$n034", "sh_tss_ugmall_$n035", "sh_tss_ugmall_$n036", "sh_tss_ugmall_$n037", "sh_tss_ugmall_$n038", "sh_tss_ugmall_$n039", "sh_tss_ugmall_$n040", "sh_tss_ugmall_$n041", "sh_tss_ugmall_$n042", "sh_tss_ugmall_$n043", "sh_tss_ugmall_$n044", "sh_tss_ugmall_$n045", "sh_tss_ugmall_$n046", "sh_tss_ugmall_$n047"} 
  7. wander = {"sh_tss_ugmall_$c005", "sh_tss_ugmall_$c005 (0)", "sh_tss_ugmall_$c005 (1)", "sh_tss_ugmall_$c005 (2)"} 
  8. bd1 = {"sh_tss_ugmall_$cwander1", "sh_tss_ugmall_$cwander1 (0)", "sh_tss_ugmall_$cwander1 (1)"} 
  9. bd2 = {"sh_tss_ugmall_$cwander2 (2)", "sh_tss_ugmall_$cwander2 (3)", "sh_tss_ugmall_$cwander2 (4)"} 
  10. bd3 = {"sh_tss_ugmall_$cwander3", "sh_tss_ugmall_$cwander3 (0)", "sh_tss_ugmall_$cwander3 (1)"} 
  11. bd4 = {"sh_tss_ugmall_$cwander4", "sh_tss_ugmall_$cwander4 (0)", "sh_tss_ugmall_$cwander4 (1)"} 
  12. thugs = {"sh_tss_ugmall_$c002", "sh_tss_ugmall_$c002 (0)", "sh_tss_ugmall_$c002 (3)", "sh_tss_ugmall_$c002 (4)", "sh_tss_ugmall_$c002 (5)", "sh_tss_ugmall_$c002 (6)", "sh_tss_ugmall_$c002 (9)", "sh_tss_ugmall_$c002 (10)", "sh_tss_ugmall_$c002 (11)", "sh_tss_ugmall_$c002 (12)", "sh_tss_ugmall_$c002 (13)", "sh_tss_ugmall_$c002 (14)", "sh_tss_ugmall_$c002 (15)", "sh_tss_ugmall_$c004", "sh_tss_ugmall_$c004 (0)", "sh_tss_ugmall_$c004 (1)", "sh_tss_ugmall_$c004 (2)", "sh_tss_ugmall_$c004 (3)"}  
  13. --bd5 = {"sh_tss_ugmall_$cwander1 (2)", "sh_tss_ugmall_$cwander1 (3)", "sh_tss_ugmall_$cwander1 (4)"} 
  14. bodyguards = {bd1, bd2, bd3, bd4} 
  15. barricades = {"sh_tss_ugmall__main_barripolc15000", "sh_tss_ugmall__main_barripolc14000", "sh_tss_ugmall__main_barripolc13000", "sh_tss_ugmall__main_barripolc12000", "sh_tss_ugmall__main_barripolc11000", "sh_tss_ugmall__main_barripolc28000", "sh_tss_ugmall__main_barripolc27000", "sh_tss_ugmall__main_barripolc26000", "sh_tss_ugmall__main_barripolc25000", "sh_tss_ugmall__main_barripolc24000", "sh_tss_ugmall__main_barripolc23000", "sh_tss_ugmall__main_barripolc20000", "sh_tss_ugmall__main_barripolc19000", "sh_tss_ugmall__main_barripolc18000", "sh_tss_ugmall__main_barripolc17000", "sh_tss_ugmall__main_barripolc16000", "sh_tss_ugmall__main_barripolc01000", "sh_tss_ugmall__main_barripolc02000", "sh_tss_ugmall__main_barripolc03000", "sh_tss_ugmall__main_barripolc04000", "sh_tss_ugmall__main_barripolc05000", "sh_tss_ugmall__main_barripolc10000", "sh_tss_ugmall__main_barripolc09000", "sh_tss_ugmall__main_barripolc08000", "sh_tss_ugmall__main_barripolc07000", "sh_tss_ugmall__main_barripolc06000"} 
  16. wander_idx = { 
  17. 					["sh_tss_ugmall_$c005"] = 1,  
  18. 					["sh_tss_ugmall_$c005 (0)"] = 2,  
  19. 					["sh_tss_ugmall_$c005 (1)"] = 3,  
  20. 					["sh_tss_ugmall_$c005 (2)"] = 4  
  21. 					} 
  22.  
  23. --Tables 
  24.  
  25. execs_total = sizeof_table( execs )  
  26. execs_count = 0 
  27. chase_total = sizeof_table( chase ) 
  28. chase_count = 0 
  29. wander_count = 0 
  30. wander_total = sizeof_table( wander ) 
  31. bd1_total = sizeof_table( bd1 ) 
  32. bd2_total = sizeof_table( bd2 ) 
  33. bd3_total = sizeof_table( bd3 ) 
  34. bd4_total = sizeof_table( bd4 ) 
  35. --bd5_total = sizeof_table( bd5 ) 
  36. bodygaurds_total = sizeof_table( bodyguards ) 
  37. thugscount = 0 
  38. thugs_total = sizeof_table( thugs ) 
  39. ---addtional Tables 
  40. bd_totals = {bd1_total, bd2_total, bd3_total, bd4_total} 
  41. bd_total_size = sizeof_table( bd_totals ) 
  42. barricades_total= sizeof_table ( barricades ) 
  43.  
  44. function sh_tss_ugmall_start(checkpoint, is_restart) 
  45. 	 
  46. 	if checkpoint == MISSION_START_CHECKPOINT then 
  47. 	set_mission_author("David Bowring")	 
  48. 	mission_start_fade_out() 
  49. 	teleport_coop("sh_tss_ugmall_$nstart","sh_tss_ugmall_$napc1") 
  50. 	 
  51. 	--[[ 
  52. 	teleport("#PLAYER1#","sh_tss_ugmall_$nstart")	 
  53. 		if (coop_is_active()) then 
  54. 			teleport("#PLAYER2#","sh_tss_ugmall_$napc1") 
  55. 		end 
  56. 	--]] 
  57.  
  58. 	--notoriety_set_max("ultor", 3)  
  59. 	--thread_new("sh_tss_ugmall_barricades", true) 
  60. 	sh_tss_ugmall_barricades(true) 
  61. 	if (not is_restart) then 
  62. 		cutscene_play("sh_tss_ugmallct1") 
  63. 	end 
  64. 	notoriety_set_max("police", 3) 
  65. 	--group_create("sh_tss_ugmall_$GCars", true) 
  66. 	group_create("sh_tss_ugmall_$GWander", true) 
  67. 	objective_text(0, "sh_tss_ugmall_instruct_two", wander_count, wander_total) 
  68. 	on_trigger("sh_tss_ugmall_escape","sh_tss_ugmall_$tescape") 
  69. 	mission_help_table_nag("sh_tss_ugmall_instruct_one") 
  70. 	delay(5) 
  71. 	on_trigger("sh_tss_ugmall_execs_trigger", "sh_tss_ugmall_$tconf") 
  72. 	mission_help_table("sh_tss_ugmall_instruct_wander") 
  73. 	door_lock("sh_tss_ugmall_DoorMM020", true) 
  74. 	door_lock("sh_tss_ugmall_DoorMM030", true) 
  75. 	door_lock("sh_tss_ugmall_DoorMM140", true) 
  76. 	door_lock("sh_tss_ugmall_DoorMM130", true) 
  77. 	door_lock("sh_tss_ugmall_DoorMM090", true) 
  78. 	door_lock("sh_tss_ugmall_DoorMM100", true) 
  79. 	--cutscene_play("sh_tss_ugmallct2") 
  80. 	sh_tss_ugmall_setup_wander() 
  81. 	--sh_tss_ugmall_chase() 
  82. 	--sh_tss_ugmall_phaseTwo() 
  83. 	mission_start_fade_in() 
  84. 	else 
  85. 		fade_in(1) 
  86. 		on_trigger("sh_tss_ugmall_escape","sh_tss_ugmall_$tescape") 
  87. 		sh_tss_ugmall_phaseTwo() 
  88. 	end 
  89. end 
  90.  
  91. function  sh_tss_ugmall_setup_wander() 
  92.  
  93. for i = 1, wander_total, 1 do 
  94. 	marker_add_npc(wander[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  95. 	on_death("sh_tss_ugmall_killwander", wander[i])			 
  96. 	wander_start(wander[i], wander[i], 20) 
  97. 	sh_tss_ugmall_alert_handeler(wander[i]) 
  98. end 
  99.  
  100. 		-- Go through each wander and each bodyguard group 
  101. 	for i = 1, wander_total, 1 do 
  102. 		-- Go through each person in group bodyguard[i] 
  103. 		on_detection("sh_tss_ugmall_wanderer", wander[i])  
  104. 		set_attack_player_flag( wander[i], true ) 
  105. 		set_cower_flee_mode( wander[i], "never cower or flee") 
  106. 			for j = 1, bd_totals[i], 1 do 
  107. 			-- Add each person in bodyguard[i] to the wander npc at index i 
  108. 			npc_follow_npc(bodyguards[i][j], wander[i]) 
  109. 			on_detection("sh_tss_ugmall_bodyguard", bodyguards[i][j]) 
  110. 			if (j == 1) then 
  111. 				set_blitz_flag(bodyguards[i][j], true) 
  112. 			end				 
  113. 		end 
  114. 	end 
  115. end 
  116.  
  117.  
  118. function sh_tss_ugmall_barricades(bool) 
  119. 	--function to hid and unhide movers 
  120. 	 
  121. 	if bool then 
  122. 		for i = 1, barricades_total, 1 do 
  123. 		mesh_mover_hide(barricades[i]) 
  124. 		mission_debug(" hide="..barricades[i]) 
  125. 		end 
  126. 	else 
  127. 		for i = 1, barricades_total, 1 do 
  128. 		mission_debug("show="..barricades[i]) 
  129. 		mesh_mover_show(barricades[i])  
  130. 		end 
  131. 	end 
  132. end 
  133.  
  134. function sh_tss_ugmall_wanderer(char) 
  135. --Make the shopping execs shop.	 
  136. 	mission_debug("DETECTED") 
  137. 	set_attack_player_flag( char, false ) 
  138. 	set_cower_flee_mode( char, "always flee when attacked")  
  139. 	flee(char,LOCAL_PLAYER,false,true) 
  140. 	for j = 1, bd_totals[wander_idx[char]], 1 do 
  141. 		-- Add each person in bodyguard[wander_idx[char]] to the wander npc at index wander_idx[char] 
  142. 		npc_stop_following(bodyguards[wander_idx[char]][j]) 
  143. 		attack(bodyguards[wander_idx[char]][j])				 
  144. 	end 
  145. end 
  146.  
  147.  
  148. function sh_tss_ugmall_bodyguard(char) 
  149. 	mission_debug("PLAYER DETECTED") 
  150. 	npc_stop_following(char) 
  151. 	attack(char) 
  152. end 
  153.  
  154.  
  155. function sh_tss_ugmall_alert_handeler(char) 
  156. 	on_take_damage("sh_tss_ugmall_alert",char) 
  157. end 
  158.  
  159.  
  160.  
  161. function sh_tss_ugmall_alert(char) 
  162. 	for j = 1, bd_totals[wander_idx[char]], 1 do 
  163. 	-- Add each person in bodyguard[wander_idx[char]] to the wander npc at index wander_idx[char] 
  164. 	npc_stop_following(bodyguards[wander_idx[char]][j]) 
  165. 	attack(bodyguards[wander_idx[char]][j])				 
  166. 	end 
  167. end 
  168.  
  169. function sh_tss_ugmall_execs_trigger() 
  170. on_trigger("sh_tss_ugmall_execs_trigger_two", "sh_tss_ugmall_$texectwo") 
  171. marker_remove_navpoint("sh_tss_ugmall_$tconf") 
  172. trigger_enable("sh_tss_ugmall_$texectwo", true) 
  173. marker_add_navpoint("sh_tss_ugmall_$texectwo", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  174. end 
  175.  
  176. function sh_tss_ugmall_execs_trigger_two() 
  177. 	sh_tss_ugmall_execs() 
  178. end 
  179.  
  180.  
  181.  
  182. function sh_tss_ugmall_execs() 
  183. 	--Kill the execs in the conference room 
  184.  
  185. 	--group_create("sh_tss_ugmall_$Gultorexecs") 
  186. 	marker_remove_navpoint("sh_tss_ugmall_$texectwo") 
  187. 	trigger_enable("sh_tss_ugmall_$texectwo", false) 
  188. 	--mission_help_table("sh_tss_ugmall_instruct_wanderfinish") 
  189. 	objective_text(0, "sh_tss_ugmall_instruct_two", execs_count, execs_total)	 
  190. 	trigger_enable("sh_tss_ugmall_$tconf", false) 
  191. 	door_lock("sh_tss_ugmall_DoorMM090", false) 
  192. 	door_lock("sh_tss_ugmall_DoorMM100", false) 
  193. 	door_lock("sh_tss_ugmall_DoorMM140", false) 
  194. 	door_lock("sh_tss_ugmall_DoorMM130", false) 
  195. 	 
  196. 		 
  197. 		for i = 1, execs_total, 1 do 
  198. 			marker_add_npc(execs[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  199. 			on_death("sh_tss_ugmall_killcount", execs[i]) 
  200. 		end	 
  201. end 
  202.  
  203.  
  204. function sh_tss_ugmall_killwander(char) 
  205.  
  206. 	wander_count = wander_count+1 
  207. 	marker_remove_npc(char) 
  208. 	--objective_text_clear() 
  209. 	objective_text(0, "sh_tss_ugmall_instruct_two", wander_count, wander_total) 
  210. 	release_to_world(char) 
  211.  
  212. 	 
  213. 		if	(wander_count == 1) then 
  214. 			notoriety_set("police", 3)		 
  215. 		end 
  216.  
  217. 		if	(wander_count == wander_total) then 
  218. 			objective_text_clear(0) 
  219. 			release_to_world("sh_tss_ugmall_$GWander") 
  220. 			delay(1) 
  221. 			trigger_enable("sh_tss_ugmall_$tconf", true) 
  222. 			marker_add_navpoint("sh_tss_ugmall_$tconf", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  223. 			mission_help_table("sh_tss_ugmall_instruct_wanderfinish") 
  224. 			--sh_tss_ugmall_chase() 
  225. 			--sh_tss_ugmall_phaseTwo() 
  226. 			group_create("sh_tss_ugmall_$Gultorexecs") 
  227. 		for i = 1, execs_total, 1 do 
  228. 			--marker_add_npc(execs[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  229. 			on_death("sh_tss_ugmall_killcount", execs[i]) 
  230. 		end 
  231. 		 
  232. 		end 
  233. end 
  234.  
  235.  
  236. function sh_tss_ugmall_escape() 
  237.  
  238. mission_end_success("sh_tss_ugmall") 
  239.  
  240. end 
  241.  
  242.  
  243.  
  244.  
  245. function sh_tss_ugmall_killcount(char) 
  246.  
  247. 	execs_count = execs_count+1 
  248. 	marker_remove_npc(char) 
  249. 	objective_text(0, "sh_tss_ugmall_instruct_two", execs_count, execs_total) 
  250. 	release_to_world(char) 
  251. 	 
  252.  
  253. 		if	(execs_count == execs_total) then 
  254. 			objective_text_clear(0) 
  255. 			release_to_world("sh_tss_ugmall_$Gultorexecs") 
  256. 			delay(1) 
  257. 			--sh_tss_ugmall_chase() 
  258. 			mission_set_checkpoint("escape") 
  259. 			sh_tss_ugmall_phaseTwo() 
  260. 		end 
  261.  
  262.  
  263. 		if	(execs_count == 1) then 
  264. 				door_lock("sh_tss_ugmall_DoorMM020", false) 
  265. 				door_lock("sh_tss_ugmall_DoorMM030", false) 
  266. 				door_open("sh_tss_ugmall_DoorMM020") 
  267. 				door_open("sh_tss_ugmall_DoorMM030") 
  268. 				door_open("sh_tss_ugmall_DoorMM140") 
  269. 				door_open("sh_tss_ugmall_DoorMM130") 
  270. 		end 
  271.  
  272.  
  273. end 
  274.  
  275.  
  276. function sh_tss_ugmall_chase() 
  277. 	group_create("sh_tss_ugmall_$Gexectwo", true)	 
  278. 	vehicle_enter_teleport("sh_tss_ugmall_$c003", "sh_tss_ugmall_$v001", 0) 
  279. 	on_death("sh_tss_ugmall_phaseTwo", "sh_tss_ugmall_$c003") 
  280. 	marker_add_npc("sh_tss_ugmall_$c003", MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  281. 	vehicle_infinite_mass("sh_tss_ugmall_$v001", true) 
  282. 	mission_help_table("sh_tss_ugmall_instruct_three") 
  283. 	vehicle_pathfind_to("sh_tss_ugmall_$v001", "sh_tss_ugmall_$pathdrive", true, true)	 
  284. end 
  285.  
  286.  
  287.  
  288.  
  289.  
  290. function sh_tss_ugmall_phaseTwo() 
  291. 	local teleport_points = {"sh_tss_ugmall_$nTele","sh_tss_ugmall_$nTele (0)"} 
  292.  
  293. 	marker_remove_npc("sh_tss_ugmall_$c003") 
  294. 	delay(3) 
  295. 	cutscene_play("sh_tss_ugmallct2","sh_tss_ugmall_$GUltorThugs",teleport_points,true)	 
  296. 	thread_new("sh_tss_ugmall_barricades", false) 
  297. 	trigger_enable("sh_tss_ugmall_$tescape", true) 
  298. 	marker_add_trigger("sh_tss_ugmall_$tescape", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  299. 	group_show("sh_tss_ugmall_$GUltorThugs") 
  300. 	mission_help_table("sh_tss_ugmall_instruct_four") 
  301. 	notoriety_set_max("police", 5) 
  302. 	notoriety_set_min("police", 5) 
  303. 	notoriety_set("police", 5) 
  304.  
  305. 	for i = 1, thugs_total, 1 do 
  306. 		while (1) do 
  307. 			delay(3) 
  308. 			attack(thugs[i]) 
  309. 		end 
  310. 	end 
  311. end 
  312.  
  313. 	 
  314.  
  315. function sh_tss_ugmall_cleanup() 
  316. 	on_trigger("", "sh_tss_ugmall_$tconf") 
  317. 	on_trigger("", "sh_tss_ugmall_$texectwo") 
  318. 	marker_remove_trigger("sh_tss_ugmall_$tescape") 
  319. 	marker_remove_navpoint("sh_tss_ugmall_$tconf") 
  320. 	marker_remove_navpoint("sh_tss_ugmall_$texectwo") 
  321. 	trigger_enable("sh_tss_ugmall_$tescape", false) 
  322. 	trigger_enable("sh_tss_ugmall_$tconf", false) 
  323. 	trigger_enable("sh_tss_ugmall_$texectwo", false) 
  324. 	door_lock("sh_tss_ugmall_DoorMM020", false) 
  325. 	door_lock("sh_tss_ugmall_DoorMM030", false) 
  326. 	door_lock("sh_tss_ugmall_DoorMM140", false) 
  327. 	door_lock("sh_tss_ugmall_DoorMM130", false) 
  328. 	door_lock("sh_tss_ugmall_DoorMM090", false) 
  329. 	door_lock("sh_tss_ugmall_DoorMM100", false) 
  330. 	on_trigger("","sh_tss_ugmall_$tescape") 
  331.  
  332. 	for i = 1, execs_total, 1 do 
  333. 		if group_is_loaded("sh_tss_ugmall_$Gultorexecs") == true then 
  334. 			if character_is_dead(execs[i]) == false then 
  335. 				marker_remove_npc(execs[i]) 
  336. 				on_death("", execs[i]) 
  337. 			end 
  338. 		end 
  339. 	end    
  340.  
  341. --cleanup stuff here 
  342. end 
  343. 	 
  344.  
  345.  
  346. function sh_tss_ugmall_success() 
  347.  
  348. --success stuff here 
  349.  
  350.  
  351. end 
  352.  
  353.