sr2lua/fr_checkAI.lua

  1. -- Groups -- 
  2. GROUP1 = "fr_checkAI_$npc_group" 
  3. GROUP2 = "fr_checkAI_$vehicle_group" 
  4. PASSENGER_GROUP1 = {"fr_checkAI_$human_6"} 
  5. PASSENGER_GROUP2 = {"fr_checkAI_$human_7"} 
  6. PASSENGER_GROUP3 = {"fr_checkAI_$human_8"} 
  7. PASSENGER_GROUP4 = {"fr_checkAI_$human_9"} 
  8. PASSENGER_GROUP5 = {"fr_checkAI_$human_10"} 
  9. PASSENGER_GROUP6 = {"fr_checkAI_$human_11"} 
  10.  
  11. -- Main Mission Function -- 
  12. function fr_checkAI_start() 
  13. 	-- Start trigger is hit... the activate button was hit 
  14. 	set_mission_author("Brendan Hanna Holloway") 
  15.  
  16. 	-- point camera to navpoint 
  17. 	camera_look_through("fr_checkAI_$camera") 
  18.  
  19. 	-- spawn some groups 
  20. 	group_create(GROUP2, true) 
  21. 	group_create(GROUP1, true) 
  22.  
  23. 	-- place passengers in vehicles 
  24. 	vehicle_enter_group_teleport(PASSENGER_GROUP1, "fr_checkAI_$vehicle_0") 
  25. 	vehicle_enter_group_teleport(PASSENGER_GROUP2, "fr_checkAI_$vehicle_1") 
  26. 	vehicle_enter_group_teleport(PASSENGER_GROUP3, "fr_checkAI_$vehicle_2") 
  27. 	vehicle_enter_group_teleport(PASSENGER_GROUP4, "fr_checkAI_$vehicle_3") 
  28. 	vehicle_enter_group_teleport(PASSENGER_GROUP5, "fr_checkAI_$vehicle_4") 
  29. 	vehicle_enter_group_teleport(PASSENGER_GROUP6, "fr_checkAI_$vehicle_5") 
  30.  
  31. 	-- start effects 
  32. 	local effect_handles = {} 
  33. 	if (framerate_test_should_play_effects()) then 
  34. 		effect_handles[1] = effect_play("CarDamage-Fire", "fr_checkAI_$vehicle_nav_1", true) 
  35. 		effect_handles[2] = effect_play("CarDamage-Fire", "fr_checkAI_$vehicle_nav_2", true) 
  36. 		effect_handles[3] = effect_play("CarDamage-Fire", "fr_checkAI_$vehicle_nav_3", true) 
  37. 		effect_handles[4] = effect_play("CarDamage-Fire", "fr_checkAI_$vehicle_nav_4", true) 
  38. 		effect_handles[5] = effect_play("CarDamage-Fire", "fr_checkAI_$vehicle_nav_5", true) 
  39. 	end 
  40.  
  41. 	if (framerate_test_should_run_continuously()) then 
  42. 		while (true) do 
  43. 			thread_yield() 
  44. 		end 
  45. 	else 
  46. 		delay(30) 
  47. 		local dump_tag = framerate_get_dump_tag("AI") 
  48. 		dump_fps_tagged(dump_tag) 
  49. 		screenshot(dump_tag) 
  50. 	end 
  51.  
  52. 	-- stop effects 
  53. 	if (framerate_test_should_play_effects()) then 
  54. 		effect_stop(effect_handles[1]) 
  55. 		effect_stop(effect_handles[2]) 
  56. 		effect_stop(effect_handles[3]) 
  57. 		effect_stop(effect_handles[4]) 
  58. 		effect_stop(effect_handles[5]) 
  59. 	end 
  60.  
  61. 	-- despawn groups 
  62. 	group_destroy(GROUP1) 
  63. 	group_destroy(GROUP2) 
  64.  
  65. 	-- end the mission 
  66. 	mission_end_success("fr_checkAI")	 
  67. end 
  68.  
  69. function fr_checkAI_success() 
  70. 	-- Called when the mission has ended with success 
  71. 	release_to_world(GROUP1) 
  72. 	release_to_world(GROUP2) 
  73. end 
  74.