sr2lua/sh_bh_airport.lua

  1.  
  2. ---Groups 
  3. guns = {"sh_bh_airport_WH_069CaseGunA010", "sh_bh_airport_WH_070CaseGunA020", "sh_bh_airport_WH_071CaseGunA030", "sh_bh_airport_WH_072CaseGunA040"} 
  4. planes = {"sh_bh_airport_$v000 (1)", "sh_bh_airport_$v000 (2)", "sh_bh_airport_$v000", "sh_bh_airport_$v000 (0)"} 
  5. trucks = {"sh_bh_airport_$v001 (3)", "sh_bh_airport_$v001 (4)", "sh_bh_airport_$v001 (5)", "sh_bh_airport_$v001 (6)"} 
  6. taxione = {"sh_bh_airport_$n000", "sh_bh_airport_$n001", "sh_bh_airport_$n002", "sh_bh_airport_$n003", "sh_bh_airport_$n004", "sh_bh_airport_$n005",} 
  7. groupone = {"sh_bh_airport_$c006", "sh_bh_airport_$c006 (0)", "sh_bh_airport_$c006 (1)", "sh_bh_airport_$c006 (2)", "sh_bh_airport_$c006 (3)", "sh_bh_airport_$c006 (4)", "sh_bh_airport_$c006 (5)", "sh_bh_airport_$c006 (6)"}  
  8. grouptwo = {"sh_bh_airport_$c006 (8)", "sh_bh_airport_$c006 (9)", "sh_bh_airport_$c006 (10)", "sh_bh_airport_$c006 (11)", "sh_bh_airport_$c006 (18)", "sh_bh_airport_$c006 (19)",  "sh_bh_airport_$c006 (7)", "sh_bh_airport_$c006 (16)"} 
  9. drivers = {"sh_bh_airport_$cpilot", "sh_bh_airport_$cpilot (0)", "sh_bh_airport_$cpilot (1)", "sh_bh_airport_$cpilot (2)", "sh_bh_airport_$c002 (2)"} 
  10. groups = {"sh_bh_airport_$Gone", "sh_bh_airport_$Gairthings", "sh_bh_airport_$Greinf", "sh_bh_airport_$Gpilots", "sh_bh_airport_$Greinf1"} 
  11.  
  12.  
  13.  
  14. --Tables 
  15. guns_total = sizeof_table( guns ) 
  16. guns_count = 0 
  17. planes_total = sizeof_table( planes ) 
  18. planes_count = 0 
  19. trucks_count = 0 
  20. trucks_total = sizeof_table( trucks ) 
  21. --Variables 
  22. is_computer_destoyed = false 
  23. thread_handle = "" 
  24. in_area = false 
  25. in_areatwo = false 
  26. transfer_complete = false 
  27. groupone_count = 0 
  28. groupone_total = sizeof_table( groupone ) 
  29. hud_remainder = 60000 
  30. groups_total = sizeof_table( groups ) 
  31. audio_thread = "" 
  32. planes_active = false 
  33. computer_radius_on_local = false 
  34. computer_radius_on_remote = false 
  35. computer_radius_count_local = 0 
  36. computer_radius_count_remote = 0 
  37. taxi_index = 0 
  38. current_driver = "" 
  39. computer_arrow_local = 1 
  40. computer_arrow_remote = 1 
  41. stronghold_complete = false 
  42. grouptwo_total = sizeof_table ( grouptwo ) 
  43. groupone_count = 0 
  44. grouptwo_count = 0 
  45.  
  46.  
  47. function sh_bh_airport_start(checkpoint, is_restart) 
  48. 	set_mission_author("David Bowring") 
  49.  
  50.  
  51. 	action_nodes_restrict_spawning( true ) 
  52. 	 
  53. 	if checkpoint == MISSION_START_CHECKPOINT then	 
  54. 		mission_start_fade_out() 
  55. 		in_area = false 
  56. 		notoriety_set_max("police", 0)	 
  57. 		teleport_coop("sh_bh_airport_$nstart","sh_bh_airport_$nstart (0)") 
  58. 		if (not is_restart) then 
  59. 			cutscene_play("sh_bh_airport") 
  60. 		else 
  61. 			group_create_hidden("sh_bh_airport_$Gairthings") 
  62. 		end 
  63.  
  64. 		--SP 7/19/08: stop action node spawning so we can save some framerate and stop peds from respawning behind the player 
  65. 	   
  66.  
  67. 		group_hide("sh_bh_airport_$Gairthings") 
  68. 		notoriety_force_no_spawn("brotherhood", true) 
  69. 		--mission_help_table("sh_tss_ugmall_instruct_one") 
  70. 		group_create("sh_bh_airport_$Gone") 
  71. 		--objective_text("sh_bh_airport_instruct_two", execs_count, execs_total) 
  72. 		marker_add_navpoint("sh_bh_airport_$nObjOne", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  73. 		on_trigger("sh_bh_airport_triggerone","sh_bh_airport_$000 (0)") 
  74. 		on_trigger("sh_bh_airport_triggerone","sh_bh_airport_$t000") 
  75. 		on_trigger("sh_bh_airport_timer","sh_bh_airport_$tComputer") 
  76. 		on_trigger("sh_bh_airport_back","sh_bh_airport_$tComputerRadius") 
  77. 		on_trigger("sh_bh_airport_phase_two","sh_bh_airport_$tgo_out") 
  78. 		on_trigger("sh_bh_airport_phase_two","sh_bh_airport_$tgo_out2") 
  79. 		trigger_enable("sh_bh_airport_$t000", true) 
  80. 		trigger_enable("sh_bh_airport_$000 (0)", true) 
  81. 		mission_help_table("sh_bh_airport_instructone") 
  82. 		on_mover_destroyed( "sh_bh_airport_failure_warning","sh_bh_airport_ServerA010") 
  83. 		--computer time stuff 
  84. 		on_trigger_exit("sh_bh_airport_leave","sh_bh_airport_$tComputerRadius") 
  85. 		on_trigger("sh_bh_airport_back","sh_bh_airport_$tComputerRadius") 
  86. 		mission_start_fade_in() 
  87. 	else 
  88. 		on_trigger("sh_bh_airport_phase_two","sh_bh_airport_$tgo_out") 
  89. 		on_trigger("sh_bh_airport_phase_two","sh_bh_airport_$tgo_out2") 
  90. 		if group_is_loaded("sh_bh_airport_$Gairthings") == false then 
  91. 			group_create_hidden("sh_bh_airport_$Gairthings") 
  92. 		end 
  93. 		fade_in(1) 
  94. 		sh_bh_airport_phase_doors() 
  95. 	end 
  96. 		 
  97. end 
  98.  
  99.  
  100.  
  101. function sh_bh_airport_triggerone() 
  102. 	trigger_enable("sh_bh_airport_$000 (0)", false) 
  103. 	trigger_enable("sh_bh_airport_$t000", false) 
  104. 	marker_remove_navpoint("sh_bh_airport_$nObjOne") 
  105. 	--sh_bh_airport_timer() 
  106. 	trigger_enable("sh_bh_airport_$tComputer", true) 
  107. 	marker_add_trigger("sh_bh_airport_$tComputer", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION)	 
  108. 	notoriety_set_min("brotherhood", 2) 
  109. 	notoriety_set_max("brotherhood", 2) 
  110. end 
  111.  
  112.  
  113. function sh_bh_airport_computer() 
  114.  
  115. --marker_add_trigger("sh_bh_airport_$tComputer", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION)	 
  116. marker_remove_trigger("sh_bh_airport_$tComputer") 
  117. --minimap_icon_add_navpoint_radius( "sh_bh_airport_$tComputer", MINIMAP_ICON_LOCATION, 20, true, nil, SYNC_ALL ) 
  118. --distance_display_on("sh_bh_airport_$tComputer", 0, 15, 0, 15, SYNC_LOCAL) 
  119. marker_add_mover("sh_bh_airport_ServerA010", MINIMAP_ICON_PROTECT_ACQUIRE, INGAME_EFFECT_VEHICLE_PROTECT_ACQUIRE) 
  120. on_mover_destroyed( "sh_bh_airport_failure_warning","sh_bh_airport_ServerA010") 
  121. door_open("sh_bh_airport_SR2_IAIH_oorAMM030") 
  122. door_open("sh_bh_airport_SR2_IAIH_oorAMM010") 
  123. audio_thread = audio_play_for_mover("SFX_BRSH5_DOWNLOAD_DATA_LOOP","sh_bh_airport_ServerA010", "foley", false) 
  124. trigger_enable("sh_bh_airport_$tComputer", false) 
  125. delay(3) 
  126. while in_area == false or in_areatwo == false and coop_is_active() do 
  127. thread_yield() 
  128. end 
  129. group_create("sh_bh_airport_$Greinf") 
  130. group_create("sh_bh_airport_$Greinf1")		 
  131. 	 
  132. 	for i=1, groupone_total, 1 do 		 
  133. 		thread_new("sh_bh_airport_attack",groupone[i]) 
  134. 		thread_new("sh_bh_airport_attack2",grouptwo[i]) 
  135. 	end	 
  136. end 
  137. 	 
  138.  
  139. function sh_bh_airport_attack(char)		 
  140. 	delay(2) 
  141. 	--if coop_is_active() then 
  142. 		mission_debug("on death callback set on ="..char) 
  143. 		on_death("sh_bh_airport_killcount_attackers",char)	 
  144. 	--end 
  145. 	move_to(char, "sh_bh_airport_$pathattackpath", 3) 
  146. 	set_blitz_flag(char, true) 
  147. 	--set_always_sees_player_flag(groupone[i], true) 
  148. 	attack(char, LOCAL_PLAYER) 
  149. 	--release_to_world(char) 
  150. 	thread_yield() 
  151. end 
  152.  
  153. function sh_bh_airport_attack2(char)		 
  154. 	delay(3) 
  155. 	--if coop_is_active() then 
  156. 		mission_debug("on death callback set on ="..char) 
  157. 		on_death("sh_bh_airport_killcount_attackers1",char)	 
  158. 	--end 
  159. 	move_to(char, "sh_bh_airport_$pathreinf2", 3) 
  160. 	set_blitz_flag(char, true) 
  161. 	--set_always_sees_player_flag(groupone[i], true) 
  162. 	attack(char, LOCAL_PLAYER) 
  163. 	--release_to_world(char)	 
  164. 	thread_yield() 
  165. end 
  166.  
  167. function sh_bh_airport_killcount_attackers(char) 
  168.  
  169. groupone_count = groupone_count + 1 
  170. mission_debug("on death call count ="..groupone_count) 
  171.  
  172. 	if groupone_count == groupone_total and transfer_complete == false then 
  173. 		groupone_count = 0 
  174. 		mission_debug("group 1 elminated") 
  175. 		release_to_world("sh_bh_airport_$Greinf") 
  176. 		if coop_is_active() then 
  177. 		group_create("sh_bh_airport_$Greinf") 
  178. 			for i=1, groupone_total, 1 do 		 
  179. 				thread_new("sh_bh_airport_attack",groupone[i]) 
  180. 			end 
  181. 		end 
  182. 	end 
  183.  
  184. 	 
  185. end 
  186.  
  187. function sh_bh_airport_killcount_attackers1(char) 
  188. 	grouptwo_count = grouptwo_count + 1  
  189.  
  190. if grouptwo_count == grouptwo_total and transfer_complete == false then 
  191. 		 
  192. 		mission_debug("group 2 elminated") 
  193. 		grouptwo_count = 0 
  194. 		release_to_world("sh_bh_airport_$Greinf1") 
  195. 		if coop_is_active() then 
  196. 			group_create("sh_bh_airport_$Greinf1") 
  197. 			for i=1, grouptwo_total, 1 do 		 
  198. 				thread_new("sh_bh_airport_attack",groupone[i]) 
  199. 			end 
  200. 		end 
  201. 	end 
  202. end 
  203.  
  204.  
  205.  
  206.  
  207. function sh_bh_airport_timer(char, triggername) 
  208. 	 
  209. 	if char==LOCAL_PLAYER then 
  210. 		in_area = true 
  211. 	end 
  212. 	 
  213. 	if char==REMOTE_PLAYER then 
  214. 		in_areatwo = true 
  215. 		 
  216. 	end 
  217.  
  218. 	if coop_is_active() and char ~= REMOTE_PLAYER then			 
  219. 		in_areatwo = false 
  220. 		mission_help_table("sh_bh_airport_coop") 
  221. 	end 
  222. 	trigger_enable("sh_bh_airport_$tComputerRadius", true) 
  223. 	marker_remove_navpoint("sh_bh_airport_$tComputer") 
  224. 	mission_help_table("sh_bh_airport_transferinstruct")	 
  225. 	hud_timer_set(0, 60000,"sh_bh_airport_phase_doors")	 
  226. 	delay(5) 
  227. 	--objective_text(0, "sh_bh_airport_radio")		 
  228. 	thread_new("sh_bh_airport_computer") 
  229. end 
  230.  
  231.  
  232.  
  233.  
  234. function sh_bh_airport_back(char, triggername) 
  235. 	local player = "" 
  236. 	mission_debug("BACK FUNCTION CALLED") 
  237.  
  238.  
  239. 	if transfer_complete then 
  240. 		return 
  241. 	end 
  242. 	--on_trigger_exit("sh_bh_airport_leave","sh_bh_airport_$tComputerRadius") 
  243. 	--on_trigger("","sh_bh_airport_$tComputerRadius") 
  244. 	 
  245. 	if char == LOCAL_PLAYER then 
  246. 		in_area = true 
  247. 		computer_radius_on_local = false 
  248. 		while computer_radius_count_local > 0 do 
  249. 			minimap_icon_remove_navpoint("sh_bh_airport_$tComputerRadius", SYNC_LOCAL) 
  250. 			render_script_trigger_on_minimap_remove() 
  251. 			computer_radius_count_local = computer_radius_count_local -1			 
  252. 			delay(1) 
  253. 		end 
  254. 			marker_add_mover("sh_bh_airport_ServerA010", MINIMAP_ICON_PROTECT_ACQUIRE, INGAME_EFFECT_VEHICLE_PROTECT_ACQUIRE,SYNC_LOCAL) 
  255. 			mission_debug("BACK FUNCTION CALLED WHILE="..computer_arrow_local) 
  256. 			computer_arrow_local = computer_arrow_local +1			 
  257. 	end 
  258.  
  259. 	 
  260. 	if char == REMOTE_PLAYER then 
  261. 		in_areatwo = true 
  262. 		computer_radius_on_remote = false 
  263. 		while computer_radius_count_remote > 0 do 
  264. 			minimap_icon_remove_navpoint("sh_bh_airport_$tComputerRadius", SYNC_REMOTE) 
  265. 			render_script_trigger_on_minimap_remove() 
  266. 			computer_radius_count_remote = computer_radius_count_remote - 1			 
  267. 			delay(1) 
  268. 		end 
  269. 		marker_add_mover("sh_bh_airport_ServerA010", MINIMAP_ICON_PROTECT_ACQUIRE, INGAME_EFFECT_VEHICLE_PROTECT_ACQUIRE,SYNC_REMOTE) 
  270. 		computer_arrow_remote = computer_arrow_remote + 1 
  271. 	end	 
  272. 	delay(3) 
  273. 	if in_area==false or in_areatwo == false and coop_is_active() then			 
  274. 		if in_area == false then 
  275. 		player=LOCAL_PLAYER 
  276. 		sh_bh_airport_leave(player, triggername) 
  277. 		elseif coop_is_active() and in_areatwo == false then 
  278. 		player=REMOTE_PLAYER 
  279. 		sh_bh_airport_leave(player, triggername) 
  280. 	end	 
  281. end	 
  282. 	 
  283.  
  284. 	hud_timer_pause(0, false) 
  285. 	hud_timer_set(0, hud_remainder,"sh_bh_airport_phase_doors") 
  286. end 
  287.  
  288.  
  289. 	 
  290. function sh_bh_airport_leave(char, triggername) 
  291. 		hud_remainder = hud_timer_get_remainder(0)  
  292. 		hud_timer_pause(0, true) 
  293. 		--on_trigger_exit("","sh_bh_airport_$tComputerRadius") 
  294. 		--on_trigger("sh_bh_airport_back","sh_bh_airport_$tComputerRadius") 
  295. 		--hud_timer_set(0, 15000,"sh_bh_airport_failure_warning")  
  296. 		if char == LOCAL_PLAYER then 
  297. 			in_area = false 
  298. 			computer_radius_on_remote = true 
  299. 			if computer_radius_on_remote then 
  300. 			--minimap_icon_add_navpoint_radius("sh_bh_airport_$tComputerRadius", MINIMAP_ICON_LOCATION, 15, nil, SYNC_LOCAL) 
  301. 			-- parameters for this function  ---- NAME OF THE TRIGGER REGION    -  { COLOR }    PULSE? 
  302. 			render_script_trigger_on_minimap_add("sh_bh_airport_$tComputerRadius", {250, 81, 81}, false,SYNC_LOCAL) 
  303. 			while computer_arrow_local > 0 do 
  304. 			marker_remove_mover("sh_bh_airport_ServerA010",SYNC_LOCAL) 
  305. 			computer_arrow_local = computer_arrow_local -1 
  306. 			end 
  307. 			computer_radius_count_local = computer_radius_count_local + 1 
  308. 			end 
  309. 		end 
  310.  
  311. 		if char == REMOTE_PLAYER then 
  312. 			in_areatwo = false 
  313. 			computer_radius_on_remote = true 
  314. 			if computer_radius_on_remote then 
  315. 			--minimap_icon_add_navpoint_radius("sh_bh_airport_$tComputerRadius", MINIMAP_ICON_LOCATION, 15, nil, SYNC_REMOTE) 
  316. 			render_script_trigger_on_minimap_add("sh_bh_airport_$tComputerRadius", {250, 81, 81}, false,SYNC_REMOTE) 
  317. 			while  computer_arrow_remote > 0 do 
  318. 			marker_remove_mover("sh_bh_airport_ServerA010",SYNC_REMOTE) 
  319. 			computer_arrow_remote = computer_arrow_remote -1 
  320. 			end 
  321. 			computer_radius_count_remote = computer_radius_count_remote +1 
  322. 			end 
  323. 		end 
  324. 	 
  325. 		local time = 0 
  326. 		local messone = true 
  327. 		local messtwo = true	 
  328. 		mission_debug("LEAVE") 
  329. 		--mission_debug(in_area) 
  330.  
  331.  
  332.  
  333. if coop_is_active() then 
  334.  
  335. 		while(not in_area or not in_areatwo) do 
  336. 			 
  337. 			time = time + get_frame_time() 
  338. 			 
  339. 		 
  340. 			if (time == 0) then				 
  341. 				if not in_area and not in_areatwo then 
  342. 				mission_help_table_nag("sh_bh_airport_warning_one","","",SYNC_ALL) 
  343. 				elseif not in_areatwo then 
  344. 				mission_help_table_nag("sh_bh_airport_warning_one","","",SYNC_REMOTE) 
  345. 				elseif not in_area then 
  346. 				mission_help_table_nag("sh_bh_airport_warning_one","","",SYNC_LOCAL) 
  347. 				end			 
  348. 			end 
  349. 		 
  350. 			if (time > 5) then 
  351. 				-- Second message (10 seconds left) 
  352. 				if (messtwo == true) then 
  353. 					if not in_area and not in_areatwo then 
  354. 					mission_help_table_nag("sh_bh_airport_warning_two","","",SYNC_ALL) 
  355. 					elseif not in_area then 
  356. 					mission_help_table_nag("sh_bh_airport_warning_two","","",SYNC_LOCAL) 
  357. 					elseif not in_areatwo then 
  358. 					mission_help_table_nag("sh_bh_airport_warning_two","","",SYNC_REMOTE) 
  359. 					end 
  360. 				messtwo = false 
  361. 			end 
  362.  
  363.  
  364. 			if (time > 10) then				 
  365. 				if (messone == true) then 
  366. 					if not in_area and not in_areatwo then 
  367. 					mission_help_table_nag("sh_bh_airport_warning_three","","",SYNC_ALL) 
  368. 					elseif not in_area then 
  369. 					mission_help_table_nag("sh_bh_airport_warning_three","","",SYNC_LOCAL) 
  370. 					elseif not in_areatwo then 
  371. 					mission_help_table_nag("sh_bh_airport_warning_three","","",SYNC_REMOTE) 
  372. 					end 
  373. 				messone = false 
  374. 				end 
  375. 			end 
  376.  
  377.  
  378.  
  379. 			if ((time >= 16)) then 
  380. 			-- Fail if timer reaches zero						 
  381. 					sh_bh_airport_failure_warning() 
  382. 			end 
  383. 			thread_yield() 
  384. 		end 
  385. 		 
  386. 		end 
  387.  
  388. 		else 
  389.  
  390. 		while(not in_area) do 
  391. 			 
  392. 			time = time + get_frame_time() 
  393.  
  394. 			if (time == 0) then 
  395. 				 
  396. 				mission_help_table_nag("sh_bh_airport_warning_one") 
  397. 				--sh_bh_airport_phase_two() 
  398. 				--sh_bh_airport_failure() 
  399.  
  400. 			end 
  401. 			 
  402.  
  403. 			if (time > 10) then 
  404. 			 
  405. 				if (messone == true) then 
  406. 					mission_help_table_nag("sh_bh_airport_warning_three") 
  407. 					messone = false 
  408. 				end 
  409.  
  410. 			end 
  411.  
  412.  
  413. 			if (time > 5) then 
  414. 				-- Second message (10 seconds left) 
  415. 				if (messtwo == true) then 
  416. 					mission_help_table_nag("sh_bh_airport_warning_two") 
  417. 					messtwo = false 
  418. 				end 
  419.  
  420. 			end 
  421.  
  422. 			if (time >= 16) then 
  423. 				-- Fail 
  424. 				sh_bh_airport_failure_warning() 
  425. 			end 
  426. 				thread_yield() 
  427. 			end 
  428. 	 
  429. 	 
  430. 		end 
  431.  
  432. 	end 
  433.  
  434.  
  435.  
  436. function sh_bh_airport_phase_doors() 
  437.  
  438. transfer_complete = true 
  439.  
  440.  
  441. while computer_arrow_local > 0 do 
  442. 	marker_remove_mover("sh_bh_airport_ServerA010",SYNC_LOCAL) 
  443. 	computer_arrow_local = computer_arrow_local -1 
  444. end 
  445.  
  446. if coop_is_active then 
  447. 	while  computer_arrow_remote > 0 do 
  448. 		marker_remove_mover("sh_bh_airport_ServerA010",SYNC_REMOTE) 
  449. 		computer_arrow_remote = computer_arrow_remote -1 
  450. 	end 
  451. end 
  452. trigger_enable("sh_bh_airport_$tComputerRadius",false) 
  453. mission_set_checkpoint("doors") 
  454. marker_remove_mover("sh_bh_airport_ServerA010") 
  455. on_mover_destroyed( "","sh_bh_airport_ServerA010") 
  456. hud_timer_stop(0) 
  457. if audio_thread ~= "" then	 
  458. 	audio_stop(audio_thread)  
  459. end 
  460. audio_play_for_mover("SFX_BRSH5_DOWNLOAD_DATA_FINISH ","sh_bh_airport_ServerA010", "foley", false) 
  461. distance_display_off()  
  462. marker_remove_navpoint("sh_bh_airport_$tComputer") 
  463.  
  464. marker_add_navpoint("sh_bh_airport_$tgo_out", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION)	 
  465. marker_add_navpoint("sh_bh_airport_$tgo_out2", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION) 
  466. trigger_enable("sh_bh_airport_$tgo_out", true) 
  467. trigger_enable("sh_bh_airport_$tgo_out2", true) 
  468. if coop_is_active then 
  469. 	in_areatwo = true 
  470. end 
  471. in_area=true 
  472.  
  473. 		 
  474. 		 
  475. if (in_area==true) then 
  476. 	if coop_is_active then 
  477. 		in_areatwo = true 
  478. 		--cash_add(100000,REMOTE_PLAYER) 
  479. 	end 
  480. 		mission_help_table_nag("sh_bh_airport_transfercomplete") 
  481. 		delay(3) 
  482. 		--cash_add(100000,LOCAL_PLAYER) 
  483. 	end		 
  484. 	mission_help_table("MSN_SH_BH_AIRPORT_INSTRUCT_OUTSIDE") 
  485. end 
  486.  
  487.  
  488.  
  489. 	 
  490. function sh_bh_airport_phase_two()	 
  491. 		local hp = 0 
  492.  
  493. trigger_enable("sh_bh_airport_$tgo_out", false) 
  494. trigger_enable("sh_bh_airport_$tgo_out2", false) 
  495. marker_remove_navpoint("sh_bh_airport_$tgo_out")	 
  496. marker_remove_navpoint("sh_bh_airport_$tgo_out2") 
  497. marker_remove_mover("sh_bh_airport_ServerA010") 
  498. on_trigger("","sh_bh_airport_$tgo_out") 
  499. on_trigger("","sh_bh_airport_$tgo_out2") 
  500. marker_remove_navpoint("sh_bh_airport_$tComputer")		 
  501. objective_text_clear(0) 
  502. group_create_hidden("sh_bh_airport_$Gpilots") 
  503. objective_text(0, "sh_bh_airport_trucksleft", trucks_count, trucks_total) 
  504. group_show("sh_bh_airport_$Gairthings") 
  505. mission_help_table("sh_bh_airport_instructtwo") 
  506. group_show("sh_bh_airport_$Gpilots") 
  507.  
  508.  
  509. 		for i=1 , planes_total, 1 do			 
  510. 			turn_invulnerable(planes[i], false) 
  511. 			turn_invulnerable(drivers[i], false)	 
  512. 			on_vehicle_destroyed("sh_bh_airport_killcountThree", planes[i]) 
  513. 			vehicle_prevent_explosion_fling(planes[i], true) 
  514. 			--vehicle_enter_teleport(drivers[i], planes[i],0) 
  515. 			npc_go_idle(drivers[i]) 
  516. 			set_unjackable_flag(planes[i], true) 
  517. 			vehicle_disable_chase(planes[i], true) 
  518. 			vehicle_disable_flee(planes[i], true) 
  519. 		end 
  520.  
  521.  
  522. 		for b=1 , trucks_total, 1 do  
  523. 			hp = 0 
  524. 			hp = get_max_hit_points(trucks[b]) 
  525. 			marker_add_vehicle(trucks[b], MINIMAP_ICON_KILL, INGAME_EFFECT_VEHICLE_KILL) 
  526. 			on_vehicle_destroyed("sh_bh_airport_killcountTwo", trucks[b])  
  527. 			set_max_hit_points(trucks[b], hp/2) 
  528. 		end 
  529. 	end 
  530. 	 
  531. 	function sh_bh_airport_killcountTwo(vehicle) 
  532. 		trucks_count = trucks_count + 1 
  533. 		marker_remove_vehicle(vehicle) 
  534. 		on_vehicle_destroyed("",vehicle) 
  535. 		mission_debug(trucks_count) 
  536. 		objective_text(0, "sh_bh_airport_trucksleft", trucks_count, trucks_total) 
  537. 		if trucks_count == trucks_total then		 
  538. 		 sh_bh_airport_phase_three()		 
  539. 		end 
  540. 	end 
  541. 	 
  542. function sh_bh_airport_killcountThree(vehicle) 
  543. 		planes_count = planes_count + 1		 
  544. 		marker_remove_vehicle(vehicle) 
  545. 		on_vehicle_destroyed("",vehicle) 
  546. 		mission_debug(planes_count) 
  547. 		 
  548. 		 
  549. 		if planes_active then 
  550. 		objective_text(0, "sh_bh_airport_planesleft", planes_count, planes_total) 
  551. 		end 
  552. 		release_to_world(vehicle)		 
  553. 	 
  554. 		if planes_count == planes_total then 
  555. 		 stronghold_complete = true	 
  556. 		 delay(3)	 	 
  557. 		 mission_end_success("sh_bh_airport")		 
  558. 		end 
  559. end 
  560. 	 
  561. 	 
  562. 	 
  563. 	 
  564. function sh_bh_airport_phase_three() 
  565. 	mission_help_table("sh_bh_airport_instructthree") 
  566. 	notoriety_force_no_spawn("brotherhood", false) 
  567. 	 
  568. 	--[[ 
  569. 	vehicle_enter_group_teleport("sh_bh_airport_$cpilot", "sh_bh_airport_$v000") 
  570. 	vehicle_enter_group_teleport("sh_bh_airport_$cpilot (0)", "sh_bh_airport_$v000 (0)") 
  571. 	vehicle_enter_group_teleport("sh_bh_airport_$cpilot (1)", "sh_bh_airport_$v000 (1)") 
  572. 	vehicle_enter_group_teleport("sh_bh_airport_$cpilot (2)", "sh_bh_airport_$v000 (2)") 
  573. 	vehicle_enter_group_teleport("sh_bh_airport_$cpilot (3)", "sh_bh_airport_$v000 (3)") 
  574.  
  575.  
  576. 	npc_go_idle("sh_bh_airport_$cpilot") 
  577. 	npc_go_idle("sh_bh_airport_$cpilot (0)")  
  578. 	npc_go_idle("sh_bh_airport_$cpilot (1)")  
  579. 	npc_go_idle("sh_bh_airport_$cpilot (2)")  
  580. 	npc_go_idle("sh_bh_airport_$cpilot (3)") 
  581. 	--]] 
  582. 	planes_active = true 
  583. 	 
  584. 	for i=1 , planes_total, 1 do 			 
  585. 		marker_add_vehicle(planes[i], MINIMAP_ICON_KILL, INGAME_EFFECT_VEHICLE_KILL) 
  586. 		on_vehicle_destroyed("sh_bh_airport_killcountThree", planes[i])		 
  587. 		turn_invulnerable(planes[i], true) 
  588. 		turn_invulnerable(drivers[i], false)  
  589. 		objective_text(0, "sh_bh_airport_planesleft", planes_count, planes_total) 
  590. 		vehicle_speed_override(planes[i], 10)  
  591. 	end 
  592. 	--group_show("sh_bh_airport_$Gpilots") 
  593. 	thread_new("sh_bh_airport_taxi") 
  594. end 
  595.  
  596.  
  597.  
  598.  
  599.  
  600. 	 
  601. function sh_bh_airport_taxi() 
  602. 		local plane_index = 1 
  603. 		local plane_tracker = 0	 
  604. 		mission_debug("START LOOP") 
  605. 		while (1) do		 
  606. 		plane_tracker = plane_index 
  607. 			delay(1)			 
  608. 			if (not vehicle_is_destroyed(planes[plane_index])) then 
  609. 			set_unjackable_flag(planes[plane_index], false)			 
  610. 			vehicle_enter_group_teleport(drivers[plane_index], planes[plane_index]) 
  611. 			current_driver = drivers[plane_index] 
  612. 			vehicle_speed_override(planes[plane_index], 10)  
  613. 			set_unjackable_flag(planes[plane_index], true) 
  614. 			vehicle_ignore_repulsors(planes[plane_index], true); 
  615. 			vehicle_pathfind_to(planes[plane_index], taxione, true, false, false, true) 
  616. 			vehicle_infinite_mass(planes[plane_index], true)  
  617. 			end 
  618.  
  619. 				if (not vehicle_is_destroyed(planes[plane_index])) then					 
  620. 					vehicle_speed_cancel(planes[plane_index])		 
  621. 					airplane_takeoff(planes[plane_index]) 
  622. 				end 
  623. 			mission_debug(planes[plane_index]) 
  624. 			if (not vehicle_is_destroyed(planes[plane_index])) then 
  625. 			delay(60) -- This delay is how much time after a plane starts taking off ansd its not destroyed a failure will register 
  626. 			end 
  627.  
  628.  
  629. 				if(vehicle_is_destroyed(planes[plane_tracker])) then 
  630. 					if current_driver ~= "" then					 
  631. 					turn_vulnerable(current_driver) 
  632. 					character_kill(current_driver) 
  633. 					character_hide(current_driver)  
  634.  
  635. 					--group_destroy(current_driver)  
  636. 					mission_debug("Driver Killed"..current_driver) 
  637. 					end 
  638. 					plane_index = plane_index + 1 
  639. 					--mission_debug(planes[plane_index]) 
  640. 					else 
  641. 					mission_end_failure("sh_bh_airport","sh_bh_airport_fail_planes") 
  642. 				end 
  643.  
  644. 			if(plane_index > planes_total) then 
  645. 				break 
  646. 			end		 
  647. 		end 
  648. 		mission_debug("EXIT") 
  649. 		--plane_index = plane_index + 1 
  650. end 
  651. 	 
  652. 	 
  653. 	 
  654. function sh_bh_airport_cleanup() 
  655. 	if stronghold_complete == false and transfer_complete == true then 
  656. 		--cash_remove(100000, LOCAL_PLAYER) 
  657. 		if coop_is_active() then 
  658. 			--cash_remove(100000, REMOTE_PLAYER) 
  659. 		end 
  660. 	end 
  661. 	 
  662. 	--SP 7/19/08: restart action node spawning when mission is over 
  663. 	action_nodes_restrict_spawning( false ) 
  664.  
  665. 	marker_remove_navpoint("sh_bh_airport_$tgo_out")	 
  666. 	marker_remove_navpoint("sh_bh_airport_$tgo_out2") 
  667. 	marker_remove_navpoint("sh_bh_airport_$nObjOne") 
  668. 	marker_remove_trigger("sh_bh_airport_$tComputer") 
  669. 	on_trigger("","sh_bh_airport_$000 (0)") 
  670. 	on_trigger("","sh_bh_airport_$t000") 
  671. 	on_trigger("","sh_bh_airport_$tComputer") 
  672. 	on_trigger("","sh_bh_airport_$tComputerRadius") 
  673. 	on_trigger("","sh_bh_airport_$tgo_out") 
  674. 	on_trigger("","sh_bh_airport_$tgo_out2") 
  675. 	trigger_enable("sh_bh_airport_$tComputerRadius", false) 
  676. 	trigger_enable("sh_bh_airport_$t000", false) 
  677. 	trigger_enable("sh_bh_airport_$000 (0)", false)	 
  678. 	notoriety_set_min("brotherhood", 0) 
  679. 	notoriety_set_max("brotherhood", 5) 
  680. 	notoriety_set("brotherhood", 0) 
  681. 	hud_timer_stop(0) 
  682. 	render_script_trigger_on_minimap_remove() 
  683.  
  684. 	for b=1 , trucks_total, 1 do  
  685. 		if vehicle_is_destroyed(trucks[b]) == false then 
  686. 			marker_remove_vehicle(trucks[b]) 
  687. 			on_vehicle_destroyed("", trucks[b]) 			 
  688. 		end 
  689. 	end	 
  690.  
  691. 	for i=1 , planes_total, 1 do 
  692. 		if vehicle_is_destroyed(planes[i]) == false then 
  693. 			marker_remove_vehicle(planes[i]) 
  694. 			on_vehicle_destroyed("", planes[i]) 
  695. 		end	 
  696. 	end 
  697.  
  698. 	for i = 1, groups_total, 1 do		 
  699. 		if group_is_loaded(groups[i]) then 
  700. 			release_to_world(groups[i])  
  701. 		end 
  702. 	end 
  703. end 
  704.  
  705.  
  706. 	 
  707. 	 
  708. function sh_bh_airport_succes() 
  709.  
  710.  
  711. end 
  712.  
  713.  
  714. function sh_bh_airport_failure_warning() 
  715. 	mission_end_failure("sh_bh_airport","sh_bh_airport_warning_fail") -- make failure` 
  716. end 
  717.  
  718.  
  719. function sh_bh_airport_failure() 
  720. 	 
  721. end 
  722.