./mm_z_05.lua

  1.  
  2. --[[ 
  3. 	MM_Z_05.lua 
  4. 	SR3 Mission Script 
  5. 	DATE: 11-12-2010 
  6. 	AUTHOR:	Jimmy Cross 
  7. ]]-- 
  8.  
  9.  
  10. -- Debug flags -- 
  11.  
  12. -- Tweakable Parameters -- 
  13.  
  14. -- Groups -- 
  15.  
  16. -- Navpoints -- 
  17. 	MM_Z_05_navs = {		 
  18. 		cp_start = { 
  19. 			player_local = "local_player", 
  20. 			player_remote = "remote_player" 
  21. 			} 
  22. 	} 
  23. 	 
  24. -- Triggers -- 
  25. 	MM_Z_05_trigger = { 
  26. 		crib = { 
  27. 			name = "ZC_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_Z_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_Z_05_cutscene = { 
  53. 	zimos_outro = "Z_Z03" 
  54. 	--zimos_outro = "" 
  55. } 
  56. 	CUTSCENE_MISSION_INTRO = "" 
  57. 	CUTSCENE_MISSION_OUTRO = "" 
  58.  
  59. -- Conversations -- 
  60. 	MM_Z_05_convo = { 
  61. 		zimos_call = { 
  62. 			name = "MM_Z_05_End_Phone_Call", 
  63. 			handle = INVALID_CONVERSATION_HANDLE, 
  64. 			zimos_persona_name = "Phone_Call", 
  65. 			zimos_persona_id = INVALID_PERSONA_HANDLE, 
  66. 		}, 
  67. 	} 
  68. -- Other -- 
  69. local call_ended = false 
  70.  
  71. -- ************************* 
  72. -- 
  73. -- Standard functions 
  74. -- 
  75. -- ************************* 
  76.  
  77. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  78. -- at the specified checkpoint. 
  79. -- CALLED FROM CODE 
  80. -- 
  81. -- checkpoint:	The checkpoint the mission should begin at 
  82. -- is_restart:					TRUE if the mission is restarting, FALSE otherwise 
  83. -- 
  84. function MM_Z_05_start(checkpoint, is_restart) 
  85. 	-- Check if this mission starting from the beginning 
  86. 	if (checkpoint == MM_Z_05_checkpoint.start.name) then 
  87. 		if (is_restart == false) then 
  88. 			-- First time playing mission 
  89. 		end	 
  90. 		 
  91. 		MM_Z_05_convo.zimos_call.zimos_persona_id = audio_persona_load_2d( MM_Z_05_convo.zimos_call.zimos_persona_name) 
  92.  
  93. 		-- Play the conversation 
  94. 		audio_play_for_mission_cellphone( MM_Z_05_convo.zimos_call.name, true, true, "", "mm_z_05_end_call") 
  95. 		--fade_out(0) 
  96. 	end 
  97.  
  98.  
  99. 	-- Handle mission initialization for the current checkpoint 
  100. 	MM_Z_05_initialize(checkpoint) 
  101.  
  102. 	-- Run the mission from the current checkpoint 
  103. 	MM_Z_05_run(checkpoint) 
  104. 	 
  105. end 
  106.  
  107. -- This is the primary function responsible for running the entire mission from start to finish. 
  108. -- 
  109. -- first_checkpoint:	The first checkpoint to begin running the mission at 
  110. -- 
  111. function MM_Z_05_run(first_checkpoint) 
  112.  
  113. 	while call_ended == false do 
  114. 		thread_yield() 
  115. 	end 
  116. 	 
  117. 	message("mission complete!!!", 17) 
  118. 	 
  119. 	mission_set_completed("mm_z_05") 
  120. 	mission_end_silently(false) 
  121. 	mission_autosave() 
  122. 	 
  123. end 
  124.  
  125. -- This is the primary function responsible for cleaning up the entire mission 
  126. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  127. -- 
  128. function MM_Z_05_cleanup() 
  129. 	--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--	 
  130. 	 
  131. 	audio_remove_mission_cellphone(MM_Z_05_convo.zimos_call.name)	 
  132. 	 
  133. 	if (MM_Z_05_convo.zimos_call.persona_id ~= INVALID_PERSONA_HANDLE) then 
  134. 		audio_persona_remove_2d(MM_Z_05_convo.zimos_call.persona_id) 
  135. 		MM_Z_05_convo.zimos_call.persona_id = INVALID_PERSONA_HANDLE 
  136. 	end 
  137. end 
  138.  
  139. -- Called when the mission has ended with success 
  140. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  141. -- 
  142. function MM_Z_05_success() 
  143. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
  144. 	 
  145. end 
  146.  
  147.  
  148. -- ************************* 
  149. -- 
  150. -- Local functions 
  151. -- 
  152. -- ************************* 
  153.  
  154. -- Initialize the mission for the specified checkpoint 
  155. -- 
  156. -- checkpoint:		Checkpoint to initialize the mission to 
  157. -- 
  158. function MM_Z_05_initialize(checkpoint) 
  159. 	-- Make sure the screen is completly faded out 
  160. 	--mission_start_fade_out(0.0) 
  161.  
  162. 	-- Set the mission author 
  163. 	set_mission_author("Jimmy Cross") 
  164.  
  165. 	-- Common initialization 
  166. 	MM_Z_05_initialize_common() 
  167.  
  168. 	-- Checkpoint specific initialization 
  169. 	MM_Z_05_initialize_checkpoint(checkpoint) 
  170.  
  171. 	-- Start fading in  
  172. 	mission_start_fade_in() 
  173.  
  174. end 
  175.  
  176.  
  177. -- *************************************************** 
  178. -- MM_Z_05_run Helper Functions 
  179. -- *************************************************** 
  180.  
  181.  
  182. -- *************************************************** 
  183. -- MM_Z_05_initialize Helper Functions 
  184. -- *************************************************** 
  185.  
  186. -- Handle any common initialization 
  187. -- 
  188. function MM_Z_05_initialize_common() 
  189. 	--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]-- 
  190. 	 
  191. end 
  192.  
  193. -- Checkpoint specific initialization 
  194. -- 
  195. -- checkpoint:		The checkpoint to be initialized 
  196. function MM_Z_05_initialize_checkpoint(checkpoint) 
  197.  
  198. 	if (checkpoint == MM_Z_05_checkpoint.start.name) then 
  199. 		--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]-- 
  200.  
  201. 	end 
  202.  
  203. end 
  204.  
  205.  
  206. -- *************************************************** 
  207. -- Miscellaneous MM_Z_05 Helper Funcrtions 
  208. -- *************************************************** 
  209. function MM_Z_05_clear_trigger(trigger) 
  210. 	on_trigger( "", trigger ) 
  211. 	trigger_enable( trigger, false ) 
  212. 	marker_remove_trigger( trigger, SYNC_ALL ) 
  213. end 
  214.  
  215. -- ************************* 
  216. -- 
  217. -- Callback functions 
  218. -- 
  219. -- ************************* 
  220.  
  221. -- Trigger callback, used to handle the start of the activity and silent failing of the mission 
  222. -- 
  223. --  
  224.  
  225. function MM_Z_05_zc_trigger_cb() 
  226. 	-- clear the trigger, waypoint, and objective 
  227. 	MM_Z_05_trigger.crib.hit = true 
  228. 	MM_Z_05_clear_trigger( MM_Z_05_trigger.crib.name ) 
  229. 	waypoint_remove() 
  230. 	objective_text_clear(0) -- clear the objective text 
  231. end 
  232.  
  233. function mm_z_05_end_call() 
  234. 	call_ended = true 
  235. end 
  236.  
  237. -- ************************* 
  238. -- 
  239. -- Thread functions 
  240. -- 
  241. -- ************************* 
  242.  
  243.