./mmstomptutorial.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 "mmStompTutorial.lua" in the missions directory. 
  5. 		3.	Replace "mmStompTutorial" with the name of your mission (must use the same name as your mission start node). 
  6. 		3a.	Replace "mmStompTutorial" 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. 
  13. 		10.	If you find an error with this template, fix it and check it in!!!!c 
  14. 		11.	Remove these instructions.  You're on your own now! 
  15. ]]-- 
  16.  
  17. --[[ 
  18. 	mmStompTutorial.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. 	mmStompTutorial_group =  
  33. 	{ 
  34. 									--[[ startup GROUPS ]]-- 
  35. 																 
  36. 									--[[ Ultor GROUPS ]]--	 
  37. 		wave_1 =  
  38. 		{ 
  39. 			name = "wave_1", 
  40. 			members =  
  41. 			{ 
  42. 				"Demon_Grunt<001>", 
  43. 			},		 
  44. 		 
  45. 			coop_name = "coop_wave_1", 
  46. 			coop_only_members = 
  47. 			{ 
  48. 				"Demon_Grunt<002>", 
  49. 			}, 
  50. 			damage_threads = { }, 
  51. 		}, 
  52. 		wave_2 =  
  53. 		{ 
  54. 			name = "wave_2", 
  55. 			members =  
  56. 			{ 
  57. 				"Demon_Grunt<003>", 
  58. 				"Demon_Grunt<004>", 
  59. 				"Demon_Grunt<005>", 
  60. 			},		 
  61. 		 
  62. 			coop_name = "coop_wave_2", 
  63. 			coop_only_members = 
  64. 			{ 
  65. 				"Demon_Grunt<006>", 
  66. 				"Demon_Grunt<007>", 
  67. 				"Demon_Grunt<008>", 
  68. 			}, 
  69. 			damage_threads = { }, 
  70. 		}, 
  71. 		wave_3 =  
  72. 		{ 
  73. 			name = "wave_3", 
  74. 			members =  
  75. 			{ 
  76. 				"Demon_Grunt<009>", 
  77. 				"Demon_Grunt<010>", 
  78. 				"Demon_Grunt<011>", 
  79. 				"Demon_Grunt<012>", 
  80. 				"Demon_Grunt<013>", 
  81. 				"Demon_Grunt<014>", 
  82. 			},		 
  83. 		 
  84. 			coop_name = "coop_wave_3", 
  85. 			coop_only_members = 
  86. 			{ 
  87. 				"Demon_Grunt<015>", 
  88. 				"Demon_Grunt<016>", 
  89. 				"Demon_Grunt<017>", 
  90. 				"Demon_Grunt<018>", 
  91. 				"Demon_Grunt<019>", 
  92. 				"Demon_Grunt<020>", 
  93. 			}, 
  94. 			damage_threads = { }, 
  95. 		}, 
  96. 		wave_4 =  
  97. 		{ 
  98. 			name = "wave_4", 
  99. 			members =  
  100. 			{ 
  101. 				"Imp<001>", 
  102. 				"Imp<002>", 
  103. 				"Imp<003>", 
  104. 				"Imp<004>", 
  105. 				"Imp<005>", 
  106. 				"Imp<006>", 
  107. 				"Imp<007>", 
  108. 				"Imp<008>", 
  109. 			},		 
  110. 		 
  111. 			coop_name = "coop_wave_4", 
  112. 			coop_only_members = 
  113. 			{ 
  114. 				"Imp<009>", 
  115. 				"Imp<010>", 
  116. 				--"Imp<011>", 
  117. 				--"Imp<012>", 
  118. 				--"Imp<013>", 
  119. 				--"Imp<014>", 
  120. 				--"Imp<015>", 
  121. 				--"Imp<016>", 
  122. 			}, 
  123. 			damage_threads = { }, 
  124. 		}, 
  125. 		wave_5 =  
  126. 		{ 
  127. 			name = "wave_5", 
  128. 			members =  
  129. 			{ 
  130. 				"Dark_Inciter<001>", 
  131. 			},		 
  132. 			destination_1 = "Dark_Inciter_Dest<001>",		 
  133. 			destination_2 = "Dark_Inciter_Dest<002>",		 
  134. 			coop_name = "coop_wave_5", 
  135. 			coop_only_members = 
  136. 			{ 
  137. 				"Dark_Inciter<002>", 
  138. 			}, 
  139. 			damage_threads = { }, 
  140. 		}, 
  141.  
  142. 		--[[  GROUPS ]]-- 
  143. 	} 
  144.  
  145. 	mmStompTutorial_respawn_points =  
  146. { 
  147. 	-- wave_1 
  148. 	[ "Demon_Grunt<001>" ] = "Respawn_Navpoint<001>", 
  149. 	[ "Demon_Grunt<002>" ] = "Respawn_Navpoint<002>", 
  150.  
  151.  
  152. 	-- wave_2 
  153. 	[ "Demon_Grunt<003>" ] = "Respawn_Navpoint<003>", 
  154. 	[ "Demon_Grunt<004>" ] = "Respawn_Navpoint<004>", 
  155. 	[ "Demon_Grunt<005>" ] = "Respawn_Navpoint<005>", 
  156. 	[ "Demon_Grunt<006>" ] = "Respawn_Navpoint<006>", 
  157. 	[ "Demon_Grunt<007>" ] = "Respawn_Navpoint<007>", 
  158. 	[ "Demon_Grunt<008>" ] = "Respawn_Navpoint<008>", 
  159. 	-- wave 3 
  160. 	[ "Demon_Grunt<009>" ] = "Respawn_Navpoint<009>", 
  161. 	[ "Demon_Grunt<010>" ] = "Respawn_Navpoint<010>", 
  162. 	[ "Demon_Grunt<011>" ] = "Respawn_Navpoint<011>", 
  163. 	[ "Demon_Grunt<012>" ] = "Respawn_Navpoint<012>", 
  164. 	[ "Demon_Grunt<013>" ] = "Respawn_Navpoint<013>", 
  165. 	[ "Demon_Grunt<014>" ] = "Respawn_Navpoint<014>", 
  166. 	[ "Demon_Grunt<015>" ] = "Respawn_Navpoint<015>", 
  167. 	[ "Demon_Grunt<016>" ] = "Respawn_Navpoint<016>", 
  168. 	[ "Demon_Grunt<017>" ] = "Respawn_Navpoint<017>", 
  169. 	[ "Demon_Grunt<018>" ] = "Respawn_Navpoint<018>", 
  170. 	[ "Demon_Grunt<019>" ] = "Respawn_Navpoint<019>", 
  171. 	[ "Demon_Grunt<020>" ] = "Respawn_Navpoint<020>", 
  172. 	-- wave_4 
  173. 	[ "Imp<001>" ] = "Respawn_Nav_Imp<001>", 
  174. 	[ "Imp<002>" ] = "Respawn_Nav_Imp<002>", 
  175. 	[ "Imp<003>" ] = "Respawn_Nav_Imp<003>", 
  176. 	[ "Imp<004>" ] = "Respawn_Nav_Imp<004>", 
  177. 	[ "Imp<005>" ] = "Respawn_Nav_Imp<005>", 
  178. 	[ "Imp<006>" ] = "Respawn_Nav_Imp<006>", 
  179. 	[ "Imp<007>" ] = "Respawn_Nav_Imp<007>", 
  180. 	[ "Imp<008>" ] = "Respawn_Nav_Imp<008>", 
  181. 	[ "Imp<009>" ] = "Respawn_Nav_Imp<009>", 
  182. 	[ "Imp<010>" ] = "Respawn_Nav_Imp<010>", 
  183. 	--[ "Imp<011>" ] = "Respawn_Nav_Imp<011>", 
  184. 	--[ "Imp<012>" ] = "Respawn_Nav_Imp<012>", 
  185. 	--[ "Imp<013>" ] = "Respawn_Nav_Imp<013>", 
  186. 	--[ "Imp<014>" ] = "Respawn_Nav_Imp<014>", 
  187. 	--[ "Imp<015>" ] = "Respawn_Nav_Imp<015>", 
  188. 	--[ "Imp<016>" ] = "Respawn_Nav_Imp<016>", 
  189. 	-- wave_5 
  190. 	[ "Dark_Inciter<001>" ] = "Respawn_Nav_inciter<001>", 
  191. 	[ "Dark_Inciter<002>" ] = "Respawn_Nav_inciter<002>", 
  192. } 
  193.  
  194. mmStompTutorial_killed_by_stomp_damage =  
  195. { 
  196. 	-- wave_1 
  197. 	[ "Demon_Grunt<001>" ] = false, 
  198. 	[ "Demon_Grunt<002>" ] = false, 
  199. 	 
  200. 	 
  201. 	-- wave_2 
  202. 	[ "Demon_Grunt<003>" ] = false, 
  203. 	[ "Demon_Grunt<004>" ] = false, 
  204. 	[ "Demon_Grunt<005>" ] = false, 
  205. 	[ "Demon_Grunt<006>" ] = false, 
  206. 	[ "Demon_Grunt<007>" ] = false, 
  207. 	[ "Demon_Grunt<008>" ] = false, 
  208. 	-- wave 3 
  209. 	[ "Demon_Grunt<009>" ] = false, 
  210. 	[ "Demon_Grunt<010>" ] = false, 
  211. 	[ "Demon_Grunt<011>" ] = false, 
  212. 	[ "Demon_Grunt<012>" ] = false, 
  213. 	[ "Demon_Grunt<013>" ] = false, 
  214. 	[ "Demon_Grunt<014>" ] = false, 
  215. 	[ "Demon_Grunt<015>" ] = false, 
  216. 	[ "Demon_Grunt<016>" ] = false, 
  217. 	[ "Demon_Grunt<017>" ] = false, 
  218. 	[ "Demon_Grunt<018>" ] = false, 
  219. 	[ "Demon_Grunt<019>" ] = false, 
  220. 	[ "Demon_Grunt<020>" ] = false, 
  221. 	-- wave_4 
  222. 	[ "Imp<001>" ] = false, 
  223. 	[ "Imp<002>" ] = false, 
  224. 	[ "Imp<003>" ] = false, 
  225. 	[ "Imp<004>" ] = false, 
  226. 	[ "Imp<005>" ] = false, 
  227. 	[ "Imp<006>" ] = false, 
  228. 	[ "Imp<007>" ] = false, 
  229. 	[ "Imp<008>" ] = false, 
  230. 	[ "Imp<009>" ] = false, 
  231. 	[ "Imp<010>" ] = false, 
  232. --	[ "Imp<011>" ] = false, 
  233. 	--[ "Imp<012>" ] = false, 
  234. 	--[ "Imp<013>" ] = false, 
  235. 	--[ "Imp<014>" ] = false, 
  236. 	--[ "Imp<015>" ] = false, 
  237. 	--[ "Imp<016>" ] = false, 
  238. } 
  239.  
  240. -------------------------------------------------------------------------------------------------- 
  241. 																				--[[ THREADS ]]-- 
  242. -------------------------------------------------------------------------------------------------- 
  243. 	mmStompTutorial_thread = { 
  244. 		-- = INVALID_THREAD_HANDLE, 
  245. 	} 
  246.  
  247. 	mmStompTutorial_effects = { 
  248. 		respawn_effect = "Vfx Hell Teleport 01<001>", 
  249. 	} 
  250. -------------------------------------------------------------------------------------------------- 
  251. 																			--[[ CHECKPOINTS ]]-- 
  252. -------------------------------------------------------------------------------------------------- 
  253. 	mmStompTutorial_checkpoint = { 
  254. 		{ 
  255. 			name = MISSION_START_CHECKPOINT,		-- First Checkpoint (fcp) 
  256. 			init = "mmStompTutorial_fcp_init",				-- init(bool mission_restart) 
  257. 			run = "mmStompTutorial_fcp_run",					-- run() 
  258. 			cleanup = "mmStompTutorial_fcp_cleanup",			-- cleanup(bool mission_exit) (+++MUST RETURN IMMEDIATELY+++) 
  259. 			--next_checkpoint = "mmStompTutorial_", 
  260. 			next_checkpoint = nil, 
  261. 			host_start = "Player_start_nav_host", 
  262. 			client_start = "Player_start_nav_client", 
  263. 			p1_car_nav = "", 
  264. 			p2_car_nav = "", 
  265. 			start_groups = { }, 
  266. 			cp_only_groups = { }, 
  267. 		}, 
  268. 	} 
  269. 	 
  270. -------------------------------------------------------------------------------------------------- 
  271. 																			--[[ CUTSCENES ]]-- 
  272.  
  273. 	mmStompTutorial_scene = { 
  274. 		intro = "", 
  275. 		outro = "" 
  276. 	} 
  277.  
  278. -------------------------------------------------------------------------------------------------- 
  279. 																			--[[ CONVERSATIONS ]]-- 
  280. -------------------------------------------------------------------------------------------------- 
  281. --------------------------------------------------------------------------------------------------mmStomp_persona 
  282. 	mmStomp_persona =  
  283. 	{  
  284. 		shakespeare = { 
  285. 			persona_name = "SHAKESPEARE", 
  286. 			persona_id = INVALID_PERSONA_HANDLE 
  287. 		}, 
  288. 	} 
  289.  
  290. 	mmStompTutorial_convo = { 
  291.  
  292.  
  293. 		--[[ = { 
  294. 			name = "file_name without voice (_bm, _wm, _bf...", 
  295. 			player_talks = true or false, 
  296. 			handle = INVALID_CONVERSATION_HANDLE, 
  297. 			convo_thread = INVALID_THREAD_HANDLE, 
  298. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  299. 			timer_thread = INVALID_THREAD_HANDLE, 
  300. 			priority = CONVO_PRIORITY_HIGH or CONVO_PRIORITY_NORMAL or CONVO_PRIORITY_OPTIONAL 
  301. 			(optional) persona_line = true,	-- this is a single line 
  302. 			(required if persona_line) speaker_name = "name of speaker",	-- single line speaker (might be set before call to play is made?) 
  303. 			(optional)phone_call = true,  -- this is a phone conversation (phone persona must be preloaded) 
  304. 			(required if phone_call) receiving_call = true or false  -- auto-answer is always true in missions (until proven otherwise) 
  305. 			 
  306. 		},]] 
  307.  
  308. 		-- Welcome back to the Inferno room. Lets get back to business and try out your new Supernatural ability, Force Stomp. Force Stomp sends anyone or anything nearby flying in the air. Try it out by stomping near these demons. 
  309. 		intro = { 
  310. 			name = "mmstomptutorial_intro", 
  311. 			player_talks = false, 
  312. 			handle = INVALID_CONVERSATION_HANDLE, 
  313. 			convo_thread = INVALID_THREAD_HANDLE, 
  314. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  315. 			timer_thread = INVALID_THREAD_HANDLE, 
  316. 			priority = CONVO_PRIORITY_HIGH, 
  317.  
  318. 		}, 
  319.  
  320. 		-- That's some nice stomping right there! Let's keep it up. Try it out on a few more targets! 
  321. 		more_enemies = { 
  322. 			name = "mmStompTutorial_wave", 
  323. 			player_talks = false, 
  324. 			handle = INVALID_CONVERSATION_HANDLE, 
  325. 			convo_thread = INVALID_THREAD_HANDLE, 
  326. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  327. 			timer_thread = INVALID_THREAD_HANDLE, 
  328. 			priority = CONVO_PRIORITY_HIGH, 
  329.  
  330. 		}, 
  331.  
  332. 		-- Now for a challenge. See if you can stomp these imps. 
  333. 		more_imps = { 
  334. 			name = "mmStompTutorial_imps", 
  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. 		}, 
  343.  
  344. 		-- 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! 
  345. 		inciter = { 
  346. 			name = "mmStompTutorial_inciter", 
  347. 			player_talks = false, 
  348. 			handle = INVALID_CONVERSATION_HANDLE, 
  349. 			convo_thread = INVALID_THREAD_HANDLE, 
  350. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  351. 			timer_thread = INVALID_THREAD_HANDLE, 
  352. 			priority = CONVO_PRIORITY_HIGH, 
  353.  
  354. 		}, 
  355. 		-- No, no, no. I know you love violence, but this excersice is about using your feet, not using your fists. 
  356. 		chide = { 
  357. 			name = "mmStompTutorial_chide", 
  358. 			player_talks = false, 
  359. 			handle = INVALID_CONVERSATION_HANDLE, 
  360. 			convo_thread = INVALID_THREAD_HANDLE, 
  361. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  362. 			timer_thread = INVALID_THREAD_HANDLE, 
  363. 			priority = CONVO_PRIORITY_HIGH, 
  364.  
  365. 		}, 
  366. 		-- Success! I'm impressed how fast you got the hang of that. 
  367. 		success = { 
  368. 			name = "mmStompTutorial_success", 
  369. 			player_talks = false, 
  370. 			handle = INVALID_CONVERSATION_HANDLE, 
  371. 			convo_thread = INVALID_THREAD_HANDLE, 
  372. 			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
  373. 			timer_thread = INVALID_THREAD_HANDLE, 
  374. 			priority = CONVO_PRIORITY_HIGH, 
  375.  
  376. 		}, 
  377.  
  378.  
  379. 	} 
  380. 	 
  381. 	mmStompTutorial_convo_queue = { 
  382. 		--[[start_drive_queue = {  
  383. 			{ delay = 2.0, convo = mmStompTutorial_convo.goto_Ultor }, 
  384. 			{ delay = 4.0, convo = mmStompTutorial_convo.goto_Ultor2 }, 
  385. 			{ delay = 3.0, convo = mmStompTutorial_convo.goto_Ultor3 }, 
  386. 			{ delay = 5.0, convo = mmStompTutorial_convo.goto_Ultor4 } 
  387. 		}, 
  388. 		]]-- 
  389. 	} 
  390. 	 
  391. -------------------------------------------------------------------------------------------------- 
  392. 																			--[[ TRIGGERS ]]-- 
  393. -------------------------------------------------------------------------------------------------- 
  394. 	mmStompTutorial_trigger = { 
  395. 		-- = { 
  396. 		--	name = "_trigger", 
  397. 		--	hit = false, 
  398. 		-- 	last_hit_by = nil, -- 	last_hit_human = nil (set to the last human to enter the trigger in the default trigger callback) 
  399. 		--  (optional)callback = "mmStompTutorial_function_name_cb" 
  400. 		--	(optional)marker = TRIGGER_LOCATION or TRIGGER_USE or custom or don't include for no marker 
  401. 		--  (optional)waypoint = true, 
  402. 		--  (optional)teleport_to = { 
  403. 		--						host = "host_nav", 
  404. 		--						client = "client_nav"  
  405. 		--					},		 
  406. 		--	(optional)conversation = mmStompTutorial_convo.convo_name  -- play a conversation 
  407. 		--	(optional)next_trigger = "next_trigger_name" sets up next trigger when triggered (breadcrumbs) 
  408. 		--}, 
  409. 		 
  410. 									--[[ Ultor TRIGGERS ]]-- 
  411. 		lava_trigger = { 
  412. 			name = "lava_trigger", 
  413. 			callback = "mmTutorial_lava_trigger_callback", 
  414. 		}, 
  415.  
  416. 									--[[  TRIGGERS ]]--	 
  417.  
  418. 	} 
  419. 	 
  420. -------------------------------------------------------------------------------------------------- 
  421. 																	  --[[ INTERROGATION DATA ]]-- 
  422. -------------------------------------------------------------------------------------------------- 
  423. 	--mmStompTutorial_interrogate = { 
  424. 	--	leader = { 
  425. 	--		target = mmStompTutorial_group.friendly_fire.owner, 
  426. 	--		persona = "Interrogation", 
  427. 	--		objective = "mmStompTutorial_INTERROGATE_OWNER", 
  428. 	--	--	(optional)conversation = mmStompTutorial_convo.convo_name  -- play a conversation while interrogating 
  429. 	--	}, 
  430. 	--} 
  431. 		 
  432. -------------------------------------------------------------------------------------------------- 
  433. 																				   --[[ OTHER ]]-- 
  434. -------------------------------------------------------------------------------------------------- 
  435. 	mmStomp_runtime =  
  436. 	{ 
  437. 			bPersonaLoaded = false, 
  438. 	} 
  439.  
  440. mmStompTutorial_CurrentEnemyCount = 0; 
  441. mmStompTutorial_PowerEquipped_Local = false 
  442. mmStompTutorial_PowerEquipped_Remote = false 
  443. SUPERPOWER_GROUNDPOUND = 1 
  444. -------------------------------------------------------------------------------------------------- 
  445. 								--[[**********************]]-- 
  446. 								--[[                      ]]-- 
  447. 								--[[  Standard functions  ]]-- 
  448. 								--[[                      ]]-- 
  449. 								--[[**********************]]-- 
  450.  
  451. -- This is the primary entry point for the mission, and is responsible for starting up the mission 
  452. -- at the specified checkpoint. 
  453. -- CALLED FROM CODE 
  454. -- 
  455. -- start_checkpoint_name:	(string) The checkpoint the mission should begin at 
  456. -- is_restart:					(bool) TRUE if the mission is restarting, FALSE otherwise 
  457. -- 
  458. function mmStompTutorial_start(start_checkpoint_name, is_restart) 
  459.  
  460. 	mission_start_fade_out(0.0) 
  461. 	imp_jump_occasionals_enable( false ) 
  462. 	disable_diversions(true) 
  463. 	ui_hud_set_current_challenge(-1) 
  464. 	 
  465. 	-- Set up the warp trigger. 
  466. 	trigger_setup( mmStompTutorial_trigger.lava_trigger ) 
  467. 	set_ped_override_density(.1) 
  468. 	set_traffic_density(.1) 
  469. 	parking_spot_disable_all(true) 
  470. 	-- turn off all pickup drops 
  471. 	health_pickups_enable(false) 
  472. 	human_all_stop_dropping_weapons(true) 
  473. 	human_all_stop_dropping_cash(true) 
  474.  
  475. 	-- Swap to the training facility. 
  476. 	city_zone_swap( "u_train", true ) 
  477.  
  478.  
  479.  
  480. 	-- initialize systems 
  481. 	mission_startup(mmStompTutorial_trigger, mmStompTutorial_convo) -- mmStompTutorial_checkpoint 
  482. 		 
  483. 	local start_cp = get_table_by_name(mmStompTutorial_checkpoint, MISSION_START_CHECKPOINT) 
  484.  
  485. 	-- Check if this mission starting from the beginning 
  486. 	if (start_checkpoint_name == start_cp.name) then 
  487. 		if (is_restart == false and mmStompTutorial_scene.intro ~= "") then 
  488. 			-- First time playing mission 
  489. 			local fade_in_after = false 
  490. 			cutscene_play(mmStompTutorial_scene.intro, nil, {start_cp.host_start, start_cp.client_start}, fade_in_after) 
  491. 		else 
  492. 			teleport_coop(start_cp.host_start, start_cp.client_start, true) 
  493. 		end 
  494. 		fade_out(0) 
  495. 	end 
  496.  
  497. 	-- Handle mission initialization for the current checkpoint 
  498. 	mmStompTutorial_initialize(start_checkpoint_name) 
  499.  
  500. 	-- Run the mission from the current checkpoint 
  501. 	checkpoint_run_mission(mmStompTutorial_checkpoint, start_checkpoint_name) 
  502. 	mission_end_success("mmStompTutorial", nil, { "player_end_nav_client", "player_end_nav_host" } ) 
  503.  
  504. end 
  505.  
  506. -- This is the primary function responsible for cleaning up the entire mission 
  507. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++) 
  508.  
  509. function mmStompTutorial_cleanup() 
  510. 	--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]-- 
  511. 	 
  512. 	city_zone_swap( "u_train", false, true ) 
  513. 	imp_jump_occasionals_enable( true ) 
  514. 	-- Clean up lava trigger		 
  515. 	trigger_cb( "", mmStompTutorial_trigger.lava_trigger ) 
  516. 	 
  517. 	disable_diversions(false) 
  518. 	ui_hud_set_current_challenge(-2) 
  519. 	inv_weapon_disable_all_but_this_slot( WEAPON_SLOT_PISTOL, true, SYNC_ALL ) 
  520.  
  521. 	hud_prompt_clear() 
  522.  
  523.  
  524. 	-- Re-enable all superpowers and weapon radial 
  525. 	local enable = true 
  526. 	player_super_attacks_enable( enable, "Freeze" ) 
  527. 	player_super_attacks_enable( enable, "Aura" ) 
  528. 	player_super_attacks_enable( enable, "Summon" ) 
  529. 	player_super_power_lock_to_tutorial_element( false ) 
  530. 	hud_inventory_disable( false ) 
  531. 	player_super_power_set_regen_scalar_buff(1.0) 
  532.  
  533. 	npc_respawn_dist_reset() 
  534. 	set_ped_override_density(-1) 
  535. 	set_traffic_density(1) 
  536. 	parking_spot_disable_all(false) 
  537. 	-- turn back on pickup drops 
  538. 	health_pickups_enable(true) 
  539. 	human_all_stop_dropping_weapons(false) 
  540. 	human_all_stop_dropping_cash(false) 
  541.  
  542. 	--ensure warp to shore is back on 
  543. 	player_warp_to_shore_enable( LOCAL_PLAYER ) 
  544. 	if coop_is_active() == true then 
  545. 		player_warp_to_shore_enable( REMOTE_PLAYER ) 
  546. 	end 
  547.  
  548. 	-- cleanup all threads 
  549. 	cleanup_threads(mmStompTutorial_thread) 
  550. 	 
  551. 	-- run checkpoint cleanups (move into mission_shutdown?) 
  552. 	checkpoint_cleanup_mission(mmStompTutorial_checkpoint) 
  553. 	 
  554. 	-- cleanup triggers, convos, kill_list and interrogations 
  555. 	mission_shutdown() 
  556. 	 
  557. 	-- cleanup all groups 
  558. 	cleanup_groups(mmStompTutorial_group) 
  559.  
  560. 	--fade_out_block() 
  561. 	--	delay(1.0) 
  562. 	--	-- teleport the player 
  563. 	--	teleport_coop("player_end_nav_host", "player_end_nav_client", true) 
  564. 	--	delay(2.0) 
  565. 	--fade_in_block() 
  566. end 
  567.  
  568. -- Called when the mission has ended with success 
  569. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++) 
  570. -- 
  571. function mmStompTutorial_success() 
  572. 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
  573. 	 
  574. end 
  575.  
  576. -------------------------------------------------------------------------------------------------- 
  577. 								--[[**********************]]-- 
  578. 								--[[                      ]]-- 
  579. 								--[[ Initialize functions ]]-- 
  580. 								--[[                      ]]-- 
  581. 								--[[**********************]]-- 
  582.  
  583. -- Initialize the mission for the specified checkpoint 
  584. -- 
  585. -- checkpoint_name:		(string) Checkpoint to initialize the mission to 
  586. -- 
  587. function mmStompTutorial_initialize(checkpoint_name) 
  588. 	-- Common initialization 
  589. 	mmStompTutorial_initialize_common() 
  590. 	 
  591. 	-- Checkpoint specific initialization 
  592. 	checkpoint_init(mmStompTutorial_checkpoint, checkpoint_name) 
  593.  
  594. 	-- Remove any present subtitles 
  595. 	message_remove_all() 
  596.  
  597. 	-- Start fading in  
  598. 	mission_start_fade_in() 
  599.  
  600.  
  601. 	audio_object_post_event( "Play_StompTutorialMusic" ) 
  602.  
  603. 	if mmStomp_runtime.bPersonaLoaded == false then 
  604. 		load_persona(mmStomp_persona.shakespeare) 
  605. 		mmStomp_runtime.bPersonaLoaded = true 
  606. 	end  
  607. end 
  608.  
  609. -- Handle any common initialization 
  610. -- 
  611. function mmStompTutorial_initialize_common() 
  612. 	--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]-- 
  613. 		waypoint_remove() 
  614. 	mission_set_cancel_warp_location("player_end_nav_host", "player_end_nav_client") 
  615.  
  616. 	--"crv crouch left" -- cops_ps_cvch_lft 
  617. 	-- Disable all superpowers and weapon radial 
  618. 	local enable = false 
  619. 	player_super_attacks_enable( enable, "Freeze" ) 
  620. 	player_super_attacks_enable( enable, "Aura" ) 
  621. 	player_super_attacks_enable( enable, "Summon" ) 
  622. 	player_super_power_lock_to_tutorial_element( true, "stomp_force", SYNC_ALL )		 
  623. 	player_super_power_select( "Stomp", SYNC_ALL, "stomp_force" ) 
  624. 	hud_inventory_disable( true ) 
  625. end 
  626.  
  627. -------------------------------------------------------------------------------------------------- 
  628. 								--[[**********************]]-- 
  629. 								--[[                      ]]-- 
  630. 								--[[ Checkpoint functions ]]-- 
  631. 								--[[                      ]]-- 
  632. 								--[[**********************]]-- 
  633.  
  634. -------------------------------------------------------------------------------------------------- 
  635. 																	--[[ First Checkpoint Name ]]-- 
  636. -------------------------------------------------------------------------------------------------- 
  637.  
  638. -- Initialize this checkpoint. 
  639. -- 
  640. -- mission_start: (bool) Whether we're initializing from a mission (re)start or from 
  641. --					a natural play-through. 
  642. -- 
  643. function mmStompTutorial_fcp_init(mission_start) 
  644.  
  645. 	-- Set up the players as invulnerable 
  646. 	turn_invulnerable( LOCAL_PLAYER ) 
  647. 	if coop_is_active() == true then 
  648. 		turn_invulnerable( REMOTE_PLAYER ) 
  649. 	end 
  650.  
  651. 	-- Disable warp to shore 
  652. 	player_warp_to_shore_disable( LOCAL_PLAYER ) 
  653. 	if coop_is_active() == true then 
  654. 		player_warp_to_shore_disable( REMOTE_PLAYER ) 
  655. 	end 
  656.  
  657.  
  658. 	-- In the case that this power isn't unlocked, unlock it. 
  659. 	-- Really only here for debug purposes when jumping into the mission at hvslice 0. 
  660.  
  661. 	--Remove all summons 
  662. 	player_super_power_clear_summons(LOCAL_PLAYER) 
  663.  
  664. 	player_unlock_super_power( SUPERPOWER_GROUNDPOUND, LOCAL_PLAYER, true ) 
  665. 	if coop_is_active() then 
  666. 		player_unlock_super_power( SUPERPOWER_GROUNDPOUND, REMOTE_PLAYER, true ) 
  667. 	end 
  668. 	-- Enable superpower stuffs 
  669. 	player_super_movement_enable( true ) 
  670. 	player_super_attacks_enable( true ) 
  671.  
  672. 	-- Disable melee (because if the co-op client melees, they gain ownership of the enemy and that messes up our death callbacks) 
  673. 	set_player_can_take_human_shields( LOCAL_PLAYER, false ) 
  674. 	set_player_can_take_human_shields( REMOTE_PLAYER, false ) 
  675. 	player_allow_weapon_melee( false ) 
  676. 	 
  677. 	-- Disable notoriety 
  678. 	notoriety_set_min_and_max( "luchadores", 0, 0 ) 
  679. 	notoriety_set_min_and_max( "police", 0, 0 ) 
  680. end 
  681.  
  682. -- The first objective -- 
  683. function mmStompTutorial_fcp_run() 
  684. 	-- Default to no power selected so that they have to select the power. 
  685. --	player_super_power_select( "none", SYNC_ALL ) 
  686. 	 
  687. 	mmStompTutorial_reset_kill_flags() 
  688.  
  689. 	-- Give the player a pistol and make it the only available weapon 
  690. 	inv_weapon_add_temporary( LOCAL_PLAYER, "Pistol-Gang", 100, true, true, false, true ) 
  691. 	inv_item_equip("Pistol-Gang", LOCAL_PLAYER) 
  692. 	if coop_is_active() == true then 
  693. 		inv_weapon_add_temporary( REMOTE_PLAYER, "Pistol-Gang", 100, true, true, false, true ) 
  694. 		inv_item_equip("Pistol-Gang", REMOTE_PLAYER) 
  695. 	end 
  696. 	inv_weapon_disable_all_but_this_slot( WEAPON_SLOT_PISTOL, true, SYNC_ALL ) 
  697.  
  698. 	-- Do not allow access to the hub menu 
  699. 	cellphone_lock(true) 
  700.  
  701. 	-- Disable all weapon slots (except fists) 
  702. 	--inv_weapon_disable_all_but_this_slot(WEAPON_SLOT_UNARMED) 
  703.  
  704. --	player_super_power_set_temp_charge( 1.0 ) 
  705. --	player_super_power_set_temp_strength( "stomp", 1.0 ) 
  706. 	player_super_power_set_regen_scalar_buff(5.0)	 
  707. 	convo_start(mmStompTutorial_convo.intro) 
  708. 	convo_wait_for_end() 
  709.  
  710.  
  711.  
  712.  
  713. 	-- commented out all the functionality to force the player to choose the ability. They need to have it auto-equipped 
  714. --[[ 
  715. 	--	local tutorial_to_play = "super_radial_select" 
  716.  
  717. --	if game_is_active_input_gamepad() == false then 
  718. --	tutorial_to_play = "super_radial_select_pc" 
  719. --	end 
  720.  
  721.  
  722. 	-- Reset our power equipped global. 
  723. 	mmStompTutorial_PowerEquipped_Local = false 
  724. 	mmStompTutorial_PowerEquipped_Remote = false 
  725.  
  726. --	tutorial_start(tutorial_to_play, 1, true, true, true) 
  727. 	on_superpower_equip("mmStompTutorial_stomp_equipped_cb", LOCAL_PLAYER) 
  728. 	on_superpower_equip("mmStompTutorial_stomp_equipped_cb", REMOTE_PLAYER) 
  729.  
  730. 		if( coop_is_active() == false ) then 
  731. 		while not mmStompTutorial_PowerEquipped_Local do 
  732. 			thread_yield() 
  733. 		end 
  734. 	else 
  735. 		while not (mmStompTutorial_PowerEquipped_Local and mmStompTutorial_PowerEquipped_Remote ) do 
  736. 			thread_yield() 
  737. 		end 
  738. 	end 
  739.  
  740. 	-- Blast equipped, clear the tutorial and start the process 
  741. 	on_superpower_equip("", LOCAL_PLAYER) 
  742. 	on_superpower_equip("", REMOTE_PLAYER) 
  743. --	tutorial_stop(tutorial_to_play) 
  744. ]]-- 
  745. 	objective_text( 0, "SRG_MMSTOMP_OBJECTIVE_ENEMIES", "", "", SYNC_ALL, OI_ASSET_POWER_STOMP ) 
  746. 	hud_prompt(LOCAL_PLAYER, "SRG_MMSTOMP_USE_NAG", "", true) 
  747. 	-- Set up the first wave. 
  748. 	tutorial_stop_current() 
  749. 	local tutorial_name = "stomp_enemies" 
  750. 	local delay_ms = 0 
  751. 	local auto_unlock = false 
  752. 	local allow_redisplay = false 
  753. 	local infinite_display = true 
  754. 	tutorial_start(tutorial_name, delay_ms, auto_unlock, allow_redisplay, infinite_display) 
  755.  
  756. 	mmStompTutorial_wave_grunt_setup( mmStompTutorial_group.wave_1 ) 
  757. 	while mmStompTutorial_CurrentEnemyCount > 0 do 
  758. 		thread_yield() 
  759. 	end 
  760. 	-- Remove nag hud prompt 
  761. 	hud_prompt_clear() 
  762. 	convo_start(mmStompTutorial_convo.more_enemies) 
  763. 		delay(1.0) 
  764. 	-- Set up the second wave. 
  765. 	mmStompTutorial_wave_grunt_setup( mmStompTutorial_group.wave_2 ) 
  766. 	while mmStompTutorial_CurrentEnemyCount > 0 do 
  767. 		thread_yield() 
  768. 	end 
  769. --	delay(1.0) 
  770. 	-- Set up the third wave. 
  771. --	mmStompTutorial_wave_grunt_setup( mmStompTutorial_group.wave_3 ) 
  772. --	while mmStompTutorial_CurrentEnemyCount > 0 do 
  773. --		thread_yield() 
  774. --	end 
  775. 	tutorial_stop_current() 
  776. 	tutorial_name = "stomp_imps" 
  777. 	tutorial_start(tutorial_name, delay_ms, auto_unlock, allow_redisplay, infinite_display) 
  778. 	convo_start(mmStompTutorial_convo.more_imps) 
  779.  
  780. 	convo_wait_for_end() 
  781. 	 
  782. 	mmStompTutorial_wave_imp_setup( mmStompTutorial_group.wave_4 ) 
  783. 	while mmStompTutorial_CurrentEnemyCount > 0 do 
  784. 		thread_yield() 
  785. 	end 
  786.  
  787. 	convo_start(mmStompTutorial_convo.inciter) 
  788. 	delay(2.0) 
  789. 	objective_text_clear(0)	 
  790. 	objective_text( 0, "SRG_MMSTOMP_OBJECTIVE_INCITER", "", "", SYNC_ALL, OI_ASSET_POWER_STOMP ) 
  791. 	tutorial_stop_current() 
  792. 	tutorial_name = "stomp_inciter"	 
  793. 	tutorial_start(tutorial_name, delay_ms, auto_unlock, allow_redisplay, infinite_display) 
  794. 	dark_inciter_ultra_shield_only_vulnerable_to_superpowers( true ) 
  795. 	mmStompTutorial_final_wave_setup( mmStompTutorial_group.wave_5 ) 
  796. 	while mmStompTutorial_CurrentEnemyCount > 0 do 
  797. 		thread_yield() 
  798. 	end	 
  799. 	dark_inciter_ultra_shield_only_vulnerable_to_superpowers( false ) 
  800. 	objective_text_clear(0)	 
  801. 	--removes current subtitle if player kills Inciter quickly.  
  802. 	message_remove_all() 
  803. 	convo_start(mmStompTutorial_convo.success) 
  804. 	convo_wait_for_end() 
  805.  
  806.  
  807. 	-- Fade the screen so we can zone swap. 
  808. 	fade_out(0.0) 
  809. 	delay(2.0) 
  810.  
  811. end 
  812.  
  813. -- Do any cleanup for this checkpoint. 
  814. -- 
  815. -- (+++THIS IS CALLED FROM MISSION CLEANUP, MUST RETURN IMMEDIATELY+++) 
  816. -- 
  817. -- mission_exit: (bool) Whether we're exiting the mission entirely, or just 
  818. --					moving on to the next checkpoint. 
  819. -- 
  820. function mmStompTutorial_fcp_cleanup(mission_exit) 
  821. 	 
  822. -- turn back on all pickup drops 
  823. 	health_pickups_enable(true) 
  824. 	human_all_stop_dropping_weapons(false) 
  825. 	human_all_stop_dropping_cash(false) 
  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. 	--on_superpower_equip( "", LOCAL_PLAYER ) 
  851. 	--on_superpower_equip( "", REMOTE_PLAYER ) 
  852.  
  853. 	npc_respawn_dist_reset() 
  854. 		 
  855. 	dark_inciter_ultra_shield_only_vulnerable_to_superpowers( false ) 
  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 mmStompTutorial_wave_grunt_setup( wave_group ) 
  874.  
  875. 	-- Reset our enemy counter 
  876. 	mmStompTutorial_CurrentEnemyCount = 0 
  877.  
  878.  
  879. 	-- Create the wave 
  880. 	group_create( wave_group.name ) 
  881.  
  882. 	-- Set special tutorial wave properties. 
  883. 	for i, wave_member in pairs( wave_group.members ) do 
  884.  
  885. 		-- Ensure they know about and see the players 
  886. 		ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  887. 		character_set_never_catch_fire(wave_member) 
  888. 		if coop_is_active() then 
  889. 			ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  890. 		end 
  891.  
  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( "mmStompTutorial_grunt_on_death_cb", wave_member ) 
  898. 		on_take_damage( "mmStompTutorial_npc_stomped_cb", wave_member ) 
  899.  
  900. 		marker_add( wave_member, MINIMAP_ICON_STOMP, OI_ASSET_POWER_STOMP, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  901. 		mmStompTutorial_CurrentEnemyCount = mmStompTutorial_CurrentEnemyCount + 1 
  902. 	end 
  903.  
  904. 	if coop_is_active() then 
  905. 		 
  906. 		-- Create the co-op wave 
  907. 		group_create( wave_group.coop_name ) 
  908.  
  909. 		-- Set special tutorial wave properties. 
  910. 		for i, wave_member in pairs( wave_group.coop_only_members ) do 
  911.  
  912. 			-- Ensure they know about and see the players 
  913. 			ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  914. 			ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  915. 			 
  916. 			--turn_invulnerable( wave_member ) 
  917. 			--npc_respawn_after_death( wave_member, true ) 
  918. 			--npc_respawn_after_death_time_override( wave_member, 10, true ) 
  919.  
  920. 			on_death( "mmStompTutorial_grunt_on_death_cb", wave_member ) 
  921. 			on_take_damage( "mmStompTutorial_npc_stomped_cb", wave_member ) 
  922.  
  923. 			marker_add( wave_member, MINIMAP_ICON_STOMP, OI_ASSET_POWER_STOMP, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  924. 			mmStompTutorial_CurrentEnemyCount = mmStompTutorial_CurrentEnemyCount + 1 
  925. 		end 
  926. 	end 
  927.  
  928. end 
  929. function mmStompTutorial_wave_imp_setup( wave_group ) 
  930.  
  931. 	-- Reset our enemy counter 
  932. 	mmStompTutorial_CurrentEnemyCount = 0 
  933.  
  934.  
  935. 	-- Create the wave 
  936. 	group_create( wave_group.name ) 
  937.  
  938. 	-- Set special tutorial wave properties. 
  939. 	for i, wave_member in pairs( wave_group.members ) do 
  940.  
  941. 		-- Ensure they know about and see the players 
  942. 		ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  943. 		if coop_is_active() then 
  944. 			ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  945. 		end 
  946.  
  947. 		 
  948. 		--turn_invulnerable( wave_member ) 
  949. 		--npc_respawn_after_death( wave_member, true ) 
  950. 		--npc_respawn_after_death_time_override( wave_member, 10, true ) 
  951.  
  952. 		on_death( "mmStompTutorial_imp_on_death_cb", wave_member ) 
  953. 		on_take_damage( "mmStompTutorial_npc_stomped_cb", wave_member ) 
  954.  
  955. 		marker_add( wave_member, MINIMAP_ICON_STOMP, OI_ASSET_POWER_STOMP, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  956. 		mmStompTutorial_CurrentEnemyCount = mmStompTutorial_CurrentEnemyCount + 1 
  957. 	end 
  958.  
  959. 	if coop_is_active() then 
  960. 		delay(.2) 
  961. 		-- Create the co-op wave 
  962. 		group_create( wave_group.coop_name ) 
  963.  
  964. 		-- Set special tutorial wave properties. 
  965. 		for i, wave_member in pairs( wave_group.coop_only_members ) do 
  966.  
  967. 			-- Ensure they know about and see the players 
  968. 			ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  969. 			ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  970. 			 
  971. 			--turn_invulnerable( wave_member ) 
  972. 			--npc_respawn_after_death( wave_member, true ) 
  973. 			--npc_respawn_after_death_time_override( wave_member, 10, true ) 
  974.  
  975. 			on_death( "mmStompTutorial_imp_on_death_cb", wave_member ) 
  976. 			on_take_damage( "mmStompTutorial_npc_stomped_cb", wave_member ) 
  977.  
  978. 			marker_add( wave_member, MINIMAP_ICON_STOMP, OI_ASSET_POWER_STOMP, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  979. 			mmStompTutorial_CurrentEnemyCount = mmStompTutorial_CurrentEnemyCount + 1 
  980. 		end 
  981. 	end 
  982.  
  983. end 
  984.  
  985. function mmStompTutorial_final_wave_setup( wave_group ) 
  986.  
  987. 	-- Reset our enemy counter 
  988. 	mmStompTutorial_CurrentEnemyCount = 0 
  989.  
  990.  
  991. 	-- Create the wave 
  992. 	group_create( wave_group.name ) 
  993.  
  994. 	-- Set special tutorial wave properties. 
  995. 	for i, wave_member in pairs( wave_group.members ) do 
  996.  
  997. 		-- Ensure they know about and see the players 
  998. 		ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  999. 		if coop_is_active() then 
  1000. 			ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  1001. 		end 
  1002. 		--Set ultra shields to be invulnerable to non-superpowers 
  1003. 		tutorial_ultra_shield_only_vulnerable_to_superpowers( wave_member, true) 
  1004.  
  1005. 		on_death( "mmStompTutorial_on_final_wave_death_cb", wave_member ) 
  1006.  
  1007. 		marker_add( wave_member, MINIMAP_ICON_STOMP, OI_ASSET_POWER_STOMP, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  1008. 		mmStompTutorial_CurrentEnemyCount = mmStompTutorial_CurrentEnemyCount + 1 
  1009. 	end 
  1010.  
  1011. 	if coop_is_active() then 
  1012. 		 
  1013. 		-- Create the co-op wave 
  1014. 		group_create( wave_group.coop_name ) 
  1015.  
  1016. 		-- Set special tutorial wave properties. 
  1017. 		for i, wave_member in pairs( wave_group.coop_only_members ) do 
  1018.  
  1019. 			-- Ensure they know about and see the players 
  1020. 			ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  1021. 			ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true ) 
  1022. 			 
  1023. 			tutorial_ultra_shield_only_vulnerable_to_superpowers( wave_member, true) 
  1024.  
  1025. 			on_death( "mmStompTutorial_on_final_wave_death_cb", wave_member ) 
  1026.  
  1027. 			marker_add( wave_member, MINIMAP_ICON_STOMP, OI_ASSET_POWER_STOMP, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  1028. 			mmStompTutorial_CurrentEnemyCount = mmStompTutorial_CurrentEnemyCount + 1 
  1029. 		end 
  1030. 	end 
  1031.  
  1032. end 
  1033.  
  1034. function mmStompTutorial_get_npc_respawn_navpoint( npc_name ) 
  1035. 	return mmStompTutorial_respawn_points[ npc_name ] 
  1036. end 
  1037.  
  1038. ------------------------------------ 
  1039. -- 
  1040. -- Checkpoint callback functions 
  1041. -- 
  1042. ------------------------------------ 
  1043. function mmStompTutorial_grunt_on_death_cb( npc ) 
  1044. 	local remove_stomped_character = false 
  1045. 	 
  1046. 	if( mmStompTutorial_killed_by_stomp_damage[ npc ] == true ) then		 
  1047. 		remove_stomped_character = true 
  1048.  
  1049. 	else 
  1050. 			 
  1051. 		delay( 0.2 ) 
  1052. 		 
  1053. 		-- sometimes we get the damaged message AFTER the kill message, so check again after the character faded out. 
  1054. 		if( mmStompTutorial_killed_by_stomp_damage[ npc ] == true ) then 
  1055. 			remove_stomped_character = true		 
  1056. 		else 
  1057. 		 
  1058. 			-- Play the VFX at the death location 
  1059. 			npc_fade_out( npc, 1.0, false, 0 )  
  1060. 			 
  1061. 			delay( 1.0 ) 
  1062. 									 
  1063. 			-- Teleport them to their respawn navpoint 
  1064. 			teleport( npc, mmStompTutorial_get_npc_respawn_navpoint( npc ) ) 
  1065.  
  1066. 			-- Respawn the character (teleport and revive) 
  1067. 			npc_revive( npc ) 
  1068. 			-- Give him a decent weapon 
  1069. 				inv_item_add( "Rifle-LavaBolter", 1, npc, true ) 
  1070. 			 
  1071. 			delay(1.0) 
  1072. 			 
  1073. 			-- Play the VFX 
  1074. 			effect_play_on_human( mmStompTutorial_effects.respawn_effect, npc )  
  1075.  
  1076. 			if (convo_is_playing() == false) then 
  1077. 				convo_start(mmStompTutorial_convo.chide) 
  1078. 			end	 
  1079. 			-- Show the character and mark them as a target 
  1080. 			character_show( npc ) 
  1081. 			marker_add( npc, MINIMAP_ICON_STOMP, OI_ASSET_POWER_STOMP, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  1082. 		end 
  1083. 	end 
  1084. 	 
  1085. 	if (remove_stomped_character == true) then 
  1086. 		mmStompTutorial_CurrentEnemyCount = mmStompTutorial_CurrentEnemyCount - 1 
  1087. 		on_death( "", npc ) 
  1088. 		on_take_damage( "", npc ) 
  1089. 		marker_remove( npc ) 
  1090. 	end 
  1091. end 
  1092.  
  1093. function mmStompTutorial_imp_on_death_cb( npc ) 
  1094. 	local remove_stomped_character = false 
  1095. 	 
  1096. 	if( mmStompTutorial_killed_by_stomp_damage[ npc ] == true ) then 
  1097. 		remove_stomped_character = true 
  1098.  
  1099.  
  1100. 	else	 
  1101. 		delay( 0.2 ) 
  1102. 		 
  1103. 		-- sometimes we get the damaged message AFTER the kill message, so check again after the character faded out. 
  1104. 		if( mmStompTutorial_killed_by_stomp_damage[ npc ] == true ) then 
  1105. 			remove_stomped_character = true		 
  1106. 		else	 
  1107. 			-- Play the VFX at the death location 
  1108. 			npc_fade_out( npc, 1.0, false, 0 )  
  1109. 			 
  1110. 			delay( 1.0 ) 
  1111. 		 
  1112. 	 
  1113. 			-- Teleport them to their respawn navpoint 
  1114. 			teleport( npc, mmStompTutorial_get_npc_respawn_navpoint( npc ) ) 
  1115.  
  1116. 			-- Respawn the character (teleport and revive) 
  1117. 			npc_revive( npc ) 
  1118. 			-- Give him a decent weapon 
  1119. 			 
  1120. 			delay(1.0) 
  1121. 			 
  1122. 			-- Play the VFX 
  1123. 			effect_play_on_human( mmStompTutorial_effects.respawn_effect, npc )  
  1124. 			 
  1125.  
  1126. 			-- Show the character and mark them as a target 
  1127. 			character_show( npc ) 
  1128. 			marker_add( npc, MINIMAP_ICON_STOMP, OI_ASSET_POWER_STOMP, OI_FLAGS_DEFAULT, SYNC_ALL ) 
  1129.  
  1130. 		end 
  1131. 		 
  1132. 	end 
  1133. 	 
  1134. 	if (remove_stomped_character == true) then 
  1135. 		mmStompTutorial_CurrentEnemyCount = mmStompTutorial_CurrentEnemyCount - 1 
  1136. 		on_death( "", npc ) 
  1137. 		on_take_damage( "", npc ) 
  1138. 		marker_remove( npc ) 
  1139. 	end 
  1140.  
  1141. end 
  1142.  
  1143. function mmStompTutorial_npc_stomped_cb(npc, attacker, dam_pct, explosion, melee, vomit, dam, tk, dfa, energy, stomp, headshot, sidescroller, buff) 
  1144. 	if stomp then 
  1145. 		mmStompTutorial_killed_by_stomp_damage[ npc ] = true 
  1146. 		on_take_damage( "", npc ) 
  1147. 		character_kill(npc, true) 
  1148. 	else 
  1149. 	--	mmStompTutorial_killed_by_stomp_damage[ npc ] = false				 
  1150. 	end 
  1151. end 
  1152.  
  1153. function mmStompTutorial_on_final_wave_death_cb( npc ) 
  1154.  
  1155. 	mmStompTutorial_CurrentEnemyCount = mmStompTutorial_CurrentEnemyCount - 1 
  1156. 	on_death( "", npc ) 
  1157. 	on_take_damage( "", npc ) 
  1158. 	marker_remove( npc ) 
  1159.  
  1160. end 
  1161.  
  1162. ------------------------------------ 
  1163. -- 
  1164. -- Checkpoint thread functions 
  1165. -- 
  1166. ------------------------------------ 
  1167.  
  1168. -------------------------------------------------------------------------------------------------- 
  1169. 								--[[**********************]]-- 
  1170. 								--[[                      ]]-- 
  1171. 								--[[   Common functions   ]]-- 
  1172. 								--[[                      ]]-- 
  1173. 								--[[**********************]]-- 
  1174.  
  1175.  
  1176. function mmStompTutorial_reset_kill_flags() 
  1177.  
  1178. 	 
  1179. 	-- wave_1 
  1180. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<001>" ] = false 
  1181. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<002>" ] = false 
  1182. 	-- wave 2 
  1183. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<003>" ] = false 
  1184. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<004>" ] = false 
  1185. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<005>" ] = false 
  1186. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<006>" ] = false 
  1187. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<007>" ] = false 
  1188. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<008>" ] = false 
  1189. 	-- wave 3 
  1190. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<009>" ] = false 
  1191. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<010>" ] = false 
  1192. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<011>" ] = false 
  1193. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<012>" ] = false 
  1194. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<013>" ] = false 
  1195. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<014>" ] = false 
  1196. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<015>" ] = false 
  1197. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<016>" ] = false 
  1198. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<017>" ] = false 
  1199. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<018>" ] = false 
  1200. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<019>" ] = false 
  1201. 	mmStompTutorial_killed_by_stomp_damage[ "Demon_Grunt<020>" ] = false 
  1202. 	-- wave_4 
  1203. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<001>" ] = false 
  1204. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<002>" ] = false 
  1205. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<003>" ] = false 
  1206. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<004>" ] = false 
  1207. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<005>" ] = false 
  1208. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<006>" ] = false 
  1209. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<007>" ] = false 
  1210. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<008>" ] = false 
  1211. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<009>" ] = false 
  1212. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<010>" ] = false 
  1213. 	--[[mmStompTutorial_killed_by_stomp_damage[ "Imp<011>" ] = false 
  1214. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<012>" ] = false 
  1215. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<013>" ] = false 
  1216. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<014>" ] = false 
  1217. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<015>" ] = false 
  1218. 	mmStompTutorial_killed_by_stomp_damage[ "Imp<016>" ] = false]]-- 
  1219.  
  1220. end 
  1221.  
  1222. -------------------------------------------------------------------------------------------------- 
  1223. 								--[[**********************]]-- 
  1224. 								--[[                      ]]-- 
  1225. 								--[[  Callback functions  ]]-- 
  1226. 								--[[                      ]]-- 
  1227. 								--[[**********************]]-- 
  1228.  
  1229. function mmStompTutorial_stomp_equipped_cb( player, power ) 
  1230. --	if( power == "stomp" ) then 
  1231.  
  1232. 		if player == LOCAL_PLAYER then 
  1233. 			mmStompTutorial_PowerEquipped_Local = true 
  1234. 		else 
  1235. 			mmStompTutorial_PowerEquipped_Remote = true 
  1236. 		end 
  1237. --	end 
  1238. end	 
  1239.  
  1240. local processing_lava_player_local = false 
  1241. local processing_lava_player_remote = false			 
  1242. function mmTutorial_lava_trigger_callback( human, trigger ) 
  1243.  
  1244. 	if human == LOCAL_PLAYER then 
  1245. 		if (processing_lava_player_local == false) then 
  1246. 			-- if we aren't currently trying to warp the player, then warp them 
  1247. 			processing_lava_player_local = true 
  1248.  
  1249. 			delay(1.0) 
  1250. 			fade_out( 0, 0, SYNC_LOCAL ) 
  1251. 			delay( 1.0 ) 
  1252. 			teleport( LOCAL_PLAYER, "Player_start_nav_host" ) 
  1253. 			fade_in( 0, 0, SYNC_LOCAL ) 
  1254. 			 
  1255. 			-- done warping the player 
  1256. 			processing_lava_player_local = false 
  1257. 		end 
  1258.  
  1259.  
  1260. 	elseif human == REMOTE_PLAYER then 
  1261. 		if (processing_lava_player_remote == false) then 
  1262. 			processing_lava_player_remote = true 
  1263. 			-- if we aren't currently trying to warp the player, then warp them 
  1264.  
  1265. 			delay(1.0) 
  1266. 			fade_out( 0, 0, SYNC_REMOTE ) 
  1267. 			delay( 1.0 ) 
  1268. 			teleport( REMOTE_PLAYER, "Player_start_nav_client" ) 
  1269. 			fade_in( 0, 0, SYNC_REMOTE ) 
  1270. 			 
  1271. 			-- done warping the player 
  1272. 			processing_lava_player_remote = false 
  1273. 		end 
  1274.  
  1275. 	end 
  1276.  
  1277. end 
  1278.  
  1279. -------------------------------------------------------------------------------------------------- 
  1280. 								--[[**********************]]-- 
  1281. 								--[[                      ]]-- 
  1282. 								--[[   Thread functions   ]]-- 
  1283. 								--[[                      ]]-- 
  1284. 								--[[**********************]]-- 
  1285.