./msatanflight.lua

  1.  
  2. --[[ USING THE MISSION START TEMPLATE  
  3. 		1.	Read "SR3 Mission Scripting Standards" if you haven't already. 
  4. 		2.	Save this file as "mIntro.lua" in the missions directory. 
  5. 		3.	Replace "mIntro" with the name of your mission (must use the same name as your mission start node). 
  6. 		3a.	Replace "mIntro" with the capitalized name of your mission 
  7. 		4.	Replace "20130821" with today's date. 
  8. 		5.	Replace "hvs" with your name. 
  9. 		6.	Replace "first_checkpoint_nav" with the name of the first location to go to 
  10. 		7.	Replace "fcp with a 3-4 letter abbreviation for the first checkpoint. 
  11. 		8.	Replace "next_checkpoint_nav" with the second checkpoint name (first is named start) 
  12. 		9.	Replace "ncp" with a 3-4 letter abbreviation for the next checkpoint. 
  13. 		10.	If you find an error with this template, fix it and check it in!!!! 
  14. 		11.	Remove these instructions.  You're on your own now! 
  15. ]]-- 
  16.  
  17. --[[ 
  18. 	mIntro.lua 
  19. 	SR3 Mission Script 
  20. 	DATE: 2013-12-09 
  21. 	AUTHOR:	Kevin Tyska 
  22. ]]-- 
  23.  
  24.  
  25. -- Debug flags -- 
  26.  
  27. -- Tweakable Parameters -- 
  28.  
  29. -------------------------------------------------------------------------------------------------- 
  30. 																				--[[ GROUPS ]]-- 
  31. -------------------------------------------------------------------------------------------------- 
  32.  
  33. -------------------------------------------------------------------------------------------------- 
  34. 																				--[[ THREADS ]]-- 
  35. -------------------------------------------------------------------------------------------------- 
  36.  
  37.  
  38. -------------------------------------------------------------------------------------------------- 
  39. 																			--[[ CHECKPOINTS ]]-- 
  40. -------------------------------------------------------------------------------------------------- 
  41. 	mSatanFlight_checkpoint = { 
  42. 		{ 
  43. 			name = MISSION_START_CHECKPOINT,		-- First Checkpoint - go to boss (gtb) 
  44. 			init = "mSatanFlight_gtb_init",				-- init(bool mission_restart) 
  45. 			run = "mSatanFlight_gtb_run",					-- run() 
  46. 			cleanup = "mSatanFlight_gtb_cleanup",			-- cleanup(bool mission_exit) (+++MUST RETURN IMMEDIATELY+++) 
  47. 			next_checkpoint = nil, 
  48. 			host_start = "nav_host", 
  49. 			client_start = "nav_client", 
  50. 			p1_car_nav = "", 
  51. 			p2_car_nav = "", 
  52. 			start_groups = { }, 
  53. 			cp_only_groups = { }, 
  54. 		}, 
  55. 	} 
  56. 	 
  57. -------------------------------------------------------------------------------------------------- 
  58. 																			--[[ CUTSCENES ]]-- 
  59. -------------------------------------------------------------------------------------------------- 
  60.  
  61. 	 
  62. -------------------------------------------------------------------------------------------------- 
  63. 																			--[[ RAIL DATA ]]-- 
  64. -------------------------------------------------------------------------------------------------- 
  65. 	 
  66. 	-- mSatanFlight_rail = { 
  67. 		-- gth_flight_rail = { 
  68. 			-- vehicle = M1_group.gth_demons.vehicle, 
  69. 			-- mission_critical = true, 
  70. 			-- seats = { 
  71. 				-- -- driver and passaner npcs will be added after team slection 
  72. 				-- {character = LOCAL_PLAYER, seat_idx = 2 }, 
  73. 			-- }, 
  74. 			-- coop_seats = { 
  75. 				-- -- driver and passaner npcs will be added after team slection 
  76. 				-- {character = LOCAL_PLAYER, seat_idx = 2 }, 
  77. 				-- {character = REMOTE_PLAYER, seat_idx = 3 }, 
  78. 			-- }, 
  79. 			-- setup = false, 
  80. 		-- } 
  81. 	-- } 
  82.  
  83. -------------------------------------------------------------------------------------------------- 
  84. 																			--[[ CONVERSATIONS ]]-- 
  85. -------------------------------------------------------------------------------------------------- 
  86.  
  87. 	mSatanFlight_convo = { 
  88. 		--[[ = { 
  89. 			name = "file_name without voice (_bm, _wm, _bf...", 
  90. 			player_talks = true or false, 
  91. 			handle = INVALID_CONVERSATION_HANDLE, 
  92. 			convo_thread = INVALID_THREAD_HANDLE, 
  93. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  94. 			timer_thread = INVALID_THREAD_HANDLE, 
  95. 			priority = CONVO_PRIORITY_HIGH or CONVO_PRIORITY_NORMAL or CONVO_PRIORITY_OPTIONAL 
  96. 			(optional) persona_line = true,	-- this is a single line 
  97. 			(required if persona_line) speaker_name = "name of speaker",	-- single line speaker (might be set before call to play is made?) 
  98. 			(optional)phone_call = true,  -- this is a phone conversation (phone persona must be preloaded) 
  99. 			(required if phone_call) receiving_call = true or false  -- auto-answer is always true in missions (until proven otherwise) 
  100. 			 
  101. 		},]] 
  102.  
  103. 	} 
  104. 	 
  105. 	mSatanFlight_convo_queue = { 
  106. 		--[[start_drive_queue = {  
  107. 			{ delay = 2.0, convo = mSatanFlight_convo.goto_first_checkpoint_nav }, 
  108. 			{ delay = 4.0, convo = mSatanFlight_convo.goto_first_checkpoint_nav2 }, 
  109. 			{ delay = 3.0, convo = mSatanFlight_convo.goto_first_checkpoint_nav3 }, 
  110. 			{ delay = 5.0, convo = mSatanFlight_convo.goto_first_checkpoint_nav4 } 
  111. 		}, 
  112. 		]]-- 
  113. 	} 
  114. 	 
  115. -------------------------------------------------------------------------------------------------- 
  116. 																			--[[ TRIGGERS ]]-- 
  117. -------------------------------------------------------------------------------------------------- 
  118. 	mSatanFlight_trigger = { 
  119. 		-- = { 
  120. 		--	name = "_trigger", 
  121. 		--	hit = false, 
  122. 		-- 	last_hit_by = nil, -- 	last_hit_human = nil (set to the last human to enter the trigger in the default trigger callback) 
  123. 		--  (optional)callback = "mSatanFlight_function_name_cb" 
  124. 		--	(optional)marker = TRIGGER_LOCATION or TRIGGER_USE or custom or don't include for no marker 
  125. 		--  (optional)waypoint = true, 
  126. 		--  (optional)teleport_to = { 
  127. 		--						host = "host_nav", 
  128. 		--						client = "client_nav"  
  129. 		--					},		 
  130. 		--	(optional)conversation = mSatanFlight_convo.convo_name  -- play a conversation 
  131. 		--	(optional)next_trigger = "next_trigger_name" sets up next trigger when triggered (breadcrumbs) 
  132. 		--}, 
  133. 		 
  134. 									--[[ first_checkpoint_nav TRIGGERS ]]-- 
  135.  
  136. 		 
  137.  
  138. 	} 
  139. 	 
  140. -------------------------------------------------------------------------------------------------- 
  141. 																	  --[[ INTERROGATION DATA ]]-- 
  142. -------------------------------------------------------------------------------------------------- 
  143. 	--mSatanFlight_interrogate = { 
  144. 	--	leader = { 
  145. 	--		target = mSatanFlight_group.friendly_fire.owner, 
  146. 	--		persona = "Interrogation", 
  147. 	--		objective = "mSatanFlight_INTERROGATE_OWNER", 
  148. 	--	--	(optional)conversation = mSatanFlight_convo.convo_name  -- play a conversation while interrogating 
  149. 	--	}, 
  150. 	--} 
  151.  
  152. -------------------------------------------------------------------------------------------------- 
  153. 																				--[[ VFX ]]-- 
  154. --------------------------------------------------------------------------------------------------	 
  155. mSatanFlight_vfx = { 
  156. 	 
  157. } 
  158.  
  159. 		 
  160. -------------------------------------------------------------------------------------------------- 
  161. 																				   --[[ OTHER ]]-- 
  162. -------------------------------------------------------------------------------------------------- 
  163.  
  164. mSatanFlight_homie = { 
  165. 	kinzie = "", 
  166. } 
  167.  
  168. mSatanFlight_p1_attach = { 
  169. 	demon = "", 
  170. } 
  171.  
  172. mSatanFlight_p2_attach = { 
  173. 	demon = "", 
  174. } 
  175.  
  176. mSatanFlight_runtime = { 
  177. } 
  178.  
  179.  
  180. mSatanFlight_players = {} 
  181.  
  182.  
  183.  
  184. -------------------------------------------------------------------------------------------------- 
  185. 								--[[**********************]]-- 
  186. 								--[[                      ]]-- 
  187. 								--[[  Standard functions  ]]-- 
  188. 								--[[                      ]]-- 
  189. 								--[[**********************]]-- 
  190.  
  191. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  192. -- at the specified checkpoint. 
  193. -- CALLED FROM CODE 
  194. -- 
  195. -- start_checkpoint_name:	(string) The checkpoint the mission should begin at 
  196. -- is_restart:					(bool) TRUE if the mission is restarting, FALSE otherwise 
  197. -- 
  198. function mSatanFlight_start(start_checkpoint_name, is_restart) 
  199. 	--mission_start_fade_out(0.0) 
  200. 	 
  201. 	mission_startup(mSatanFlight_trigger, mSatanFlight_convo) 
  202.  
  203. 	-- Handle mission initialization for the current checkpoint 
  204. 	mSatanFlight_initialize(start_checkpoint_name) 
  205.  
  206. 	-- Run the mission from the current checkpoint 
  207. 	checkpoint_run_mission(mSatanFlight_checkpoint, start_checkpoint_name) 
  208. 	 
  209. 	mission_end_success("mSatanFlight")--, mSatanFlight_scene.outro, {, }) 
  210. 	--mission_set_next_mission( "mFlightTutorial" ) 
  211. end 
  212.  
  213. -- This is the primary function responsible for cleaning up the entire mission 
  214. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++) 
  215. -- 
  216. function mSatanFlight_cleanup() 
  217. 	--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]-- 
  218. 	 
  219. 	-- cleanup all threads 
  220. 	--cleanup_threads(mSatanFlight_thread) 
  221. 	 
  222. 	-- cleanup triggers, convos, kill_list and interrogations 
  223. 	mission_shutdown() 
  224. 	 
  225. 	-- cleanup all groups 
  226. 	--cleanup_groups(mSatanFlight_group) 
  227.  
  228. 	--Make sure no camera scripts are functioning 
  229. 	camera_script_disable() 
  230.  
  231. 	--make sure we're not exploding 
  232. 	continuous_explosion_stop() 
  233.  
  234. 	--make sure health pick ups are on 
  235. 	health_pickups_enable(true) 
  236.  
  237. 	--Make sure camera shake is off 
  238. 	camera_shake_stop() 
  239.  
  240. 	--Make sure vehicles spawn 
  241. 	spawning_vehicles(true)  
  242.  
  243. 	--Ensure player collision is on 
  244. 	character_collision_enable(LOCAL_PLAYER, true) 
  245.  
  246. 	--Make sure this is back on 
  247. 	-- Re-enable warp to shore	 
  248. 	for i, player in pairs( mSatanFlight_players ) do 
  249. 		player_warp_to_shore_enable( player ) 
  250. 	end 
  251.  
  252. 	--camera_set_platforming_mode(false) 
  253.  
  254. end 
  255.  
  256. -- Called when the mission has ended with success 
  257. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++) 
  258. -- 
  259. function mSatanFlight_success() 
  260. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
  261. 	 
  262. end 
  263.  
  264. -------------------------------------------------------------------------------------------------- 
  265. 								--[[**********************]]-- 
  266. 								--[[                      ]]-- 
  267. 								--[[ Initialize functions ]]-- 
  268. 								--[[                      ]]-- 
  269. 								--[[**********************]]-- 
  270.  
  271. -- Initialize the mission for the specified checkpoint 
  272. -- 
  273. -- checkpoint_name:		(string) Checkpoint to initialize the mission to 
  274. -- 
  275. function mSatanFlight_initialize(checkpoint_name) 
  276. 	-- Common initialization 
  277. 	mSatanFlight_initialize_common() 
  278. 	 
  279. 	-- Checkpoint specific initialization 
  280. 	checkpoint_init(mSatanFlight_checkpoint, checkpoint_name) 
  281.  
  282. 	-- Get the player names 
  283. 	mSatanFlight_players = player_names_get_all() 
  284.  
  285. 	-- Start fading in  
  286. 	--mission_start_fade_in() 
  287. end 
  288.  
  289. -- Handle any common initialization 
  290. -- 
  291. function mSatanFlight_initialize_common() 
  292. 	--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]-- 
  293.  
  294. 	--Set up the camera for platforming 
  295. 	--camera_set_platforming_mode(true) 
  296.  
  297. 	--Turn off any and all super powers 
  298.  
  299. end 
  300.  
  301. -- function mSatanFlight_setup_homies( ) 
  302. 	-- if mSatanFlight_groups.homies.kinzie ~= nil and coop_is_active()==false and mSatanFlight_groups.homies.kinzie ~= "" then 
  303. 		 
  304. 		-- if (add_to_party == true) then 
  305. 			-- party_add(mSatanFlight_groups.homies.kinzie, LOCAL_PLAYER) 
  306. 		-- end 
  307. 		 
  308. 		-- on_death("mSatanFlight_failure_kinzie_died_cb", mImpfest_homie.kinzie) 
  309. 		-- on_dismiss("mSatanFlight_failure_dismissed_cb", mImpfest_homie.kinzie) 
  310. 	-- end 
  311.  
  312. 	-- -- the co-op check here to get rid of her 
  313. 	-- if (coop_is_active() == true) then 
  314. 		-- mSatanFlight_cleanup_homies() 
  315. 		-- group_destroy(mSatanFlight_groups.homies.kinzie) 
  316. 	-- end 
  317. -- end 
  318.  
  319. -- -- remove callbacks for homies 
  320. -- -- 
  321. -- function mSatanFlight_cleanup_homies() 
  322. 	-- if mSatanFlight_groups.homies.kinzie ~= nil and coop_is_active()==false then 
  323. 		-- on_death("", mSatanFlight_groups.homies.kinzie) 
  324. 		-- on_dismiss("", mSatanFlight_groups.homies.kinzie) 
  325. 	-- end 
  326. -- end 
  327.  
  328. -------------------------------------------------------------------------------------------------- 
  329. 								--[[**********************]]-- 
  330. 								--[[                      ]]-- 
  331. 								--[[ Checkpoint functions ]]-- 
  332. 								--[[                      ]]-- 
  333. 								--[[**********************]]-- 
  334.  
  335. -------------------------------------------------------------------------------------------------- 
  336. 																	--[[ Go to Boss ]]-- 
  337. -------------------------------------------------------------------------------------------------- 
  338.  
  339. -- Initialize this checkpoint. 
  340. -- 
  341. -- mission_start: (bool) Whether we're initializing from a mission (re)start or from 
  342. --					a natural play-through. 
  343. -- 
  344. function mSatanFlight_gtb_init(mission_start) 
  345. 	 
  346. end 
  347.  
  348. -- The first objective 
  349. -- 
  350. function mSatanFlight_gtb_run() 
  351.  
  352. 	local start_cp = get_table_by_name(mSatanFlight_checkpoint, MISSION_START_CHECKPOINT) 
  353. 	local fade_in_after = true 
  354. 	cutscene_play("Bink_Islands_Completed", nil, {start_cp.host_start, start_cp.client_start}, fade_in_after) 
  355.  
  356. end 
  357.  
  358. -- Do any cleanup for this checkpoint. 
  359. -- 
  360. -- (+++THIS IS CALLED FROM MISSION CLEANUP, MUST RETURN IMMEDIATELY+++) 
  361. -- 
  362. -- mission_exit: (bool) Whether we're exiting the mission entirely, or just 
  363. --					moving on to the next checkpoint. 
  364. -- 
  365. function mSatanFlight_gtb_cleanup(mission_exit) 
  366.  
  367. end 
  368.  
  369. ------------------------------------ 
  370. -- 
  371. -- Checkpoint helper functions 
  372. -- 
  373. ------------------------------------ 
  374.  
  375. ------------------------------------ 
  376. -- 
  377. -- Checkpoint callback functions 
  378. -- 
  379. ------------------------------------ 
  380.  
  381. --  
  382. -------------------------------------------------------------------------------------------------- 
  383. 								--[[**********************]]-- 
  384. 								--[[                      ]]-- 
  385. 								--[[   Common functions   ]]-- 
  386. 								--[[                      ]]-- 
  387. 								--[[**********************]]-- 
  388. 								 
  389.  
  390.  
  391. -------------------------------------------------------------------------------------------------- 
  392. 								--[[**********************]]-- 
  393. 								--[[                      ]]-- 
  394. 								--[[  Callback functions  ]]-- 
  395. 								--[[                      ]]-- 
  396. 								--[[**********************]]-- 
  397.  
  398.  
  399. -------------------------------------------------------------------------------------------------- 
  400. 								--[[**********************]]-- 
  401. 								--[[                      ]]-- 
  402. 								--[[   Thread functions   ]]-- 
  403. 								--[[                      ]]-- 
  404. 								--[[**********************]]-- 
  405.  
  406.  
  407.