./mm_m16_5.lua

  1. --[[ 
  2. 	mm_m16_5.lua 
  3. 	SR3 Mission Script 
  4. 	DATE: 11/22/2010 
  5. 	AUTHOR:	Jimmy Cross 
  6. ]]-- 
  7.  
  8.  
  9. -- Debug flags -- 
  10.  
  11. -- Tweakable Parameters -- 
  12.  
  13. -- Groups -- 
  14.  
  15. -- Navpoints -- 
  16.  
  17. -- Triggers -- 
  18.  
  19. -- Characters -- 
  20.  
  21. -- Vehicles -- 
  22.  
  23. -- Mesh Movers -- 
  24.  
  25. -- Text -- 
  26.  
  27. -- Threads -- 
  28.  
  29. -- Checkpoints -- 
  30. 	CHECKPOINT_START = MISSION_START_CHECKPOINT			-- defined in ug_lib.lua 
  31. 	 
  32. -- Cutscenes -- 
  33.  
  34. -- Conversations -- 
  35. 	MM_M16_5_convo = { 
  36. 		shaundi_call = { 
  37. 			name = "MM_M16_5_Shaundi_Kidnapped", 
  38. 			handle = INVALID_CONVERSATION_HANDLE, 
  39. 			shaundi_persona_name = "Phone_Call", 
  40. 			shaundi_persona_id = INVALID_PERSONA_HANDLE, 
  41. 		}, 
  42. 	} 
  43. 		 
  44. -- Other -- 
  45.  
  46.  
  47. -- ************************* 
  48. -- 
  49. -- Standard functions 
  50. -- 
  51. -- ************************* 
  52.  
  53. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  54. -- at the specified checkpoint. 
  55. -- CALLED FROM CODE 
  56. -- 
  57. -- mm_m16_5_checkpoint:	The checkpoint the mission should begin at 
  58. -- is_restart:					TRUE if the mission is restarting, FALSE otherwise 
  59. -- 
  60. function mm_m16_5_start(mm_m16_5_checkpoint, is_restart) 
  61. 	-- Check if this mission starting from the beginning 
  62. 	if (mm_m16_5_checkpoint == CHECKPOINT_START) then 
  63. 		if (is_restart == false) then 
  64. 			-- First time playing mission 
  65. 		end 
  66. 		--fade_out(0) 
  67. 	end 
  68.  
  69. 	-- Handle mission initialization for the current checkpoint 
  70. 	mm_m16_5_initialize(mm_m16_5_checkpoint) 
  71.  
  72. 	-- Run the mission from the current checkpoint 
  73. 	mm_m16_5_run(mm_m16_5_checkpoint) 
  74. 	 
  75. end 
  76.  
  77. -- This is the primary function responsible for running the entire mission from start to finish. 
  78. -- 
  79. -- first_checkpoint:	The first checkpoint to begin running the mission at 
  80. -- 
  81. function mm_m16_5_run(first_checkpoint) 
  82. 	audio_persona_load_2d( MM_M16_5_convo.shaundi_call.shaundi_persona_name) 
  83. 	 
  84. 	MM_M16_5_convo.shaundi_call.handle = audio_conversation_load(MM_M16_5_convo.shaundi_call.name) 
  85. 	-- Play the conversation 
  86. 	audio_conversation_play(MM_M16_5_convo.shaundi_call.handle) 
  87.  
  88. 	-- Wait for the conversation to end 
  89. 	audio_conversation_wait_for_end( MM_M16_5_convo.shaundi_call.handle ) 
  90. 	MM_M16_5_convo.shaundi_call.handle = INVALID_CONVERSATION_HANDLE 
  91. 	--[[ 
  92. 	MM_M16_5_convo.shaundi_call.kinzie_persona_id = audio_persona_load_2d( MM_M16_5_convo.shaundi_call.shaundi_persona_name ) 
  93. 	 
  94. 	MM_M16_5_convo.shaundi_call.kinzie_persona_id = audio_persona_load_2d( MM_M16_5_convo.shaundi_call.shaundi_persona_name ) 
  95. 	MM_M16_5_convo.shaundi_call.handle = audio_conversation_load( MM_M16_5_convo.shaundi_call.name ) 
  96.  
  97. 	-- Start the Shaundi phone call 
  98. 	audio_conversation_play( MM_M16_5_convo.shaundi_call.handle ) 
  99. 	 
  100. 	audio_conversation_wait_for_end( MM_M16_5_convo.shaundi_call.handle ) 
  101. 	MM_M16_5_convo.shaundi_call.handle = INVALID_CONVERSATION_HANDLE 
  102. 	audio_persona_remove_2d( MM_M16_5_convo.shaundi_call.kinzie_persona_id ) 
  103. 	MM_M16_5_convo.shaundi_call.kinzie_persona_id = INVALID_PERSONA_HANDLE 
  104. 	]]-- 
  105. 	 
  106. 	mission_set_completed("mm_m16_5") 
  107. 	 
  108. 	--unlock the next mission 
  109. 	--mission_unlock("m17") 
  110. 	 
  111. 	mission_end_silently(false) 
  112. 	 
  113. 	mission_autosave() 
  114. end 
  115.  
  116. -- This is the primary function responsible for cleaning up the entire mission 
  117. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  118. -- 
  119. function mm_m16_5_cleanup() 
  120. 	--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]-- 
  121.  
  122. end 
  123.  
  124. -- Called when the mission has ended with success 
  125. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  126. -- 
  127. function mm_m16_5_success() 
  128. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
  129. 	 
  130. end 
  131.  
  132.  
  133. -- ************************* 
  134. -- 
  135. -- Local functions 
  136. -- 
  137. -- ************************* 
  138.  
  139. -- Initialize the mission for the specified checkpoint 
  140. -- 
  141. -- checkpoint:		Checkpoint to initialize the mission to 
  142. -- 
  143. function mm_m16_5_initialize(checkpoint) 
  144. 	-- Make sure the screen is completly faded out 
  145. 	--mission_start_fade_out(0.0) 
  146.  
  147. 	-- Set the mission author 
  148. 	set_mission_author("Jimmy Cross") 
  149.  
  150. 	-- Common initialization 
  151. 	mm_m16_5_initialize_common() 
  152.  
  153. 	-- Checkpoint specific initialization 
  154. 	mm_m16_5_initialize_checkpoint(checkpoint) 
  155.  
  156. 	-- Start fading in  
  157. 	mission_start_fade_in() 
  158.  
  159. end 
  160.  
  161.  
  162. -- *************************************************** 
  163. -- mm_m16_5_run Helper Functions 
  164. -- *************************************************** 
  165.  
  166.  
  167. -- *************************************************** 
  168. -- mm_m16_5_initialize Helper Functions 
  169. -- *************************************************** 
  170.  
  171. -- Handle any common initialization 
  172. -- 
  173. function mm_m16_5_initialize_common() 
  174. 	--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]-- 
  175. 	 
  176. end 
  177.  
  178. -- Checkpoint specific initialization 
  179. -- 
  180. -- checkpoint:		The checkpoint to be initialized 
  181. function mm_m16_5_initialize_checkpoint(checkpoint) 
  182.  
  183. 	if (checkpoint == CHECKPOINT_START) then 
  184. 		--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]-- 
  185.  
  186. 	end 
  187.  
  188. end 
  189.  
  190.  
  191. -- *************************************************** 
  192. -- Miscellaneous mm_m16_5 Helper Funcrtions 
  193. -- *************************************************** 
  194.  
  195.  
  196. -- ************************* 
  197. -- 
  198. -- Callback functions 
  199. -- 
  200. -- ************************* 
  201.  
  202.  
  203. -- ************************* 
  204. -- 
  205. -- Thread functions 
  206. -- 
  207. -- *************************