./mmblasttutorial.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 "mmBlastTutorial.lua" in the missions directory. 
  5. 		3.	Replace "mmBlastTutorial" with the name of your mission (must use the same name as your mission start node). 
  6. 		3a.	Replace "mmBlastTutorial" with the capitalized name of your mission 
  7. 		4.	Replace "3-3-2014" with today's date. 
  8. 		5.	Replace "Arturo Mata" with your name. 
  9. 		6.	Replace "Ultor" 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 "" with the second checkpoint name (first is named start) 
  12. 		9.	Replace "" with a 3-4 letter abbreviation for the next checkpoint.succes 
  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. 	mmBlastTutorial.lua 
  19. 	SR3 Mission Script 
  20. 	DATE: 3-3-2014 
  21. 	AUTHOR:	Arturo Mata 
  22. ]]-- 
  23.  
  24.  
  25. -- Debug flags -- 
  26.  
  27. -- Tweakable Parameters -- 
  28.  
  29. -------------------------------------------------------------------------------------------------- 
  30. 																				--[[ GROUPS ]]-- 
  31. -------------------------------------------------------------------------------------------------- 
  32. 	mmBlastTutorial_group = { 
  33. 		--[[ startup GROUPS ]]--	 
  34. 		wave_1 =  
  35. 		{ 
  36. 			name = "wave_1", 
  37. 			members =  
  38. 			{ 
  39. 				"Demon_Grunt<001>", 
  40. 			},		 
  41.  
  42. 			coop_name = "coop_wave_1", 
  43. 			coop_only_members = 
  44. 			{ 
  45. 				"Demon_Grunt<002>", 
  46. 			}, 
  47.  
  48. 			damage_threads = { }, 
  49. 		}, 
  50.  
  51.  
  52.  
  53. 		wave_2 =  
  54. 		{ 
  55. 			name = "wave_2", 
  56. 			members =  
  57. 			{ 
  58. 				"Demon_Grunt<003>", 
  59. 				"Demon_Grunt<004>",	 
  60. 				"Demon_Grunt<005>", 
  61. 			}, 
  62. 			 
  63.  
  64.  
  65. 			coop_name = "coop_wave_2", 
  66. 			coop_only_members = 
  67. 			{ 
  68. 				"Demon_Grunt<006>",	 
  69. 				"Demon_Grunt<007>", 
  70. 				"Demon_Grunt<008>",	 
  71. 			}, 
  72.  
  73. 			damage_threads = { }, 
  74. 		}, 
  75. 		 
  76. 		wave_3 =  
  77. 		{ 
  78. 			name = "wave_3", 
  79. 			members =  
  80. 			{ 
  81. 				"Demon_Grunt<009>", 
  82. 				"Demon_Grunt<010>", 
  83. 				"Demon_Grunt<011>", 
  84. 				"Demon_Grunt<012>", 
  85. 				"Demon_Grunt<013>", 
  86. 				"Demon_Grunt<014>", 
  87. 			}, 
  88.  
  89. 			coop_name = "coop_wave_3", 
  90. 			coop_only_members = 
  91. 			{ 
  92. 				"Demon_Grunt<015>", 
  93. 				"Demon_Grunt<016>", 
  94. 				"Demon_Grunt<017>", 
  95. 				"Demon_Grunt<018>", 
  96. 				"Demon_Grunt<019>", 
  97. 				"Demon_Grunt<020>",		 
  98. 			}, 
  99.  
  100. 			damage_threads = { }, 
  101. 		}, 
  102. 		wave_4 =  
  103. 		{ 
  104. 			name = "wave_4", 
  105. 			members =  
  106. 			{ 
  107. 				"Winged_Militia<001>", 
  108. 			}, 
  109. 				destination_1 = "Winged_Militia_Dest<001>",		 
  110. 				destination_2 = "Winged_Militia_Dest<002>",		 
  111. 				coop_name = "coop_wave_4", 
  112. 			coop_only_members = 
  113. 			{ 
  114. 				"Winged_Militia<002>", 
  115. 			}, 
  116. 						 
  117. 			damage_threads = { }, 
  118. 		}, 
  119. 		wave_5 =  
  120. 		{ 
  121. 			name = "wave_5", 
  122. 			members =  
  123. 			{ 
  124. 				"Winged_Militia<003>", 
  125. 				"Winged_Militia<004>", 
  126. 				"Winged_Militia<005>", 
  127. 			}, 
  128. 				destination_3 = "Winged_Militia_Dest<003>",		 
  129. 				destination_4 = "Winged_Militia_Dest<004>",	 
  130. 				destination_5 = "Winged_Militia_Dest<005>",		 
  131. 				destination_6 = "Winged_Militia_Dest<006>",		 
  132. 				destination_7 = "Winged_Militia_Dest<007>",					 
  133. 				coop_name = "coop_wave_5", 
  134. 			coop_only_members = 
  135. 			{ 
  136. 				"Winged_Militia<006>", 
  137. 				"Winged_Militia<007>",	 
  138. 			}, 
  139. 						 
  140. 			damage_threads = { }, 
  141. 		},	 
  142. 		wave_6 =  
  143. 		{ 
  144. 			name = "wave_6", 
  145. 			members =  
  146. 			{ 
  147. 				"Dark_Inciter<001>", 
  148. 			}, 
  149. 			destination_8 = "Respawn_Navpoint_inciter<001>",		 
  150. 			destination_9 = "Respawn_Navpoint_inciter<002>",		 
  151. 			coop_name = "coop_wave_6", 
  152. 			coop_only_members = 
  153. 			{ 
  154. 				"Dark_Inciter<002>"		 
  155. 			}, 
  156. 						 
  157. 			damage_threads = { }, 
  158. 		}, 
  159. 		--[[  GROUPS ]]-- 
  160. 	} 
  161.  
  162. mmBlastTutorial_respawn_points =  
  163. { 
  164. 	-- wave_1 
  165. 	[ "Demon_Grunt<001>" ] = "Respawn_Navpoint<001>", 
  166. 	[ "Demon_Grunt<002>" ] = "Respawn_Navpoint<002>", 
  167. 	-- wave_2 
  168. 	[ "Demon_Grunt<003>" ] = "Respawn_Navpoint<003>", 
  169. 	[ "Demon_Grunt<004>" ] = "Respawn_Navpoint<004>", 
  170. 	[ "Demon_Grunt<005>" ] = "Respawn_Navpoint<005>", 
  171. 	[ "Demon_Grunt<006>" ] = "Respawn_Navpoint<006>", 
  172. 	[ "Demon_Grunt<007>" ] = "Respawn_Navpoint<007>", 
  173. 	[ "Demon_Grunt<008>" ] = "Respawn_Navpoint<008>", 
  174. 	-- wave_3 
  175. 	[ "Demon_Grunt<009>" ] = "Respawn_Navpoint<009>", 
  176. 	[ "Demon_Grunt<010>" ] = "Respawn_Navpoint<010>", 
  177. 	[ "Demon_Grunt<011>" ] = "Respawn_Navpoint<011>", 
  178. 	[ "Demon_Grunt<012>" ] = "Respawn_Navpoint<012>", 
  179. 	[ "Demon_Grunt<013>" ] = "Respawn_Navpoint<013>", 
  180. 	[ "Demon_Grunt<014>" ] = "Respawn_Navpoint<014>", 
  181. 	[ "Demon_Grunt<015>" ] = "Respawn_Navpoint<015>", 
  182. 	[ "Demon_Grunt<016>" ] = "Respawn_Navpoint<016>", 
  183. 	[ "Demon_Grunt<017>" ] = "Respawn_Navpoint<017>", 
  184. 	[ "Demon_Grunt<018>" ] = "Respawn_Navpoint<018>", 
  185. 	[ "Demon_Grunt<019>" ] = "Respawn_Navpoint<019>", 
  186. 	[ "Demon_Grunt<020>" ] = "Respawn_Navpoint<020>", 
  187.  
  188. 	-- wave_4 
  189. 	[ "Winged_Militia<001>" ] = "Respawn_Navpoint_winged<001>", 
  190. 	[ "Winged_Militia<002>" ] = "Respawn_Navpoint_winged<002>", 
  191. 	-- wave_5 
  192. 	[ "Winged_Militia<003>" ] = "Respawn_Navpoint_winged<003>", 
  193. 	[ "Winged_Militia<004>" ] = "Respawn_Navpoint_winged<004>", 
  194. 	[ "Winged_Militia<005>" ] = "Respawn_Navpoint_winged<005>", 
  195. 	[ "Winged_Militia<006>" ] = "Respawn_Navpoint_winged<006>", 
  196. 	[ "Winged_Militia<007>" ] = "Respawn_Navpoint_winged<007>", 
  197. 	-- wave_6 
  198. 	[ "Dark_Inciter<001>" ] = "Respawn_Navpoint_inciter<001>", 
  199. 	[ "Dark_Inciter<002>" ] = "Respawn_Navpoint_inciter<002>", 
  200. } 
  201.  
  202. -------------------------------------------------------------------------------------------------- 
  203. 																				--[[ THREADS ]]-- 
  204. -------------------------------------------------------------------------------------------------- 
  205. 	mmBlastTutorial_thread = { 
  206. 		-- = INVALID_THREAD_HANDLE, 
  207. 		lava_trigger_threads = { INVALID_THREAD_HANDLE, INVALID_THREAD_HANDLE }, 
  208. 	} 
  209.  
  210. 	 
  211. -------------------------------------------------------------------------------------------------- 
  212. 																				--[[ EFFECTS ]]-- 
  213. -------------------------------------------------------------------------------------------------- 
  214. 	mmBlastTutorial_effects = { 
  215. 		respawn_effect = "Vfx Hell Teleport 01<001>", 
  216. 	} 
  217.  
  218. 	 
  219. -------------------------------------------------------------------------------------------------- 
  220. 																			--[[ CHECKPOINTS ]]-- 
  221. -------------------------------------------------------------------------------------------------- 
  222. 	mmBlastTutorial_checkpoint = { 
  223. 		{ 
  224. 			name = MISSION_START_CHECKPOINT,		-- First Checkpoint (fcp) 
  225. 			init = "mmBlastTutorial_fcp_init",				-- init(bool mission_restart) 
  226. 			run = "mmBlastTutorial_fcp_run",					-- run() 
  227. 			cleanup = "mmBlastTutorial_fcp_cleanup",			-- cleanup(bool mission_exit) (+++MUST RETURN IMMEDIATELY+++) 
  228. 			--next_checkpoint = "mmBlastTutorial_", 
  229. 			next_checkpoint = nil, 
  230. 			host_start = "Player_start_nav_host", 
  231. 			client_start = "Player_start_nav_client", 
  232. 			p1_car_nav = "", 
  233. 			p2_car_nav = "", 
  234. 			start_groups = { }, 
  235. 			cp_only_groups = { }, 
  236. 		}, 
  237. 	} 
  238. 	 
  239. -------------------------------------------------------------------------------------------------- 
  240. 																			--[[ CUTSCENES ]]-- 
  241. -------------------------------------------------------------------------------------------------- 
  242. 	mmBlastTutorial_scene = { 
  243. 		intro = "", 
  244. 		outro = "" 
  245. 	} 
  246.  
  247. -------------------------------------------------------------------------------------------------- 
  248. 																			--[[ CONVERSATIONS ]]-- 
  249. -------------------------------------------------------------------------------------------------- 
  250.  
  251. 	mmBlastTutorial_persona = {  
  252. 		Kiki = { 
  253. 			persona_name = "KIKI", 
  254. 			persona_id = INVALID_PERSONA_HANDLE 
  255. 		}, 
  256. 		Viola = { 
  257. 			persona_name = "SUKO", 
  258. 			persona_id = INVALID_PERSONA_HANDLE 
  259. 		}, 
  260. 	} 
  261.  
  262.  
  263.  
  264. 	mmBlastTutorial_convo = { 
  265. 		--[[ = { 
  266. 			name = "file_name without voice (_bm, _wm, _bf...", 
  267. 			player_talks = true or false, 
  268. 			handle = INVALID_CONVERSATION_HANDLE, 
  269. 			convo_thread = INVALID_THREAD_HANDLE, 
  270. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  271. 			timer_thread = INVALID_THREAD_HANDLE, 
  272. 			priority = CONVO_PRIORITY_HIGH or CONVO_PRIORITY_NORMAL or CONVO_PRIORITY_OPTIONAL 
  273. 			(optional) persona_line = true,	-- this is a single line 
  274. 			(required if persona_line) speaker_name = "name of speaker",	-- single line speaker (might be set before call to play is made?) 
  275. 			(optional)phone_call = true,  -- this is a phone conversation (phone persona must be preloaded) 
  276. 			(required if phone_call) receiving_call = true or false  -- auto-answer is always true in missions (until proven otherwise) 
  277. 			 
  278. 		},]] 
  279.  
  280. 		-- Welcome�to�the�Inferno�room.�A�place�we�are�free�to�experiment.�Now�lets�test out your�Stone�Blast power. Try turning these�demons�to�stone�then�use�your�pistol�to�shatter�them. 
  281. 		intro = { 
  282. 			name = "mmblasttutorial_intro", 
  283. 			player_talks = false, 
  284. 			handle = INVALID_CONVERSATION_HANDLE, 
  285. 			convo_thread = INVALID_THREAD_HANDLE, 
  286. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  287. 			timer_thread = INVALID_THREAD_HANDLE, 
  288. 			priority = CONVO_PRIORITY_HIGH, 
  289. 		}, 
  290. 		-- So go ahead and blast these�demons�to turn them to�stone! Then�use�your�pistol�to�shatter�them into lots of little bits. 
  291. 		wave = { 
  292. 			name = "mmBlastTutorial_wave", 
  293. 			player_talks = false, 
  294. 			handle = INVALID_CONVERSATION_HANDLE, 
  295. 			convo_thread = INVALID_THREAD_HANDLE, 
  296. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  297. 			timer_thread = INVALID_THREAD_HANDLE, 
  298. 			priority = CONVO_PRIORITY_HIGH, 
  299. 		}, 
  300. 		-- Exquisite.�I�think�you'll�find�the�power�particularly�useful�against�flying�demons,�like�this�one. 
  301. 		flying = { 
  302. 			name = "mmBlastTutorial_flying", 
  303. 			player_talks = false, 
  304. 			handle = INVALID_CONVERSATION_HANDLE, 
  305. 			convo_thread = INVALID_THREAD_HANDLE, 
  306. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  307. 			timer_thread = INVALID_THREAD_HANDLE, 
  308. 			priority = CONVO_PRIORITY_HIGH, 
  309. 		}, 
  310.  
  311. 		-- Nicely,�done.�Let's�see�you�drop�a�few�more. 
  312. 		more_flying = { 
  313. 			name = "mmBlastTutorial_flying_more", 
  314. 			player_talks = false, 
  315. 			handle = INVALID_CONVERSATION_HANDLE, 
  316. 			convo_thread = INVALID_THREAD_HANDLE, 
  317. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  318. 			timer_thread = INVALID_THREAD_HANDLE, 
  319. 			priority = CONVO_PRIORITY_HIGH, 
  320. 		}, 
  321.  
  322. 		-- Blast�powers�also�deactivate�enemy�shields.�Use�the�blast�to�take�out�the�shield�on�a�Dark�Inciter�then�give�it�a�face�full�of�bullets! 
  323. 		inciter = { 
  324. 			name = "mmBlastTutorial_dark_inciter", 
  325. 			player_talks = false, 
  326. 			handle = INVALID_CONVERSATION_HANDLE, 
  327. 			convo_thread = INVALID_THREAD_HANDLE, 
  328. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  329. 			timer_thread = INVALID_THREAD_HANDLE, 
  330. 			priority = CONVO_PRIORITY_HIGH, 
  331. 		}, 
  332. 		-- Didn�t�doubt�you�for�a�second.�Weird�saying�this,�but�that�halo�fits�you�nicely. 
  333. 		success = { 
  334. 			name = "mmBlastTutorial_success", 
  335. 			player_talks = false, 
  336. 			handle = INVALID_CONVERSATION_HANDLE, 
  337. 			convo_thread = INVALID_THREAD_HANDLE, 
  338. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  339. 			timer_thread = INVALID_THREAD_HANDLE, 
  340. 			priority = CONVO_PRIORITY_HIGH, 
  341. 		}, 
  342. 		-- I�know�it's�fun�to�blast�these�things�back�to...�hell,�but�you�will�need�to�use�Stone�Blast�first�to�complete�this�exercise. 
  343. 		chide = { 
  344. 			name = "mmBlastTutorial_chide", 
  345. 			player_talks = false, 
  346. 			handle = INVALID_CONVERSATION_HANDLE, 
  347. 			convo_thread = INVALID_THREAD_HANDLE, 
  348. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  349. 			timer_thread = INVALID_THREAD_HANDLE, 
  350. 			priority = CONVO_PRIORITY_HIGH, 
  351. 		}, 
  352.  
  353.  
  354. 	} 
  355. 	 
  356. 	mmBlastTutorial_convo_queue = { 
  357. 		--[[start_drive_queue = {  
  358. 			{ delay = 2.0, convo = mmBlastTutorial_convo.goto_Ultor }, 
  359. 			{ delay = 4.0, convo = mmBlastTutorial_convo.goto_Ultor2 }, 
  360. 			{ delay = 3.0, convo = mmBlastTutorial_convo.goto_Ultor3 }, 
  361. 			{ delay = 5.0, convo = mmBlastTutorial_convo.goto_Ultor4 } 
  362. 		}, 
  363. 		]]-- 
  364. 	} 
  365. 	 
  366. -------------------------------------------------------------------------------------------------- 
  367. 																			--[[ TRIGGERS ]]-- 
  368. -------------------------------------------------------------------------------------------------- 
  369. 	mTutorial_trigger = { 
  370. 		-- = { 
  371. 		--	name = "_trigger", 
  372. 		--	hit = false, 
  373. 		-- 	last_hit_by = nil, -- 	last```````````r`r_hit_human = nil (set to the last human to enter the trigger in the default trigger callback) 
  374. 		--  (optional)callback = "mmBlastTutorial_function_name_cb" 
  375. 		--	(optional)marker = TRIGGER_LOCATION or TRIGGER_USE or custom or don't include for no marker 
  376. 		--  (optional)waypoint = true, 
  377. 		--  (optional)teleport_to = { 
  378. 		--						host = "host_nav", 
  379. 		--						client = "client_nav"  
  380. 		--					},		 
  381. 		--	(optional)conversation = mmBlastTutorial_convo.convo_name  -- play a conversation 
  382. 		--	(optional)next_trigger = "next_trigger_name" sets up next trigger when triggered (breadcrumbs) 
  383. 		--}, 
  384. 		 
  385. 									--[[ Ultor TRIGGERS ]]-- 
  386. 		 
  387. 	--[[ Lava TRIGGERS ]]-- 
  388. 									 
  389. 			lava_trigger =  
  390. 			{ 
  391. 				name = "lava_trigger", 
  392. 				callback = "mmTutorial_lava_trigger_callback", 
  393. 			}, 
  394.  
  395.  
  396.  
  397. 									--[[  TRIGGERS ]]--	 
  398.  
  399.  
  400. 	} 
  401. 	 
  402. -------------------------------------------------------------------------------------------------- 
  403. 																	  --[[ INTERROGATION DATA ]]-- 
  404. -------------------------------------------------------------------------------------------------- 
  405. 	--mmBlastTutorial_interrogate = { 
  406. 	--	leader = { 
  407. 	--		target = mmBlastTutorial_group.friendly_fire.owner, 
  408. 	--		persona = "Interrogation", 
  409. 	--		objective = "mmBlastTutorial_INTERROGATE_OWNER", 
  410. 	--	--	(optional)conversation = mmBlastTutorial_convo.convo_name  -- play a conversation while interrogating 
  411. 	--	}, 
  412. 	--} 
  413. 		 
  414. -------------------------------------------------------------------------------------------------- 
  415. 																				   --[[ OTHER ]]-- 
  416. -------------------------------------------------------------------------------------------------- 
  417.  
  418. 	mmBlast_runtime =  
  419. 	{ 
  420. 		bPersonaLoaded = false, 
  421. 	} 
  422. --mmBlastTutorial_PowerEquipped_Local = false 
  423. --mmBlastTutorial_PowerEquipped_Remote = false 
  424. SUPERPOWER_BLAST = 3 
  425. PLAYER_SUPERPOWER_BLAST_STONE = 9 
  426. mmBlastTutorial_CurrentActiveEnemies = 0 
  427.  
  428. -------------------------------------------------------------------------------------------------- 
  429. 								--[[**********************]]-- 
  430. 								--[[                      ]]-- 
  431. 								--[[  Standard functions  ]]-- 
  432. 								--[[                      ]]-- 
  433. 								--[[**********************]]-- 
  434.  
  435. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  436. -- at the specified checkpoint. 
  437. -- CALLED FROM CODE 
  438. -- 
  439. -- start_checkpoint_name:	(string) The checkpoint the mission should begin at 
  440. -- is_restart:					(bool) TRUE if the mission is restarting, FALSE otherwise 
  441. -- 
  442. function mmBlastTutorial_start(start_checkpoint_name, is_restart) 
  443. 	mission_start_fade_out(0.0) 
  444. 	 
  445. 	disable_diversions(true) 
  446. 	ui_hud_set_current_challenge(-1) 
  447. 	 
  448. 	-- turn off all pickup drops 
  449. 	health_pickups_enable(false) 
  450. 	human_all_stop_dropping_weapons(true) 
  451. 	human_all_stop_dropping_cash(true) 
  452. 	 
  453. 	-- Swap to the training facility. 
  454. 	city_zone_swap( "u_train", true ) 
  455. 	set_ped_override_density(.1) 
  456. 	set_traffic_density(.1) 
  457. 	parking_spot_disable_all(true) 
  458. 	-- initialize systems 
  459. 	mission_startup(mTutorial_trigger, mmBlastTutorial_convo) -- mmBlastTutorial_checkpoint 
  460. 	-- if using interrogations 
  461. 	--interrogate_startup(mmBlastTutorial_interrogate) 
  462. 	 
  463. 	local start_cp = get_table_by_name(mmBlastTutorial_checkpoint, MISSION_START_CHECKPOINT) 
  464.  
  465. 	-- Check if this mission starting from the beginning 
  466. 	if (start_checkpoint_name == start_cp.name) then 
  467. 		if (is_restart == false and mmBlastTutorial_scene.intro ~= "") then 
  468. 			-- First time playing mission 
  469. 			local fade_in_after = false 
  470. 			cutscene_play(mmBlastTutorial_scene.intro, nil, {start_cp.host_start, start_cp.client_start}, fade_in_after) 
  471. 		else 
  472. 			teleport_coop(start_cp.host_start, start_cp.client_start, true) 
  473. 		end 
  474. 		fade_out(0) 
  475. 	end 
  476.  
  477. 	-- Handle mission initialization for the current checkpoint 
  478. 	mmBlastTutorial_initialize(start_checkpoint_name) 
  479.  
  480. 	-- Run the mission from the current checkpoint 
  481. 	checkpoint_run_mission(mmBlastTutorial_checkpoint, start_checkpoint_name) 
  482. 	 
  483. 	mission_end_success("mmBlastTutorial", nil, { "player_end_nav_client", "player_end_nav_host" } ) -- mmBlastTutorial_scene.outro, {, }) 
  484. end 
  485.  
  486. -- This is the primary function responsible for cleaning up the entire mission 
  487. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++) 
  488. -- 
  489. function mmBlastTutorial_cleanup() 
  490. 	--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]-- 
  491. 	 
  492. 	city_zone_swap( "u_train", false, true )		 
  493.  
  494.  
  495. 	-- Re-enable all superpowers and weapon radial 
  496. 	local enable = true 
  497. 	player_super_attacks_enable( enable, "Stomp" ) 
  498. 	player_super_attacks_enable( enable, "Aura" ) 
  499. 	player_super_attacks_enable( enable, "Summon" ) 
  500. 	player_super_power_lock_to_tutorial_element( false ) 
  501. 	hud_inventory_disable( false ) 
  502. 	player_super_power_set_regen_scalar_buff(1.0) 
  503. 	npc_respawn_dist_reset() 
  504.  
  505. 	hud_prompt_clear() 
  506. 	 
  507. 	set_ped_override_density(-1) 
  508. 	set_traffic_density(1) 
  509. 	parking_spot_disable_all(false) 
  510.  
  511. 	disable_diversions(false) 
  512. 	ui_hud_set_current_challenge(-2) 
  513.  
  514. 	-- cleanup all threads 
  515. 	cleanup_threads(mmBlastTutorial_thread) 
  516. 	 
  517. 	-- run checkpoint cleanups (move into mission_shutdown?) 
  518. 	checkpoint_cleanup_mission(mmBlastTutorial_checkpoint) 
  519. 	 
  520. 	-- cleanup triggers, convos, kill_list and interrogations 
  521. 	mission_shutdown() 
  522. 	 
  523. 	-- cleanup all groups 
  524. 	cleanup_groups(mmBlastTutorial_group) 
  525. 	 
  526. 	-- turn back on pickup drops 
  527. 	health_pickups_enable(true) 
  528. 	human_all_stop_dropping_weapons(false) 
  529. 	human_all_stop_dropping_cash(false) 
  530.  
  531.  
  532. 	--ensure warp to shore is back on 
  533. 	player_warp_to_shore_enable( LOCAL_PLAYER ) 
  534. 	if coop_is_active() == true then 
  535. 		player_warp_to_shore_enable( REMOTE_PLAYER ) 
  536. 	end 
  537. 	 
  538. 	--fade_out_block() 
  539. 	--	delay(1.5) 
  540. 	--	city_zone_swap( "u_train", false ) 
  541. 		-- teleport the player 
  542. 	--	teleport_coop("player_end_nav_host", "player_end_nav_client", true) 
  543. 	--	delay(3.0) 
  544. 	--fade_in_block() 
  545. end 
  546.  
  547. -- Called when the mission has ended with success 
  548. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++) 
  549. -- 
  550. function mmBlastTutorial_success() 
  551. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
  552. 	 
  553. end 
  554.  
  555. -------------------------------------------------------------------------------------------------- 
  556. 								--[[**********************]]-- 
  557. 								--[[                      ]]-- 
  558. 								--[[ Initialize functions ]]-- 
  559. 								--[[                      ]]-- 
  560. 								--[[**********************]]-- 
  561.  
  562. -- Initialize the mission for the specified checkpoint 
  563. -- 
  564. -- checkpoint_name:		(string) Checkpoint to initialize the mission to 
  565. -- 
  566. function mmBlastTutorial_initialize(checkpoint_name) 
  567. 	-- Common initialization 
  568. 	mmBlastTutorial_initialize_common() 
  569. 	 
  570. 	-- Checkpoint specific initialization 
  571. 	checkpoint_init(mmBlastTutorial_checkpoint, checkpoint_name) 
  572.  
  573. 	-- Setup the lava trigger 
  574. 	trigger_setup( mTutorial_trigger.lava_trigger ) 
  575.  
  576. 	-- Remove any present subtitles 
  577. 	message_remove_all() 
  578.  
  579. 	-- Start fading in  
  580. 	mission_start_fade_in() 
  581. 		audio_object_post_event( "Play_BlastTutorialMusic" ) 
  582. end 
  583.  
  584. -- Handle any common initialization 
  585. -- 
  586. function mmBlastTutorial_initialize_common() 
  587. 	--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]-- 
  588. 	waypoint_remove() 
  589. 	mission_set_cancel_warp_location("player_end_nav_host", "player_end_nav_client") 
  590.  
  591. 	if mmBlast_runtime.bPersonaLoaded == false then 
  592. 		load_persona(mmBlastTutorial_persona.Kiki) 
  593. 		load_persona(mmBlastTutorial_persona.Viola) 
  594. 		mmBlast_runtime.bPersonaLoaded = true 
  595. 	end  
  596.  
  597. 	-- Enable superpower stuffs 
  598. 	player_super_movement_enable( true ) 
  599. 	player_super_attacks_enable( true ) 
  600. 	 
  601. 	-- Disable all superpowers and weapon radial 
  602. 	local enable = false 
  603. 	player_super_attacks_enable( enable, "Stomp" ) 
  604. 	player_super_attacks_enable( enable, "Aura" ) 
  605. 	player_super_attacks_enable( enable, "Summon" ) 
  606. 	player_super_power_lock_to_tutorial_element( true, "blast_stone", SYNC_ALL ) 
  607. 	player_super_power_select( "Blast", SYNC_ALL, "blast_stone" )	 
  608. 	hud_inventory_disable( true ) 
  609.  
  610. end 
  611.  
  612. -------------------------------------------------------------------------------------------------- 
  613. 								--[[**********************]]-- 
  614. 								--[[                      ]]-- 
  615. 								--[[ Checkpoint functions ]]-- 
  616. 								--[[                      ]]-- 
  617. 								--[[**********************]]-- 
  618.  
  619. -------------------------------------------------------------------------------------------------- 
  620. 																	--[[ First Checkpoint Name ]]-- 
  621. -------------------------------------------------------------------------------------------------- 
  622.  
  623. -- Initialize this checkpoint. 
  624. -- 
  625. -- mission_start: (bool) Whether we're initializing from a mission (re)start or from 
  626. --					a natural play-through. 
  627. -- 
  628. function mmBlastTutorial_fcp_init(mission_start) 
  629.  
  630.  
  631. 	-- Set up the players as invulnerable 
  632. 	turn_invulnerable( LOCAL_PLAYER ) 
  633. 	if coop_is_active() == true then 
  634. 		turn_invulnerable( REMOTE_PLAYER ) 
  635. 	end 
  636.  
  637. 	-- Disable warp to shore 
  638. 	player_warp_to_shore_disable( LOCAL_PLAYER ) 
  639. 	if coop_is_active() == true then 
  640. 		player_warp_to_shore_disable( REMOTE_PLAYER ) 
  641. 	end 
  642.  
  643. 	--Remove all summons 
  644. 	player_super_power_clear_summons(LOCAL_PLAYER) 
  645.  
  646. 	-- In the case that this power isn't unlocked, unlock it. 
  647. 	-- Really only here for debug purposes when jumping into the mission at hvslice 0. 
  648. 	player_unlock_super_power( SUPERPOWER_BLAST, LOCAL_PLAYER, true ) 
  649. 	if coop_is_active() then 
  650. 		player_unlock_super_power( SUPERPOWER_BLAST, REMOTE_PLAYER, true ) 
  651. 	end 
  652.  
  653. 	-- Disable melee (because if the co-op client melees, they gain ownership of the enemy and that messes up our death callbacks) 
  654. 	set_player_can_take_human_shields( LOCAL_PLAYER, false ) 
  655. 	set_player_can_take_human_shields( REMOTE_PLAYER, false ) 
  656. 	player_allow_weapon_melee( false ) 
  657.  
  658. 	-- Disable notoriety 
  659. 	notoriety_set_min_and_max( "luchadores", 0, 0 ) 
  660. 	notoriety_set_min_and_max( "police", 0, 0 ) 
  661.  
  662. end 
  663.  
  664. -- The first objective 
  665. -- 
  666. function mmBlastTutorial_fcp_run() 
  667.  
  668.  
  669. 		 
  670. 	-- Default to no power selected so that they have to select the power. 
  671. 	--player_super_power_select( "none", SYNC_ALL ) 
  672.  
  673. 	-- Give the player a pistol and make it the only available weapon 
  674. 	-- Give the player a pistol and make it the only available weapon 
  675. 	inv_weapon_add_temporary( LOCAL_PLAYER, "Pistol-Gang", 100, true, true, false, true ) 
  676. 	inv_item_equip("Pistol-Gang", LOCAL_PLAYER) 
  677. 	if coop_is_active() == true then 
  678. 		inv_weapon_add_temporary( REMOTE_PLAYER, "Pistol-Gang", 100, true, true, false, true ) 
  679. 		inv_item_equip("Pistol-Gang", REMOTE_PLAYER) 
  680. 	end 
  681. 	inv_weapon_disable_all_but_this_slot( WEAPON_SLOT_PISTOL, true, SYNC_ALL ) 
  682. --	player_super_power_set_temp_charge( 1.5 ) 
  683. --	player_super_power_set_temp_strength( "freeze", 1.0 ) 
  684. 	player_super_power_set_regen_scalar_buff(5.0) 
  685. 	-- Do not allow weapon pick ups 
  686. 	auto_pickup_weapons(false) 
  687.  
  688. 	-- Do not allow access to the hub menu 
  689. 	cellphone_lock(true) 
  690. 	convo_start(mmBlastTutorial_convo.intro) 
  691. 	convo_wait_for_end() 
  692. 	convo_start(mmBlastTutorial_convo.wave) 
  693. --	local tutorial_to_play = "super_radial_select" 
  694. --	if game_is_active_input_gamepad() == false then 
  695. --	tutorial_to_play = "super_radial_select_pc" 
  696. --	end 
  697.  
  698. 	-- Reset our power equipped global. 
  699. --	mmBlastTutorial_PowerEquipped_Local = false 
  700. --	mmBlastTutorial_PowerEquipped_Remote = false 
  701.  
  702. 	--tutorial_start(tutorial_to_play, 1, true, true, true) 
  703. 	--on_superpower_equip("mmBlastTutorial_stone_blast_equipped_cb", LOCAL_PLAYER) 
  704. 	--on_superpower_equip("mmBlastTutorial_stone_blast_equipped_cb", REMOTE_PLAYER) 
  705. 	 
  706. 	--if( coop_is_active() == false ) then 
  707. 	---	while not mmBlastTutorial_PowerEquipped_Local do 
  708. 	--		thread_yield() 
  709. 	--	end 
  710. 	--else 
  711. 	--	while not (mmBlastTutorial_PowerEquipped_Local and mmBlastTutorial_PowerEquipped_Remote ) do 
  712. 	--		thread_yield() 
  713. 	--	end 
  714. 	--end 
  715.  
  716. 	-- Freeze equipped, clear the tutorial and start the process 
  717. --	on_superpower_equip("", LOCAL_PLAYER) 
  718. --	on_superpower_equip("", REMOTE_PLAYER) 
  719. --	tutorial_stop(tutorial_to_play) 
  720. 	 
  721. 	objective_text( 0, "SRG_MMBLAST_OBJECTIVE_ENEMIES", "", "", SYNC_ALL, OI_ASSET_POWER_BLAST ) 
  722. --	tutorial_stop_current() 
  723.  
  724. 	hud_prompt(LOCAL_PLAYER, "SRG_MMBLAST_USE_NAG", "", true) 
  725.  
  726.  
  727. 	-- Play the tutorial text 
  728. 	local tutorial_name = "blast_enemies" 
  729. 	local delay_ms = 0 
  730. 	local auto_unlock = false 
  731. 	local allow_redisplay = false 
  732. 	local infinite_display = true 
  733. 	tutorial_start(tutorial_name, delay_ms, auto_unlock, allow_redisplay, infinite_display) 
  734.  
  735. 	mmBlastTutorial_wave_setup( mmBlastTutorial_group.wave_1 ) 
  736. 	while mmBlastTutorial_CurrentActiveEnemies > 0 do 
  737. 		thread_yield() 
  738. 	end 
  739. 	hud_prompt_clear() 
  740. 	mmBlastTutorial_wave_setup( mmBlastTutorial_group.wave_2 ) 
  741. 	while mmBlastTutorial_CurrentActiveEnemies > 0 do 
  742. 		thread_yield() 
  743. 	end 
  744. --	mmBlastTutorial_wave_setup( mmBlastTutorial_group.wave_3 ) 
  745. --	while mmBlastTutorial_CurrentActiveEnemies > 0 do 
  746. --		thread_yield() 
  747. --	end 
  748. 	objective_text_clear(0)	 
  749. 	objective_text( 0, "SRG_MMBLAST_OBJECTIVE_FLYING", "", "", SYNC_ALL, OI_ASSET_POWER_BLAST ) 
  750. 	convo_start(mmBlastTutorial_convo.flying) 
  751. 	mmBlastTutorial_wave_setup( mmBlastTutorial_group.wave_4 ) 
  752. 	tutorial_stop_current() 
  753.  
  754. 	-- Play the tutorial text 
  755. 	tutorial_name = "blast_flying" 
  756. 	tutorial_start(tutorial_name, delay_ms, auto_unlock, allow_redisplay, infinite_display) 
  757. 	 
  758. 	ai_attack_region("Winged_Militia<001>", mmBlastTutorial_group.wave_4.destination_1, 5.0) 
  759. 	if coop_is_active() == true then 
  760. 	ai_attack_region("Winged_Militia<002>", mmBlastTutorial_group.wave_4.destination_2, 5.0) 
  761. 	end 
  762. 	while mmBlastTutorial_CurrentActiveEnemies > 0 do 
  763. 		thread_yield() 
  764. 	end 
  765. 	convo_start(mmBlastTutorial_convo.more_flying) 
  766. 	mmBlastTutorial_wave_setup( mmBlastTutorial_group.wave_5 ) 
  767. 	ai_attack_region("Winged_Militia<003>", mmBlastTutorial_group.wave_5.destination_3, 5.0) 
  768. 	ai_attack_region("Winged_Militia<004>", mmBlastTutorial_group.wave_5.destination_4, 5.0) 
  769. 	ai_attack_region("Winged_Militia<005>", mmBlastTutorial_group.wave_5.destination_5, 5.0) 
  770. 	if coop_is_active() == true then 
  771. 	ai_attack_region("Winged_Militia<006>", mmBlastTutorial_group.wave_5.destination_6, 5.0) 
  772. 	ai_attack_region("Winged_Militia<007>", mmBlastTutorial_group.wave_5.destination_7, 5.0) 
  773. 	end 
  774. 	while mmBlastTutorial_CurrentActiveEnemies > 0 do 
  775. 		thread_yield() 
  776. 	end 
  777. 	objective_text_clear(0)	 
  778. 	objective_text( 0, "SRG_MMBLAST_OBJECTIVE_INCITER", "", "", SYNC_ALL, OI_ASSET_POWER_BLAST ) 
  779. 	convo_start(mmBlastTutorial_convo.inciter) 
  780. 	tutorial_stop_current() 
  781. 	 
  782. 	-- Play the tutorial text 
  783. 	tutorial_name = "blast_inciter" 
  784. 	tutorial_start(tutorial_name, delay_ms, auto_unlock, allow_redisplay, infinite_display) 
  785. 		 
  786. 	mmBlastTutorial_final_wave_setup( mmBlastTutorial_group.wave_6) 
  787. 	while mmBlastTutorial_CurrentActiveEnemies > 0 do 
  788. 		thread_yield() 
  789. 	end 
  790. 	objective_text_clear(0)	 
  791. 	convo_start(mmBlastTutorial_convo.success) 
  792. 	convo_wait_for_end() 
  793. 	delay(1.0) 
  794.  
  795. 	-- Fade the screen so we can zone swap. 
  796. 	fade_out(0.0) 
  797. 	delay(2.0) 
  798. 		 
  799. end 
  800.  
  801. -- Do any cleanup for this checkpoint. 
  802. -- 
  803. -- (+++THIS IS CALLED FROM MISSION CLEANUP, MUST RETURN IMMEDIATELY+++) 
  804. -- 
  805. -- mission_exit: (bool) Whether we're exiting the mission entirely, or just 
  806. --					moving on to the next checkpoint. 
  807. -- 
  808. function mmBlastTutorial_fcp_cleanup(mission_exit) 
  809.  
  810. 	-- clean up the lava trigger 
  811. 	trigger_cb( "", mTutorial_trigger.lava_trigger  ) 
  812.  
  813. 	-- turn back on all pickup drops 
  814. 	health_pickups_enable(true) 
  815. 	human_all_stop_dropping_weapons(false) 
  816. 	human_all_stop_dropping_cash(false) 
  817.  
  818. 	-- Allow weapon pick ups 
  819. 	auto_pickup_weapons(true) 
  820.  
  821. 	-- Re-enable all superpowers and weapon radial 
  822. 	inv_weapon_remove_temporary( LOCAL_PLAYER, "Pistol-Gang") 
  823. 	if coop_is_active() == true then 
  824. 		inv_weapon_remove_temporary( REMOTE_PLAYER, "Pistol-Gang") 
  825. 	end 
  826.  
  827.  
  828. 	-- Re-enable all weapon slots 
  829. 	inv_weapon_disable_all_slots( false, SYNC_ALL ) 
  830. 	inv_weapon_remove_temporary( LOCAL_PLAYER, "Pistol-Gang" ) 
  831. 	if coop_is_active() == true then 
  832. 		inv_weapon_remove_temporary( REMOTE_PLAYER, "Pistol-Gang" ) 
  833. 	end 
  834. 		 
  835. 	-- Re-enable access to the hub menu 
  836. 	cellphone_lock( false ) 
  837.  
  838. 	turn_vulnerable( LOCAL_PLAYER ) 
  839. 	if coop_is_active() == true then 
  840. 		turn_vulnerable( REMOTE_PLAYER ) 
  841. 	end 
  842.  
  843. 	-- Enable warp to shore 
  844. 	player_warp_to_shore_enable( LOCAL_PLAYER ) 
  845. 	if coop_is_active() == true then 
  846. 		player_warp_to_shore_enable( REMOTE_PLAYER ) 
  847. 	end 
  848.  
  849. 	-- Clean up superpower tweaks. 
  850. 	player_super_power_set_temp_charge( -1 ) 
  851. 	player_super_power_set_temp_strength( "freeze", -1 ) 
  852. --	on_superpower_equip( "", LOCAL_PLAYER ) 
  853. 	--on_superpower_equip( "", REMOTE_PLAYER ) 
  854. 	dark_inciter_ultra_shield_only_vulnerable_to_superpowers( false ) 
  855. 	npc_respawn_dist_reset() 
  856. 	 
  857. 	-- Re-enable melee 
  858. 	set_player_can_take_human_shields( LOCAL_PLAYER, true ) 
  859. 	set_player_can_take_human_shields( REMOTE_PLAYER, true ) 
  860. 	player_allow_weapon_melee( true ) 
  861. 	 
  862. 	-- Re-enable notoriety 
  863. 	notoriety_set_min_and_max( "luchadores", 0, MAX_NOTORIETY_LEVEL ) 
  864. 	notoriety_set_min_and_max( "police", 0, MAX_NOTORIETY_LEVEL ) 
  865.  
  866. end 
  867.  
  868. ------------------------------------ 
  869. -- 
  870. -- Checkpoint helper functions 
  871. -- 
  872. ------------------------------------ 
  873. function mmBlastTutorial_wave_setup( wave_group ) 
  874.  
  875. 	-- Reset our enemy counter 
  876. 	mmBlastTutorial_CurrentActiveEnemies = 0 
  877.  
  878. 	-- Allow respawning at a close distance 
  879. 	npc_respawn_dist_override( 100000.0 ) 
  880.  
  881. 	-- Create the wave 
  882. 	group_create( wave_group.name ) 
  883.  
  884. 	-- Set special tutorial wave properties. 
  885. 	for i, wave_member in pairs( wave_group.members ) do 
  886.  
  887. 		-- Ensure they know about and see the players 
  888. 		ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  889. 		if coop_is_active() then 
  890. 			ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  891. 		end 
  892.  
  893. 		--turn_invulnerable( wave_member ) 
  894. 		npc_respawn_after_death( wave_member, true ) 
  895. 		npc_respawn_after_death_time_override( wave_member, 10, true ) 
  896.  
  897. 		on_death( "mmBlastTutorial_on_death_cb", wave_member ) 
  898. 		marker_add( wave_member, MINIMAP_ICON_BLAST, OI_ASSET_POWER_BLAST, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  899. 		mmBlastTutorial_CurrentActiveEnemies = mmBlastTutorial_CurrentActiveEnemies + 1 
  900. 	end 
  901.  
  902. 	if coop_is_active() then 
  903. 		 
  904. 		-- Create the co-op wave 
  905. 		group_create( wave_group.coop_name ) 
  906.  
  907. 		-- Set special tutorial wave properties. 
  908. 		for i, wave_member in pairs( wave_group.coop_only_members ) do 
  909.  
  910. 			-- Ensure they know about and see the players 
  911. 			ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  912. 			ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  913. 			 
  914. 			npc_respawn_after_death( wave_member, true ) 
  915. 			npc_respawn_after_death_time_override( wave_member, 10, true ) 
  916.  
  917. 			on_death( "mmBlastTutorial_on_death_cb", wave_member ) 
  918. 			marker_add( wave_member, MINIMAP_ICON_BLAST, OI_ASSET_POWER_BLAST, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  919. 			mmBlastTutorial_CurrentActiveEnemies = mmBlastTutorial_CurrentActiveEnemies + 1 
  920. 		end 
  921. 	end 
  922.  
  923. end 
  924.  
  925.  
  926. function mmBlastTutorial_final_wave_setup( wave_group ) 
  927.  
  928. 	-- Reset our enemy counter 
  929. 	mmBlastTutorial_CurrentActiveEnemies = 0 
  930.  
  931. 	-- Create the wave 
  932. 	group_create( wave_group.name ) 
  933.  
  934. 	-- Set special tutorial wave properties. 
  935. 	for i, wave_member in pairs( wave_group.members ) do 
  936.  
  937. 		-- Ensure they know about and see the players 
  938. 	--	ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  939. 		if coop_is_active() then 
  940. 	--		ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  941. 		end 
  942.  
  943. 		turn_invulnerable( wave_member ) 
  944. 		wave_group.damage_threads[ wave_member ] = thread_new("mmBlastTutorial_npc_frozen_thread", wave_member ) 
  945.  
  946. 		on_death( "mmBlastTutorial_final_wave_on_death_cb", wave_member ) 
  947. 		on_take_damage( "mmTutorial_final_wave_on_damage", wave_member ) 
  948.  
  949. 		marker_add( wave_member, MINIMAP_ICON_BLAST, OI_ASSET_POWER_BLAST, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  950. 		mmBlastTutorial_CurrentActiveEnemies = mmBlastTutorial_CurrentActiveEnemies + 1 
  951. 		--Set dark inciters' ultra shields to be immune to non-superpowers 
  952. 		tutorial_ultra_shield_only_vulnerable_to_superpowers( wave_member, true) 
  953. 	end 
  954.  
  955. 	if coop_is_active() then 
  956.  
  957. 		-- Create the wave 
  958. 		group_create( wave_group.coop_name ) 
  959.  
  960. 		-- Set special tutorial wave properties. 
  961. 		for i, wave_member in pairs( wave_group.coop_only_members ) do 
  962.  
  963. 			-- Ensure they know about and see the players 
  964. 		--	ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  965. 		--	ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  966. 			 
  967. 					 
  968. 			turn_invulnerable( wave_member ) 
  969. 			wave_group.damage_threads[ wave_member ] = thread_new("mmBlastTutorial_npc_frozen_thread", wave_member ) 
  970.  
  971. 			on_death( "mmBlastTutorial_final_wave_on_death_cb", wave_member ) 
  972. 			on_take_damage( "mmTutorial_final_wave_on_damage", wave_member ) 
  973. 			tutorial_ultra_shield_only_vulnerable_to_superpowers( wave_member, true) 
  974. 			marker_add( wave_member, MINIMAP_ICON_BLAST, OI_ASSET_POWER_BLAST, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  975. 			mmBlastTutorial_CurrentActiveEnemies = mmBlastTutorial_CurrentActiveEnemies + 1 
  976. 		end 
  977.  
  978. 	end 
  979.  
  980. end 
  981.  
  982. function mmBlastTutorial_get_npc_respawn_navpoint( npc_name ) 
  983. 	return mmBlastTutorial_respawn_points[ npc_name ] 
  984. end 
  985.  
  986. ------------------------------------ 
  987. -- 
  988. -- Checkpoint callback functions 
  989. -- 
  990. ------------------------------------ 
  991. --function mmBlastTutorial_stone_blast_equipped_cb( player, power ) 
  992. --	if( power == "freeze" ) then 
  993.  
  994. --		if player == LOCAL_PLAYER then 
  995. --			mmBlastTutorial_PowerEquipped_Local = true 
  996. --		else 
  997. --			mmBlastTutorial_PowerEquipped_Remote = true 
  998. --		end 
  999. --	end 
  1000. --end	 
  1001.  
  1002. function mmBlastTutorial_on_death_cb( npc ) 
  1003.  
  1004.  
  1005. 	if( human_is_frozen( npc ) == true ) then 
  1006. 		mmBlastTutorial_CurrentActiveEnemies = mmBlastTutorial_CurrentActiveEnemies - 1 
  1007. 		on_death( "", npc ) 
  1008. 		marker_remove( npc ) 
  1009. 	else 
  1010. 			 
  1011. 		-- Play the VFX at the death location 
  1012. 		npc_fade_out( npc, 1.0, false, 0 )  
  1013. 		 
  1014. 		human_set_invulnerable_to_freeze(npc, true) 
  1015. 		delay( 1.0 ) 
  1016. 		human_set_invulnerable_to_freeze(npc, false) 
  1017. 		-- TODO: Play the VO for an unsuccessful kill. 
  1018. 		if (convo_is_playing() == false) then 
  1019. 			convo_start(mmBlastTutorial_convo.chide) 
  1020. 		end	 
  1021. 		-- Teleport them to their respawn navpoint 
  1022. 		teleport( npc, mmBlastTutorial_get_npc_respawn_navpoint( npc ) ) 
  1023.  
  1024. 		-- Respawn the character (teleport and revive) 
  1025. 		npc_revive( npc ) 
  1026. 		 
  1027. 		-- Give him a decent weapon 
  1028. 		inv_item_add( "Rifle-LavaBolter", 1, npc, true ) 
  1029. 		 
  1030. 		delay(1.0) 
  1031. 		 
  1032. 		-- Play the VFX 
  1033. 		effect_play_on_human( mmBlastTutorial_effects.respawn_effect, npc )  
  1034.  
  1035. 		-- Show the character and mark them as a target 
  1036. 		character_show( npc ) 
  1037. 		marker_add( npc, MINIMAP_ICON_BLAST, OI_ASSET_POWER_BLAST, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  1038.  
  1039. 	end 
  1040.  
  1041. end 
  1042.  
  1043.  
  1044. function mmBlastTutorial_final_wave_on_death_cb( npc ) 
  1045. 	 
  1046. 	mmBlastTutorial_CurrentActiveEnemies = mmBlastTutorial_CurrentActiveEnemies - 1 
  1047. 	on_death( "", npc )	 
  1048. 	on_take_damage( "", npc ) 
  1049. 	marker_remove( npc ) 
  1050.  
  1051. end 
  1052.  
  1053.  
  1054.  
  1055. function mmTutorial_final_wave_on_damage(npc, attacker, dam_pct, explosion, melee, vomit, dam, tk, dfa, energy_blast, stomp, headshot, sidescroller, buff) 
  1056. 	 
  1057. 	-- Ensure that the shield doesn't go down if we weren't hit by a blast. 
  1058. 	if energy_blast == false and character_has_ultra_shield_up( npc ) == false then 
  1059. 		npc_ultra_shield_enable( npc, true ) 
  1060. 	end 
  1061. end 
  1062.  
  1063. ------------------------------------ 
  1064. -- 
  1065. -- Checkpoint thread functions 
  1066. -- 
  1067. ------------------------------------ 
  1068.  
  1069. function mmBlastTutorial_npc_frozen_thread(npc) 
  1070. 	while( true )do 
  1071. 		if( character_has_ultra_shield_up( npc ) == true )then 
  1072. 			turn_invulnerable( npc )  
  1073. 		else 
  1074. 			turn_vulnerable( npc )  
  1075. 		end 
  1076. 		thread_yield() 
  1077. 	end 
  1078. end 
  1079.  
  1080. -------------------------------------------------------------------------------------------------- 
  1081. 								--[[**********************]]-- 
  1082. 								--[[                      ]]-- 
  1083. 								--[[   Common functions   ]]-- 
  1084. 								--[[                      ]]-- 
  1085. 								--[[**********************]]-- 
  1086. 								 
  1087. local processing_lava_player_local = false 
  1088. local processing_lava_player_remote = false		 
  1089. function mmTutorial_lava_trigger_callback( human, trigger ) 
  1090. 	 
  1091. 	if human == LOCAL_PLAYER then 
  1092. 		if (processing_lava_player_local == false) then 
  1093. 			-- if we aren't currently trying to warp the player, then warp them 
  1094. 			processing_lava_player_local = true 
  1095. 			 
  1096. 			delay( 1.0 ) 
  1097. 			fade_out( 0, 0, SYNC_LOCAL ) 
  1098. 			delay( 1.0 ) 
  1099. 			teleport( LOCAL_PLAYER, "Player_start_nav_host" ) 
  1100. 			fade_in( 0, 0, SYNC_LOCAL ) 
  1101. 			 
  1102. 			-- done warping the player 
  1103. 			processing_lava_player_local = false 
  1104. 		end 
  1105.  
  1106.  
  1107. 	elseif human == REMOTE_PLAYER then 
  1108. 		if (processing_lava_player_remote == false) then 
  1109. 			processing_lava_player_remote = true 
  1110. 			-- if we aren't currently trying to warp the player, then warp them 
  1111.  
  1112. 			delay( 1.0 ) 
  1113. 			fade_out( 0, 0, SYNC_REMOTE ) 
  1114. 			delay( 1.0 ) 
  1115. 			teleport( REMOTE_PLAYER, "Player_start_nav_client" ) 
  1116. 			fade_in( 0, 0, SYNC_REMOTE ) 
  1117.  
  1118. 			-- done warping the player 
  1119. 			processing_lava_player_remote = false 
  1120. 		end 
  1121. 	end 
  1122. 	 
  1123. 	 
  1124.  
  1125. end 
  1126. -------------------------------------------------------------------------------------------------- 
  1127. 								--[[**********************]]-- 
  1128. 								--[[                      ]]-- 
  1129. 								--[[  Callback functions  ]]-- 
  1130. 								--[[                      ]]-- 
  1131. 								--[[**********************]]-- 
  1132.  
  1133. -------------------------------------------------------------------------------------------------- 
  1134. 								--[[**********************]]-- 
  1135. 								--[[                      ]]-- 
  1136. 								--[[   Thread functions   ]]-- 
  1137. 								--[[                      ]]-- 
  1138. 								--[[**********************]]--