./mm_k_06.lua

  1.  
  2. --[[ 
  3. 	MM_K_06.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_K_06_navs = {		 
  18. 		cp_start = { 
  19. 			player_local = "local_player", 
  20. 			player_remote = "remote_player" 
  21. 			} 
  22. 	} 
  23. 	 
  24. -- Triggers -- 
  25. 	MM_K_06_trigger = { 
  26. 		crib = { 
  27. 			name = "KC_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_K_06_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_K_06_cutscene = { 
  53. 	kinzie_outro = "K_Z03" 
  54. 	--kinzie_outro = "" 
  55. } 
  56. 	CUTSCENE_MISSION_INTRO = "" 
  57. 	CUTSCENE_MISSION_OUTRO = "" 
  58.  
  59. -- Conversations -- 
  60. 	MM_K_06_convo = { 
  61. 		kinzie_call = { 
  62. 			name = "MM_K_06_End_Phone_Call", 
  63. 			handle = INVALID_CONVERSATION_HANDLE, 
  64. 			kinzie_persona_name = "Phone_Call", 
  65. 			kinzie_persona_id = INVALID_PERSONA_HANDLE, 
  66. 		}, 
  67. 	} 
  68. 		 
  69. -- Other -- 
  70. Mm_k_06_call_ended = false 
  71.  
  72. -- ************************* 
  73. -- 
  74. -- Standard functions 
  75. -- 
  76. -- ************************* 
  77.  
  78. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  79. -- at the specified checkpoint. 
  80. -- CALLED FROM CODE 
  81. -- 
  82. -- checkpoint:	The checkpoint the mission should begin at 
  83. -- is_restart:					TRUE if the mission is restarting, FALSE otherwise 
  84. -- 
  85. function MM_K_06_start(checkpoint, is_restart) 
  86. 	-- Check if this mission starting from the beginning 
  87. 	if (checkpoint == MM_K_06_checkpoint.start.name) then 
  88. 		if (is_restart == false) then 
  89. 			-- First time playing mission 
  90. 			 
  91. 		end 
  92. 		--fade_out(0) 
  93. 	end 
  94.  
  95.  
  96. 	-- Handle mission initialization for the current checkpoint 
  97. 	MM_K_06_initialize(checkpoint) 
  98.  
  99. 	-- Run the mission from the current checkpoint 
  100. 	MM_K_06_run(checkpoint) 
  101. 	 
  102. end 
  103.  
  104. -- This is the primary function responsible for running the entire mission from start to finish. 
  105. -- 
  106. -- first_checkpoint:	The first checkpoint to begin running the mission at 
  107. -- 
  108. function MM_K_06_run(first_checkpoint) 
  109. 	Mm_k_06_call_ended = false 
  110. 	MM_K_06_convo.kinzie_call.persona_id = audio_persona_load_2d( MM_K_06_convo.kinzie_call.kinzie_persona_name) 
  111.  
  112. 	-- Play the conversation 
  113. 	audio_play_for_mission_cellphone( MM_K_06_convo.kinzie_call.name, true, true, "", "mm_k_06_end_call") 
  114. 	 
  115. 	while not Mm_k_06_call_ended do 
  116. 		thread_yield() 
  117. 	end 
  118.  
  119. 	mission_set_completed("mm_k_06") 
  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_K_06_cleanup() 
  129. 	--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]-- 
  130. 	 
  131. 	audio_remove_mission_cellphone(MM_K_06_convo.kinzie_call.name)	 
  132. 	 
  133. 	if (MM_K_06_convo.kinzie_call.persona_id ~= INVALID_PERSONA_HANDLE) then 
  134. 		audio_persona_remove_2d(MM_K_06_convo.kinzie_call.persona_id) 
  135. 		MM_K_06_convo.kinzie_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_K_06_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_K_06_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_K_06_initialize_common() 
  167.  
  168. 	-- Checkpoint specific initialization 
  169. 	MM_K_06_initialize_checkpoint(checkpoint) 
  170.  
  171. 	-- Start fading in  
  172. 	mission_start_fade_in() 
  173.  
  174. end 
  175.  
  176.  
  177. -- *************************************************** 
  178. -- MM_K_06_run Helper Functions 
  179. -- *************************************************** 
  180.  
  181.  
  182. -- *************************************************** 
  183. -- MM_K_06_initialize Helper Functions 
  184. -- *************************************************** 
  185.  
  186. -- Handle any common initialization 
  187. -- 
  188. function MM_K_06_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_K_06_initialize_checkpoint(checkpoint) 
  197.  
  198. 	if (checkpoint == MM_K_06_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_K_06 Helper Functions 
  208. -- *************************************************** 
  209. function MM_K_06_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_K_06_kc_trigger_cb() 
  226. 	-- clear the trigger, waypoint, and objective 
  227. 	MM_K_06_trigger.crib.hit = true 
  228. 	MM_K_06_clear_trigger( MM_K_06_trigger.crib.name ) 
  229. 	waypoint_remove() 
  230. 	objective_text_clear(0) -- clear the objective text 
  231. end 
  232.  
  233.  
  234.  
  235. function mm_k_06_end_call() 
  236. 	Mm_k_06_call_ended = true 
  237. end 
  238.  
  239. -- ************************* 
  240. -- 
  241. -- Thread functions 
  242. -- 
  243. -- ************************* 
  244.  
  245.