./mm_z_04.lua

  1.  
  2. --[[ 
  3. 	MM_Z_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_Z_04_navs = {		 
  18. 		cp_start = { "local_player", "remote_player" } 
  19. 	} 
  20. 	 
  21. -- Triggers -- 
  22. 	MM_Z_04_trigger = { 
  23.  
  24. 	} 
  25. 				 
  26. -- Characters -- 
  27.  
  28. -- Vehicles -- 
  29.  
  30. -- Mesh Movers -- 
  31.  
  32. -- Text -- 
  33.  
  34. -- Threads -- 
  35.  
  36. -- Checkpoints -- 
  37. 	MM_Z_04_checkpoint = { 
  38. 		start = { 
  39. 			name = MISSION_START_CHECKPOINT, 
  40. 			nav1 = "start_nav 001", 
  41. 			nav2 = "start_nav 002" 
  42. 		} 
  43. 	} 
  44. 	 
  45. -- Cutscenes -- 
  46. MM_Z_04_cutscene = { 
  47. 	zimos_outro = "Z_Z02" 
  48. 	--zimos_outro = "" 
  49. } 
  50. 	CUTSCENE_MISSION_INTRO = "" 
  51. 	CUTSCENE_MISSION_OUTRO = "" 
  52.  
  53. -- Conversations -- 
  54. 	MM_Z_04_convo = { 
  55. 		--[[mission_start = { 
  56. 			name = "MM_Z_04_convo_1", 
  57. 			handle = INVALID_CONVERSATION_HANDLE 
  58. 		} 
  59. 		]]-- 
  60. 	} 
  61. 		 
  62. -- Other -- 
  63.  
  64.  
  65. -- ************************* 
  66. -- 
  67. -- Standard functions 
  68. -- 
  69. -- ************************* 
  70.  
  71. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  72. -- at the specified checkpoint. 
  73. -- CALLED FROM CODE 
  74. -- 
  75. -- checkpoint:	The checkpoint the mission should begin at 
  76. -- is_restart:					TRUE if the mission is restarting, FALSE otherwise 
  77. -- 
  78. function MM_Z_04_start(checkpoint, is_restart) 
  79. 	-- Check if this mission starting from the beginning 
  80. 	if (checkpoint == MM_Z_04_checkpoint.start.name) then 
  81. 		if (is_restart == false) then 
  82. 			-- First time playing mission 
  83. 			 
  84. 			if( MM_Z_04_cutscene.zimos_outro ~= "" ) then 
  85. 			--cutscene_in() 
  86. 			--cutscene_play( MM_Z_04_cutscene.zimos_outro ) 
  87. 			zscene_prep( MM_Z_04_cutscene.zimos_outro ) 
  88. 			while( not zscene_is_loaded(MM_Z_04_cutscene.zimos_outro) ) do 
  89. 				thread_yield() 
  90. 			end 
  91. 			cutscene_play( MM_Z_04_cutscene.zimos_outro,  nil, MM_Z_04_navs.cp_start, false ) 
  92. 			--fade_out( 0.5 ) 
  93. 			--fade_out_block() 
  94. 			--teleport_coop( MM_Z_04_navs.cp_start.player_local, MM_Z_04_navs.cp_start.player_remote, true ) 
  95. 			--bink_play( MM_Z_04_cutscene.zimos_outro ) 
  96. 			--fade_in( 0.5 ) 
  97. 			--fade_in_block() 
  98. 			--cutscene_out() 
  99. 			end 
  100. 		end 
  101.  
  102. 		fade_out(0) 
  103. 	end 
  104.  
  105.  
  106. 	-- Handle mission initialization for the current checkpoint 
  107. 	MM_Z_04_initialize(checkpoint) 
  108.  
  109. 	-- Run the mission from the current checkpoint 
  110. 	MM_Z_04_run(checkpoint) 
  111. 	 
  112. end 
  113.  
  114. -- This is the primary function responsible for running the entire mission from start to finish. 
  115. -- 
  116. -- first_checkpoint:	The first checkpoint to begin running the mission at 
  117. -- 
  118. function MM_Z_04_run(first_checkpoint) 
  119. 	local current_checkpoint = first_checkpoint 
  120.  
  121. 	-- Run the mission from the beginning 
  122. 	if( current_checkpoint == MM_Z_04_checkpoint.start.name  ) then 
  123. 		--[[ INSERT PROCESSING FOR THE FIRST CHECKPOINT HERE ]]-- 
  124. 	--[[ 
  125. 		-- Intro animations 
  126. 		-- Player(s) look cool GO! 
  127. 		local anim_name = "M06 Player Mission Start" 
  128. 		local morph_name = "M06 Player Mission Start" 
  129. 		local force_play = false 
  130. 		local stand_still = false 
  131. 		local zero_movement = false 
  132. 		action_play_non_blocking(LOCAL_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement) 
  133. 		player_script_controlled_clear(LOCAL_PLAYER)	-- let player escape this animation 
  134. 		if (coop_is_active()) then 
  135. 			action_play_non_blocking(REMOTE_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement) 
  136. 			player_script_controlled_clear(REMOTE_PLAYER)	-- let player escape this animation 
  137. 		end 
  138. 		 
  139. 		--delay(3) 
  140. 		--while action_play_is_finished( LOCAL_PLAYER, 1.0 ) == false or action_play_is_finished( REMOTE_PLAYER, 1.0 ) == false do 
  141. 			--thread_yield() 
  142. 		--end 
  143. 		while action_sequence_is_playing() == true do 
  144. 			thread_yield() 
  145. 		end 
  146. 		]]-- 
  147. 		mission_unlock("_A_TM_NE_01") 
  148. 		 
  149. 		mission_set_completed("mm_z_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_Z_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_Z_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_Z_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_Z_04_initialize_common() 
  191.  
  192. 	-- Checkpoint specific initialization 
  193. 	MM_Z_04_initialize_checkpoint(checkpoint) 
  194.  
  195. 	-- Start fading in  
  196. 	mission_start_fade_in() 
  197.  
  198. end 
  199.  
  200.  
  201. -- *************************************************** 
  202. -- MM_Z_04_run Helper Functions 
  203. -- *************************************************** 
  204.  
  205.  
  206. -- *************************************************** 
  207. -- MM_Z_04_initialize Helper Functions 
  208. -- *************************************************** 
  209.  
  210. -- Handle any common initialization 
  211. -- 
  212. function MM_Z_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_Z_04_initialize_checkpoint(checkpoint) 
  221.  
  222. 	if (checkpoint == MM_Z_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_Z_04 Helper Funcrtions 
  232. -- *************************************************** 
  233. function MM_Z_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. -- Thread functions 
  248. -- 
  249. -- ************************* 
  250.  
  251.