sr2lua/sh_rn_museum_pier.lua

  1. -- Tables 
  2. GroupOne = {"sh_rn_museum_pier_$c000", "sh_rn_museum_pier_$c001", "sh_rn_museum_pier_$c002", "sh_rn_museum_pier_$c003", "sh_rn_museum_pier_$c004", "sh_rn_museum_pier_$c005", "sh_rn_museum_pier_$c006", "sh_rn_museum_pier_$c007", "sh_rn_museum_pier_$c008"}     
  3. GroupTwo = {"sh_rn_museum_pier_$c010", "sh_rn_museum_pier_$c011", "sh_rn_museum_pier_$c012", "sh_rn_museum_pier_$c013", "sh_rn_museum_pier_$c014", "sh_rn_museum_pier_$c015", "sh_rn_museum_pier_$c016", "sh_rn_museum_pier_$c017", "sh_rn_museum_pier_$c018", "sh_rn_museum_pier_$c019"} 
  4. GroupThree = {"sh_rn_museum_pier_$c023", "sh_rn_museum_pier_$c022", "sh_rn_museum_pier_$c021", "sh_rn_museum_pier_$c020"} 
  5. GroupFour = {"sh_rn_museum_pier_$c024", "sh_rn_museum_pier_$c025", "sh_rn_museum_pier_$c026", "sh_rn_museum_pier_$c027", "sh_rn_museum_pier_$c028", "sh_rn_museum_pier_$c029", "sh_rn_museum_pier_$c030", "sh_rn_museum_pier_$c031", "sh_rn_museum_pier_$c032", "sh_rn_museum_pier_$c033", "sh_rn_museum_pier_$c034", "sh_rn_museum_pier_$c035", "sh_rn_museum_pier_$c036", "sh_rn_museum_pier_$c037", "sh_rn_museum_pier_$c038", "sh_rn_museum_pier_$c039"}        
  6. GroupBoats ={"sh_rn_museum_pier_$v000", "sh_rn_museum_pier_$v001", "sh_rn_museum_pier_$v002", "sh_rn_museum_pier_$v003", "sh_rn_museum_pier_$v004"} 
  7. GroupLts = {"sh_rn_museum_pier_$c040", "sh_rn_museum_pier_$c041", "sh_rn_museum_pier_$c042", "sh_rn_museum_pier_$c043", "sh_rn_museum_pier_$c044", "sh_rn_museum_pier_$c045"} 
  8. Groups = {"sh_rn_museum_pier_$GO", "sh_rn_museum_pier_$Gt", "sh_rn_museum_pier_$G3", "sh_rn_museum_pier_$Gb", "sh_rn_museum_pier_$Gboats", "sh_rn_museum_pier_$GLts"} 
  9. helipath = {"sh_rn_museum_pier_$n005", "sh_rn_museum_pier_$n006", "sh_rn_museum_pier_$n007", "sh_rn_museum_pier_$n008", "sh_rn_museum_pier_$n009", "sh_rn_museum_pier_$n010", "sh_rn_museum_pier_$n011", "sh_rn_museum_pier_$n012", "sh_rn_museum_pier_$n013", "sh_rn_museum_pier_$n014", "sh_rn_museum_pier_$n015"} 
  10. boatguards = {"sh_rn_museum_pier_$c024", "sh_rn_museum_pier_$c025", "sh_rn_museum_pier_$c026", "sh_rn_museum_pier_$c027", "sh_rn_museum_pier_$c028", "sh_rn_museum_pier_$c029", "sh_rn_museum_pier_$c032", "sh_rn_museum_pier_$c033", "sh_rn_museum_pier_$c034", "sh_rn_museum_pier_$c036"} 
  11. --Global Vaiables 
  12. GroupOneCount = 0 
  13. GroupOneTotal = sizeof_table( GroupOne ) 
  14. GroupTwoCount = 0 
  15. GroupTwoTotal = sizeof_table( GroupTwo ) 
  16. GroupThreeCount = 0 
  17. GroupThreeTotal = sizeof_table( GroupBoats ) 
  18. GroupFourCount = 0 
  19. GroupFourTotal = sizeof_table( GroupLts ) 
  20. GroupsTotal = sizeof_table( Groups ) 
  21. boatguardscount =0 
  22. boatguardstotal = sizeof_table( boatguards ) 
  23. areaone = false 
  24. areatwo = false 
  25. areathree = false 
  26. areaone_done = false 
  27. areatwo_done = false 
  28. areathree_done = false 
  29. marker_three = false 
  30.  
  31. --- Start Function 
  32. function sh_rn_museum_pier_start(checkpoint, is_restart) 
  33. 	set_mission_author("David Bowring") 
  34. 	mission_start_fade_out() 
  35. 	teleport_coop("sh_rn_museum_pier_$nstart","sh_rn_museum_pier_$nstart2")	 
  36. 	if (not is_restart) then 
  37. 		cutscene_play("sh_rn_museum_piercs3") 
  38. 	end 
  39.  
  40. 	character_slots_cap_for_team("police", 0) 
  41. 	group_destroy("sh_rn_museum_pier_$GCTE") 
  42. 	thread_new("sh_rn_museum_pier_trigger") 
  43. 	notoriety_set_max("police", 0) 
  44. 	notoriety_set_max("ronin", 0)	 
  45. 	--added delay to make more network friendly 
  46. 	group_create("sh_rn_museum_pier_$GO") 
  47. 	delay(.5)	 
  48. 	--atempting to spawn all 
  49. 	group_create("sh_rn_museum_pier_$Gt", true) 
  50. 	delay(.5) 
  51. 	group_create("sh_rn_museum_pier_$Gb") 
  52. 	delay(.5) 
  53. 	group_create("sh_rn_museum_pier_$Gboats") 
  54. 	--notoriety_force_no_spawn("ronin", true)  
  55. 	ambient_cop_spawn_enable(false)  
  56. 	ambient_gang_spawn_enable(false)  
  57. 	spawning_pedestrians(false)  
  58. 	--end spawn all 
  59. 	group_create("sh_rn_museum_pier_$GRoad") 
  60. 	mission_help_table_nag("sh_rn_museum_pier_setup") 
  61. 	--delay(5) 
  62. 	--objective_text(0, "sh_rn_museum_pier_GroupOneCount",   GroupOneCount, GroupOneTotal) 
  63. 	--cutscene_play("sh_rn_museum_pier_cs2", "sh_rn_museum_pier_$Gb")	 
  64. 	--delay(3) 
  65.  
  66. 		for i = 1, GroupOneTotal, 1 do			 
  67. 			on_death("sh_rn_museum_pier_killcount", GroupOne[i]) 
  68. 			set_always_sees_player_flag(GroupOne[i], true) 
  69. 		end 
  70.  
  71. 		for i = 1, GroupTwoTotal, 1 do 
  72. 			if not character_is_dead(GroupTwo[i]) then 
  73. 				on_death("sh_rn_museum_pier_killcountTwo", GroupTwo[i]) 
  74. 				wander_start(GroupTwo[i], GroupTwo[i], 10) 
  75. 			end 
  76. 		end 
  77.  
  78. 		for i = 1, GroupThreeTotal, 1 do 
  79. 				if not vehicle_is_destroyed(GroupBoats[i]) then 
  80. 					--marker_add_vehicle(GroupBoats[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  81. 					set_current_hit_points( GroupBoats[i], 1000)  
  82. 					turn_invulnerable(GroupBoats[i], true) 
  83. 					--attack(GroupBoats[i], "#PLAYER#")  
  84. 					on_vehicle_destroyed("sh_rn_museum_pier_killcountThree", GroupBoats[i]) 
  85. 				end 
  86. 		end 
  87. 		mission_start_fade_in() 
  88. end 
  89.  
  90.  
  91.  
  92.  
  93. function sh_rn_museum_pier_trigger() 
  94. 	mission_debug("Thread active") 
  95. 	mission_help_table("sh_rn_museum_pier_instructtwo") 
  96. 	marker_add_navpoint("sh_rn_museum_pier_$tareaone", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  97. 	trigger_enable("sh_rn_museum_pier_$tareaone", true) 
  98. 	on_trigger("sh_rn_museum_pier_areaone", "sh_rn_museum_pier_$tareaone") 
  99. 	on_trigger("sh_rn_museum_pier_areatwo", "sh_rn_museum_pier_$tareatwo") 
  100. 	on_trigger("sh_rn_museum_pier_areathree", "sh_rn_museum_pier_$tareathree") 
  101. end 
  102.  
  103.  
  104.  
  105. function sh_rn_museum_pier_areaone() 
  106. 		mission_debug("trigger")		 
  107. 		notoriety_set_max("ronin", 2) 
  108. 		notoriety_set_min("ronin", 2) 
  109. 		objective_text(0, "sh_rn_museum_pier_GroupOneCount",   GroupOneCount, GroupOneTotal) 
  110. 		trigger_enable("sh_rn_museum_pier_$tareaone", false) 
  111. 		marker_remove_navpoint("sh_rn_museum_pier_$tareaone") 
  112. 	for i = 1, GroupOneTotal, 1 do 
  113. 		marker_add_npc(GroupOne[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  114. 		attack(GroupOne[i], LOCAL_PLAYER) 
  115. 	end 
  116. end 
  117.  
  118.  
  119.  
  120.  
  121. function sh_rn_museum_pier_areatwo() 
  122. if coop_is_active() then 
  123. 	sh_rn_museum_pier_heli() 
  124. end 
  125.  
  126. 	objective_text_clear(0)	 
  127. 	areatwo=true 
  128. 		if (GroupTwoCount == GroupTwoTotal)  and areatwo then 
  129. 			--debug_message("GROUP TWO") 
  130. 			release_to_world("sh_rn_museum_pier_$Gt") 
  131. 			marker_add_navpoint("sh_rn_museum_pier_$tareathree", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  132. 			trigger_enable("sh_rn_museum_pier_$tareathree", true) 
  133. 			objective_text_clear(0) 
  134. 			areathree=true 
  135. 		end 
  136. 	if areatwo then 
  137. 		sh_rn_museum_pier_group_two() 
  138. 	elseif areathree then 
  139. 		sh_rn_museum_pier_areathree() 
  140. 	end 
  141. end 
  142.  
  143.  
  144. function sh_rn_museum_pier_areathree() 
  145. 	 
  146. 	objective_text_clear(0) 
  147. 	areathree=true 
  148. 	trigger_enable("sh_rn_museum_pier_$tareathree", false) 
  149. 	mission_debug("remove navpoint") 
  150. 	marker_remove_navpoint("sh_rn_museum_pier_$tareathree") 
  151. 		 
  152. 		if GroupThreeCount == GroupThreeTotal and areathree then 
  153. 			--debug_message("GROUP TWO") 
  154. 			release_to_world("sh_rn_museum_pier_$Gb") 
  155. 			--sh_rn_museum_pier_group_three() 
  156. 			delay(3) 
  157. 			mission_end_success("sh_rn_museum_pier")  
  158. 			--sh_rn_museum_pier_group_Four()			 
  159. 		end 
  160.  
  161. 	sh_rn_museum_pier_group_three() 
  162.  
  163. end 
  164.  
  165.  
  166. function sh_rn_museum_pier_killcount(char) 
  167.  
  168. 	GroupOneCount = GroupOneCount + 1 
  169. 	 
  170. 	 
  171. 	marker_remove_npc(char) 
  172. 	objective_text(0, "sh_rn_museum_pier_GroupOneCount",  GroupOneCount, GroupOneTotal) 
  173. 	notoriety_set_max("police", 0) 
  174.  
  175. 		if GroupOneCount == GroupOneTotal then 
  176. 			--debug_message("GROUP TWO") 
  177. 			release_to_world("sh_rn_museum_pier_$GO") 
  178. 			marker_add_navpoint("sh_rn_museum_pier_$tareatwo", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION)			 
  179. 			mission_help_table("sh_rn_museum_pier_instructone") 
  180. 			objective_text_clear(0) 
  181. 			areaone_done = true 
  182. 			areatwo = true 
  183. 			trigger_enable("sh_rn_museum_pier_$tareatwo", true) 
  184. 		end 
  185.  
  186.  
  187. 		if (GroupOneCount == 1) then 
  188. 			for i = 1, GroupOneTotal, 1 do 
  189. 				set_always_sees_player_flag(GroupOne[i], true) 
  190. 				attack(GroupOne[i], LOCAL_PLAYER) 
  191. 			end			 
  192. 		end 
  193. 		 
  194. 	 
  195. end 
  196.  
  197.  
  198. function sh_rn_museum_pier_group_two() 
  199.  
  200. 	trigger_enable("sh_rn_museum_pier_$tareatwo", false) 
  201. 	marker_remove_navpoint("sh_rn_museum_pier_$tareatwo") 
  202. 	objective_text_clear(0) 
  203. 	--group_create("sh_rn_museum_pier_$Gt", true) 
  204. 	 
  205. 	 
  206. 	if (GroupTwoCount == GroupTwoTotal)  and areatwo then 
  207. 			--debug_message("GROUP TWO") 
  208. 			release_to_world("sh_rn_museum_pier_$Gt") 
  209. 			marker_add_navpoint("sh_rn_museum_pier_$tareathree", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  210. 			trigger_enable("sh_rn_museum_pier_$tareathree", true) 
  211. 			objective_text_clear(0) 
  212. 			areathree=true 
  213. 	end 
  214. 	 
  215. 	objective_text(0, "sh_rn_museum_pier_GroupTwoCount", GroupTwoCount, GroupTwoTotal) 
  216.  
  217. 		 
  218. 		 
  219. 		for i = 1, GroupTwoTotal, 1 do 
  220. 			if not character_is_dead(GroupTwo[i]) then 
  221. 				marker_add_npc(GroupTwo[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  222. 				on_death("sh_rn_museum_pier_killcountTwo", GroupTwo[i]) 
  223. 			end 
  224. 		end 
  225. 	 
  226.  	notoriety_set_max("ronin", 2) 
  227. 	notoriety_set_min("ronin", 2) 
  228.  
  229.  
  230. end 
  231.  
  232. function sh_rn_museum_pier_killcountTwo(char) 
  233.  
  234. 	GroupTwoCount = GroupTwoCount + 1 
  235. 	 
  236. 	if areatwo then 
  237. 	marker_remove_npc(char) 
  238. 	objective_text(0, "sh_rn_museum_pier_GroupTwoCount", GroupTwoCount, GroupTwoTotal) 
  239. 	end 
  240. 	 
  241. 	if (GroupTwoCount == GroupTwoTotal)  and areatwo then 
  242. 		--debug_message("GROUP TWO") 
  243. 		release_to_world("sh_rn_museum_pier_$Gt") 
  244. 		if marker_three == false then 
  245. 		marker_add_navpoint("sh_rn_museum_pier_$tareathree", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  246. 		end 
  247. 		trigger_enable("sh_rn_museum_pier_$tareathree", true) 
  248. 		objective_text_clear(0) 
  249. 		areathree=true 
  250. 		mission_help_table("sh_rn_museum_pier_instructthree") 
  251. 		areatwo_done = true 
  252. 	end 
  253. end 
  254.  
  255.  
  256. function sh_rn_museum_pier_group_three() 
  257. 		 
  258. 	delay(3)		 
  259. 	if areathree then 
  260. 	mission_help_table_nag("sh_rn_museum_pier_instructthree") 
  261. 	objective_text(0, "sh_rn_museum_pier_GroupThreeCount",  GroupThreeCount, GroupThreeTotal ) 
  262. 	end 
  263.  
  264. 	marker_remove_navpoint("sh_rn_museum_pier_$tareathree") 
  265. 	marker_remove_navpoint("sh_rn_museum_pier_$tareathree") 
  266. 	 
  267. 	if GroupThreeCount == GroupThreeTotal and areathree then 
  268. 		--debug_message("GROUP TWO") 
  269. 		release_to_world("sh_rn_museum_pier_$Gb") 
  270. 		delay(3) 
  271. 		mission_end_success("sh_rn_museum_pier")  
  272. 	end 
  273. 	 
  274. 	 
  275. 		 
  276. 	for i = 1, boatguardstotal, 1 do			 
  277. 		if character_is_dead(boatguards[i])==false then  
  278. 			on_death( "sh_rn_museum_pier_boatguards", boatguards[i]) 
  279. 		end 
  280. 	end 
  281. 	 
  282. 		 
  283. 	for i = 1, GroupThreeTotal, 1 do 
  284. 		if not vehicle_is_destroyed(GroupBoats[i]) then 
  285. 			marker_add_vehicle(GroupBoats[i], MINIMAP_ICON_KILL, INGAME_EFFECT_VEHICLE_KILL) 
  286. 			set_current_hit_points( GroupBoats[i], 1000)  
  287. 			turn_invulnerable(GroupBoats[i], true) 
  288. 			--attack(GroupBoats[i], "#PLAYER#")  
  289. 			on_vehicle_destroyed("sh_rn_museum_pier_killcountThree", GroupBoats[i]) 
  290. 		end 
  291. 	end 
  292. end 
  293.  
  294.  
  295. function sh_rn_museum_pier_boatguards(char) 
  296. boatguardscount = boatguardscount + 1 
  297. -- Make the boat guards attack the players 
  298. 	if boatguardscount == 1 then 
  299. 		for i = 1, boatguardstotal, 1 do 
  300. 			if not character_is_dead(boatguards[i]) then					 
  301. 				set_always_sees_player_flag(boatguards[i], true)				 
  302. 				attack(boatguards[i]) 
  303. 			end 
  304. 		end 
  305. 	end 
  306. end 
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316. function sh_rn_museum_pier_killcountThree(vehicle) 
  317.  
  318. 	GroupThreeCount = GroupThreeCount + 1 
  319. 	if areathree then 
  320. 		marker_remove_vehicle(vehicle) 
  321. 		objective_text(0, "sh_rn_museum_pier_GroupThreeCount",  GroupThreeCount, GroupThreeTotal ) 
  322. 	end 
  323.  
  324. 		if GroupThreeCount == GroupThreeTotal and areathree then 
  325. 			--debug_message("GROUP TWO") 
  326. 			release_to_world("sh_rn_museum_pier_$Gb") 
  327. 			--sh_rn_museum_pier_group_three() 
  328. 			delay(3) 
  329. 			mission_end_success("sh_rn_museum_pier") 
  330. 			areathree_done = false 
  331. 			--sh_rn_museum_pier_group_Four()			 
  332. 		end 
  333.  
  334. end 
  335.  
  336.  
  337. --[[ --All this was cut 
  338.  
  339. function sh_rn_museum_pier_group_Four() 
  340.  
  341. 		mission_help_table("sh_rn_museum_pier_instructfour") 
  342. 		group_create("sh_rn_museum_pier_$GLts", true) 
  343. 		objective_text(0, "sh_rn_museum_pier_GroupThreeCount", GroupFourCount, GroupFourTotal ) 
  344.  
  345. 			for i = 1, GroupFourTotal, 1 do 
  346. 			marker_add_npc(GroupLts[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  347. 			on_death("sh_rn_museum_pier_killcountFour", GroupLts[i])   
  348. 			end 
  349.  
  350. end 
  351.  
  352. function sh_rn_museum_pier_killcountFour(char) 
  353.  
  354. 	GroupFourCount = GroupFourCount + 1 
  355. 	marker_remove_npc(char) 
  356. 	objective_text(0, "sh_rn_museum_pier_GroupThreeCount", GroupFourCount, GroupFourTotal ) 
  357.  
  358.  
  359. 	if GroupFourCount == GroupFourTotal then 
  360. 			release_to_world("sh_rn_museum_pier_$GLts") 
  361. 			mission_end_success("sh_rn_museum_pier") 			 
  362. 	end 
  363.  
  364. end 
  365. --]] 
  366.  
  367. function sh_rn_museum_pier_success() 
  368.  
  369.  
  370. end 
  371.  
  372.  
  373. function sh_rn_museum_pier_heli() 
  374. 	group_create("sh_rn_museum_pier_$Gchopper") 
  375. 	vehicle_enter_teleport("sh_rn_museum_pier_$c031", "sh_rn_museum_pier_$v006", 0) 
  376. 	vehicle_enter_teleport("sh_rn_museum_pier_$c031 (0)", "sh_rn_museum_pier_$v006", 2) 
  377. 	helicopter_fly_to("sh_rn_museum_pier_$v006", helipath) 
  378. 	vehicle_chase("sh_rn_museum_pier_$v006", LOCAL_PLAYER) 
  379. end 
  380.  
  381.  
  382.  
  383. function sh_rn_museum_pier_cleanup() 
  384. 	notoriety_set_min("ronin", 0) 
  385. 	notoriety_set_max("ronin", 5) 
  386. 	notoriety_set("ronin", 0)	 
  387. 	notoriety_force_no_spawn("ronin", false)  
  388. 	ambient_cop_spawn_enable(true)  
  389. 	ambient_gang_spawn_enable(true)  
  390. 	spawning_pedestrians(true) 
  391. 	trigger_enable("sh_rn_museum_pier_$tareaone", false) 
  392. 	trigger_enable("sh_rn_museum_pier_$tareatwo", false) 
  393. 	trigger_enable("sh_rn_museum_pier_$tareathree", false) 
  394. 	on_trigger("", "sh_rn_museum_pier_$tareaone") 
  395. 	on_trigger("", "sh_rn_museum_pier_$tareatwo") 
  396. 	on_trigger("", "sh_rn_museum_pier_$tareathree") 
  397. 	marker_remove_navpoint("sh_rn_museum_pier_$tareaone") 
  398. 	marker_remove_navpoint("sh_rn_museum_pier_$tareatwo") 
  399. 	marker_remove_navpoint("sh_rn_museum_pier_$tareathree") 
  400. 	 
  401. 	if(group_is_loaded("sh_rn_museum_pier_$GO")) then 
  402. 	for i = 1, GroupOneTotal, 1 do 
  403. 			marker_remove_npc(GroupOne[i]) 
  404. 			on_death("", GroupOne[i]) 
  405. 		end 
  406. 	end 
  407.  
  408. 	if(group_is_loaded("sh_rn_museum_pier_$Gt")) then 
  409. 		for i = 1, GroupTwoTotal, 1 do 
  410. 			marker_remove_npc(GroupTwo[i]) 
  411. 			on_death("", GroupTwo[i])   
  412. 		end 
  413. 	end 
  414.  
  415. 	if(group_is_loaded("sh_rn_museum_pier_$GLts")) then 
  416. 		for i = 1, GroupFourTotal, 1 do 
  417. 			marker_remove_npc(GroupLts[i]) 
  418. 			on_death("", GroupLts[i])   
  419. 		end 
  420. 	end 
  421. 	 
  422. 	if(group_is_loaded("sh_rn_museum_pier_$Gboats")) then 
  423. 		for i = 1, GroupThreeTotal, 1 do 
  424. 			marker_remove_vehicle(GroupBoats[i]) 
  425. 			on_vehicle_destroyed("", GroupBoats[i])   
  426. 		end 
  427. 	end	 
  428. 	 
  429. 	for i = 1, GroupsTotal, 1 do		 
  430. 		if(group_is_loaded(Groups[i])) then		 
  431. 		release_to_world(Groups[i])		 
  432. 		end 
  433. 	end 
  434. end