./mm_k_05.lua

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