./mm_a_04.lua

  1.  
  2. --[[ 
  3. 	MM_A_04.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_A_04_navs = {		 
  18. 		cp_start = { "local_player", "remote_player" } 
  19. 	} 
  20. 	 
  21. -- Triggers -- 
  22. 	MM_A_04_trigger = { 
  23. 	} 
  24. 				 
  25. -- Characters -- 
  26.  
  27. -- Vehicles -- 
  28.  
  29. -- Mesh Movers -- 
  30.  
  31. -- Text -- 
  32.  
  33. -- Threads -- 
  34.  
  35. -- Checkpoints -- 
  36. 	MM_A_04_checkpoint = { 
  37. 		start = { 
  38. 			name = MISSION_START_CHECKPOINT, 
  39. 			nav1 = "start_nav 001", 
  40. 			nav2 = "start_nav 002" 
  41. 		} 
  42. 	} 
  43. 	 
  44. -- Cutscenes -- 
  45. 	MM_A_04_cutscene = { 
  46. 		angel_outro = "A_Z02" 
  47. 		--angel_outro = "" 
  48. 	} 
  49. 	CUTSCENE_MISSION_INTRO = "" 
  50. 	CUTSCENE_MISSION_OUTRO = "" 
  51.  
  52. -- Conversations -- 
  53. 	MM_A_04_convo = { 
  54. 		--[[mission_start = { 
  55. 			name = "MM_A_04_convo_1", 
  56. 			handle = INVALID_CONVERSATION_HANDLE 
  57. 		} 
  58. 		]]-- 
  59. 	} 
  60. 		 
  61. -- Other -- 
  62.  
  63.  
  64. -- ************************* 
  65. -- 
  66. -- Standard functions 
  67. -- 
  68. -- ************************* 
  69.  
  70. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  71. -- at the specified checkpoint. 
  72. -- CALLED FROM CODE 
  73. -- 
  74. -- checkpoint:	The checkpoint the mission should begin at 
  75. -- is_restart:					TRUE if the mission is restarting, FALSE otherwise 
  76. -- 
  77. function MM_A_04_start(checkpoint, is_restart) 
  78. 	-- Check if this mission starting from the beginning 
  79. 	if (checkpoint == MM_A_04_checkpoint.start.name) then 
  80. 		if (is_restart == false) then 
  81. 			-- First time playing mission 
  82. 			 
  83. 			if( MM_A_04_cutscene.angel_intro ~= "" ) then 
  84. 				--cutscene_out() 
  85. 				--cutscene_play( MM_A_04_cutscene.angel_intro ) 
  86. 				zscene_prep( MM_A_04_cutscene.angel_outro ) 
  87. 				while( not zscene_is_loaded(MM_A_04_cutscene.angel_outro) ) do 
  88. 					thread_yield() 
  89. 				end 
  90.  
  91. 				cutscene_play( MM_A_04_cutscene.angel_outro,  nil, MM_A_04_navs.cp_start, false ) 
  92.  
  93. 				--cutscene_in() 
  94. 			else 
  95. 				fade_out( 0.5 ) 
  96. 				fade_out_block() 
  97.  
  98. 				delay( 1.5 ) 
  99. 				 
  100. 				fade_in( 0.5 ) 
  101. 				fade_in_block() 
  102. 			end 
  103. 		end 
  104. 		fade_out(0) 
  105. 	end 
  106.  
  107.  
  108. 	-- Handle mission initialization for the current checkpoint 
  109. 	MM_A_04_initialize(checkpoint) 
  110.  
  111. 	-- Run the mission from the current checkpoint 
  112. 	MM_A_04_run(checkpoint) 
  113. 	 
  114. end 
  115.  
  116. -- This is the primary function responsible for running the entire mission from start to finish. 
  117. -- 
  118. -- first_checkpoint:	The first checkpoint to begin running the mission at 
  119. -- 
  120. function MM_A_04_run(first_checkpoint) 
  121. 	local current_checkpoint = first_checkpoint 
  122.  
  123. 	-- Run the mission from the beginning 
  124. 	if( current_checkpoint == MM_A_04_checkpoint.start.name  ) then 
  125. 		--[[ INSERT PROCESSING FOR THE FIRST CHECKPOINT HERE ]]-- 
  126. 		--[[ 
  127. 		-- Intro animations 
  128. 		-- Player(s) look cool GO! 
  129. 		local anim_name = "M06 Player Mission Start" 
  130. 		local morph_name = "M06 Player Mission Start" 
  131. 		local force_play = false 
  132. 		local stand_still = false 
  133. 		local zero_movement = false 
  134. 		action_play_non_blocking(LOCAL_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement) 
  135. 		player_script_controlled_clear(LOCAL_PLAYER)	-- let player escape this animation 
  136. 		if (coop_is_active()) then 
  137. 			action_play_non_blocking(REMOTE_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement) 
  138. 			player_script_controlled_clear(REMOTE_PLAYER)	-- let player escape this animation 
  139. 		end 
  140. 		 
  141. 		--delay(3) 
  142. 		while action_play_is_finished( LOCAL_PLAYER, 1.5 ) == false or action_play_is_finished( REMOTE_PLAYER, 1.5 ) == false do 
  143. 			thread_yield() 
  144. 		end 
  145. ]]-- 
  146. 		mission_unlock("_A_RM_SW_01") 
  147. 		mission_unlock("_A_MH_SW_01") 
  148.  
  149. 		mission_set_completed("mm_a_04") 
  150. 		mission_end_silently(false) 
  151. 		mission_autosave() 
  152. 	end 
  153. end 
  154.  
  155. -- This is the primary function responsible for cleaning up the entire mission 
  156. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  157. -- 
  158. function MM_A_04_cleanup() 
  159. 	--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]-- 
  160.  
  161. end 
  162.  
  163. -- Called when the mission has ended with success 
  164. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  165. -- 
  166. function MM_A_04_success() 
  167. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
  168. 	 
  169. end 
  170.  
  171.  
  172. -- ************************* 
  173. -- 
  174. -- Local functions 
  175. -- 
  176. -- ************************* 
  177.  
  178. -- Initialize the mission for the specified checkpoint 
  179. -- 
  180. -- checkpoint:		Checkpoint to initialize the mission to 
  181. -- 
  182. function MM_A_04_initialize(checkpoint) 
  183. 	-- Make sure the screen is completly faded out 
  184. 	mission_start_fade_out(0.0) 
  185.  
  186. 	-- Set the mission author 
  187. 	set_mission_author("Jimmy Cross") 
  188.  
  189. 	-- Common initialization 
  190. 	MM_A_04_initialize_common() 
  191.  
  192. 	-- Checkpoint specific initialization 
  193. 	MM_A_04_initialize_checkpoint(checkpoint) 
  194.  
  195. 	-- Start fading in  
  196. 	mission_start_fade_in() 
  197.  
  198. end 
  199.  
  200.  
  201. -- *************************************************** 
  202. -- MM_A_04_run Helper Functions 
  203. -- *************************************************** 
  204.  
  205.  
  206. -- *************************************************** 
  207. -- MM_A_04_initialize Helper Functions 
  208. -- *************************************************** 
  209.  
  210. -- Handle any common initialization 
  211. -- 
  212. function MM_A_04_initialize_common() 
  213. 	--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]-- 
  214. 	 
  215. end 
  216.  
  217. -- Checkpoint specific initialization 
  218. -- 
  219. -- checkpoint:		The checkpoint to be initialized 
  220. function MM_A_04_initialize_checkpoint(checkpoint) 
  221.  
  222. 	if (checkpoint == MM_A_04_checkpoint.start.name) then 
  223. 		--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]-- 
  224.  
  225. 	end 
  226.  
  227. end 
  228.  
  229.  
  230. -- *************************************************** 
  231. -- Miscellaneous MM_A_04 Helper Funcrtions 
  232. -- *************************************************** 
  233. function MM_A_04_clear_trigger(trigger) 
  234. 	on_trigger( "", trigger ) 
  235. 	trigger_enable( trigger, false ) 
  236. 	marker_remove_trigger( trigger, SYNC_ALL ) 
  237. end 
  238.  
  239. -- ************************* 
  240. -- 
  241. -- Callback functions 
  242. -- 
  243. -- ************************* 
  244.  
  245.  
  246. -- ************************* 
  247. -- 
  248. -- Thread functions 
  249. -- 
  250. -- ************************* 
  251.  
  252.