./mm_p_07.lua

  1. --[[ 
  2. 	mm_p_07.lua 
  3. 	SR3 Mission Script 
  4. 	DATE: 11-15-2010 
  5. 	AUTHOR:	Jimmy Cross 
  6. ]]-- 
  7.  
  8.  
  9. -- Debug flags -- 
  10.  
  11. -- Tweakable Parameters -- 
  12. 	MM_P_07_PIERCE_TRIGGER_DIST = 4.0 -- distance at which to start the Zscene ("close", by definition of the spec) 
  13. 	MM_P_07_PIERCE_SPAWN_DIST = 200.0 
  14. 	 
  15. -- Groups -- 
  16.  
  17. 	MM_P_07_group = { 
  18.  
  19. 	} 
  20.  
  21. -- Navpoints -- 
  22. 	MM_P_07_navs = { 
  23. 		hq = "MM_P_07_Nav_Saints_HQ", 
  24. 		cp_start = { "local_player", "remote_player"	} 
  25. 	} 
  26.  
  27. -- Triggers -- 
  28.  
  29. 		 
  30. -- Characters --. 
  31. 	MM_P_07_char = { 
  32. 		--pierce = "NPC Pierce" 
  33. 	} 
  34.  
  35. -- Vehicles -- 
  36.  
  37. -- Mesh Movers -- 
  38.  
  39. -- Text -- 
  40.  
  41. -- Threads -- 
  42.  
  43. -- Checkpoints -- 
  44. 	MM_P_07_checkpoint = { 
  45. 		start = { 
  46. 			name = MISSION_START_CHECKPOINT, 
  47. 			nav1 = "start_nav 001", 
  48. 			nav2 = "start_nav 002" 
  49. 		} 
  50. 	} 
  51. 	 
  52. -- Cutscenes -- 
  53. MM_P_07_cutscene = { 
  54. 		pierce_outro = "P_Z03" 
  55. 	} 
  56. 	CUTSCENE_MISSION_INTRO = "" 
  57. 	CUTSCENE_MISSION_OUTRO = "" 
  58.  
  59. -- Conversations -- 
  60. 	MM_P_07_convo = { 
  61. 		pierce_call = { 
  62. 			name = "MM_P_07_End_Phone_Call", 
  63. 			handle = INVALID_CONVERSATION_HANDLE, 
  64. 			pierce_persona_name = "Phone_Call", 
  65. 			pierce_persona_id = INVALID_PERSONA_HANDLE, 
  66. 		} 
  67. 	} 
  68. 		 
  69. -- Other -- 
  70.  
  71. 	Mm_p_07_call_ended = false 
  72.  
  73. -- ************************* 
  74. -- 
  75. -- Standard functions 
  76. -- 
  77. -- ************************* 
  78.  
  79. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  80. -- at the specified checkpoint. 
  81. -- CALLED FROM CODE 
  82. -- 
  83. -- checkpoint:	The checkpoint the mission should begin at 
  84. -- is_restart:	TRUE if the mission is restarting, FALSE otherwise 
  85. -- 
  86. function mm_p_07_start(checkpoint, is_restart) 
  87. 	-- Check if this mission starting from the beginning 
  88. 	if (checkpoint == MM_P_07_checkpoint.start.name) then 
  89. 		if (is_restart == false) then 
  90. 			-- First time playing mission 
  91. 			 
  92. 		end 
  93. 		--fade_out(0) 
  94. 	end 
  95.  
  96. 	-- Handle mission initialization for the current checkpoint 
  97. 	mm_p_07_initialize(checkpoint) 
  98.  
  99. 	-- Run the mission from the current checkpoint 
  100. 	mm_p_07_run(checkpoint) 
  101. 	 
  102. end 
  103.  
  104. -- This is the primary function responsible for running the entire mission from start to finish. 
  105. -- 
  106. -- first_checkpoint:	The first checkpoint to begin running the mission at 
  107. -- 
  108. function mm_p_07_run(first_checkpoint) 
  109. 	Mm_p_07_call_ended = false 
  110. 	MM_P_07_convo.pierce_call.persona_id = audio_persona_load_2d( MM_P_07_convo.pierce_call.pierce_persona_name) 
  111. 	 
  112. 	-- Play the conversation 
  113. 	audio_play_for_mission_cellphone( MM_P_07_convo.pierce_call.name, true, true, "", "mm_p_07_end_call") 
  114. 	 
  115. 	while not Mm_p_07_call_ended do 
  116. 		thread_yield() 
  117. 	end 
  118. 	 
  119. 	mission_set_completed("mm_p_07") 
  120. 	mission_end_silently(false) 
  121. 	mission_autosave() 
  122. 	 
  123. end 
  124.  
  125. -- This is the primary function responsible for cleaning up the entire mission 
  126. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  127. -- 
  128. function mm_p_07_cleanup() 
  129. 	--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]-- 
  130. 	--group_destroy( MM_P_07_group.npcs.name ) 
  131. 	 
  132. 	audio_remove_mission_cellphone(MM_P_07_convo.pierce_call.name)	 
  133. 	 
  134. 	if (MM_P_07_convo.pierce_call.persona_id ~= INVALID_PERSONA_HANDLE) then 
  135. 		audio_persona_remove_2d(MM_P_07_convo.pierce_call.persona_id) 
  136. 		MM_P_07_convo.pierce_call.persona_id = INVALID_PERSONA_HANDLE 
  137. 	end 
  138. end 
  139.  
  140. -- Called when the mission has ended with success 
  141. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  142. -- 
  143. function mm_p_07_success() 
  144. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
  145. 	 
  146. end 
  147.  
  148.  
  149. -- ************************* 
  150. -- 
  151. -- Local functions 
  152. -- 
  153. -- ************************* 
  154.  
  155. -- Initialize the mission for the specified checkpoint 
  156. -- 
  157. -- checkpoint:		Checkpoint to initialize the mission to 
  158. -- 
  159. function mm_p_07_initialize(checkpoint) 
  160. 	-- Make sure the screen is completly faded out 
  161. 	--mission_start_fade_out(0.0) 
  162.  
  163. 	-- Set the mission author 
  164. 	set_mission_author("Jimmy Cross") 
  165.  
  166. 	-- Common initialization 
  167. 	mm_p_07_initialize_common() 
  168.  
  169. 	-- Checkpoint specific initialization 
  170. 	mm_p_07_initialize_checkpoint(checkpoint) 
  171.  
  172. 	-- Start fading in  
  173. 	mission_start_fade_in() 
  174.  
  175. end 
  176.  
  177. -- Getting the player to the Saints HQ 
  178. -- 
  179. -- 
  180. function mm_p_07_go_to_saints_hq() 
  181. 	-- set GPS to Saints HQ 
  182. 	waypoint_add( MM_P_07_navs.hq ) -- add GPS marker at Saints HQ 
  183. 	marker_add( MM_P_07_navs.hq, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION ) 
  184. 	objective_text( 0, "mm_p_07_obj_meet_pierce", nil, nil, SYNC_ALL, OI_ASSET_LOCATION ) 
  185. 	 
  186. end 
  187.  
  188. -- *************************************************** 
  189. -- mm_p_07_run Helper Functions 
  190. -- *************************************************** 
  191.  
  192.  
  193. -- *************************************************** 
  194. -- mm_p_07_initialize Helper Functions 
  195. -- *************************************************** 
  196.  
  197. -- Handle any common initialization 
  198. -- 
  199. function mm_p_07_initialize_common() 
  200. 	--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]-- 
  201. 	 
  202. end 
  203.  
  204. -- Checkpoint specific initialization 
  205. -- 
  206. -- checkpoint:		The checkpoint to be initialized 
  207. function mm_p_07_initialize_checkpoint(checkpoint) 
  208.  
  209. 	if (checkpoint == MM_P_07_checkpoint.start.name) then 
  210. 		--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]-- 
  211.  
  212. 	end 
  213.  
  214. end 
  215.  
  216.  
  217. -- *************************************************** 
  218. -- Miscellaneous mm_p_07 Helper Funcrtions 
  219. -- *************************************************** 
  220.  
  221.  
  222. -- ************************* 
  223. -- 
  224. -- Callback functions 
  225. -- 
  226. -- ************************* 
  227.  
  228. function mm_p_07_end_call() 
  229. 	Mm_p_07_call_ended = true 
  230. end 
  231.  
  232. -- ************************* 
  233. -- 
  234. -- Thread functions 
  235. -- 
  236. -- ************************* 
  237.  
  238.