./mm_a_05.lua

  1.  
  2. --[[ 
  3. 	MM_A_05.lua 
  4. 	SR3 Mission Script 
  5. 	DATE: 11-15-2010 
  6. 	AUTHOR:	Jimmy Cross 
  7. ]]-- 
  8.  
  9.  
  10. -- Debug flags -- 
  11.  
  12. -- Tweakable Parameters -- 
  13.  
  14. -- Groups -- 
  15.  
  16. -- Navpoints -- 
  17. 	MM_A_05_navs = {		 
  18. 		cp_start = { 
  19. 			player_local = "local_player", 
  20. 			player_remote = "remote_player" 
  21. 			} 
  22. 	} 
  23. 	 
  24. -- Triggers -- 
  25. 	MM_A_05_trigger = { 
  26. 		casino = { 
  27. 			name = "AC_trigger", 
  28. 			hit = false 
  29. 		} 
  30. 	} 
  31. 				 
  32. -- Characters -- 
  33.  
  34. -- Vehicles -- 
  35.  
  36. -- Mesh Movers -- 
  37.  
  38. -- Text -- 
  39.  
  40. -- Threads -- 
  41.  
  42. -- Checkpoints -- 
  43. 	MM_A_05_checkpoint = { 
  44. 		start = { 
  45. 			name = MISSION_START_CHECKPOINT, 
  46. 			nav1 = "start_nav 001", 
  47. 			nav2 = "start_nav 002" 
  48. 		} 
  49. 	} 
  50. 	 
  51. -- Cutscenes -- 
  52. 	MM_A_05_cutscene = { 
  53. 		angel_outro = "A_Z03" 
  54. 		--angel_outro = "" 
  55. 	} 
  56. 	CUTSCENE_MISSION_INTRO = "" 
  57. 	CUTSCENE_MISSION_OUTRO = "" 
  58.  
  59. -- Conversations -- 
  60. 	MM_A_05_convo = { 
  61. 		angel_call = { 
  62. 			name = "MM_A_05_End_Phone_Call", 
  63. 			handle = INVALID_CONVERSATION_HANDLE, 
  64. 			angel_persona_name = "Phone_Call", 
  65. 			angel_persona_id = INVALID_PERSONA_HANDLE, 
  66. 		}, 
  67. 	} 
  68. 		 
  69. -- Other -- 
  70. Mm_a_05_call_ended = false 
  71.  
  72.  
  73. -- ************************* 
  74. -- 
  75. -- Standard functions 
  76. -- 
  77. -- ************************* 
  78.  
  79. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  80. -- at the specified checkpoint. 
  81. -- CALLED FROM CODE 
  82. -- 
  83. -- checkpoint:	The checkpoint the mission should begin at 
  84. -- is_restart:					TRUE if the mission is restarting, FALSE otherwise 
  85. -- 
  86. function MM_A_05_start(checkpoint, is_restart) 
  87. 	-- Check if this mission starting from the beginning 
  88. 	if (checkpoint == MM_A_05_checkpoint.start.name) then 
  89. 		if (is_restart == false) then 
  90. 			-- First time playing mission 
  91. 					 
  92. 		end 
  93. 		--fade_out(0) 
  94. 	end 
  95.  
  96.  
  97. 	-- Handle mission initialization for the current checkpoint 
  98. 	MM_A_05_initialize(checkpoint) 
  99.  
  100. 	-- Run the mission from the current checkpoint 
  101. 	MM_A_05_run(checkpoint) 
  102. 	 
  103. end 
  104.  
  105. -- This is the primary function responsible for running the entire mission from start to finish. 
  106. -- 
  107. -- first_checkpoint:	The first checkpoint to begin running the mission at 
  108. -- 
  109. function MM_A_05_run(first_checkpoint) 
  110. 	Mm_a_05_call_ended = false 
  111. 	MM_A_05_convo.angel_call.persona_id = audio_persona_load_2d( MM_A_05_convo.angel_call.angel_persona_name) 
  112. 	-- Play the conversation 
  113. 	--audio_conversation_play(MM_A_05_convo.angel_call.handle) 
  114. 	audio_play_for_mission_cellphone( MM_A_05_convo.angel_call.name, true, true, "", "mm_a_05_end_call") 
  115. 	 
  116. 	while not Mm_a_05_call_ended do 
  117. 		thread_yield() 
  118. 	end 
  119. 	 
  120. 	mission_set_completed("MM_A_05") 
  121. 	mission_end_silently(false) 
  122. 	mission_autosave() 
  123.  
  124. end 
  125.  
  126. -- This is the primary function responsible for cleaning up the entire mission 
  127. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  128. -- 
  129. function MM_A_05_cleanup() 
  130. 	--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]-- 
  131. 	 
  132. 	audio_remove_mission_cellphone(MM_A_05_convo.angel_call.name)	 
  133. 	 
  134. 	if (MM_A_05_convo.angel_call.persona_id ~= INVALID_PERSONA_HANDLE) then 
  135. 		audio_persona_remove_2d(MM_A_05_convo.angel_call.persona_id) 
  136. 		MM_A_05_convo.angel_call.persona_id = INVALID_PERSONA_HANDLE 
  137. 	end 
  138. end 
  139.  
  140. -- Called when the mission has ended with success 
  141. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  142. -- 
  143. function MM_A_05_success() 
  144. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
  145. 	 
  146. end 
  147.  
  148.  
  149. -- ************************* 
  150. -- 
  151. -- Local functions 
  152. -- 
  153. -- ************************* 
  154.  
  155. -- Initialize the mission for the specified checkpoint 
  156. -- 
  157. -- checkpoint:		Checkpoint to initialize the mission to 
  158. -- 
  159. function MM_A_05_initialize(checkpoint) 
  160. 	-- Make sure the screen is completly faded out 
  161. 	--mission_start_fade_out(0.0) 
  162.  
  163. 	-- Set the mission author 
  164. 	set_mission_author("Jimmy Cross") 
  165.  
  166. 	-- Common initialization 
  167. 	MM_A_05_initialize_common() 
  168.  
  169. 	-- Checkpoint specific initialization 
  170. 	MM_A_05_initialize_checkpoint(checkpoint) 
  171.  
  172. 	-- Start fading in  
  173. 	mission_start_fade_in() 
  174.  
  175. end 
  176.  
  177.  
  178. -- *************************************************** 
  179. -- MM_A_05_run Helper Functions 
  180. -- *************************************************** 
  181.  
  182.  
  183. -- *************************************************** 
  184. -- MM_A_05_initialize Helper Functions 
  185. -- *************************************************** 
  186.  
  187. -- Handle any common initialization 
  188. -- 
  189. function MM_A_05_initialize_common() 
  190. 	--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]-- 
  191. 	 
  192. end 
  193.  
  194. -- Checkpoint specific initialization 
  195. -- 
  196. -- checkpoint:		The checkpoint to be initialized 
  197. function MM_A_05_initialize_checkpoint(checkpoint) 
  198.  
  199. 	if (checkpoint == MM_A_05_checkpoint.start.name) then 
  200. 		--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]-- 
  201.  
  202. 	end 
  203.  
  204. end 
  205.  
  206.  
  207. -- *************************************************** 
  208. -- Miscellaneous MM_A_05 Helper Funcrtions 
  209. -- *************************************************** 
  210. function MM_A_05_clear_trigger(trigger) 
  211. 	on_trigger( "", trigger ) 
  212. 	trigger_enable( trigger, false ) 
  213. 	marker_remove_trigger( trigger, SYNC_ALL ) 
  214. end 
  215.  
  216. -- ************************* 
  217. -- 
  218. -- Callback functions 
  219. -- 
  220. -- ************************* 
  221.  
  222. -- Trigger callback, used to handle the start of the activity and silent failing of the mission 
  223. -- 
  224. --  
  225.  
  226. function MM_A_05_ac_trigger_cb() 
  227. 	-- clear the trigger, waypoint, and objective 
  228. 	MM_A_05_trigger.casino.hit = true 
  229. 	MM_A_05_clear_trigger( MM_A_05_trigger.casino.name ) 
  230. 	waypoint_remove() 
  231. 	objective_text_clear(0) -- clear the objective text 
  232. end 
  233.  
  234.  
  235. function mm_a_05_end_call() 
  236. 	Mm_a_05_call_ended = true 
  237. end 
  238.  
  239. -- ************************* 
  240. -- 
  241. -- Thread functions 
  242. -- 
  243. -- ************************* 
  244.  
  245.