sr2lua/coop_test.lua

  1.  
  2. FREE_CLOTHING_NAME					= "parachute suit" 
  3. FREE_CLOTHING_WEAR_OPTION			= "cmSui_uJumpSui01.cmeshx" 
  4. FREE_CLOTHING_VARIANT_NAME			= "07 - Default" 
  5.  
  6. doors = {"coop_test_FrontDoor1", "coop_test_FrontDoor2", "coop_test_DoorToBack","coop_test_DoorToCas1A", "coop_test_DoorToCas2B", "coop_test_ExitCas1A", "coop_test_ExitCas1B", "coop_test_DoorToJail", "coop_test_CellDoor", "coop_test_DoorCas2B", "coop_test_DoorToCas2B", "coop_test_ExitCas2", "coop_test_GaurdDoor"} 
  7.  
  8. Time = 0 
  9.  
  10. function coop_test_start( checkpoint_name ) 
  11. 	set_mission_author("Russell Aasland") 
  12.  
  13. 	if (checkpoint_name == MISSION_START_CHECKPOINT) then 
  14. 		fade_in( 0 ) 
  15.  
  16. 		group_create( "coop_test_$G000_ghosting" ) 
  17. 		set_max_hit_points( "coop_test_$c000", 1500 ) 
  18. 		damage_indicator_on(0,"coop_test_$c000",0.0, "rn10_hud_akuji_health") 
  19. 		 
  20. 		teleport( LOCAL_PLAYER, "sr2_city_coop_test_mission" ) 
  21. 		 
  22. 		if (coop_is_active()) then 
  23. 			teleport( REMOTE_PLAYER, "sr2_city_coop_test_mission" ) 
  24. 		end 
  25. 		 
  26. 		on_pickup( "coop_test_checkpoint1", "coop_test_satchel" ) 
  27. 		 
  28. 		--set_ignore_ai_flag( "coop_test_$c000", true ) 
  29. 		 
  30. 		--vehicle_enter_group_teleport( "coop_test_$c001", "coop_test_$c002", "coop_test_$v001" ) 
  31. 	end 
  32. 	 
  33. 	mission_debug( checkpoint_name, 0, 0 ) 
  34. 	 
  35. 	on_vehicle_enter( "coop_test_checkpoint2", LOCAL_PLAYER ) 
  36. 	 
  37. 	mission_help_table( "bh09_next_wave", 10 ) 
  38. end 
  39.  
  40. DEFAULT_ENTER_UG_MALL_TRIGGER = "highend_$t-ug-mall-elevator-out" 
  41. DEFAULT_LEAVE_UG_MALL_TRIGGER = "highend_$t-ug-mall-elevator-in" 
  42. function coop_trigger_disable_test( ) 
  43. 	trigger_enable( DEFAULT_ENTER_UG_MALL_TRIGGER, false ) 
  44. 	trigger_enable( DEFAULT_LEAVE_UG_MALL_TRIGGER, false ) 
  45. 	trigger_type_enable("clothing store", false) 
  46. end 
  47. function coop_trigger_enable_test( ) 
  48. 	trigger_enable( DEFAULT_ENTER_UG_MALL_TRIGGER, true ) 
  49. 	trigger_enable( DEFAULT_LEAVE_UG_MALL_TRIGGER, true ) 
  50. 	trigger_type_enable("clothing store", true) 
  51. end 
  52.  
  53. function coop_kill_followers() 
  54. 	character_kill( "coop_test_$c001" ) 
  55. 	character_kill( "coop_test_$c002" ) 
  56. end 
  57.  
  58. function coop_cash_add() 
  59. 	cash_add( 100000, REMOTE_PLAYER ) 
  60. end 
  61.  
  62. function coop_cash_remove() 
  63. 	cash_remove( 100000, REMOTE_PLAYER ) 
  64. end 
  65.  
  66. function coop_players_warp() 
  67. 	teleport_coop( "coop_test_$n002", "coop_test_$n003" ) 
  68. 	 
  69. 	coop_test_timer() 
  70. end 
  71.  
  72. function coop_cellphone_test() 
  73. 	mid_mission_phonecall( "coop_test_checkpoint3" ) 
  74. end 
  75.  
  76. function coop_test_doors_open() 
  77. 	for k,v in doors do 
  78. 		door_open( v ) 
  79. 	end 
  80. end 
  81.  
  82. function coop_test_doors_hide() 
  83. 	for k,v in doors do 
  84. 		mesh_mover_hide( v ) 
  85. 	end 
  86. end 
  87.  
  88. function coop_test_doors_show() 
  89. 	for k,v in doors do 
  90. 		mesh_mover_show( v ) 
  91. 	end 
  92. end 
  93.  
  94. function coop_test_warp_test() 
  95. 	teleport( LOCAL_PLAYER, "coop_test_$c001" ) 
  96. 	 
  97. 	while (teleport_check_done(LOCAL_PLAYER) == false) do 
  98. 		thread_yield() 
  99. 	end 
  100. 	 
  101. 	coop_test_timer() 
  102. end 
  103.  
  104. function coop_mover_hide_test() 
  105. 	door_lock( "coop_test_FrontDoor1", true ); 
  106. 	door_lock( "coop_test_FrontDoor2", true ); 
  107. 	mesh_mover_hide( "coop_test_FrontDoor1" ); 
  108. 	mesh_mover_hide( "coop_test_FrontDoor2" ); 
  109. end 
  110.  
  111. function coop_objective_local() 
  112. 	objective_text( 0, "ss06_samedi_gang_members_killed", 1, "", SYNC_LOCAL ) 
  113. end 
  114.  
  115. function coop_objective_remote() 
  116. 	objective_text( 0, "ss06_samedi_gang_members_killed", 2, "", SYNC_REMOTE ) 
  117. end 
  118.  
  119. function coop_objective_all() 
  120. 	objective_text( 0, "ss06_samedi_gang_members_killed", 3, "", SYNC_ALL ) 
  121. end 
  122.  
  123. function coop_help_text() 
  124. 	mission_help_table( "ss06_samedi_gang_members_killed", 3, "", SYNC_ALL ) 
  125. end 
  126.  
  127. function coop_unhide_test() 
  128. 	group_show( "coop_test_$G000_ghosting" ) 
  129. end 
  130.  
  131. function coop_give() 
  132. 	group_give_to_client( "coop_test_$G000_ghosting" ) 
  133. end 
  134.  
  135. function coop_test_heli_pathfind() 
  136. 	helicopter_fly_to_direct( "coop_test_$v001", 45, "coop_test_$n005", "coop_test_$n004" ) 
  137. end 
  138.  
  139. function coop_test_ragdoll_entry() 
  140. 	character_ignite( LOCAL_PLAYER, true ) 
  141. 	delay( 1 ) 
  142. 	vehicle_enter_group_teleport( REMOTE_PLAYER, LOCAL_PLAYER, "coop_test_$v001" ) 
  143. end 
  144.  
  145. function coop_test_mission_win_cutscene() 
  146. 	mission_end_success( "coop_test", "mayhem_nukeplant" ) 
  147. end 
  148.  
  149. function coop_test_mover_reset() 
  150. 	mesh_mover_reset( "coop_test_gazebo" ) 
  151. end 
  152.  
  153. function coop_test_hud_bar() 
  154. 	local value = 100 
  155.  
  156. 	hud_bar_on( 0, "Health", "rn07_hud_gat_health", value ) 
  157. 	 
  158. 	while (true) do 
  159. 		delay( .25 ) 
  160. 		 
  161. 		value = value - 10 
  162. 		hud_bar_set_value( 0, value ) 
  163. 		 
  164. 		if (value == 0) then 
  165. 			value = 100 
  166. 		end 
  167. 	end 
  168. end 
  169.  
  170. function coop_test_timer() 
  171. 	hud_timer_set( 0, 30000 ) 
  172. end 
  173.  
  174. function coop_test_weapon_give() 
  175. 	inv_item_add( "ar50_launcher", 100, REMOTE_PLAYER, true ); 
  176. end 
  177.  
  178. function coop_test_action_node() 
  179. 	npc_use_closest_action_node_of_type( "coop_test_$c000", "Hammerer", 100 ) 
  180. end 
  181.  
  182. function coop_test_pause_menu_objective( ) 
  183. 	mission_help_table("bh01_escape_caverns") 
  184. end 
  185.  
  186. function coop_test_add_follower( ) 
  187. 	party_add( "coop_test_$c000", REMOTE_PLAYER ); 
  188. 	set_ignore_ai_flag( "coop_test_$c000", false ) 
  189. end 
  190.  
  191. function coop_test_add_objective() 
  192. 	objective_text(0, "rss01_objective", 4, 8, SYNC_ALL) 
  193. end 
  194.  
  195. function coop_test_remove_objective() 
  196. 	objective_text_clear(0) 
  197. end 
  198.  
  199. function coop_test_cleanup() 
  200. 	finishers_disable() 
  201. 	coop_test_doors_show() 
  202. 	on_vehicle_enter( "", LOCAL_PLAYER ) 
  203. end 
  204.  
  205. function coop_test_global() 
  206. 	finishers_enable() 
  207. end 
  208.  
  209. function coop_test_game_time() 
  210. 	Time = get_game_time() 
  211. end 
  212.  
  213. function coop_test_mark_local( ) 
  214. 	vehicle_mark_as_players( "coop_test_$v000", LOCAL_PLAYER ) 
  215. end 
  216.  
  217. function coop_test_mark_remote( ) 
  218. 	vehicle_mark_as_players( "coop_test_$v000", REMOTE_PLAYER ) 
  219. end 
  220.  
  221. function coop_test_disable_slot( ) 
  222. 	inv_weapon_disable_slot( WEAPON_SLOT_SHOTGUN, true, SYNC_REMOTE ) 
  223. end 
  224.  
  225. function coop_test_disable_all_but_slot( ) 
  226. 	inv_weapon_disable_all_but_this_slot( WEAPON_SLOT_PISTOL, SYNC_REMOTE ) 
  227. end 
  228.  
  229. function coop_test_enable_all( ) 
  230. 	inv_weapon_enable_or_disable_all_slots( true, SYNC_REMOTE ) 
  231. end 
  232.  
  233. function coop_test_group_entry( ) 
  234. 	vehicle_enter_group_teleport( "coop_test_$c000", "coop_test_$c001", "coop_test_$c002", "coop_test_$v000" ) 
  235. end 
  236.  
  237. function coop_test_current1() 
  238. 	objective_text(1, "bh07_store_damage_meter", 5, "", SYNC_REMOTE) 
  239. end 
  240.  
  241. function coop_test_current2() 
  242. 	objective_text_clear(1) 
  243. end 
  244.  
  245. function coop_test_success() 
  246. 	set_ignore_ai_flag( "coop_test_$c000", true ) 
  247. 	set_ignore_ai_flag( "coop_test_$c001", true ) 
  248. 	set_ignore_ai_flag( "coop_test_$c002", true ) 
  249. end 
  250.  
  251. function coop_test_checkpoint1( ) 
  252. 	mission_set_checkpoint( "cp alpha" ) 
  253. end 
  254.  
  255. function coop_test_checkpoint2( ) 
  256. 	mission_set_checkpoint( "cp beta" ) 
  257. end 
  258.  
  259. function coop_test_checkpoint3( ) 
  260. 	mission_set_checkpoint( "cp charlie" ) 
  261. end 
  262.  
  263. function coop_test_vehicle_flag( ) 
  264. 	set_player_can_enter_exit_vehicles( "#PLAYER1#", true ) 
  265. end 
  266.  
  267. function coop_test_lock_vehicle( ) 
  268. 	set_unjackable_flag( "coop_test_$v000", true ) 
  269. 	set_unjackable_flag( "coop_test_$v001", true ) 
  270. end 
  271.  
  272. 	PLANT_BOMB_MAX_DISTANCE =	3.0		-- Maximum distance from car center to keep planting bomb 
  273. 	STATE_PLANT_BOMB =			"crouch plant bomb"		-- Bomb planting animation state 
  274. function coop_test_pathfind( ) 
  275. 	--while (true) do 
  276. 	--	move_to( "coop_test_$c002", "coop_test_$n000", "coop_test_$n001", 2 ) 
  277. 	--end 
  278. 	local donnie = "coop_test_$c002" 
  279. 	local Current_bomb_target = "coop_test_$v000" 
  280. 	local Current_target_seat = 0 
  281. 	 
  282. 	while true do 
  283. 		thread_yield() 
  284. 		if get_dist(donnie, Current_bomb_target) > PLANT_BOMB_MAX_DISTANCE or not check_animation_state(donnie, STATE_PLANT_BOMB) then 
  285. 			if crouch_is_crouching(donnie) then 
  286. 				crouch_stop(donnie) 
  287. 			end		 
  288. 			move_to_vehicle_entry_point(donnie, Current_bomb_target, Current_target_seat, 3, true) 
  289. 			crouch_start(donnie) 
  290. 			delay(1) 
  291. 			set_animation_state(donnie, STATE_PLANT_BOMB) 
  292. 		else 
  293. 			if not crouch_is_crouching(donnie) then 
  294. 				crouch_start(donnie) 
  295. 				delay(1) 
  296. 			end 
  297.  
  298. 			if not check_animation_state(donnie, STATE_PLANT_BOMB) then 
  299. 				set_animation_state(donnie, STATE_PLANT_BOMB) 
  300. 			end 
  301.  
  302. 		end 
  303. 	end 
  304. 	 
  305. end 
  306.  
  307. function coop_test_mover1( ) 
  308. 	mesh_mover_play_action( "coop_test_GarDoorPanelA100", "start1" ) 
  309. end 
  310.  
  311. function coop_test_mover2( ) 
  312. 	mesh_mover_play_action( "coop_test_GarDoorPanelA100", "start2" ) 
  313. end 
  314.  
  315. Audio_handle = -1 
  316. function coop_test_audio_nav( ) 
  317. 	Audio_handle = audio_play_for_navpoint("SFX_ALARM_5", "coop_test_$n000", "foley") 
  318. end 
  319.  
  320. function coop_test_audio_char( ) 
  321. 	Audio_handle = audio_play_for_character("SFX_ALARM_5", "coop_test_$c001", "foley") 
  322. end 
  323.  
  324. function coop_test_audio_2d( ) 
  325. 	Audio_handle = audio_play( "SFX_ALARM_5", "foley" ) 
  326. end 
  327.  
  328. function coop_test_audio_stop( ) 
  329. 	audio_stop( Audio_handle ) 
  330. end 
  331.  
  332. function coop_test_customization_local() 
  333. 	customization_item_wear(FREE_CLOTHING_NAME,FREE_CLOTHING_WEAR_OPTION,FREE_CLOTHING_VARIANT_NAME, SYNC_LOCAL) 
  334. end 
  335.  
  336. function coop_test_customization_remote() 
  337. 	customization_item_wear(FREE_CLOTHING_NAME,FREE_CLOTHING_WEAR_OPTION,FREE_CLOTHING_VARIANT_NAME, SYNC_REMOTE) 
  338. end 
  339.  
  340. function coop_test_revert_local() 
  341. 	customization_item_revert( SYNC_LOCAL ) 
  342. end 
  343.  
  344. function coop_test_revert_remote() 
  345. 	customization_item_revert( SYNC_REMOTE ) 
  346. end 
  347.  
  348. function coop_test_nav_path( ) 
  349. 	vehicle_enter_group_teleport( "coop_test_$c000", "coop_test_$v000" ) 
  350.  
  351. 	vehicle_pathfind_to( "coop_test_$v000", {"coop_test_$n000", "coop_test_$n001"}, true, true, false ) 
  352. end