sr2lua/sh_bh_docks.lua

  1. -----tables 
  2. convoy={ "sh_bh_docks_$c004", "sh_bh_docks_$c004 (0)", "sh_bh_docks_$c004 (1)", "sh_bh_docks_$c004 (2)", "sh_bh_docks_$c004 (3)", "sh_bh_docks_$c004 (4)", "sh_bh_docks_$c004 (5)", "sh_bh_docks_$c004 (6)", "sh_bh_docks_$c005", "sh_bh_docks_$c005 (0)", "sh_bh_docks_$c005 (1)", "sh_bh_docks_$c005 (2)"}  
  3. convoy_one = { "sh_bh_docks_$c004", "sh_bh_docks_$c004 (0)", "sh_bh_docks_$c004 (1)","sh_bh_docks_$c004 (2)"} 
  4. convoy_one_navs = {"sh_bh_docks_$nconvoy_one_path_find", "sh_bh_docks_$nconvoy_one_path_find (0)", "sh_bh_docks_$nconvoy_one_path_find (1)", "sh_bh_docks_$nconvoy_one_path_find (2)"} 
  5. hijackpeds={{"sh_bh_docks_$c000", 1}, 
  6. 				{"sh_bh_docks_$c001", 1}, 
  7. 				{"sh_bh_docks_$c002", 2}, 
  8. 				{"sh_bh_docks_$c003", 2}} 
  9. buyers= {"sh_bh_docks_$c006 (0)", "sh_bh_docks_$c006", "sh_bh_docks_$c006 (1)", "sh_bh_docks_$c006 (2)", "sh_bh_docks_$c006 (3)"} 
  10. follow_car={"sh_bh_docks_$c004", "sh_bh_docks_$c004 (0)", "sh_bh_docks_$c004 (1)", "sh_bh_docks_$c004 (2)"} 
  11. action={{"sh_bh_docks_$c004 (2)" , 1}, 
  12. 		  {"sh_bh_docks_$c004 (3)" , 1},  
  13. 		  {"sh_bh_docks_$c004 (4)" , 1}, 
  14. 		  {"sh_bh_docks_$c004 (5)" , 1},  
  15. 		  {"sh_bh_docks_$c004 (6)" , 2}, 
  16. 		  {"sh_bh_docks_$c005" , 2}, 
  17. 		  {"sh_bh_docks_$c005 (0)", 2},  
  18. 		  {"sh_bh_docks_$c005 (1)" , 3},  
  19. 		  {"sh_bh_docks_$c005 (2)" , 3}}  
  20.  
  21. thread_handles = {"", "", "", ""} 
  22.    
  23. ---variables 
  24. convoy1=false 
  25. convoy2=false 
  26. convoy3=false 
  27. incar=false 
  28. incar_timer=true 
  29. incar_timer_coop=true 
  30. convoy_count = 0 
  31. convoy_total = sizeof_table( convoy ) 
  32. hijackpeds_count=0 
  33. hijackpeds_total=sizeof_table( hijackpeds ) 
  34. buyers_count=0 
  35. times_damaged = 0 
  36. follow_count = sizeof_table( follow_car ) 
  37. action_total = sizeof_table( action ) 
  38. convoy_one_total = sizeof_table ( convoy_one ) 
  39. message_playing = false 
  40.  
  41.  
  42.  
  43.   
  44.  
  45. function sh_bh_docks_start(checkpoint, is_restart) 
  46. set_mission_author("David Bowring") 
  47. notoriety_set_max("brotherhood", 0) 
  48. notoriety_set_max("police", 0)	 
  49. 	 
  50. 	if checkpoint == MISSION_START_CHECKPOINT then 
  51. 	 
  52. 	sh_bh_docks_hijack(is_restart) 
  53. 	else 
  54. 	fade_in(1) 
  55. 	sh_bh_docks_hijack(is_restart) 
  56. 	--sh_bh_docks_boat() 
  57. 	end 
  58.  
  59.  
  60. end 
  61.  
  62.  
  63. function sh_bh_docks_hijack(is_restart) 
  64. 	mission_start_fade_out()	 
  65. 	teleport_coop("sh_bh_docks_$nstart","sh_bh_docks_$nstart (0)") 
  66. 	 
  67. 	if (not is_restart) then 
  68. 	cutscene_play("sh_bh_docksct1") 
  69. 	else 
  70. 	group_create_hidden("sh_bh_docks_$Ghijack") 
  71. 	end 
  72. 	group_show("sh_bh_docks_$Ghijack") 
  73. 	 
  74. 	--[[ Chris Uncomment this block and comment out the line above this and your in bussines! 
  75. 	group_create("sh_bh_docks_$Ghijack") 
  76. 	mission_start_fade_in() 
  77. 	for i = 1, hijackpeds_total, 1 do 
  78. 			sh_bh_docks_nodes(hijackpeds[i][1],hijackpeds[i][2]) 
  79. 	end 
  80. 	--]] 
  81. 	 
  82. 	while group_is_loaded("sh_bh_docks_$Ghijack")==false  do 
  83. 	thread_yield() 
  84. 	end 
  85. 	on_trigger("sh_bh_docks_roadblock" ,"sh_bh_docks_$troadblock") 
  86. 	on_vehicle_enter("sh_bh_docks_hijack_handler", "sh_bh_docks_$v000") 
  87. 	on_take_damage("sh_bh_docks_hijack_warning", "sh_bh_docks_$v000") 	 
  88. 	ambient_gang_spawn_enable(false) 
  89. 	notoriety_force_no_spawn("brotherhood", true) 	 
  90. 	objective_text_clear(0) 
  91. 	mission_help_table("sh_bh_docks_instruct_one") 
  92. 	on_vehicle_destroyed("sh_bh_docks_vehicle_destroyed_fail","sh_bh_docks_$v000") 
  93. 	marker_add_vehicle("sh_bh_docks_$v000", MINIMAP_ICON_PROTECT_ACQUIRE, INGAME_EFFECT_VEHICLE_PROTECT_ACQUIRE) 
  94. 	mission_start_fade_in() 
  95. end 
  96.  
  97. function sh_bh_docks_hijack_warning() 
  98. 	 
  99. 	if message_playing then 
  100. 		return 
  101. 	else 
  102. 		message_playing=true 
  103. 		mission_help_table_nag("sh_bh_docks_fail_warning_four") 
  104. 		delay(10) 
  105. 		message_playing=false   
  106. 	end 
  107. end 
  108.  
  109.  
  110.  
  111. function sh_bh_docks_hijack_handler(char)	 
  112. 	incar_timer=false 
  113. 	incar=true 
  114. 	mission_debug("hijackhandler="..hijackpeds_count) 
  115. 	on_take_damage("", "sh_bh_docks_$v000") 	 
  116. 	if (incar) then 
  117. 	-- on_vehicle_exit("sh_bh_docks_get_back", "sh_bh_docks_$v000") 
  118. 	 on_vehicle_destroyed("","sh_bh_docks_$v000") 
  119. 	 --on_vehicle_enter("sh_bh_docks_get_back_in", "sh_bh_docks_$v000") 
  120. 	 objective_text_clear(0) 
  121. 	 sh_bh_docks_convoy(char) 
  122. 	end 
  123. end 
  124.  
  125. function sh_bh_docks_nodes(char, index) 
  126. local action_node 
  127.  
  128. --function to put NPC into action nodes 
  129. --mission_debug("Nodes Used"..char..index) 
  130.   
  131. if index == 1 then 
  132. 	 
  133. 	action_node = "BH_RandomAction" 
  134.  
  135. 	elseif index == 2 then 
  136.  
  137. 	action_node = "BH_DrinkBeer" 
  138.  
  139. 	elseif index == 3 then 
  140.  
  141. 	action_node = "Blunt_Smoker" 
  142.  
  143. 	else 
  144.  
  145. 	action_node = "BH_RandomAction" 
  146.  
  147. 	end	 
  148.  
  149. mission_debug("Nodes Used"..action_node) 
  150. npc_use_closest_action_node_of_type(char, action_node,100) 
  151. end 
  152.  
  153. function sh_bh_docks_get_back_in()	 
  154. 	incar_timer=true 
  155. 	incar=true 
  156. 	marker_remove_vehicle("sh_bh_docks_$v000") 
  157. 	hud_timer_stop(0) 
  158. end 
  159.  
  160. function sh_bh_docks_get_back() 
  161. incar=false 
  162. mission_help_table("MSN_SH_BH_DOCKS_GETBACK") 
  163. --hud_timer_set(0,15000, "sh_bh_docks_get_back_fail") 
  164. marker_add_vehicle("sh_bh_docks_$v000", MINIMAP_ICON_PROTECT_ACQUIRE, INGAME_EFFECT_VEHICLE_PROTECT_ACQUIRE) 
  165. sh_bh_docks_timer() 
  166. 	while (incar==false) do 
  167. 		thread_yield()		 
  168. 	end 
  169. 	return 
  170. end 
  171.  
  172. function sh_bh_docks_get_back_fail() 
  173. mission_end_failure("sh_bh_docks", "MSN_SH_BH_DOCKS_GETBACK_FAIL")  
  174. end 
  175.  
  176.  
  177. function sh_bh_docks_killcount1(human) 
  178. hijackpeds_count = hijackpeds_count+1 
  179. objective_text(0, "sh_bh_docks_gangleft", hijackpeds_count,hijackpeds_total, SYNC_ALL) 
  180. marker_remove_npc(human) 
  181. --release_to_world(char) 
  182. on_death("", human) 
  183. 	if (hijackpeds_count == hijackpeds_total) then 
  184. 	objective_text_clear(0) 
  185. 	mission_help_table("sh_bh_docks_instruct_one") 
  186. 	marker_add_vehicle("sh_bh_docks_$v000", MINIMAP_ICON_PROTECT_ACQUIRE, INGAME_EFFECT_VEHICLE_PROTECT_ACQUIRE) 
  187. 	sh_bh_docks_convoy(LOCAL_PLAYER)	 
  188. 	end 
  189.  
  190. end 
  191.  
  192. function sh_bh_docks_convoy(human) 
  193. 	if (not human == LOCAL_PLAYER) then 
  194. 		mission_debug("returning") 
  195. 		return	 
  196. 	end 
  197.  
  198. 		if (hijackpeds_count == hijackpeds_total) then 
  199. 			objective_text_clear(0) 
  200. 		end 
  201. 		 
  202.  
  203. 		if (incar) then			 
  204. 		mission_debug("convoy_begin") 
  205. 		on_projectile_hit("sh_bh_docks_satchel") 
  206. 		 
  207. 		marker_remove_vehicle("sh_bh_docks_$v000") 
  208. 		on_vehicle_enter("", "sh_bh_docks_$v000")  
  209. 		trigger_enable("sh_bh_docks_$troadblock", true) 
  210. 		--Creating groups for later  
  211. 		mission_debug("creating groups") 
  212. 		group_create("sh_bh_docks_$Gconvoy", true) 
  213. 		group_create("sh_bh_docks_$GCone", true) 
  214. 		group_create("sh_bh_docks_$GCtwo", true) 
  215. 		group_create("sh_bh_docks_$Gthree", true) 
  216. 		group_create("sh_bh_docks_$Graodblock", true) 
  217.  
  218. 		for i = 1, convoy_total, 1 do 
  219. 			mission_debug("on death called") 
  220. 			on_death("sh_bh_docks_vehicle_destroyed_fail_passenger", convoy[i]) 
  221. 		end 
  222. 		on_vehicle_destroyed("sh_bh_docks_fail_convoy","sh_bh_docks_$v001") 
  223. 		vehicle_set_untowable("sh_bh_docks_$v001", true) 
  224. 		mission_debug("groups created") 
  225. 		turn_invulnerable("sh_bh_docks_$v001", false) 
  226. 		--put guys in cars 
  227. 		mission_debug("get yo ass in car") 
  228. 		vehicle_enter_group_teleport("sh_bh_docks_$croad2", "sh_bh_docks_$croad2 (0)" , "sh_bh_docks_$v001 (2)") 
  229. 		vehicle_enter_group_teleport("sh_bh_docks_$croad1", "sh_bh_docks_$croad1 (0)" , "sh_bh_docks_$v001 (3)") 
  230. 		vehicle_enter_group_teleport("sh_bh_docks_$c004", "sh_bh_docks_$c004 (0)", "sh_bh_docks_$c004 (1)", "sh_bh_docks_$c004 (2)", "sh_bh_docks_$v001") 
  231. 		--vehicle_enter_group_teleport("sh_bh_docks_$c004 (3)", "sh_bh_docks_$c004 (4)", "sh_bh_docks_$c004 (5)", "sh_bh_docks_$c004 (6)", "sh_bh_docks_$v001 (0)") 
  232. 		--vehicle_enter_group_teleport("sh_bh_docks_$c005", "sh_bh_docks_$c005 (0)", "sh_bh_docks_$c005 (1)", "sh_bh_docks_$c005 (2)", "sh_bh_docks_$v001 (1)") 
  233. 		for i = 1, follow_count, 1 do 
  234. 			on_death("sh_bh_docks_vehicle_destroyed_fail_passenger",follow_car[i]) 
  235. 		end 
  236. 		mission_debug("ass in cars") 
  237. 		marker_add_vehicle("sh_bh_docks_$v001", MINIMAP_ICON_PROTECT_ACQUIRE, INGAME_EFFECT_VEHICLE_PROTECT_ACQUIRE)		 
  238. 		mission_debug("starting convoy") 
  239. 		thread_new("sh_bh_docks_convoy1") 
  240. 		mission_help_table("sh_bh_docks_instruct_three") 
  241. 		delay(12) 
  242. 		mission_help_table("sh_bh_docks_instruct_two") 
  243. 		distance_display_on("sh_bh_docks_$v001", 0, 60, 0, 60, SYNC_ALL)  
  244. 		on_tailing_too_far("sh_bh_docks_follow_bad")  
  245. 		on_tailing_good("sh_bh_docks_follow_good")		 
  246. 		if(get_dist_char_to_vehicle(LOCAL_PLAYER,"sh_bh_docks_$v001") > 60) then 
  247. 			sh_bh_docks_follow_bad() 
  248. 		end 
  249. 		if coop_is_active() then 
  250. 			if(get_dist_char_to_vehicle(REMOTE_PLAYER,"sh_bh_docks_$v001") > 60) then 
  251. 				sh_bh_docks_follow_bad() 
  252. 			end 
  253. 		end 
  254. 		delay(.5)		 
  255. 				while (not convoy1) do  
  256. 					thread_yield() 
  257. 				end		 
  258. 			else	 
  259. 				return 
  260. 			end	 
  261. 	--mission_debug("done yeilding") 
  262. 	if (convoy1) then 
  263. 		hud_timer_stop(0)  
  264. 		on_projectile_hit("") 
  265. 		marker_remove_vehicle("sh_bh_docks_$v001") 
  266. 		objective_text(0, "sh_bh_docks_gangleft",  convoy_count, convoy_total, SYNC_ALL) 
  267. 		on_take_damage("", "sh_bh_docks_$v001")  
  268. 		on_tailing_too_far("")  
  269. 		on_tailing_good("") 
  270. 		on_vehicle_destroyed("","sh_bh_docks_$v001")		 
  271. 	end	 
  272. 	sh_bh_docks_getout() 
  273. end 
  274.  
  275. --Give convoy infinite life (i.e. once at 50% he can never go below 50%) 
  276.  
  277. function sh_bh_docks_convoy1() 
  278. 	mission_debug("Convoy now") 
  279. 	vehicle_set_allow_ram_ped("sh_bh_docks_$v001", true)  
  280. 	vehicle_never_flatten_tires("sh_bh_docks_$v001", true)  
  281. 	vehicle_set_script_hard_goto("sh_bh_docks_$v001", true) 
  282. 	on_take_damage("sh_bh_docks_fail_take_damage", "sh_bh_docks_$v001")  
  283. 	vehicle_ignore_repulsors("sh_bh_docks_$v001", true) 
  284. 	vehicle_infinite_mass("sh_bh_docks_$v001", true) 
  285. 	vehicle_speed_override("sh_bh_docks_$v001", 50) 
  286. 	vehicle_pathfind_to("sh_bh_docks_$v001", "sh_bh_docks_$pathConvoy", true, false) 
  287. 	vehicle_pathfind_to("sh_bh_docks_$v001", "sh_bh_docks_$pathConvoy1", true, false) 
  288. 	vehicle_pathfind_to("sh_bh_docks_$v001", "sh_bh_docks_$pathconvoyint", true, false) 
  289. 	vehicle_pathfind_to("sh_bh_docks_$v001", "sh_bh_docks_$pathconvoyint1", true, false) 
  290. 	vehicle_pathfind_to("sh_bh_docks_$v001", "sh_bh_docks_$pathConvoy2", true, false) 
  291. 	vehicle_pathfind_to("sh_bh_docks_$v001", "sh_bh_docks_$npath1", true, true) 
  292. 	hud_timer_stop(0) 
  293. 	distance_display_off(SYNC_ALL) 
  294. 	mission_debug("convoy true") 
  295. 	convoy1=true 
  296. end 
  297.  
  298.  
  299. function sh_bh_docks_getout()	 
  300. objective_text_clear(0) 
  301. mission_help_table("MSN_SH_BH_DOCKS_INSTRUCT_SIX") 
  302. notoriety_set_max("brotherhood", 3) 
  303. notoriety_force_no_spawn("brotherhood", false) 
  304. mission_debug("getout") 
  305. objective_text(0, "sh_bh_docks_gangleft",  convoy_count, convoy_total, SYNC_ALL) 
  306. turn_invulnerable("sh_bh_docks_$v001",true) 
  307. 	for i = 1, convoy_total, 1 do 
  308. 		if character_is_dead(convoy[i]) == false then 
  309. 		on_death("sh_bh_docks_killcount", convoy[i]) 
  310. 		marker_add_npc(convoy[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL) 
  311. 		--no animations for big truck		 
  312. 		--vehicle_exit(convoy[i], true) 
  313. 		--attack(convoy[i], LOCAL_PLAYER) 
  314. 		end 
  315. 	end 
  316.  
  317. 	for i=1, convoy_one_total, 1 do	 
  318. 		if character_is_dead(convoy_one[i])== false then 
  319. 			thread_handles[i]=thread_new("sh_bh_docks_pathfind",convoy_one[i],convoy_one_navs[i]) 
  320. 		end 
  321. 	end 
  322. end 
  323.  
  324. function sh_bh_docks_pathfind(char_name, nav) 
  325. 	vehicle_exit(char_name, true) 
  326. 	npc_combat_enable(char_name, true) 		 
  327. 	move_to_safe(char_name, nav, 2, false, false) 
  328. 	return 
  329. end 
  330.  
  331. function sh_bh_docks_killcount(char) 
  332. convoy_count = convoy_count + 1 
  333. marker_remove_npc(char) 
  334. if convoy1 then 
  335. objective_text(0, "sh_bh_docks_gangleft",  convoy_count, convoy_total, SYNC_ALL) 
  336. end 
  337. 	if convoy_count == convoy_total then 
  338. 		--debug_message("GROUP TWO") 
  339. 		objective_text_clear(0) 
  340. 		release_to_world("sh_bh_docks_$Gconvoy") 
  341. 		--mission_set_checkpoint("boat") 
  342. 		mission_end_success("sh_bh_docks")					 
  343. 	end 
  344. 	if convoy_count == 1 then 
  345. 		notoriety_set_min("brotherhood", 3) 
  346. 		notoriety_force_no_spawn("brotherhood", false) 	 
  347. 	end 
  348. end 
  349.  
  350. function sh_bh_docks_satchel(type, name, weapon) 
  351. --mission_debug("type=  "..type) 
  352. --mission_debug("name=  "..name) 
  353. --mission_debug("weapon=  "..weapon) 
  354.  
  355. 	if type == "vehicle" and name == "sh_bh_docks_$v001" and weapon == "satchel" then 
  356. 		mission_end_failure("sh_bh_docks","sh_bh_docks_fail_three") 
  357. 	end 
  358.  
  359. end 
  360.  
  361.  
  362. function sh_bh_docks_boat() 
  363. 	group_create("sh_bh_docks_$Gwaverunner4player", true) 
  364. 	turn_invulnerable("sh_bh_docks_$vplayerwave") 
  365. 	marker_add_vehicle("sh_bh_docks_$vplayerwave",MINIMAP_ICON_PROTECT_ACQUIRE, INGAME_EFFECT_VEHICLE_PROTECT_ACQUIRE) 
  366. 	on_vehicle_enter("sh_bh_docks_wave", "sh_bh_docks_$vplayerwave")	 
  367. 	mission_help_table("sh_bh_docks_instruct_four") 
  368. 	--objective_text(0, "sh_bh_docks_buyersleft",  buyers_count, buyers_total) 
  369. end 
  370.  
  371.  
  372. function sh_bh_docks_boat_killcount(char) 
  373. 	buyers_count = buyers_count + 1 
  374. 	marker_remove_npc(char) 
  375. 	--objective_text(0, "sh_bh_docks_buyersleft",  buyers_count, buyers_total, SYNC_ALL) 
  376. 	on_death("", char)	 
  377.  
  378. 		--if buyers_count == buyers_total then 
  379. 			--debug_message("GROUP TWO") 
  380. 			 
  381. 			objective_text_clear(0)			 
  382. 			mission_end_success("sh_bh_docks")			 
  383. 		--end 
  384.  
  385.  
  386. end 
  387.  
  388. function sh_bh_docks_roadblock(char, trigger_name) 
  389.  
  390. --mission_debug("char ="..char) 
  391.  
  392. 	if char == "sh_bh_docks_$c004 (2)" or "sh_bh_docks_$c004" or "sh_bh_docks_$c004 (0)" or "sh_bh_docks_$c004 (1)" or "sh_bh_docks_$v001" then 
  393. 		mission_debug("EXECUTE") 
  394. 		--[[ 
  395. 		for i = 1, action_total, 1 do 
  396. 			sh_bh_docks_nodes(action[i][1],action[i][2]) 
  397. 		end 
  398. 		--]] 
  399. 		vehicle_speed_override("sh_bh_docks_$v001", 100) 
  400. 		--mission_help_table_nag("sh_bh_docks_made_you") 
  401. 		hud_timer_stop(0) 
  402. 		delay(3) 
  403. 		--thread_new("sh_bh_docks_roadblock_move_one") 
  404. 		--thread_new("sh_bh_docks_roadblock_move_two") 
  405. 		trigger_enable("sh_bh_docks_$troadblock", false) 
  406. 		notoriety_set_max("brotherhood", 3) 
  407. 		--`notoriety_set("brotherhood", 3) 
  408. 		marker_remove_vehicle("sh_bh_docks_$v001") 
  409. 		distance_display_off(SYNC_ALL) 
  410. 		on_vehicle_destroyed("","sh_bh_docks_$v000") 
  411. 		on_vehicle_destroyed("","sh_bh_docks_$v001") 
  412. 		on_take_damage("", "sh_bh_docks_$v001")  
  413. 		on_tailing_too_far("")  
  414. 		on_tailing_good("")  
  415. 		on_vehicle_exit("", "sh_bh_docks_$v000") 
  416. 		on_vehicle_enter("", "sh_bh_docks_$v000") 
  417. 	end 
  418. end 
  419.  
  420. function sh_bh_docks_roadblock_move_one() 
  421.  
  422. 	vehicle_pathfind_to("sh_bh_docks_$v001 (2)", "sh_bh_docks_$nroad1", true, true) 
  423. 	vehicle_exit("sh_bh_docks_$croad2") 
  424. 	vehicle_exit("sh_bh_docks_$croad2 (0)")  
  425. 	return 
  426.  
  427. end 
  428.  
  429.  
  430. function sh_bh_docks_roadblock_move_two() 
  431. 	vehicle_pathfind_to("sh_bh_docks_$v001 (3)", "sh_bh_docks_$nroad1 (0)", true, true) 
  432. 	vehicle_exit("sh_bh_docks_$croad1") 
  433. 	vehicle_exit("sh_bh_docks_$croad1 (0)")  
  434. 	return 
  435.  
  436. end 
  437.  
  438.  
  439. function sh_bh_docks_wave() 
  440. 	group_create("sh_bh_docks_$Gboats",true)	 
  441. 	marker_remove_vehicle("sh_bh_docks_$vplayerwave") 
  442. 	on_vehicle_enter("", "sh_bh_docks_$vplayerwave")	 
  443. 	turn_vulnerable("sh_bh_docks_$vplayerwave") 
  444. 	marker_add_npc("sh_bh_docks_$c006", MINIMAP_ICON_KILL, INGAME_EFFECT_VEHICLE_KILL) 
  445. 	on_death("sh_bh_docks_boat_killcount","sh_bh_docks_$c006") 
  446. 	persona_override_character_start("sh_bh_docks_$c006", "threat - alert (group attack)",			"BMHUST_BR_STRONG_DOCKS") 
  447. 	persona_override_character_start("sh_bh_docks_$c006", "threat - alert (solo attack)",			"BMHUST_BR_STRONG_DOCKS") 
  448. 	persona_override_character_start("sh_bh_docks_$c006", "threat - damage received (firearm)",	"BMHUST_BR_STRONG_DOCKS") 
  449. 	persona_override_character_start("sh_bh_docks_$c006", "threat - damage received (melee)",		"BMHUST_BR_STRONG_DOCKS") 
  450. 	persona_override_character_start("sh_bh_docks_$c006", "threat - knocked down npc/pc",			"BMHUST_BR_STRONG_DOCKS") 
  451. 	vehicle_enter_teleport("sh_bh_docks_$c006 (0)", "sh_bh_docks_$v002 (0)") 
  452. 	vehicle_enter_teleport("sh_bh_docks_$c006", "sh_bh_docks_$v002") 
  453. 	vehicle_enter_teleport("sh_bh_docks_$c006 (1)", "sh_bh_docks_$v002 (1)") 
  454. 	vehicle_enter_teleport("sh_bh_docks_$c006 (2)", "sh_bh_docks_$v002 (2)") 
  455. 	vehicle_enter_teleport("sh_bh_docks_$c006 (3)", "sh_bh_docks_$v002 (3)") 
  456. 	thread_new("sh_bh_docks_buyer_chase") 
  457. 	vehicle_chase("sh_bh_docks_$v002 (0)", LOCAL_PLAYER, true, false, true) 
  458. 	vehicle_chase("sh_bh_docks_$v002 (1)", LOCAL_PLAYER, true, false, true) 
  459. 	vehicle_chase("sh_bh_docks_$v002 (2)", LOCAL_PLAYER, true, false, true) 
  460. end 
  461.  
  462.  
  463.  
  464. function sh_bh_docks_buyer_chase() 
  465. delay(7) 
  466. vehicle_speed_override("sh_bh_docks_$v002", 40) 
  467. vehicle_pathfind_to("sh_bh_docks_$v002", "sh_bh_docks_$path001", true, false) 
  468. vehicle_pathfind_to("sh_bh_docks_$v001", "sh_bh_docks_$path002", true, false) 
  469. end 
  470.  
  471.  
  472.  
  473.  
  474. function sh_bh_docks_follow_bad()		 
  475. 	mission_help_table_nag("sh_bh_docks_warning_two") 
  476. 	hud_timer_set(0,1000*20, "sh_bh_docks_fail_convoy") --, SYNC_ALL, true)  
  477. end 
  478.  
  479. function sh_bh_docks_follow_good()		 
  480. 	hud_timer_stop(0) 	 
  481. end 
  482.  
  483. function sh_bh_docks_vehicle_destroyed_fail() 
  484. 	mission_end_failure("sh_bh_docks", "sh_bh_docks_fail_four") --You destroyed the truck! 
  485. end 
  486.  
  487. function sh_bh_docks_vehicle_destroyed_fail_passenger() 
  488. 	mission_end_failure("sh_bh_docks", "sh_bh_docks_fail") --You destroyed the truck! 
  489. end 
  490.  
  491. function sh_bh_docks_fail_convoy() 
  492. 	mission_end_failure("sh_bh_docks","sh_bh_docks_fail_two") 
  493. end 
  494.  
  495. function sh_bh_docks_fail_take_damage(attacked_vehicle, attacker) 
  496. 	 
  497. 	if (attacker==LOCAL_PLAYER or attacker==REMOTE_PLAYER) then 
  498. 	times_damaged = times_damaged + 1	 
  499. 		if times_damaged >= 3 then		 
  500. 				mission_end_failure("sh_bh_docks","sh_bh_docks_fail_three") 
  501. 			else 
  502. 				mission_help_table_nag("sh_bh_docks_fail_warning_four") 
  503. 		end 
  504.  
  505. 	end 
  506. end 
  507.  
  508. function sh_bh_docks_cleanup() 
  509. 	--turn_invulnerable("sh_bh_docks_$vplayerwave", false) 
  510. 	--release_to_world("sh_bh_docks_$vplayerwave") 
  511. 	marker_remove_vehicle("sh_bh_docks_$v000") 
  512. 	marker_remove_vehicle("sh_bh_docks_$v002") 
  513. 	on_tailing_too_far("")  
  514. 	on_tailing_good("")  
  515. 	on_vehicle_enter("", "sh_bh_docks_$vplayerwave") 
  516. 	on_take_damage("", "sh_bh_docks_$v001") 
  517. 	on_vehicle_enter("", "sh_bh_docks_$v000")  
  518. 	on_take_damage("", "sh_bh_docks_$v000")  
  519. 	on_trigger("" ,"sh_bh_docks_$troadblock") 
  520. 	on_projectile_hit("") 
  521. 	distance_display_off()  
  522. 	on_tailing_too_far("")  
  523. 	on_tailing_good("") 
  524. 	on_vehicle_destroyed("","sh_bh_docks_$v001") 
  525. 	hud_timer_stop(0) 
  526. 	for i = 1, convoy_total, 1 do 
  527. 		if group_is_loaded("sh_bh_docks_$GCtwo") then 
  528. 			if character_is_dead(convoy[i]) == false then 
  529. 				on_death("", convoy[i]) 
  530. 				marker_remove_npc(convoy[i]) 
  531. 			end 
  532. 		end 
  533. 	end 
  534.  
  535. 	if group_is_loaded("sh_bh_docks_$GCone") then 
  536. 		group_destroy("sh_bh_docks_$GCone") 
  537. 	end 
  538. 	 
  539. 	if group_is_loaded("sh_bh_docks_$GCtwo") then 
  540. 		group_destroy("sh_bh_docks_$GCtwo") 
  541. 	end 
  542.  
  543. 	if group_is_loaded("sh_bh_docks_$GCthree") then 
  544. 		group_destroy("sh_bh_docks_$GCthree") 
  545. 	end 
  546.  
  547.  
  548. end 
  549.  
  550.  
  551.  
  552. function sh_bh_docks_success() 
  553.  
  554.  
  555.  
  556. end 
  557.  
  558.  
  559.  
  560. function sh_bh_docks_timer() 
  561.  
  562. 	--hud_timer_pause(0, true) 
  563. 	--hud_timer_set(0, 15000, "sh_bh_chinatown_timeout")  
  564. 	incar_timer=false 
  565. 	incar_timer_coop=false 
  566. 		 
  567. 		if coop_is_active() then 
  568. 			if char == REMOTE_PLAYER then 
  569. 				in_areatwo = false 
  570. 			end 
  571. 		end 
  572.  
  573. 		local time = 0 
  574. 		local messone = true 
  575. 		local messtwo = true	 
  576. 		mission_debug("LEAVE") 
  577. 		--mission_debug(in_area) 
  578.  
  579.  
  580.  
  581. 	if coop_is_active() then 
  582.  
  583. 			while(incar_timer==false and incar_timer_coop==false) do 
  584. 				 
  585. 				time = time + get_frame_time() 
  586.  
  587. 				if(incar_timer==true and incar_timer_coop==false) then 
  588. 				return 
  589. 				end 
  590.  
  591. 				if (time > 15) then					 
  592. 					mission_help_table_nag("MSN_SH_BH_DOCKS_WARNING_ONE") 
  593. 				end 
  594. 				 
  595.  
  596. 				if (time > 10) then				 
  597. 					if (messone == true) then 
  598. 					mission_help_table_nag("MSN_SH_BH_DOCKS_WARNING_THREE_TIMER") 
  599. 					messone = false 
  600. 					end 
  601. 				end 
  602.  
  603.  
  604. 				if (time > 5) then 
  605. 					-- Second message (10 seconds left) 
  606. 					if (messtwo == true) then 
  607. 						mission_help_table_nag("MSN_SH_BH_DOCKS_WARNING_TWO_TIMER")						 
  608. 						messtwo = false 
  609. 					end				 
  610. 				end 
  611. 				 
  612. 				if (time == 0) then 
  613. 					-- Fail if timer runs out 
  614. 					if (messtwo == true) then 
  615. 						--put fail function here	 
  616. 						messtwo = false 
  617. 					end				 
  618. 				end 
  619.  
  620. 				thread_yield()	 
  621. 			end				 
  622.  
  623. 			else 
  624.  
  625. 			while(incar_timer==false) do 
  626. 				 
  627. 				time = time + get_frame_time() 
  628.  
  629. 				if(incar_timer==true) then 
  630. 				return 
  631. 				end 
  632.  
  633.  
  634. 				if (time > 15) then					 
  635. 					--mission_help_table_nag("sh_bh_chinatown_warning_one") 
  636. 					mission_help_table_nag("MSN_SH_BH_DOCKS_WARNING_ONE")		 
  637. 				end				 
  638.  
  639. 				if (time > 10) then				 
  640. 					if (messone == true) then 
  641. 						mission_help_table_nag("MSN_SH_BH_DOCKS_WARNING_THREE_TIMER") 
  642. 						messone = false 
  643. 					end 
  644. 				end 
  645.  
  646.  
  647. 				if (time > 5) then 
  648. 					-- Second message (10 seconds left) 
  649. 					if (messtwo == true) then 
  650. 						mission_help_table_nag("MSN_SH_BH_DOCKS_WARNING_TWO_TIMER") 
  651. 						messtwo = false 
  652. 					end 
  653. 				end 
  654.  
  655. 				if (time == 0) then 
  656. 					-- Fail if timer runs out 
  657. 					if (messtwo == true) then 
  658. 							 
  659. 						messtwo = false 
  660. 					end				 
  661. 				end 
  662. 				thread_yield() 
  663. 			end				 
  664. 		end 
  665. 		--hud_timer_hide(0, true) 		 
  666. 		--hud_timer_stop(0, true)				 
  667. end