./mm_k_01.lua

  1.  
  2. --[[ 
  3. 	MM_K_01.lua 
  4. 	SR3 Mission Script 
  5. 	DATE: 10-29-2010 
  6. 	AUTHOR:	Jimmy Cross 
  7. ]]-- 
  8.  
  9.  
  10. -- Debug flags -- 
  11.  
  12. -- Tweakable Parameters -- 
  13.  
  14. -- Groups -- 
  15.  
  16.  
  17. -- Navpoints -- 
  18. 	MM_K_01_navs = {		 
  19. 		cp_start = { "local_player", "remote_player" } 
  20. 	} 
  21. 	 
  22. -- Triggers -- 
  23. 	MM_K_01_trigger = { 
  24. 		tb = { 
  25. 			name = "TB_trigger", 
  26. 			hit = false 
  27. 		} 
  28. 	} 
  29. 				 
  30. -- Characters -- 
  31.  
  32. -- Vehicles -- 
  33.  
  34. -- Mesh Movers -- 
  35.  
  36. -- Text -- 
  37.  
  38. -- Threads -- 
  39.  
  40. -- Checkpoints -- 
  41. 	MM_K_01_checkpoint = { 
  42. 		start = { 
  43. 			name = MISSION_START_CHECKPOINT, 
  44. 			nav1 = "start_nav 001", 
  45. 			nav2 = "start_nav 002" 
  46. 		} 
  47. 	} 
  48. 	 
  49. -- Cutscenes -- 
  50. MM_K_01_cutscene = { 
  51. 	kinzie_intro = "K_Z01" 
  52. 	--kinzie_intro = "" 
  53. } 
  54. 	CUTSCENE_MISSION_INTRO = "" 
  55. 	CUTSCENE_MISSION_OUTRO = "" 
  56.  
  57. -- Conversations -- 
  58. 	MM_K_01_convo = { 
  59. 		--[[mission_start = { 
  60. 			name = "MM_K_01_convo_1", 
  61. 			handle = INVALID_CONVERSATION_HANDLE 
  62. 		} 
  63. 		]]-- 
  64. 	} 
  65. 		 
  66. -- Other -- 
  67.  
  68.  
  69. -- ************************* 
  70. -- 
  71. -- Standard functions 
  72. -- 
  73. -- ************************* 
  74.  
  75. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  76. -- at the specified checkpoint. 
  77. -- CALLED FROM CODE 
  78. -- 
  79. -- checkpoint:	The checkpoint the mission should begin at 
  80. -- is_restart:					TRUE if the mission is restarting, FALSE otherwise 
  81. -- 
  82. function MM_K_01_start(checkpoint, is_restart) 
  83. 	-- Check if this mission starting from the beginning 
  84. 	if (checkpoint == MM_K_01_checkpoint.start.name) then 
  85. 		if (is_restart == false) then 
  86. 			-- First time playing mission 
  87. 			if (MM_K_01_cutscene.kinzie_intro ~= "") then 
  88. 				zscene_prep( MM_K_01_cutscene.kinzie_intro ) 
  89. 				 
  90. 				while( not zscene_is_loaded(MM_K_01_cutscene.kinzie_intro) ) do 
  91. 					thread_yield() 
  92. 				end 
  93. 				 
  94. 				--cutscene_out() 
  95. 				cutscene_play( MM_K_01_cutscene.kinzie_intro, nil, MM_K_01_navs.cp_start, false ) 
  96. 				--cutscene_in() 
  97. 			else 
  98. 				fade_out( 0.5 ) 
  99. 				fade_out_block() 
  100. 				 
  101. 				delay( 1.5 ) 
  102. 				 
  103. 				fade_in( 0.5 ) 
  104. 				fade_in_block() 
  105. 			end 
  106. 		end 
  107.  
  108. 		mission_end_to_activity("MM_K_01", "_A_TB_NW_01") 
  109. 	end 
  110.  
  111.  
  112. 	-- Handle mission initialization for the current checkpoint 
  113. 	--MM_K_01_initialize(checkpoint) 
  114.  
  115. 	-- Run the mission from the current checkpoint 
  116. 	--MM_K_01_run(checkpoint) 
  117. 	 
  118. end 
  119.  
  120. -- This is the primary function responsible for running the entire mission from start to finish. 
  121. -- 
  122. -- first_checkpoint:	The first checkpoint to begin running the mission at 
  123. -- 
  124. function MM_K_01_run(first_checkpoint) 
  125. 	local current_checkpoint = first_checkpoint 
  126.  
  127. 	-- Run the mission from the beginning 
  128. 	if( current_checkpoint == MM_K_01_checkpoint.start.name  ) then 
  129. 		--[[ INSERT PROCESSING FOR THE FIRST CHECKPOINT HERE ]]-- 
  130. 		 
  131. 		--mission_end_to_activity("MM_K_01", "_A_TB_NW_01") 
  132. 		 
  133. 		--zscene_prep( MM_K_01_cutscene.kinzie_intro ) 
  134. 		--cutscene_in() 
  135. 		--cutscene_play( MM_K_01_cutscene.kinzie_intro, nil, MM_K_01_navs.cp_start, false ) 
  136. 		--cutscene_out() 
  137. 		 
  138. 		-- set GPS to Trail Blazing instance #1 
  139. 		--trigger_enable( MM_K_01_trigger.tb.name, true ) 
  140. 		--waypoint_add( MM_K_01_trigger.tb.name ) -- add GPS marker at the start of the TB activity 
  141. 		--marker_add_trigger( MM_K_01_trigger.tb.name, MINIMAP_ICON_LOCATION, "VFX_TrailBlazingIcon", nil, OI_FLAGS_LOCATION, SYNC_ALL ) 
  142. 		 
  143. 		--on_trigger( "MM_K_01_tb_trigger_cb", MM_K_01_trigger.tb.name ) -- register the callback for the trigger 
  144. 		--objective_text( 0, "MM_K_01_obj_meet_kinzie", "", "", SYNC_ALL ) -- tell the player to meet Kinzie 
  145. 		--objective_text( 0, "MM_K_01_obj_goto_tb", nil, nil, SYNC_ALL, OI_ASSET_LOCATION ) 
  146. 		 
  147. 		--while not MM_K_01_trigger.tb.hit do -- wait for the player to hit the trigger at the TB start point 
  148. 			--thread_yield() 
  149. 		--end  
  150. 		 
  151. 	end 
  152. end 
  153.  
  154. -- This is the primary function responsible for cleaning up the entire mission 
  155. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  156. -- 
  157. function MM_K_01_cleanup() 
  158. 	--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]-- 
  159. 	MM_K_01_clear_trigger( MM_K_01_trigger.tb.name ) 
  160. end 
  161.  
  162. -- Called when the mission has ended with success 
  163. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  164. -- 
  165. function MM_K_01_success() 
  166. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
  167. 	 
  168. end 
  169.  
  170.  
  171. -- ************************* 
  172. -- 
  173. -- Local functions 
  174. -- 
  175. -- ************************* 
  176.  
  177. -- Initialize the mission for the specified checkpoint 
  178. -- 
  179. -- checkpoint:		Checkpoint to initialize the mission to 
  180. -- 
  181. function MM_K_01_initialize(checkpoint) 
  182. 	-- Make sure the screen is completly faded out 
  183. 	mission_start_fade_out(0.0) 
  184.  
  185. 	-- Set the mission author 
  186. 	set_mission_author("Jimmy Cross") 
  187.  
  188. 	-- Common initialization 
  189. 	MM_K_01_initialize_common() 
  190.  
  191. 	-- Checkpoint specific initialization 
  192. 	MM_K_01_initialize_checkpoint(checkpoint) 
  193.  
  194. 	-- Start fading in  
  195. 	mission_start_fade_in() 
  196.  
  197. end 
  198.  
  199.  
  200. -- *************************************************** 
  201. -- MM_K_01_run Helper Functions 
  202. -- *************************************************** 
  203.  
  204.  
  205. -- *************************************************** 
  206. -- MM_K_01_initialize Helper Functions 
  207. -- *************************************************** 
  208.  
  209. -- Handle any common initialization 
  210. -- 
  211. function MM_K_01_initialize_common() 
  212. 	--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]-- 
  213. 	 
  214. end 
  215.  
  216. -- Checkpoint specific initialization 
  217. -- 
  218. -- checkpoint:		The checkpoint to be initialized 
  219. function MM_K_01_initialize_checkpoint(checkpoint) 
  220.  
  221. 	if (checkpoint == MM_K_01_checkpoint.start.name) then 
  222. 		--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]-- 
  223.  
  224. 	end 
  225.  
  226. end 
  227.  
  228.  
  229. -- *************************************************** 
  230. -- Miscellaneous MM_K_01 Helper Functions 
  231. -- *************************************************** 
  232. function MM_K_01_clear_trigger(trigger) 
  233. 	on_trigger( "", trigger ) 
  234. 	trigger_enable( trigger, false ) 
  235. 	marker_remove_trigger( trigger, SYNC_ALL ) 
  236. end 
  237.  
  238. -- ************************* 
  239. -- 
  240. -- Callback functions 
  241. -- 
  242. -- ************************* 
  243.  
  244. -- Trigger callback, used to handle the start of the activity and silent failing of the mission 
  245. -- 
  246. --  
  247. function MM_K_01_tb_trigger_cb() 
  248. 	-- clear the trigger, waypoint, and objective 
  249. 	MM_K_01_trigger.tb.hit = true 
  250. 	MM_K_01_clear_trigger( MM_K_01_trigger.tb.name ) 
  251. 	waypoint_remove() 
  252. 	objective_text_clear(0) -- clear the objective text 
  253. 	 
  254. 	-- activity start triggered 
  255. 	mission_end_to_activity("MM_K_01", "_A_TB_NW_01") 
  256. 	 
  257. end 
  258.  
  259.  
  260. -- ************************* 
  261. -- 
  262. -- Thread functions 
  263. -- 
  264. -- ************************* 
  265.  
  266.