--[[ USING THE MISSION START TEMPLATE  
 
		1.	Read "SR3 Mission Scripting Standards" if you haven't already. 
 
		2.	Save this file as "mFlightTutorial.lua" in the missions directory. 
 
		3.	Replace "mFlightTutorial" with the name of your mission (must use the same name as your mission start node). 
 
		3a.	Replace "mFlightTutorial" with the capitalized name of your mission 
 
		4.	Replace "1-31-2014" with today's date. 
 
		5.	Replace "Arturo Mata" with your name. 
 
		6.	Replace "Altar" with the name of the first location to go tomFlightTutorial_doflaporbs_collected_1 
 
		7.	Replace "fcp with a 3-4 letter abbreviation for the first checkpoint. 
 
		8.	Replace "" with the second checkpoint name (first is named start) 
 
		9.	Replace "" with a 3-4 letter abbreviation for the next checkpoint. 
 
		10.	If you find an error with this template, fix it and check it in!!!! 
 
		11.	Remove these instructions.  You're on your own now! 
 
]]-- 
 
 
 
--[[ 
 
	mFlightTutorial.lua 
 
	SR3 Mission Script 
 
	DATE: 1-31-2014 
 
	AUTHOR:	Arturo Mata 
 
]]-- 
 
 
 
 
 
-- Tweakable Parameters -- 
 
MM_1_2_SUPERPOWER_SPRINT = 5 
 
MM_1_2_SUPERPOWER_JUMP = 6 
 
SUPERPOWER_BLAST = 3 
 
PLAYER_SUPERPOWER_BLAST_STONE = 12 
 
MFLIGHTTUTORIAL_NUM_CLUSTERS = 4 
 
mImpfest_leash_distance = 400 
 
-- not tweakable 
 
iNumberOfFlapsAtStartRemote = 0 
 
iStartFlapsLocal = 0 
 
iCurrentFlapsLocal = 0 
 
iCurrentFlapsRemote = 0 
 
bMissedFlapOrb_Remote = true 
 
bMissedFlapOrb_Local = true 
 
mFlightTutorial_clusters_collected = 0 
 
mFlightTutorial_FlapVFX_1 = 1 
 
mFlightTutorial_FlapVFX_2 = 2 
 
mFlightTutorial_BreadCrumb_1 = 3 
 
mFlightTutorial_BreadCrumb_2 = 4 
 
mFlightTutorial_BreadCrumb_3 = 5 
 
mFlightTutorial_BreadCrumb_4 = 6 
 
mFlightTutorial_BreadCrumb_5 = 7 
 
mFlightTutorial_BreadCrumb_6 = 8 
 
mFlightTutorial_BreadCrumb_7 = 9 
 
mFlightTutorial_BreadCrumb_8 = 10 
 
mFlightTutorial_BreadCrumb_9 = 11 
 
mFlightTutorial_BreadCrumb_10 = 12 
 
mFlightTutorial_BreadCrumb_11 = 13 
 
mFlightTutorial_BreadCrumb_12 = 14 
 
mFlightTutorial_BreadCrumb_13 = 15 
 
mFlightTutorial_BreadCrumb_14 = 16 
 
mFlightTutorial_BreadCrumb_15 = 17 
 
mFlightTutorial_BreadCrumb_16 = 18 
 
mFlightTutorial_BreadCrumb_17 = 19 
 
mFlightTutorial_BreadCrumb_18 = 20 
 
mFlightTutorial_BreadCrumb_19 = 21 
 
mFlightTutorial_BreadCrumb_20 = 22 
 
bLOCAL_PLAYER_FLAPPED = false 
 
bREMOTE_PLAYER_FLAPPED = false 
 
-------------------------------------------------------------------------------------------------- 
 
--   _____                            
 
--  / ____|                           
 
-- | |  __ _ __ ___  _   _ _ __  ___  
 
-- | | |_ | '__/ _ \| | | | '_ \/ __| 
 
-- | |__| | | | (_) | |_| | |_) \__ \ 
 
--  \_____|_|  \___/ \__,_| .__/|___/ 
 
--                        | |         
 
--                        |_|         
 
-------------------------------------------------------------------------------------------------- 
 
mFlightTutorial_group =  
 
{  
									--[[ startup GROUPS ]]--	 
 
									 
 
									--[[ Altar GROUPS ]]--	 
 
		soul_clusters =  
 
		{  
			cluster01 = { name = "soul_cluster<001>", },  
			cluster02 = { name = "soul_cluster<002>", },  
			cluster03 = { name = "soul_cluster<003>", },  
			cluster04 = { name = "soul_cluster<004>", },  
		}, 
 
 
 
		damned_soul = {  
			name = "damned_soul_group", 
 
			npc = "npc_DamnedSoul", 
 
		}, 
 
		start_navs = 
 
		{  
			altar_nav_host = "altar_nav_host", 
 
			altar_nav_client = "altar_nav_client", 
 
		}, 
 
		end_navs = 
 
		{  
			end_nav_host = "end_nav_host", 
 
			end_nav_client = "end_nav_client", 
 
		}, 
 
		use_flap_orbs = 
 
		{  
			use_flap_orb_1 = "give_flap_trigger_01", 
 
			use_flap_orb_2 = "give_flap_trigger_02", 
 
		} 
 
} 
 
 
 
-------------------------------------------------------------------------------------------------- 
 
--  _______ _                        _      
 
-- |__   __| |                      | |     
 
--    | |  | |__  _ __ ___  __ _  __| |___  
 
--    | |  | '_ \| '__/ _ \/ _` |/ _` / __| 
 
--    | |  | | | | | |  __/ (_| | (_| \__ \ 
 
--    |_|  |_| |_|_|  \___|\__,_|\__,_|___/ 
 
--                                          
 
-------------------------------------------------------------------------------------------------- 
 
	mFlightTutorial_thread = {  
		lava_trigger_threads = { INVALID_THREAD_HANDLE, INVALID_THREAD_HANDLE },  
		tutorial_triggers_threads = { INVALID_THREAD_HANDLE, INVALID_THREAD_HANDLE },  
		leash_thread = {INVALID_THREAD_HANDLE, INVALID_THREAD_HANDLE},  
		flight_state_machine = {INVALID_THREAD_HANDLE, INVALID_THREAD_HANDLE},  
	} 
 
 
 
-------------------------------------------------------------------------------------------------- 
 
--   _____ _               _                _       _        
 
--  / ____| |             | |              (_)     | |       
 
-- | |    | |__   ___  ___| | ___ __   ___  _ _ __ | |_ ___  
 
-- | |    | '_ \ / _ \/ __| |/ / '_ \ / _ \| | '_ \| __/ __| 
 
-- | |____| | | |  __/ (__|   <| |_) | (_) | | | | | |_\__ \ 
 
--  \_____|_| |_|\___|\___|_|\_\ .__/ \___/|_|_| |_|\__|___/ 
 
--                             | |                           
 
--                             |_|                           
 
-------------------------------------------------------------------------------------------------- 
 
	mFlightTutorial_checkpoint = {  
		--{  
		--	name = MISSION_START_CHECKPOINT,		-- First Checkpoint (fcp) 
 
		--	init = "mFlightTutorial_fcp_init",				-- init(bool mission_restart) 
 
		--	run = "mFlightTutorial_fcp_run",					-- run() 
 
		--	cleanup = "mFlightTutorial_fcp_cleanup",			-- cleanup(bool mission_exit) (+++MUST RETURN IMMEDIATELY+++) 
 
		--	next_checkpoint = "mFlightTutorial_orb_nav", 
 
		--	host_start = "Player_start_nav_host", 
 
		--	client_start = "Player_start_nav_client", 
 
		--	p1_car_nav = "", 
 
		--	p2_car_nav = "", 
 
		--	start_groups = { },  
		--	cp_only_groups = { },  
		--}, 
 
		 
 
		{  
			name = MISSION_START_CHECKPOINT,		-- Collect Orbs (orb) 
 
			init = "mFlightTutorial_orb_init",				-- init(bool mission_restart) 
 
			run = "mFlightTutorial_orb_run",					-- run() 
 
			cleanup = "mFlightTutorial_orb_cleanup",			-- cleanup(bool mission_exit) (+++MUST RETURN IMMEDIATELY+++) 
 
			next_checkpoint = "nil", 
 
			host_start = "altar_nav_host", 
 
			client_start = "altar_nav_client", 
 
			p1_car_nav = "", 
 
			p2_car_nav = "", 
 
			start_groups = { },  
			cp_only_groups = { },  
		}, 
 
		 
 
	} 
 
	 
 
-------------------------------------------------------------------------------------------------- 
 
--   _____      _                                 
 
--  / ____|    | |                                
 
-- | |    _   _| |_ ___  ___ ___ _ __   ___  ___  
 
-- | |   | | | | __/ __|/ __/ _ \ '_ \ / _ \/ __| 
 
-- | |___| |_| | |_\__ \ (_|  __/ | | |  __/\__ \ 
 
--  \_____\__,_|\__|___/\___\___|_| |_|\___||___/ 
 
--                                                
 
-------------------------------------------------------------------------------------------------- 
 
	mFlightTutorial_scene = {  
		intro = "", 
 
		outro = "Bink_Intro_Hell" 
 
	} 
 
 
 
-------------------------------------------------------------------------------------------------- 
 
--   _____                                    _   _                  
 
--  / ____|                                  | | (_)                 
 
-- | |     ___  _ ____   _____ _ __ ___  __ _| |_ _  ___  _ __  ___  
 
-- | |    / _ \| '_ \ \ / / _ \ '__/ __|/ _` | __| |/ _ \| '_ \/ __| 
 
-- | |___| (_) | | | \ V /  __/ |  \__ \ (_| | |_| | (_) | | | \__ \ 
 
--  \_____\___/|_| |_|\_/ \___|_|  |___/\__,_|\__|_|\___/|_| |_|___/ 
 
--                                                                   
 
-------------------------------------------------------------------------------------------------- 
 
 
 
	mFlightTutorial_persona = {   
		Johnny = {  
			persona_name = "Johnny_Gat", 
 
			persona_id = INVALID_PERSONA_HANDLE 
 
		}, 
 
		Dane = {  
			persona_name = "Dane", 
 
			persona_id = INVALID_PERSONA_HANDLE 
 
		}, 
 
	} 
 
 
 
	mFlightTutorial_convo = {  
		--[[ = { 
 
			name = "file_name without voice (_bm, _wm, _bf...", 
 
			player_talks = true or false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60,	-- if the conversation doesn't complete before this time, kill it 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_HIGH or CONVO_PRIORITY_NORMAL or CONVO_PRIORITY_OPTIONAL 
 
			(optional) persona_line = true,	-- this is a single line 
 
			(required if persona_line) speaker_name = "name of speaker",	-- single line speaker (might be set before call to play is made?) 
 
			(optional)phone_call = true,  -- this is a phone conversation (phone persona must be preloaded) 
 
			(required if phone_call) receiving_call = true or false  -- auto-answer is always true in missions (until proven otherwise) 
 
			 
 
		},]] 
 
		 
 
		charge = {  
			name = "mFlightTutorial_Charge",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		-- for top of wall ledge I think "you didn't fuck it up" 
 
		dash_end = {  
			name = "mFlightTutorial_Dash_End",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
 
 
		dive_start = {  
			name = "mFlightTutorial_Dive_Start",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
 
 
		flight_end = {  
			name = "mFlightTutorial_End",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		fail_a = {  
			name = "mFlightTutorial_FailA",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		fail_b = {  
			name = "mFlightTutorial_FailB",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		fall = {  
			name = "mFlightTutorial_Fall",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		flap = {  
			name = "mFlightTutorial_Flap",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		flap_nag = {  
			name = "mFlightTutorial_Flap_Nag",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		flight_nag = {  
			name = "mFlightTutorial_Flight_Nag",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		flight_start = {  
			name = "mFlightTutorial_Flight_Start",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		flight_variant = {  
			name = "mFlightTutorial_Flight_Variant",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		get_boost = {  
			name = "mFlightTutorial_Get_Boost",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		give_flap = {  
			name = "mFlightTutorial_GiveFlap",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		helper_first = {  
			name = "mFlightTutorial_Helper_First",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		helper_nag = {  
			name = "mFlightTutorial_Helper_Nag",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		helper_second = {  
			name = "mFlightTutorial_Helper_Second",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		missed_boost = {  
			name = "mFlightTutorial_Missed_Boost",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL,		 
 
		}, 
 
		powerup = {  
			name = "mFlightTutorial_Powerup",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL,		 
 
		}, 
 
		start = {  
			name = "mFlightTutorial_Start",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL,		 
 
		}, 
 
		turn = {  
			name = "mFlightTutorial_Turn",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		use_flap = {  
			name = "mFlightTutorial_Use_Flap",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		wall_jump = {  
			name = "mFlightTutorial_Wall_Jump",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		}, 
 
		transition = {  
			name = "mFlightTutorial_Transition",  
 
			player_talks = false, 
 
			handle = INVALID_CONVERSATION_HANDLE, 
 
			convo_thread = INVALID_THREAD_HANDLE, 
 
			max_wait_seconds = 60, 
 
			timer_thread = INVALID_THREAD_HANDLE, 
 
			priority = CONVO_PRIORITY_NORMAL, 
 
			sync = SYNC_ALL, 
 
		},		 
 
		--fail_gat = {  
		--	name = "mFlightTutorial_Fail_Gat",  
 
		--	player_talks = false, 
 
		--	handle = INVALID_CONVERSATION_HANDLE, 
 
		--	convo_thread = INVALID_THREAD_HANDLE, 
 
		--	max_wait_seconds = 60, 
 
		--	timer_thread = INVALID_THREAD_HANDLE, 
 
		--	priority = CONVO_PRIORITY_NORMAL, 
 
		--}, 
 
		--	 
 
		--fail_kinzie = {  
		--	name = "mFlightTutorial_Fail_KZ",  
 
		--	player_talks = false, 
 
		--	handle = INVALID_CONVERSATION_HANDLE, 
 
		--	convo_thread = INVALID_THREAD_HANDLE, 
 
		--	max_wait_seconds = 60, 
 
		--	timer_thread = INVALID_THREAD_HANDLE, 
 
		--	priority = CONVO_PRIORITY_NORMAL, 
 
		--}, 
 
		--	 
 
		--leash_gat = {  
		--	name = "mFlightTutorial_Leash_Gat",  
 
		--	player_talks = false, 
 
		--	handle = INVALID_CONVERSATION_HANDLE, 
 
		--	convo_thread = INVALID_THREAD_HANDLE, 
 
		--	max_wait_seconds = 60, 
 
		--	timer_thread = INVALID_THREAD_HANDLE, 
 
		--	priority = CONVO_PRIORITY_NORMAL, 
 
		--}, 
 
		--	 
 
		--leash_kinzie = {  
		--	name = "mFlightTutorial_Leash_KZ",  
 
		--	player_talks = false, 
 
		--	handle = INVALID_CONVERSATION_HANDLE, 
 
		--	convo_thread = INVALID_THREAD_HANDLE, 
 
		--	max_wait_seconds = 60, 
 
		--	timer_thread = INVALID_THREAD_HANDLE, 
 
		--	priority = CONVO_PRIORITY_NORMAL, 
 
		--}, 
 
	} 
 
	 
 
	mFlightTutorial_convo_queue = {  
		--[[start_drive_queue = {   
			{ delay = 2.0, convo = mFlightTutorial_convo.goto_Altar },  
			{ delay = 4.0, convo = mFlightTutorial_convo.goto_Altar2 },  
			{ delay = 3.0, convo = mFlightTutorial_convo.goto_Altar3 },  
			{ delay = 5.0, convo = mFlightTutorial_convo.goto_Altar4 }  
		}, 
 
		]]-- 
 
	} 
 
	 
 
-------------------------------------------------------------------------------------------------- 
 
--  _______   _                            
 
-- |__   __| (_)                           
 
--    | |_ __ _  __ _  __ _  ___ _ __ ___  
 
--    | | '__| |/ _` |/ _` |/ _ \ '__/ __| 
 
--    | | |  | | (_| | (_| |  __/ |  \__ \ 
 
--    |_|_|  |_|\__, |\__, |\___|_|  |___/ 
 
--               __/ | __/ |               
 
--              |___/ |___/     
 
-------------------------------------------------------------------------------------------------- 
 
	 
 
	-- Custom waypoint marker for triggers which isn't synced 
 
	-- so that each player can see their progress independently. 
 
	FLIGHTTUT_CUSTOM_TRIGGER_LOCATION = {  
		minimap_icon_name = MINIMAP_ICON_LOCATION, 
 
		ingame_effect_name = INGAME_EFFECT_LOCATION, 
 
		object_indicator_id = OI_ASSET_LOCATION, 
 
		object_indicator_flags = OI_FLAGS_LOCATION, 
 
	} 
 
 
 
	mFlightTutorial_trigger = {  
		-- = { 
 
		--	name = "_trigger", 
 
		--	hit = false, 
 
		-- 	last_hit_by = nil, -- 	last_hit_human = nil (set to the last human to enter the trigger in the default trigger callback) 
 
		--  (optional)callback = "mFlightTutorial_function_name_cb" 
 
		--	(optional)marker = TRIGGER_LOCATION or TRIGGER_USE or custom or don't include for no marker 
 
		--  (optional)waypoint = true, 
 
		--  (optional)teleport_to = {  
		--						host = "host_nav", 
 
		--						client = "client_nav"  
 
		--					},		 
 
		--	(optional)conversation = mFlightTutorial_convo.convo_name  -- play a conversation 
 
		--	(optional)next_trigger = "next_trigger_name" sets up next trigger when triggered (breadcrumbs) 
 
		--}, 
 
		 
 
		 
 
						--[[ Ultor TRIGGERS ]]-- 
 
									 
 
			ultor_jump_off_trigger = {  
			name = "ultor_jump_off_trigger", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_ultor_jump_off_trigger_callback", 
 
			},	 
 
 
 
									 
 
			ultor_teleport_trigger = {  
			name = "ultor_teleport_trigger", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_ultor_teleport_trigger_cb", 
 
			},	 
 
 
 
			ultor_super_movement_trigger = {  
			name = "ultor_super_movement_trigger", 
 
			hit = false, 
 
			waypoint = false, 
 
			}, 
 
 
 
						--[[ Lava TRIGGERS ]]-- 
 
									 
 
			lava_trigger = {  
			name = "lava_trigger", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_lava_trigger_callback", 
 
			}, 
 
			missed_flap_trigger_1 = {  
			name = "missed_flap_trigger_01", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_missed_flap_trigger_1_cb", 
 
			},	 
 
						--[[ Altar TRIGGERS ]]-- 
 
									 
 
			--altar_trigger = {  
			--name = "altar_trigger", 
 
			--hit = false, 
 
			--marker = TRIGGER_USE, 
 
			--disabled = true, 
 
			--anim_action = "hadouken", 
 
			--callback = "mFlightTutorial_altar_trigger_cb", 
 
			--}, 
 
 
 
						--[[ Jump TRIGGERS ]]--									 
 
			jump_trigger_01 = {  
			name = "jump_trigger_01", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_trigger_cb" 
 
			}, 
 
 
 
					--[[ Run-Jump TRIGGERS ]]--									 
 
			runningjump_trigger_01 = {  
			name = "runningjump_trigger_01", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_trigger_cb" 
 
			}, 
 
 
 
					--[[ Wall Jump TRIGGERS ]]--									 
 
			walljump_trigger_01 = {  
			name = "walljump_trigger_01", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_trigger_cb" 
 
			}, 
 
 
 
			--orb triggers 
 
			Bread_Crumb_Trigger_01 = {  
				name = "Bread_Crumb_Trigger<001>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_1" 
 
			}, 
 
			Bread_Crumb_Trigger_02 = {  
				name = "Bread_Crumb_Trigger<002>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_2" 
 
			}, 
 
			Bread_Crumb_Trigger_03 = {  
				name = "Bread_Crumb_Trigger<003>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_3" 
 
			}, 
 
			Bread_Crumb_Trigger_04 = {  
				name = "Bread_Crumb_Trigger<004>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_4" 
 
			}, 
 
			Bread_Crumb_Trigger_05 = {  
				name = "Bread_Crumb_Trigger<005>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_5" 
 
			}, 
 
			Bread_Crumb_Trigger_06 = {  
				name = "Bread_Crumb_Trigger<006>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_6" 
 
			}, 
 
			Bread_Crumb_Trigger_07 = {  
				name = "Bread_Crumb_Trigger<007>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_7" 
 
			}, 
 
			Bread_Crumb_Trigger_08 = {  
				name = "Bread_Crumb_Trigger<008>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_8" 
 
			}, 
 
			Bread_Crumb_Trigger_09 = {  
				name = "Bread_Crumb_Trigger<009>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_9" 
 
			}, 
 
			Bread_Crumb_Trigger_10 = {  
				name = "Bread_Crumb_Trigger<010>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_10" 
 
			}, 
 
			Bread_Crumb_Trigger_11 = {  
				name = "Bread_Crumb_Trigger<011>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_11" 
 
			}, 
 
			Bread_Crumb_Trigger_12 = {  
				name = "Bread_Crumb_Trigger<012>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_12" 
 
			}, 
 
			Bread_Crumb_Trigger_13 = {  
				name = "Bread_Crumb_Trigger<013>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_13" 
 
			}, 
 
			Bread_Crumb_Trigger_14 = {  
				name = "Bread_Crumb_Trigger<014>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_14" 
 
			}, 
 
			Bread_Crumb_Trigger_15 = {  
				name = "Bread_Crumb_Trigger<015>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_15" 
 
			}, 
 
			Bread_Crumb_Trigger_16 = {  
				name = "Bread_Crumb_Trigger<016>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_16" 
 
			}, 
 
			Bread_Crumb_Trigger_17 = {  
				name = "Bread_Crumb_Trigger<017>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_17" 
 
			}, 
 
			Bread_Crumb_Trigger_18 = {  
				name = "Bread_Crumb_Trigger<018>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_18" 
 
			}, 
 
			Bread_Crumb_Trigger_19 = {  
				name = "Bread_Crumb_Trigger<019>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_19" 
 
			}, 
 
			Bread_Crumb_Trigger_20 = {  
				name = "Bread_Crumb_Trigger<020>", 
 
				hit = false, 
 
				waypoint = false, 
 
				callback = "mFlighTutorial_breadcrumb_20" 
 
			}, 
 
			--[[ Glide TRIGGERS ]]-- 
 
			glide_trigger_01 = {  
			name = "glide_trigger_01", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_trigger_cb" 
 
			}, 
 
 
 
			give_flap_trigger_01 = {  
			name = "give_flap_trigger_01", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_do_flap_cb_1", 
 
 
 
			}, 
 
			give_flap_trigger_02 = {  
			name = "give_flap_trigger_02", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_do_flap_cb_2", 
 
 
 
			}, 
 
						--[[ Flap TRIGGERS ]]-- 
 
			flap_trigger_01 = {  
			name = "flap_trigger_01", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_trigger_cb" 
 
			}, 
 
 
 
						--[[ Dive TRIGGERS ]]-- 
 
			dive_trigger_01 = {  
			name = "dive_trigger_01", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_trigger_cb" 
 
			}, 
 
 
 
						--[[ Climb TRIGGERS ]]-- 
 
			climb_trigger_01 = {  
			name = "climb_trigger_01", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_trigger_cb" 
 
			}, 
 
						--[[ Turn TRIGGERS ]]-- 
 
			turn_trigger_01 = {  
			name = "turn_trigger_01", 
 
			hit = false, 
 
			waypoint = false, 
 
			callback = "mFlightTutorial_trigger_cb" 
 
			}, 
 
			 
 
						--[[ End TRIGGERS ]]-- 
 
			end_trigger = {  
			name = "end_mission_trigger", 
 
			hit = false, 
 
			marker = TRIGGER_LOCATION, 
 
			waypoint = false, 
 
			}, 
 
 
 
	} 
 
	 
 
-------------------------------------------------------------------------------------------------- 
 
--   _____ _       _           _      
 
--  / ____| |     | |         | |     
 
-- | |  __| | ___ | |__   __ _| |___  
 
-- | | |_ | |/ _ \| '_ \ / _` | / __| 
 
-- | |__| | | (_) | |_) | (_| | \__ \ 
 
--  \_____|_|\___/|_.__/ \__,_|_|___/ 
 
--                                    
 
--                                    
 
-------------------------------------------------------------------------------------------------- 
 
mFlightTutorial_players = {}  
mLastIslandTriggered_Local = "altar_nav_host" 
 
mLastIslandTriggered_Remote = "altar_nav_client" 
 
mLocalTurnTriggerHit = false 
 
mRemoteTurnTriggerHit = false 
 
mFlightTutorial_UsePlayerLeash = true 
 
 
 
-- Indicates which is the farthest island we've reached 
 
g_nCurrentNavpointNumber = 0 
 
mFlightTutorial_RespawnNavpoints = {  
	["jump_respawn_nav_host"]			= 1, 
 
	["walljump_respawn_nav_host"]		= 2, 
 
	["runningjump_respawn_nav_host"]	= 3, 
 
	["glide_respawn_nav_host"]			= 4, 
 
	["give_flap_nav_host"]				= 5, 
 
	["dive_respawn_nav_host"]			= 6, 
 
	["flap_respawn_nav_host"]			= 7, 
 
	["climb_respawn_nav_host"]			= 8, 
 
	["turn_respawn_nav_host"]			= 9, 
 
} 
 
 
 
mFlightTutorial_powers_tutorial = {  
	{  
		purchased = false, 
 
		finished = false, 
 
	}, 
 
	{  
		purchased = true, 
 
		finished = true, 
 
	}, 
 
} 
 
 
 
 
 
-------------------------------------------------------------------------------------------------- 
 
-- __      __________   __ 
 
-- \ \    / /  ____\ \ / / 
 
--  \ \  / /| |__   \ V /  
 
--   \ \/ / |  __|   > <   
 
--    \  /  | |     / . \  
 
--     \/   |_|    /_/ \_\ 
 
--                         
 
--------------------------------------------------------------------------------------------------	 
 
mFlightTutorial_vfx_list = {  
 
 
	power_up = { name = "vfx_Altars_PowerUp", handle = "" },  
	teleport = { name = "Vfx_Hell_Teleport", handle = "" },  
} 
 
 
 
-------------------------------------------------------------------------------------------------- 
 
--                 _                 _   _                  
 
--     /\         (_)               | | (_)                 
 
--    /  \   _ __  _ _ __ ___   __ _| |_ _  ___  _ __  ___  
 
--   / /\ \ | '_ \| | '_ ` _ \ / _` | __| |/ _ \| '_ \/ __| 
 
--  / ____ \| | | | | | | | | | (_| | |_| | (_) | | | \__ \ 
 
-- /_/    \_\_| |_|_|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/ 
 
--                                                          
 
--------------------------------------------------------------------------------------------------	 
 
mFlightTutorial_animation_list = {  
 
 
	clusters_collected = { anim_action_name = "hadouken" },  
 
 
} 
 
 
 
-------------------------------------------------------------------------------------------------- 
 
								--[[**********************]]-- 
 
								--[[                      ]]-- 
 
								--[[  Standard functions  ]]-- 
 
								--[[                      ]]-- 
 
								--[[**********************]]-- 
 
 
 
-- This is the primary entry point for the mission, and is responsible for starting up the mission 
 
-- at the specified checkpoint. 
 
-- CALLED FROM CODE 
 
-- 
 
-- start_checkpoint_name:	(string) The checkpoint the mission should begin at 
 
-- is_restart:					(bool) TRUE if the mission is restarting, FALSE otherwise 
 
-- 
 
function mFlightTutorial_start(start_checkpoint_name, is_restart) 
 
	mission_start_fade_out(0.0) 
 
	collectible_hide_orbs(true) 
 
 
 
	-- Disable the default tutorial nags 
 
	tutorial_lock("super_jump_1")  
	tutorial_lock("super_jump_2")  
	tutorial_lock("jump_climb")  
 
 
	-- initialize systems 
 
	mission_startup(mFlightTutorial_trigger, mFlightTutorial_convo) -- mFlightTutorial_checkpoint 
 
	load_persona(mFlightTutorial_persona.Dane) 
 
	 
 
	-- HVS_BDF: we don't necessarily want to call load_persona() because this creates a 2D 
 
	-- version, which can prevent actual in-game characters from lip syncing their VO if 
 
	-- the 2D persona was loaded prior to their character being spawned. 
 
	-- In the case of PC characters, they are present in the world and should lip sync their VO. 
 
	--load_persona(mIntro_persona.Johnny) 
 
 
 
	-- if using interrogations 
 
	--interrogate_startup(mFlightTutorial_interrogate) 
 
	 
 
	local start_cp = get_table_by_name(mFlightTutorial_checkpoint, MISSION_START_CHECKPOINT) 
 
 
 
	-- Check if this mission starting from the beginning 
 
	if (start_checkpoint_name == start_cp.name) then 
 
		if (is_restart == false and mFlightTutorial_scene.intro ~= "") then 
 
			-- First time playing mission 
 
			local fade_in_after = false 
 
			cutscene_play(mFlightTutorial_scene.intro, nil, {"altar_nav_host", "altar_nav_client" }, fade_in_after)  
		else 
 
		teleport_coop(mFlightTutorial_group.start_navs.altar_nav_host, mFlightTutorial_group.start_navs.altar_nav_client, true) 
 
		end 
 
		fade_out(0) 
 
	end 
 
 
 
	-- Remove any flaps we awarded. 
 
--	super_jump_set_flap_max( 0, SYNC_LOCAL, false ) 
 
	 
 
	if coop_is_active() then 
 
--		super_jump_set_flap_max( 0, SYNC_REMOTE, false ) 
 
	end 
 
 
 
	-- Handle mission initialization for the current checkpoint 
 
	mFlightTutorial_initialize(start_checkpoint_name) 
 
 
 
	-- Run the mission from the current checkpoint 
 
	checkpoint_run_mission(mFlightTutorial_checkpoint, start_checkpoint_name) 
 
	 
 
	mFlightTutorial_success() 
 
 
 
	mission_end_success("mFlightTutorial")--, nil, "end_nav_host", "end_nav_remote")  
end 
 
 
 
-- This is the primary function responsible for cleaning up the entire mission 
 
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++) 
 
-- 
 
function mFlightTutorial_cleanup() 
 
	--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--	 
 
 
 
		-- Enable the default tutorial nags 
 
	tutorial_unlock("super_jump_1")  
	tutorial_unlock("super_jump_2")  
	tutorial_unlock("jump_climb")  
 
 
 
 
	flight_tutorial_stamina(false, LOCAL_PLAYER) 
 
	if(coop_is_active()) then 
 
		flight_tutorial_stamina(false, REMOTE_PLAYER) 
 
	end 
 
	-- restore normal jump height 
 
	tweak_table_restore_value ("Jump_super_max_height_scripted")  
	player_super_power_set_wall_jump_and_sprint_disabled(false, false, LOCAL_PLAYER) 
 
	if(coop_is_active()) then 
 
		player_super_power_set_wall_jump_and_sprint_disabled(false, false, REMOTE_PLAYER) 
 
	end 
 
	player_super_movement_enable(true) 
 
	player_super_attacks_enable(true) 
 
	unlockable_lock("Glide_Power_2", SYNC_ALL)  
	temp_restore_flight_power() 
 
	if(coop_is_active()) then 
 
		if (iNumberOfFlapsAtStartRemote > 1) then 
 
			--iCurrentFlapsRemote = iNumberOfFlapsAtStartRemote 
 
			super_jump_set_flap_max( iNumberOfFlapsAtStartRemote, SYNC_REMOTE, true ) 
 
 
 
		end 
 
		 
 
	end 
 
	 
 
	if (iStartFlapsLocal > 1) then 
 
		super_jump_set_flap_max( iStartFlapsLocal, SYNC_LOCAL, true ) 
 
	end 
 
	-- Swap back to the city 
 
	city_zone_swap( "u_train", false ) 
 
 
 
	-- cleanup all threads 
 
	cleanup_threads(mFlightTutorial_thread) 
 
	 
 
	-- run checkpoint cleanups (move into mission_shutdown?) 
 
	checkpoint_cleanup_mission(mFlightTutorial_checkpoint) 
 
 
 
	-- HVS_RCK - This is intentional. We want to start the challenges tutorial as this mission is ending. That unlocks the challenges menu. 
 
	if not mission_is_failed() then 
 
		hud_prompt(LOCAL_PLAYER, "MM_1_1_OBJ_ACCESS_HUB", "", true) 
 
		if coop_is_active() then 
 
			hud_prompt(REMOTE_PLAYER, "MM_1_1_OBJ_ACCESS_HUB", "", true) 
 
		end 
 
		challenge_tutorial_set_active(true) 
 
	end 
 
 
 
	-- cleanup triggers, convos, kill_list and interrogations 
 
	mission_shutdown() 
 
	 
 
	-- cleanup all groups 
 
	cleanup_groups(mFlightTutorial_group) 
 
 
 
end 
 
 
 
-- Called when the mission has ended with success 
 
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++) 
 
-- 
 
function mFlightTutorial_success() 
 
	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]-- 
 
 
 
	-- Equip the superpower if we finished successfully 
 
	--player_super_power_select( "freeze", SYNC_ALL, "blast_stone" ) 
 
	collectible_hide_orbs(false) 
 
 
 
end 
 
 
 
-------------------------------------------------------------------------------------------------- 
 
								--[[**********************]]-- 
 
								--[[                      ]]-- 
 
								--[[ Initialize functions ]]-- 
 
								--[[                      ]]-- 
 
								--[[**********************]]-- 
 
 
 
-- Initialize the mission for the specified checkpoint 
 
-- 
 
-- checkpoint_name:		(string) Checkpoint to initialize the mission to 
 
-- 
 
function mFlightTutorial_initialize(checkpoint_name) 
 
	-- Common initialization 
 
	mFlightTutorial_initialize_common() 
 
 
 
	flight_tutorial_stamina(true, LOCAL_PLAYER) 
 
	if(coop_is_active()) then 
 
	flight_tutorial_stamina(true, REMOTE_PLAYER) 
 
	end 
 
	 
 
	-- Get the player names 
 
	mFlightTutorial_players = player_names_get_all() 
 
 
 
	-- Checkpoint specific initialization 
 
	checkpoint_init(mFlightTutorial_checkpoint, checkpoint_name) 
 
 
 
	-- Setup the lava trigger 
 
	trigger_setup( mFlightTutorial_trigger.lava_trigger ) 
 
 
 
	-- Start the lava thread 
 
	for i, player in pairs( mFlightTutorial_players ) do 
 
		mFlightTutorial_thread.lava_trigger_threads[ i ] = thread_new( "mFlightTutorial_lava_trigger_thread_func", player ) 
 
	end 
 
 
 
	-- Remove any present subtitles 
 
	message_remove_all() 
 
 
 
	-- Start fading in  
 
	mission_start_fade_in() 
 
end 
 
 
 
 
 
bFlightPower2Unlocked = false 
 
 
 
 
 
-- Handle any common initialization 
 
function mFlightTutorial_initialize_common() 
 
	--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]-- 
 
	audio_object_post_event( "Play_FlightMusic" ) 
 
	audio_object_post_event( "Play_amb_mFlightTutorial" ) 
 
		 
 
	-- Lets check to see if the remote player has more flaps 
 
	if(coop_is_active()) then 
 
		if (player_get_num_flaps(REMOTE_PLAYER) > 0) then 
 
			iNumberOfFlapsAtStartRemote = player_get_num_flaps(REMOTE_PLAYER) 
 
			super_jump_set_flap_max( 0, SYNC_REMOTE, true ) 
 
			iCurrentFlapsRemote = 0 
 
		end 
 
	end 
 
	iStartFlapsLocal = player_get_num_flaps(LOCAL_PLAYER) 
 
	temp_save_flight_power() 
 
	unlockable_unlock("Glide_Power_2", true, SYNC_ALL)  
	 
 
	-- remove any flaps 
 
	super_jump_set_flap_max( 0, SYNC_LOCAL, true ) 
 
	--iCurrentFlapsRemote = iNumberOfFlapsAtStartRemote 
 
	flight_tutorial_stamina(true, LOCAL_PLAYER) 
 
	if(coop_is_active()) then 
 
	flight_tutorial_stamina(true, REMOTE_PLAYER) 
 
	end 
 
end 
 
 
 
-------------------------------------------------------------------------------------------------- 
 
								--[[**********************]]-- 
 
								--[[                      ]]-- 
 
								--[[ Checkpoint functions ]]-- 
 
								--[[                      ]]-- 
 
								--[[**********************]]-- 
 
 
 
-------------------------------------------------------------------------------------------------- 
 
--[[ 
 
  ______ _          _      _____ _               _                _       _    
 
 |  ____(_)        | |    / ____| |             | |              (_)     | |   
 
 | |__   _ _ __ ___| |_  | |    | |__   ___  ___| | ___ __   ___  _ _ __ | |_  
 
 |  __| | | '__/ __| __| | |    | '_ \ / _ \/ __| |/ / '_ \ / _ \| | '_ \| __| 
 
 | |    | | |  \__ \ |_  | |____| | | |  __/ (__|   <| |_) | (_) | | | | | |_  
 
 |_|    |_|_|  |___/\__|  \_____|_| |_|\___|\___|_|\_\ .__/ \___/|_|_| |_|\__| 
 
													 | |                       
 
													 |_|                       
 
]]-- 
 
-------------------------------------------------------------------------------------------------- 
 
 
 
-- Initialize this checkpoint. 
 
-- 
 
-- mission_start: (bool) Whether we're initializing from a mission (re)start or from 
 
--					a natural play-through. 
 
-- 
 
function mFlightTutorial_fcp_init(mission_start) 
 
 
 
	-- Enable super movement, but not super attacks 
 
	player_super_movement_enable( false ) 
 
	player_super_attacks_enable( false ) 
 
	--human_allow_freefall( false ) 
 
 
 
end 
 
 
 
-- The first objective 
 
-- 
 
function mFlightTutorial_fcp_run() 
 
 
 
	-- Disable super powers 
 
	--player_super_movement_enable( false ) 
 
	--player_super_attacks_enable( false ) 
 
	--human_allow_freefall( true )	 
 
 
 
	mFlightTutorial_allow_player_controls( false ) 
 
	 
 
	-- Tell the player to jump off of the building 
 
	objective_text( 0, "GM_FLIGHTTUT_OBJ_FLY_TO_CLUSTER", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
 
	player_wings_force_open( LOCAL_PLAYER, true )	 
 
	mFlightTutorial_allow_player_controls( true ) 
 
 
 
	-- Set up our super movement trigger 
 
	--trigger_enable( mFlightTutorial_trigger.ultor_super_movement_trigger.name ) 
 
	--on_trigger_exit( "mFlightTutorial_ultor_super_movement_trigger_callback", mFlightTutorial_trigger.ultor_super_movement_trigger.name ) 
 
 
 
 
 
 
 
	delay( 2.0 ) 
 
 
 
	--  Set up the fake waypoint marker 
 
	object_indicator_add( "fake_goal_navpoint", OI_ASSET_LOCATION ) 
 
 
 
	-- Set up the jump off trigger 
 
	trigger_setup( mFlightTutorial_trigger.ultor_teleport_trigger ) 
 
	trigger_setup( mFlightTutorial_trigger.ultor_jump_off_trigger ) 
 
	while not mFlightTutorial_trigger.ultor_teleport_trigger.hit do 
 
		thread_yield() 
 
	end 
 
	-- TODO: Play SAM 
 
 
 
	-- Block until the SAM is done 
 
	delay(2.0) 
 
 
 
	-- Fade to black and teleport. 
 
	fade_out( 0.0 ) 
 
	fade_out_block() 
 
	 
 
	--  Remove the fake waypoint marker and text 
 
	object_indicator_remove( "fake_goal_navpoint" ) 
 
	objective_text_clear( 0 ) 
 
	message_remove_all() 
 
 
 
	-- Disable warp to shore and un-force the player's wings 
 
	for i, player in pairs( mFlightTutorial_players ) do 
 
		player_warp_to_shore_disable( player ) 
 
	end 
 
	 
 
	-- Swap to the training area and bring our players with 
 
	--city_zone_swap( "f_train", true ) 
 
	if coop_is_active() == false then 
 
		teleport( LOCAL_PLAYER, "altar_nav_host" ) 
 
		character_show( LOCAL_PLAYER ) 
 
		human_gravity_enable( LOCAL_PLAYER, true ) 
 
		player_wings_force_open( LOCAL_PLAYER, false ) 
 
	else 
 
		teleport_coop( "altar_nav_host", "altar_nav_client" ) 
 
		character_show( LOCAL_PLAYER )	 
 
		character_show( REMOTE_PLAYER ) 
 
		human_gravity_enable( LOCAL_PLAYER, true ) 
 
		human_gravity_enable( REMOTE_PLAYER, true ) 
 
		camera_set_target( LOCAL_PLAYER, true, SYNC_LOCAL ) 
 
		camera_set_target( REMOTE_PLAYER, true, SYNC_REMOTE ) 
 
		player_wings_force_open( LOCAL_PLAYER, false ) 
 
		player_wings_force_open( REMOTE_PLAYER, false ) 
 
	end 
 
 
 
		-- Disable superpowers (Mostly here so that if we restart the mission, it'll play as it should.) 
 
	player_lock_super_power(MM_1_2_SUPERPOWER_SPRINT, LOCAL_PLAYER) 
 
	player_lock_super_power(MM_1_2_SUPERPOWER_JUMP, LOCAL_PLAYER) 
 
	player_flight_unlock( LOCAL_PLAYER, false ) 
 
	if coop_is_active() then 
 
		player_lock_super_power(MM_1_2_SUPERPOWER_SPRINT, REMOTE_PLAYER) 
 
		player_lock_super_power(MM_1_2_SUPERPOWER_JUMP, REMOTE_PLAYER) 
 
		player_flight_unlock( REMOTE_PLAYER, false ) 
 
	end 
 
 
 
 
 
	-- Create our soul clusters 
 
	group_create( "soul_cluster_group" ) 
 
 
 
	marker_add(mFlightTutorial_group.soul_clusters, MINIMAP_ICON_LOCATION,OI_ASSET_LOCATION)  
 
	 
 
	-- Reset the current navpoint counter 
 
	g_nCurrentNavpointNumber = 0 
 
 
 
	delay( 4.0 )  
 
 
 
	fade_in( 0.0 ) 
 
	 
 
	--group_create( mFlightTutorial_group.damned_soul.name ) 
 
	--on_death( "mFlightTutorial_damned_soul_on_death_cb", mFlightTutorial_group.damned_soul.npc ) 
 
 
 
	mFlightTutorial_allow_player_controls( true ) 
 
end 
 
 
 
-- Do any cleanup for this checkpoint. 
 
-- 
 
-- (+++THIS IS CALLED FROM MISSION CLEANUP, MUST RETURN IMMEDIATELY+++) 
 
-- 
 
-- mission_exit: (bool) Whether we're exiting the mission entirely, or just 
 
--					moving on to the next checkpoint. 
 
-- 
 
function mFlightTutorial_fcp_cleanup(mission_exit) 
 
	 
 
	-- Clean up damned soul callback 
 
	if mission_exit then 
 
		on_death( "", mFlightTutorial_group.damned_soul.npc ) 
 
	end 
 
 
 
	if mission_is_failed() then 
 
 
 
		player_super_movement_enable(false) 
 
		player_lock_super_power(MM_1_2_SUPERPOWER_SPRINT, LOCAL_PLAYER) 
 
		player_lock_super_power(MM_1_2_SUPERPOWER_JUMP, LOCAL_PLAYER) 
 
		player_flight_unlock( LOCAL_PLAYER, false ) 
 
 
 
		if coop_is_active() then 
 
			player_lock_super_power(MM_1_2_SUPERPOWER_SPRINT, REMOTE_PLAYER) 
 
			player_lock_super_power(MM_1_2_SUPERPOWER_JUMP, REMOTE_PLAYER) 
 
			player_flight_unlock( REMOTE_PLAYER, false ) 
 
		end 
 
 
 
		player_super_attacks_enable( false ) 
 
	end 
 
	flight_tutorial_stamina(false, LOCAL_PLAYER) 
 
	if(coop_is_active()) then 
 
	flight_tutorial_stamina(false, REMOTE_PLAYER) 
 
	end 
 
end 
 
 
 
------------------------------------ 
 
-- 
 
-- Checkpoint helper functions 
 
-- 
 
------------------------------------ 
 
 
 
------------------------------------ 
 
-- 
 
-- Checkpoint thread functions 
 
-- 
 
------------------------------------ 
 
 
 
------------------------------------ 
 
-- 
 
-- Checkpoint callback functions 
 
-- 
 
------------------------------------ 
 
 
 
-------------------------------------------------------------------------------------------------- 
 
--[[ 
 
   _____      _ _           _      ____       _          
 
  / ____|    | | |         | |    / __ \     | |         
 
 | |     ___ | | | ___  ___| |_  | |  | |_ __| |__  ___  
 
 | |    / _ \| | |/ _ \/ __| __| | |  | | '__| '_ \/ __| 
 
 | |___| (_) | | |  __/ (__| |_  | |__| | |  | |_) \__ \ 
 
  \_____\___/|_|_|\___|\___|\__|  \____/|_|  |_.__/|___/ 
 
																											   
 
]]-- 
 
-------------------------------------------------------------------------------------------------- 
 
function mFlightTutorial_orb_init(mission_start) 
 
 
 
	-- Disable warp to shore and un-force the player's wings 
 
	for i, player in pairs( mFlightTutorial_players ) do 
 
		player_warp_to_shore_disable( player ) 
 
	end 
 
	 
 
	-- Swap to the training area and bring our players with 
 
	--city_zone_swap( "f_train", true ) 
 
	if coop_is_active() == false then 
 
		teleport( LOCAL_PLAYER, "altar_nav_host" ) 
 
		character_show( LOCAL_PLAYER ) 
 
		human_gravity_enable( LOCAL_PLAYER, true ) 
 
		player_wings_force_open( LOCAL_PLAYER, false ) 
 
	else 
 
		teleport_coop( "altar_nav_host", "altar_nav_client" ) 
 
		character_show( LOCAL_PLAYER )	 
 
		character_show( REMOTE_PLAYER ) 
 
		human_gravity_enable( LOCAL_PLAYER, true ) 
 
		human_gravity_enable( REMOTE_PLAYER, true ) 
 
		camera_set_target( LOCAL_PLAYER, true, SYNC_LOCAL ) 
 
		camera_set_target( REMOTE_PLAYER, true, SYNC_REMOTE ) 
 
		player_wings_force_open( LOCAL_PLAYER, false ) 
 
		player_wings_force_open( REMOTE_PLAYER, false ) 
 
	end 
 
 
 
		-- Disable superpowers (Mostly here so that if we restart the mission, it'll play as it should.) 
 
	player_lock_super_power(MM_1_2_SUPERPOWER_SPRINT, LOCAL_PLAYER) 
 
	player_lock_super_power(MM_1_2_SUPERPOWER_JUMP, LOCAL_PLAYER) 
 
	player_flight_unlock( LOCAL_PLAYER, false ) 
 
	if coop_is_active() then 
 
		player_lock_super_power(MM_1_2_SUPERPOWER_SPRINT, REMOTE_PLAYER) 
 
		player_lock_super_power(MM_1_2_SUPERPOWER_JUMP, REMOTE_PLAYER) 
 
		player_flight_unlock( REMOTE_PLAYER, false ) 
 
	end 
 
 
 
 
 
	-- Create our soul clusters and hide the fourth one 
 
	group_create( "soul_cluster_group" ) 
 
	--item_hide( mFlightTutorial_group.soul_clusters.cluster04.name ) 
 
	marker_add(mFlightTutorial_group.soul_clusters, MINIMAP_ICON_LOCATION,OI_ASSET_LOCATION)  
 
	-- Reset the current navpoint counter 
 
	g_nCurrentNavpointNumber = 0 
 
	 
 
	delay( 4.0 )  
 
 
 
	fade_in( 0.0 ) 
 
	 
 
	--group_create( mFlightTutorial_group.damned_soul.name ) 
 
	--on_death( "mFlightTutorial_damned_soul_on_death_cb", mFlightTutorial_group.damned_soul.npc ) 
 
 
 
	mFlightTutorial_allow_player_controls( true ) 
 
 
 
	-- Disable super movement 
 
	player_super_movement_enable( false ) 
 
	player_super_attacks_enable( false ) 
 
	--human_allow_freefall( false ) 
 
 
 
	-- Set up the soul cluster item call back 
 
	for i, cluster in pairs( mFlightTutorial_group.soul_clusters ) do	 
 
		on_pickup( "mFlightTutorial_cluster_collected", cluster.name ) 
 
		object_indicator_add( cluster.name, OI_ASSET_LOCATION ) 
 
	end 
 
end 
 
 
 
function mFlightTutorial_orb_run() 
 
 
 
	tweak_table_override_value("Jump_super_max_height_scripted",24)  
 
 
 
 
	objective_text( 0, "GM_FLIGHTTUT_OBJ_COLLECT_SOUL_CLUSTERS", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
 
	-- Set indicators on every soul cluster 
 
--	for i, cluster in pairs( mFlightTutorial_group.soul_clusters ) do	 
 
		 
 
--	end 
 
	convo_end_all() 
 
	convo_start(mFlightTutorial_convo.start)	 
 
	for i, player in pairs( mFlightTutorial_players ) do 
 
		mFlightTutorial_thread.leash_thread[ i ] = thread_new("mFlightTutorial_leash_thread", player)  
	end 
 
 
 
	 
 
 
 
	 
 
	while mFlightTutorial_clusters_collected ~= MFLIGHTTUTORIAL_NUM_CLUSTERS do 
 
		thread_yield() 
 
	end 
 
	 
 
	convo_end_all() 
 
	convo_start(mFlightTutorial_convo.powerup) 
 
	 
 
	message_remove_all() 
 
 
 
	--while not mFlightTutorial_trigger.altar_trigger.hit do 
 
	--	thread_yield() 
 
	--end 
 
	objective_text_clear( 0 ) 
 
	-- Go through the power purchase tutorial 
 
	human_allow_freefall( false )	 
 
	objective_text(0, "GM_FLIGHTTUT_OBJ_ACCESS_POWERS", nil, nil, SYNC_LOCAL, OI_ASSET_USE) 
 
	mFlightTutorial_purchase_powers() 
 
	 
 
	-- Start the tutorial trigger threads 
 
	objective_text_clear( 0 ) 
 
	objective_text( 0, "GM_FLIGHTTUT_OBJ_COMPLETE_TRAINING", nil, nil, SYNC_LOCAL, OI_ASSET_LOCATION ) 
 
	if coop_is_active() then 
 
		objective_text( 1, "GM_FLIGHTTUT_OBJ_COMPLETE_TRAINING", nil, nil, SYNC_REMOTE, OI_ASSET_LOCATION )		 
 
	end 
 
	message_remove_all() 
 
	for i, player in pairs( mFlightTutorial_players ) do 
 
		mFlightTutorial_thread.tutorial_triggers_threads[ i ] = thread_new( "mFlightTutorial_tutorial_triggers_thread_func", player ) 
 
	end 
 
	 
 
	-- Wait until the turn trigger is properly hit.	 
 
	if( coop_is_active() ) then 
 
		 
 
		local turn_trigger_hit = false 
 
		while not ( turn_trigger_hit ) do 			 
 
			if(  mLocalTurnTriggerHit == true or mRemoteTurnTriggerHit == true )then 
 
				turn_trigger_hit = true 
 
			end 
 
			thread_yield() 
 
		end 
 
	else 
 
		while not ( mLocalTurnTriggerHit == true ) do 
 
			thread_yield() 
 
		end 
 
	end 
 
	 
 
	-- Set up the last trigger. 
 
	if( coop_is_active() ) then 
 
		local local_player_hit_last_trigger = false 
 
		local remote_player_hit_last_trigger = false 
 
 
 
		while( local_player_hit_last_trigger == false or remote_player_hit_last_trigger == false )do  
 
			 
 
			-- For the last trigger, tell the player who finished first to wait for their buddy. 
 
			if local_player_hit_last_trigger == false and object_is_in_trigger( mFlightTutorial_trigger.end_trigger.name, LOCAL_PLAYER ) and player_is_standing( LOCAL_PLAYER ) then 
 
				objective_text( 0, "MM_1_1_OBJ_WAIT_FOR_PLAYER", nil, nil, SYNC_LOCAL, OI_ASSET_LOCATION ) 
 
				marker_remove_trigger( mFlightTutorial_trigger.end_trigger.name, SYNC_LOCAL )		 
 
				local_player_hit_last_trigger = true 
 
			end 
 
			 
 
			if remote_player_hit_last_trigger == false and object_is_in_trigger( mFlightTutorial_trigger.end_trigger.name, REMOTE_PLAYER ) and player_is_standing( REMOTE_PLAYER ) then 
 
				objective_text( 1, "MM_1_1_OBJ_WAIT_FOR_PLAYER", nil, nil, SYNC_REMOTE, OI_ASSET_LOCATION )	 
 
				marker_remove_trigger( mFlightTutorial_trigger.end_trigger.name, SYNC_REMOTE ) 
 
				remote_player_hit_last_trigger = true 
 
			end 
 
			 
 
			thread_yield() 
 
		end 
 
	else 
 
		while not ( object_is_in_trigger( mFlightTutorial_trigger.end_trigger.name, LOCAL_PLAYER ) and player_is_standing( LOCAL_PLAYER ) ) do 
 
			thread_yield() 
 
		end 
 
	end 
 
	 
 
	-- Last trigger, both players should be here for the mission to complete. 
 
	-- Otherwise, complete the mission. 
 
	--if coop_is_active() then 
 
	--	while get_num_humans_in_trigger( mFlightTutorial_trigger.end_trigger.name ) ~= 2 do 
 
	--		thread_yield() 
 
	--	end 
 
	--end 
 
	 
 
 
 
	tutorial_stop_current() 
 
	objective_text_clear(0) 
 
	objective_text_clear(1) 
 
	marker_remove_trigger( mFlightTutorial_trigger.end_trigger.name, SYNC_ALL ) 
 
	mFlightTutorial_UsePlayerLeash = false 
 
	convo_end_all() 
 
 
 
	audio_object_post_event( "Stop_FlightMusic" ) 
 
	audio_object_post_event( "Stop_amb_mFlightTutorial" ) 
 
	mFlightTutorial_convo.transition.sync = SYNC_ALL 
 
	convo_start(mFlightTutorial_convo.transition)	 
 
	convo_wait_for_end() 
 
	cutscene_play(mFlightTutorial_scene.outro, nil, {"player_start_nav_host", "player_start_nav_client"}, true )  
 
 
	-- Send the players back to Ultor per Volition's request 
 
	--fade_out(1.0) 
 
	--teleport_coop("player_start_nav_host", "player_start_nav_client")  
	--delay(3.0) 
 
	--fade_in(1.0) 
 
end 
 
 
 
function mFlightTutorial_orb_cleanup(mission_exit) 
 
	 
 
	 
 
	-- Clear purchase powers callback 
 
	on_powers_tutorial_completed("")  
	 
 
	-- Disable super powers tutorial 
 
	cellphone_enable_powers_tutorial(false) 
 
	 
 
	-- Clear HUD prompt 
 
	hud_prompt_clear() 
 
	 
 
 
 
	-- Clean up triggers	 
 
	on_trigger_exit( "", mFlightTutorial_trigger.ultor_super_movement_trigger.name ) 
 
	trigger_cb( "", mFlightTutorial_trigger.lava_trigger  ) 
 
 
 
	-- Clean up clusters 
 
	on_pickup( "", mFlightTutorial_group.soul_clusters.cluster01.name ) 
 
	on_pickup( "", mFlightTutorial_group.soul_clusters.cluster02.name ) 
 
	on_pickup( "", mFlightTutorial_group.soul_clusters.cluster03.name ) 
 
	on_pickup( "", mFlightTutorial_group.soul_clusters.cluster04.name ) 
 
 
 
	-- Re-enable warp to shore	 
 
	for i, player in pairs( mFlightTutorial_players ) do 
 
		player_warp_to_shore_enable( player ) 
 
	end 
 
		 
 
	if mission_is_failed() then 
 
 
 
		player_super_movement_enable(false) 
 
		player_lock_super_power(MM_1_2_SUPERPOWER_SPRINT, LOCAL_PLAYER) 
 
		player_lock_super_power(MM_1_2_SUPERPOWER_JUMP, LOCAL_PLAYER) 
 
		player_flight_unlock( LOCAL_PLAYER, false ) 
 
		if coop_is_active() then 
 
			player_lock_super_power(MM_1_2_SUPERPOWER_SPRINT, REMOTE_PLAYER) 
 
			player_lock_super_power(MM_1_2_SUPERPOWER_JUMP, REMOTE_PLAYER) 
 
			player_flight_unlock( REMOTE_PLAYER, false ) 
 
		end 
 
 
 
		player_super_attacks_enable( false ) 
 
	else	 
 
 
 
		--player_unlock_super_power( SUPERPOWER_BLAST, LOCAL_PLAYER, true ) 
 
		--if coop_is_active() then 
 
		--	player_unlock_super_power( SUPERPOWER_BLAST, REMOTE_PLAYER, true ) 
 
		--end 
 
		-- 
 
		----player_unlock_element( PLAYER_SUPERPOWER_BLAST_STONE ) 
 
		--player_super_attacks_enable( true ) 
 
	end 
 
end 
 
 
 
------------------------------------ 
 
-- 
 
-- Checkpoint helper functions 
 
-- 
 
------------------------------------ 
 
function mFlightTutorial_purchase_powers() 
 
 
 
	-- "That should be enough. Let's see what I can do here... Check your HUB." 
 
	 
 
	-- Wait for Kinzie to call out HUB (end of convo) 
 
	--convo_wait_for_end() 
 
	 
 
	-- Setup callback to track if powers were purchased 
 
	on_powers_tutorial_completed("mFlightTutorial_powers_purchased_cb")  
	 
 
	-- Enable super powers tutorial 
 
	cellphone_enable_powers_tutorial(true) 
 
	 
 
	-- Have player(s) purchase Sprint/Jump powers (local/remote separate) 
 
	hud_prompt(LOCAL_PLAYER, "MM_1_2_ACT_ACCESS_HUB", "mFlightTutorial_empty_cb") 
 
	if coop_is_active() then 
 
		mFlightTutorial_powers_tutorial[SYNC_REMOTE].purchased = false 
 
		mFlightTutorial_powers_tutorial[SYNC_REMOTE].finished = false 
 
		objective_text( 1, "GM_FLIGHTTUT_OBJ_ACCESS_POWERS", nil, nil, SYNC_REMOTE, OI_ASSET_USE) 
 
		hud_prompt(REMOTE_PLAYER, "MM_1_2_ACT_ACCESS_HUB", "mFlightTutorial_empty_cb") 
 
	end 
 
	 
 
	-- Wait for player(s) to purchase Sprint/Jump powers (local/remote separate) 
 
	while ((mFlightTutorial_powers_tutorial[SYNC_LOCAL].finished == false)  
 
	or (mFlightTutorial_powers_tutorial[SYNC_REMOTE].finished == false)) do 
 
	 
 
		-- Check if local player purchased powers 
 
		if (mFlightTutorial_powers_tutorial[SYNC_LOCAL].purchased == true) then 
 
		 
 
			-- If local player just finished, have them wait for remote player, if needed 
 
			if (mFlightTutorial_powers_tutorial[SYNC_LOCAL].finished == false) then 
 
				if (mFlightTutorial_powers_tutorial[SYNC_REMOTE].finished == false) then 
 
					objective_text(0, "MM_1_1_OBJ_WAIT_FOR_PLAYER", nil, nil, SYNC_LOCAL, OI_ASSET_LOCATION) 
 
					hud_prompt_clear(LOCAL_PLAYER) 
 
				end 
 
				mFlightTutorial_powers_tutorial[SYNC_LOCAL].finished = true 
 
			end 
 
			 
 
		end 
 
		 
 
		-- Check if remote player purchased powers 
 
		if (mFlightTutorial_powers_tutorial[SYNC_REMOTE].purchased == true) then 
 
		 
 
			-- If remote player just finished, have them wait for local player, if needed 
 
			if (mFlightTutorial_powers_tutorial[SYNC_REMOTE].finished == false) then 
 
				if (mFlightTutorial_powers_tutorial[SYNC_LOCAL].finished == false) then 
 
					objective_text(1, "MM_1_1_OBJ_WAIT_FOR_PLAYER", nil, nil, SYNC_REMOTE, OI_ASSET_LOCATION) 
 
					hud_prompt_clear(REMOTE_PLAYER) 
 
				end 
 
				mFlightTutorial_powers_tutorial[SYNC_REMOTE].finished = true 
 
			end 
 
			 
 
		end 
 
		 
 
		-- Let other threads run 
 
		thread_yield() 
 
		 
 
	end 
 
	 
 
	-- Clear purchase powers callback 
 
	on_powers_tutorial_completed("")  
	 
 
	-- Disable super powers tutorial 
 
	cellphone_enable_powers_tutorial(false) 
 
	 
 
	-- Clear objective text (local/remote separate) 
 
	objective_text_clear(0) 
 
	hud_prompt_clear(LOCAL_PLAYER) 
 
	if coop_is_active() then 
 
		objective_text_clear(1) 
 
		hud_prompt_clear(REMOTE_PLAYER) 
 
	end 
 
	 
 
	-- Evacuate player(s) from vehicle(s), just in case 
 
	--character_evacuate_from_all_vehicles(LOCAL_PLAYER) 
 
	--if coop_is_active() then 
 
	--	character_evacuate_from_all_vehicles(REMOTE_PLAYER) 
 
	--end 
 
	 
 
	-- Wait for evacuating vehicles, just in case 
 
	--delay(1) 
 
	 
 
	-- Have player(s) fully power up (non-blocking) 
 
	local anim_name = "altars_powerup" 
 
	local morph_name = anim_name 
 
	local force_play = false 
 
	local stand_still = true 
 
	local zero_movement = true 
 
	effect_play_on_human( mFlightTutorial_vfx_list.power_up.name, LOCAL_PLAYER, "spine2" ) 
 
	action_play_non_blocking(LOCAL_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement) 
 
	if coop_is_active() then 
 
		effect_play_on_human( mFlightTutorial_vfx_list.power_up.name, REMOTE_PLAYER, "spine2"  ) 
 
		action_play_non_blocking(REMOTE_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement) 
 
	end 
 
	 
 
	-- Wait for player to react 
 
	delay(2) 
 
	 
 
	-- "This feels AWESOME!" 
 
	 
 
	-- Wait for player(s) to finish animating before continuing 
 
	while not action_play_is_finished(LOCAL_PLAYER, 1.0) do 
 
		thread_yield() 
 
	end 
 
	if coop_is_active() then 
 
		while not action_play_is_finished(REMOTE_PLAYER, 1.0) do 
 
			thread_yield() 
 
		end 
 
	end 
 
	 
 
	-- Enable super movement 
 
	player_super_movement_enable(true) 
 
	 
 
	 
 
	audio_object_post_event( "Play_FlightMusic" ) 
 
	audio_object_post_event( "Play_amb_mFlightTutorial" ) 
 
 
 
	-- Give player(s) Sprint/Jump super powers (no UI message) 
 
	player_unlock_super_power(MM_1_2_SUPERPOWER_SPRINT, LOCAL_PLAYER, true) 
 
	player_unlock_super_power(MM_1_2_SUPERPOWER_JUMP, LOCAL_PLAYER, true) 
 
	if coop_is_active() then 
 
		player_unlock_super_power(MM_1_2_SUPERPOWER_SPRINT, REMOTE_PLAYER, true) 
 
		player_unlock_super_power(MM_1_2_SUPERPOWER_JUMP, REMOTE_PLAYER, true) 
 
	end 
 
	 
 
	-- Wait for convo to finish before continuing 
 
	convo_wait_for_end() 
 
 
 
end 
 
 
 
------------------------------------ 
 
-- 
 
-- Checkpoint thread functions 
 
-- 
 
------------------------------------ 
 
 
 
------------------------------------ 
 
-- 
 
-- Checkpoint callback functions 
 
-- 
 
------------------------------------ 
 
function mFlightTutorial_powers_purchased_cb( player_name )  
 
	 
 
	-- Track which player purchased powers 
 
	if (player_name == LOCAL_PLAYER) then 
 
		mFlightTutorial_powers_tutorial[SYNC_LOCAL].purchased = true 
 
	else 
 
		mFlightTutorial_powers_tutorial[SYNC_REMOTE].purchased = true 
 
	end 
 
 
 
end 
 
-------------------------------------------------------------------------------------------------- 
 
								--[[**********************]]-- 
 
								--[[                      ]]-- 
 
								--[[   Common functions   ]]-- 
 
								--[[                      ]]-- 
 
								--[[**********************]]-- 
 
-- Enables or disables player controls 
 
function mFlightTutorial_allow_player_controls( allow_controls ) 
 
	if allow_controls then 
 
		player_controls_enable(LOCAL_PLAYER) 
 
		if coop_is_active() then 
 
			player_controls_enable(REMOTE_PLAYER) 
 
		end 
 
	else 
 
		player_controls_disable(LOCAL_PLAYER) 
 
		if coop_is_active() then 
 
			player_controls_disable(REMOTE_PLAYER) 
 
		end 
 
	end 
 
end 
 
 
 
-- Sets a trigger marker for the machine requesting it 
 
function mFlightTutorial_set_trigger_marker( trigger_name, sync_type ) 
 
	 
 
	marker_add_trigger( trigger_name, FLIGHTTUT_CUSTOM_TRIGGER_LOCATION.minimap_icon_name, FLIGHTTUT_CUSTOM_TRIGGER_LOCATION.ingame_effect_name, FLIGHTTUT_CUSTOM_TRIGGER_LOCATION.object_indicator_id, FLIGHTTUT_CUSTOM_TRIGGER_LOCATION.object_indicator_flags, sync_type ) 
 
 
 
end 
 
 
 
-- Cleans up the trigger marker for the machine requesting it 
 
function mFlightTutorial_cleanup_trigger_marker( trigger_name, sync_type ) 
 
 
 
	marker_remove( trigger_name, sync_type ) 
 
 
 
end 
 
 
 
function mFlightTutorial_try_update_farthest_waypoint_marker( navpoint_number, next_trigger_name, sync_type ) 
 
 
 
	if navpoint_number > g_nCurrentNavpointNumber then 
 
		g_nCurrentNavpointNumber = navpoint_number 
 
	end 
 
	 
 
	mFlightTutorial_set_trigger_marker( next_trigger_name, sync_type ) 
 
 
 
end 
 
 
 
function mFlightTutorial_trigger_transition( player, island_navpoint_name, next_trigger_name ) 
 
 
 
	local sync_type = SYNC_LOCAL	 
 
	if player == LOCAL_PLAYER then 
 
		mLastIslandTriggered_Local = island_navpoint_name 
 
	else 
 
		mLastIslandTriggered_Remote = island_navpoint_name 
 
		sync_type = SYNC_REMOTE 
 
	end 
 
 
 
	mFlightTutorial_try_update_farthest_waypoint_marker( mFlightTutorial_RespawnNavpoints[ island_navpoint_name ], next_trigger_name, sync_type ) 
 
 
 
end 
 
 
 
function mFlightTutorial_set_tutorial_text( message_text, player_name ) 
 
 
 
	-- Clear out any previous text 
 
	-- Set the next message and store it as the latest message 
 
	 
 
	--hud_prompt_clear( player_name ) 
 
	--hud_prompt( player_name, message_text, "mFlightTutorial_empty_cb" ) 
 
	 
 
	local sync_type = SYNC_LOCAL 
 
	if player_name == REMOTE_PLAYER then 
 
		sync_type = SYNC_REMOTE 
 
	end 
 
 
 
	tutorial_stop_current( sync_type ) 
 
 
 
	tutorial_start( message_text, 0, false, true, true, sync_type ) 
 
 
 
end 
 
 
 
function mFlightTutorial_flight_stall_detected() 
 
 
 
	-- Play VO 
 
 
 
	-- TODO: Remove this when VO is in. 
 
	 
 
	message_remove_all() 
 
	--message( "PLACEHOLDER: Vogel lets Johnny know that he needs to flap his wings in order to reach the higher island.", 50.0, false ) 
 
 
 
end 
 
 
 
function mFlightTutorial_final_trigger_setup( trigger_table, sync_type ) 
 
 
 
	if( trigger_is_enabled( trigger_table.name ) == false )then 
 
		trigger_enable( trigger_table.name ) 
 
	end 
 
 
 
	mFlightTutorial_set_trigger_marker( trigger_table.name, sync_type ) 
 
 
 
 
 
	--marker_add_trigger(trigger_table.name, trigger_table.marker.minimap_icon_name, trigger_table.marker.ingame_effect_name, trigger_table.marker.object_indicator_id, trigger_table.marker.object_indicator_flags, trigger_table.marker.sync_type, trigger_table.marker.fade_dist) 
 
	 
 
	--mission_waypoint_add( trigger_table.name ) 
 
 
 
end 
 
 
 
-------------------------------------------------------------------------------------------------- 
 
								--[[**********************]]-- 
 
								--[[                      ]]-- 
 
								--[[  Callback functions  ]]-- 
 
								--[[                      ]]-- 
 
								--[[**********************]]-- 
 
 
 
-- Callback function for the ultor super movement trigger which  
 
-- disables super movement when any player leaves it. 
 
function mFlightTutorial_ultor_super_movement_trigger_callback( character_name, trigger_name ) 
 
	 
 
	-- Disable super movement 
 
	player_super_movement_enable( false ) 
 
	human_allow_freefall( true ) 
 
	 
 
	-- Kind of a hack to stop the character from moving, without taking control away. 
 
	character_ragdoll( character_name ) 
 
	character_ragdoll_stop( character_name ) 
 
	character_collision_enable( character_name, true ) 
 
 
 
end 
 
 
 
-- Callback function for the ultor jump off trigger which throws the player 
 
-- into a SAM so where they tumble to the bottom. 
 
function mFlightTutorial_ultor_jump_off_trigger_callback( character_name, trigger_name ) 
 
	 
 
	-- Coop work 
 
	local other_player = "" 
 
	local sync_flag_for_other_player = "" 
 
	if coop_is_active() then 
 
		if( character_name == LOCAL_PLAYER )then 
 
			other_player = REMOTE_PLAYER 
 
			sync_flag_for_other_player = SYNC_REMOTE 
 
		else 
 
			other_player = LOCAL_PLAYER 
 
			sync_flag_for_other_player = SYNC_LOCAL 
 
		end 
 
	end 
 
				 
 
	-- Make the player play the freefall animation 
 
	local anim_name = "freefall fail" 
 
	set_animation_state( character_name, anim_name )	 
 
	camera_set_target( character_name ) 
 
		 
 
	-- Make the wings play the freefall animation 
 
	local anim_action_name = "" 
 
	local anim_state_name = anim_name 
 
	local use_high_priority = true 
 
	local sync_flags = SYNC_LOCAL 
 
	if coop_is_active() then 
 
		sync_flags = SYNC_ALL 
 
	end 
 
 
 
	wings_play_anim( character_name, anim_action_name, anim_state_name, use_high_priority, sync_flags ) 
 
	 
 
 
 
	-- Disable player control 
 
	player_controls_disable( character_name ) 
 
	if( coop_is_active() )then 
 
		player_controls_disable( other_player ) 
 
	end 
 
		 
 
	local trigger_table = trigger_get_table( trigger_name ) 
 
	trigger_table.hit = true 
 
		 
 
end 
 
 
 
-- Callabck 
 
function mFlightTutorial_ultor_teleport_trigger_cb( character_name, trigger_name ) 
 
 
 
	-- Play vfx 
 
	effect_play_on_human( mFlightTutorial_vfx_list.teleport.name, character_name ) 
 
	delay( 0.75 ) 
 
 
 
	-- Hide the character 
 
	human_gravity_enable( character_name, false ) 
 
	player_wings_force_open( character_name, false ) 
 
	character_hide( character_name ) 
 
	clear_animation_state( character_name ) 
 
 
 
	delay( 1.0 ) 
 
 
 
	-- Trigger the trigger 
 
	local trigger_table = trigger_get_table( trigger_name ) 
 
	trigger_table.hit = true 
 
 
 
end 
 
 
 
Local_CollectedOrb_A = false 
 
Local_CollectedOrb_B = false 
 
Remote_CollectedOrb_A = false 
 
Remote_CollectedOrb_B = false 
 
FlapsCollected = 0 
 
function mFlightTutorial_do_flap_cb_1(player_name) 
 
 
 
	--HVS_BAS - only for local player 
 
	if (player_name == LOCAL_PLAYER) then 
 
		-- Play the orb collect VFX 
 
		FlapsCollected = FlapsCollected + 1 
 
		force_flap_player(player_name) 
 
	--	effect_play_on_human("Vfx_soul_collect", player)  
		trigger_clear(mFlightTutorial_trigger.give_flap_trigger_01.name) 
 
		effect_stop(mFlightTutorial_FlapVFX_1) 
 
		trigger_clear(mFlightTutorial_trigger.missed_flap_trigger_1.name) 
 
		Local_CollectedOrb_A = true 
 
	end 
 
end 
 
function mFlightTutorial_do_flap_cb_2(player_name) 
 
	if (player_name == REMOTE_PLAYER) then 
 
		FlapsCollected = FlapsCollected + 1 
 
		-- Play the orb collect VFX 
 
		force_flap_player(player_name) 
 
	--	effect_play_on_human("Vfx_soul_collect", player)  
		trigger_clear(mFlightTutorial_trigger.give_flap_trigger_02.name) 
 
		effect_stop(mFlightTutorial_FlapVFX_2) 
 
		Remote_CollectedOrb_B = true 
 
	end 
 
end 
 
function mFlightTutorial_missed_flap_trigger_1_cb(player) 
 
			if (player == LOCAL_PLAYER and Local_CollectedOrb_A == false) then 
 
				--convo_start(mFlightTutorial_convo.fail_gat) then	 
 
				fade_out( 0, 0, SYNC_LOCAL ) 
 
				delay( 1.0 ) 
 
				teleport( LOCAL_PLAYER, mLastIslandTriggered_Local ) 
 
				fade_in( 0, 0, SYNC_LOCAL ) 
 
				delay( 1.0 ) 
 
				mFlightTutorial_convo.charge.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.dash_end.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.dive_start.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.flight_end.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.fail_a.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.fail_b.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.fall.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.flap.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.flap_nag.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.flight_start.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.flight_variant.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.get_boost.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.give_flap.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.helper_first.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.helper_second.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.missed_boost.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.powerup.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.start.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.turn.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.use_flap.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.wall_jump.sync = SYNC_LOCAL 
 
				mFlightTutorial_convo.transition.sync = SYNC_LOCAL 
 
				convo_end(mFlightTutorial_convo.charge) 
 
				convo_end(mFlightTutorial_convo.dash_end) 
 
				convo_end(mFlightTutorial_convo.dive_start) 
 
				convo_end(mFlightTutorial_convo.flight_end) 
 
				convo_end(mFlightTutorial_convo.fail_a) 
 
				convo_end(mFlightTutorial_convo.fail_b) 
 
				convo_end(mFlightTutorial_convo.fall) 
 
				convo_end(mFlightTutorial_convo.flap) 
 
				convo_end(mFlightTutorial_convo.flap_nag) 
 
				convo_end(mFlightTutorial_convo.flight_start) 
 
				convo_end(mFlightTutorial_convo.flight_variant) 
 
				convo_end(mFlightTutorial_convo.get_boost) 
 
				convo_end(mFlightTutorial_convo.give_flap) 
 
				convo_end(mFlightTutorial_convo.helper_first) 
 
				convo_end(mFlightTutorial_convo.helper_second) 
 
				convo_end(mFlightTutorial_convo.missed_boost) 
 
				convo_end(mFlightTutorial_convo.powerup) 
 
				convo_end(mFlightTutorial_convo.start) 
 
				convo_end(mFlightTutorial_convo.turn) 
 
				convo_end(mFlightTutorial_convo.use_flap) 
 
				convo_end(mFlightTutorial_convo.wall_jump) 
 
				convo_end(mFlightTutorial_convo.transition) 
 
				delay( 1.0 ) 
 
				mFlightTutorial_convo.missed_boost.sync = SYNC_LOCAL 
 
				convo_start(mFlightTutorial_convo.missed_boost) 
 
			elseif (player == REMOTE_PLAYER and Remote_CollectedOrb_B == false)  then 
 
				fade_out( 0, 0, SYNC_REMOTE ) 
 
				delay( 1.0 ) 
 
				teleport( REMOTE_PLAYER, mLastIslandTriggered_Remote ) 
 
				delay( 1.0 ) 
 
				fade_in( 0, 0, SYNC_REMOTE ) 
 
				mFlightTutorial_convo.charge.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.dash_end.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.dive_start.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.flight_end.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.fail_a.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.fail_b.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.fall.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.flap.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.flap_nag.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.flight_start.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.flight_variant.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.get_boost.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.give_flap.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.helper_first.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.helper_second.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.missed_boost.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.powerup.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.start.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.turn.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.use_flap.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.wall_jump.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.transition.sync = SYNC_REMOTE 
 
				convo_end(mFlightTutorial_convo.charge) 
 
				convo_end(mFlightTutorial_convo.dash_end) 
 
				convo_end(mFlightTutorial_convo.dive_start) 
 
				convo_end(mFlightTutorial_convo.flight_end) 
 
				convo_end(mFlightTutorial_convo.fail_a) 
 
				convo_end(mFlightTutorial_convo.fail_b) 
 
				convo_end(mFlightTutorial_convo.fall) 
 
				convo_end(mFlightTutorial_convo.flap) 
 
				convo_end(mFlightTutorial_convo.flap_nag) 
 
				convo_end(mFlightTutorial_convo.flight_start) 
 
				convo_end(mFlightTutorial_convo.flight_variant) 
 
				convo_end(mFlightTutorial_convo.get_boost) 
 
				convo_end(mFlightTutorial_convo.give_flap) 
 
				convo_end(mFlightTutorial_convo.helper_first) 
 
				convo_end(mFlightTutorial_convo.helper_second) 
 
				convo_end(mFlightTutorial_convo.missed_boost) 
 
				convo_end(mFlightTutorial_convo.powerup) 
 
				convo_end(mFlightTutorial_convo.start) 
 
				convo_end(mFlightTutorial_convo.turn) 
 
				convo_end(mFlightTutorial_convo.use_flap) 
 
				convo_end(mFlightTutorial_convo.wall_jump) 
 
				convo_end(mFlightTutorial_convo.transition) 
 
				delay( 1.0 ) 
 
				mFlightTutorial_convo.missed_boost.sync = SYNC_REMOTE 
 
				convo_start(mFlightTutorial_convo.missed_boost) 
 
			end 
 
end 
 
-- last trigger they tripped. 
 
bFailedAlternate = true 
 
 
 
bLavaReadyLocal = true 
 
bLavaReadyRemote = true 
 
-- Callback function for the lava trigger to teleport the player back to the 
 
function mFlightTutorial_lava_trigger_callback(player_name) 
 
	 
 
	--delay(1.0) 
 
	 
 
	if( mFlightTutorial_UsePlayerLeash )then 
 
		 
 
		if (player_name == LOCAL_PLAYER) then 
 
		  if(bLavaReadyLocal == true ) then	 
 
				bLavaReadyLocal = false 
 
				-- ResetLocalPlayer stuff 
 
				ResetLocalPlayerStuff() 
 
		  end 
 
		elseif (bLavaReadyRemote == true) then 
 
			bLavaReadyRemote = false 
 
			ResetRemotePlayerStuff() 
 
		end 
 
	end 
 
end 
 
function ResetLocalPlayerStuff() 
 
	fade_out( 0, 0, SYNC_LOCAL ) 
 
	delay( 1.0 ) 
 
		mFlightTutorial_convo.charge.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.dash_end.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.dive_start.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.flight_end.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.fail_a.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.fail_b.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.fall.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.flap.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.flap_nag.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.flight_start.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.flight_variant.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.get_boost.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.give_flap.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.helper_first.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.helper_second.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.missed_boost.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.powerup.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.start.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.turn.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.use_flap.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.wall_jump.sync = SYNC_LOCAL 
 
		mFlightTutorial_convo.transition.sync = SYNC_LOCAL 
 
		convo_end(mFlightTutorial_convo.charge) 
 
		convo_end(mFlightTutorial_convo.dash_end) 
 
		convo_end(mFlightTutorial_convo.dive_start) 
 
		convo_end(mFlightTutorial_convo.flight_end) 
 
		convo_end(mFlightTutorial_convo.fail_a) 
 
		convo_end(mFlightTutorial_convo.fail_b) 
 
		convo_end(mFlightTutorial_convo.fall) 
 
		convo_end(mFlightTutorial_convo.flap) 
 
		convo_end(mFlightTutorial_convo.flap_nag) 
 
		convo_end(mFlightTutorial_convo.flight_start) 
 
		convo_end(mFlightTutorial_convo.flight_variant) 
 
		convo_end(mFlightTutorial_convo.get_boost) 
 
		convo_end(mFlightTutorial_convo.give_flap) 
 
		convo_end(mFlightTutorial_convo.helper_first) 
 
		convo_end(mFlightTutorial_convo.helper_second) 
 
		convo_end(mFlightTutorial_convo.missed_boost) 
 
		convo_end(mFlightTutorial_convo.powerup) 
 
		convo_end(mFlightTutorial_convo.start) 
 
		convo_end(mFlightTutorial_convo.turn) 
 
		convo_end(mFlightTutorial_convo.use_flap) 
 
		convo_end(mFlightTutorial_convo.wall_jump) 
 
		convo_end(mFlightTutorial_convo.transition) 
 
	teleport( LOCAL_PLAYER, mLastIslandTriggered_Local ) 
 
	fade_in( 0, 0, SYNC_LOCAL ) 
 
	-- Set the FLAP orb if the player fell at that one! 
 
	if (mLastIslandTriggered_Local == "dive_respawn_nav_host") then 
 
		if (Local_CollectedOrb_A == true) then 
 
			mFlightTutorial_FlapVFX_1 = effect_play("Vfx Hb Xtraflap 01<001>", true, SYNC_LOCAL)  
			trigger_setup( mFlightTutorial_trigger.give_flap_trigger_01) 
 
			trigger_setup(mFlightTutorial_trigger.missed_flap_trigger_1) 
 
			marker_add(mFlightTutorial_group.use_flap_orbs.use_flap_orb_1, MINIMAP_ICON_LOCATION,OI_ASSET_LOCATION, OI_FLAGS_DEFAULT, SYNC_LOCAL)  
 
			object_indicator_add( mFlightTutorial_group.use_flap_orbs.use_flap_orb_1, OI_ASSET_LOCATION, OI_FLAGS_DEFAULT, SYNC_LOCAL ) 
 
		 
 
			Local_CollectedOrb_A = false 
 
			FlapsCollected = FlapsCollected - 1 
 
		end 
 
		--marker_add_trigger( mFlightTutorial_group.use_flap_orbs.use_flap_orb_1, FLIGHTTUT_CUSTOM_TRIGGER_LOCATION.minimap_icon_name, FLIGHTTUT_CUSTOM_TRIGGER_LOCATION.ingame_effect_name, FLIGHTTUT_CUSTOM_TRIGGER_LOCATION.object_indicator_id, FLIGHTTUT_CUSTOM_TRIGGER_LOCATION.object_indicator_flags, SYNC_LOCAL ) 
 
	end 
 
		-- cleanup and reset riggers and orbs 
 
	if (mLastIslandTriggered_Local == "runningjump_respawn_nav_host") then 
 
 
 
		mFlighTutorial_breadcrumb_1(LOCAL_PLAYER) 
 
		mFlighTutorial_breadcrumb_2(LOCAL_PLAYER) 
 
		mFlighTutorial_breadcrumb_3(LOCAL_PLAYER) 
 
		mFlighTutorial_breadcrumb_4(LOCAL_PLAYER) 
 
		mFlighTutorial_breadcrumb_5(LOCAL_PLAYER) 
 
 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_01) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_02) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_03) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_04) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_05) 
 
 
 
		mFlightTutorial_BreadCrumb_1 = effect_play("Vfx Hb Boostnode<001>", true, SYNC_LOCAL)  
		mFlightTutorial_BreadCrumb_2 = effect_play("Vfx Hb Boostnode<002>", true, SYNC_LOCAL)  
		mFlightTutorial_BreadCrumb_3 = effect_play("Vfx Hb Boostnode<003>", true, SYNC_LOCAL)  
		mFlightTutorial_BreadCrumb_4 = effect_play("Vfx Hb Boostnode<004>", true, SYNC_LOCAL)  
		mFlightTutorial_BreadCrumb_5 = effect_play("Vfx Hb Boostnode<005>", true, SYNC_LOCAL)  
		delay( 1.5 ) 
 
		if (bFailedAlternate == true) then 
 
			mFlightTutorial_convo.fail_a.sync = SYNC_LOCAL 
 
			convo_start(mFlightTutorial_convo.fail_a) 
 
			bFailedAlternate = false 
 
		else 
 
			mFlightTutorial_convo.fail_b.sync = SYNC_LOCAL 
 
			convo_start(mFlightTutorial_convo.fail_b) 
 
			bFailedAlternate = true 
 
		end 
 
	elseif (mLastIslandTriggered_Local == "climb_respawn_nav_host") then 
 
 
 
		mFlighTutorial_breadcrumb_11(LOCAL_PLAYER) 
 
		mFlighTutorial_breadcrumb_12(LOCAL_PLAYER) 
 
		mFlighTutorial_breadcrumb_13(LOCAL_PLAYER) 
 
		mFlighTutorial_breadcrumb_14(LOCAL_PLAYER) 
 
		mFlighTutorial_breadcrumb_15(LOCAL_PLAYER) 
 
 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_11) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_12) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_13) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_14) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_15) 
 
 
 
		mFlightTutorial_BreadCrumb_11 = effect_play("Vfx Hb Boostnode<011>", true, SYNC_LOCAL)  
		mFlightTutorial_BreadCrumb_12 = effect_play("Vfx Hb Boostnode<012>", true, SYNC_LOCAL)  
		mFlightTutorial_BreadCrumb_13 = effect_play("Vfx Hb Boostnode<013>", true, SYNC_LOCAL)  
		mFlightTutorial_BreadCrumb_14 = effect_play("Vfx Hb Boostnode<014>", true, SYNC_LOCAL)  
		mFlightTutorial_BreadCrumb_15 = effect_play("Vfx Hb Boostnode<015>", true, SYNC_LOCAL)  
		delay( 1.5 ) 
 
	else  
 
		delay( 1.5 ) 
 
	end 
 
	local_warping = false 
 
	bLavaReadyLocal = true 
 
end 
 
function ResetRemotePlayerStuff() 
 
	fade_out( 0, 0, SYNC_REMOTE ) 
 
	delay( 1.0 ) 
 
	mFlightTutorial_convo.charge.sync = SYNC_REMOTE 
 
	convo_end(mFlightTutorial_convo.charge) 
 
	mFlightTutorial_convo.charge.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.dash_end.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.dive_start.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.flight_end.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.fail_a.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.fail_b.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.fall.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.flap.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.flap_nag.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.flight_start.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.flight_variant.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.get_boost.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.give_flap.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.helper_first.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.helper_second.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.missed_boost.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.powerup.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.start.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.turn.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.use_flap.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.wall_jump.sync = SYNC_REMOTE 
 
				mFlightTutorial_convo.transition.sync = SYNC_REMOTE 
 
				convo_end(mFlightTutorial_convo.charge) 
 
				convo_end(mFlightTutorial_convo.dash_end) 
 
				convo_end(mFlightTutorial_convo.dive_start) 
 
				convo_end(mFlightTutorial_convo.flight_end) 
 
				convo_end(mFlightTutorial_convo.fail_a) 
 
				convo_end(mFlightTutorial_convo.fail_b) 
 
				convo_end(mFlightTutorial_convo.fall) 
 
				convo_end(mFlightTutorial_convo.flap) 
 
				convo_end(mFlightTutorial_convo.flap_nag) 
 
				convo_end(mFlightTutorial_convo.flight_start) 
 
				convo_end(mFlightTutorial_convo.flight_variant) 
 
				convo_end(mFlightTutorial_convo.get_boost) 
 
				convo_end(mFlightTutorial_convo.give_flap) 
 
				convo_end(mFlightTutorial_convo.helper_first) 
 
				convo_end(mFlightTutorial_convo.helper_second) 
 
				convo_end(mFlightTutorial_convo.missed_boost) 
 
				convo_end(mFlightTutorial_convo.powerup) 
 
				convo_end(mFlightTutorial_convo.start) 
 
				convo_end(mFlightTutorial_convo.turn) 
 
				convo_end(mFlightTutorial_convo.use_flap) 
 
				convo_end(mFlightTutorial_convo.wall_jump) 
 
				convo_end(mFlightTutorial_convo.transition) 
 
	teleport( REMOTE_PLAYER, mLastIslandTriggered_Remote ) 
 
	fade_in( 0, 0, SYNC_REMOTE ) 
 
	if (mLastIslandTriggered_Remote == "dive_respawn_nav_host") then 
 
		if (Remote_CollectedOrb_B == true) then 
 
				mFlightTutorial_FlapVFX_2 = effect_play("Vfx Hb Xtraflap 01<002>", true, SYNC_REMOTE)  
				trigger_setup( mFlightTutorial_trigger.give_flap_trigger_02) 
 
				trigger_setup(mFlightTutorial_trigger.missed_flap_trigger_1) 
 
				object_indicator_add( mFlightTutorial_group.use_flap_orbs.use_flap_orb_2, OI_ASSET_LOCATION, OI_FLAGS_DEFAULT, SYNC_REMOTE ) 
 
				marker_add(mFlightTutorial_group.use_flap_orbs.use_flap_orb_2, MINIMAP_ICON_LOCATION,OI_ASSET_LOCATION, OI_FLAGS_DEFAULT, SYNC_REMOTE)  
 
				Remote_CollectedOrb_B = false 
 
				FlapsCollected = FlapsCollected - 1 
 
		end 
 
 
 
	-- Play appropriate VO 
 
	elseif (mLastIslandTriggered_Remote == "runningjump_respawn_nav_host") then 
 
		mFlighTutorial_breadcrumb_6(REMOTE_PLAYER) 
 
		mFlighTutorial_breadcrumb_7(REMOTE_PLAYER) 
 
		mFlighTutorial_breadcrumb_8(REMOTE_PLAYER) 
 
		mFlighTutorial_breadcrumb_9(REMOTE_PLAYER) 
 
		mFlighTutorial_breadcrumb_10(REMOTE_PLAYER) 
 
 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_06) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_07) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_08) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_09) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_10) 
 
 
 
		mFlightTutorial_BreadCrumb_6 = effect_play("Vfx Hb Boostnode<006>", true, SYNC_REMOTE)  
		mFlightTutorial_BreadCrumb_7 = effect_play("Vfx Hb Boostnode<007>", true, SYNC_REMOTE)  
		mFlightTutorial_BreadCrumb_8 = effect_play("Vfx Hb Boostnode<008>", true, SYNC_REMOTE)  
		mFlightTutorial_BreadCrumb_9 = effect_play("Vfx Hb Boostnode<009>", true, SYNC_REMOTE)  
		mFlightTutorial_BreadCrumb_10 = effect_play("Vfx Hb Boostnode<010>", true, SYNC_REMOTE)  
		delay( 1.5 ) 
 
		if (bFailedAlternate == true) then 
 
			mFlightTutorial_convo.fail_a.sync = SYNC_REMOTE 
 
			convo_start(mFlightTutorial_convo.fail_a) 
 
			bFailedAlternate = false 
 
		else 
 
			mFlightTutorial_convo.fail_b.sync = SYNC_REMOTE 
 
			convo_start(mFlightTutorial_convo.fail_b) 
 
			bFailedAlternate = true 
 
		end 
 
	elseif (mLastIslandTriggered_Local == "climb_respawn_nav_host") then 
 
		mFlighTutorial_breadcrumb_16(REMOTE_PLAYER) 
 
		mFlighTutorial_breadcrumb_17(REMOTE_PLAYER) 
 
		mFlighTutorial_breadcrumb_18(REMOTE_PLAYER) 
 
		mFlighTutorial_breadcrumb_19(REMOTE_PLAYER) 
 
		mFlighTutorial_breadcrumb_20(REMOTE_PLAYER) 
 
 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_16) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_17) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_18) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_19) 
 
		trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_20) 
 
		mFlightTutorial_BreadCrumb_16 = effect_play("Vfx Hb Boostnode<016>", true, SYNC_REMOTE)  
		mFlightTutorial_BreadCrumb_17 = effect_play("Vfx Hb Boostnode<017>", true, SYNC_REMOTE)  
		mFlightTutorial_BreadCrumb_18 = effect_play("Vfx Hb Boostnode<018>", true, SYNC_REMOTE)  
		mFlightTutorial_BreadCrumb_19 = effect_play("Vfx Hb Boostnode<019>", true, SYNC_REMOTE)  
		mFlightTutorial_BreadCrumb_20 = effect_play("Vfx Hb Boostnode<020>", true, SYNC_REMOTE)  
		delay( 1.5 ) 
 
	else  
 
		delay( 1.5 ) 
 
	end 
 
	remote_warping  = false 
 
	bLavaReadyRemote = true 
 
end 
 
 
 
function mFlighTutorial_breadcrumb_1(player_name) 
 
	if (player_name == LOCAL_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_1) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_01.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_2(player_name) 
 
	if (player_name == LOCAL_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_2) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_02.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_3(player_name) 
 
	if (player_name == LOCAL_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_3) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_03.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_4(player_name) 
 
	if (player_name == LOCAL_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_4) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_04.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_5(player_name) 
 
	if (player_name == LOCAL_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_5) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_05.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_6(player_name) 
 
	if (player_name == REMOTE_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_6) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_06.name) 
 
	end 
 
	 
 
end 
 
function mFlighTutorial_breadcrumb_7(player_name) 
 
	if (player_name == REMOTE_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_7) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_07.name) 
 
	end 
 
	 
 
end 
 
function mFlighTutorial_breadcrumb_8(player_name) 
 
	if (player_name == REMOTE_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_8) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_08.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_9(player_name) 
 
	if (player_name == REMOTE_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_9) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_09.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_10(player_name) 
 
	if (player_name == REMOTE_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_10) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_10.name) 
 
	end 
 
	 
 
end 
 
function mFlighTutorial_breadcrumb_11(player_name) 
 
	if (player_name == LOCAL_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_11) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_11.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_12(player_name) 
 
	if (player_name == LOCAL_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_12) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_12.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_13(player_name) 
 
	if (player_name == LOCAL_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_13) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_13.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_14(player_name) 
 
	if (player_name == LOCAL_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_14) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_14.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_15(player_name) 
 
	if (player_name == LOCAL_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_15) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_15.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_16(player_name) 
 
	if (player_name == REMOTE_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_16) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_16.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_17(player_name) 
 
	if (player_name == REMOTE_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_17) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_17.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_18(player_name) 
 
	if (player_name == REMOTE_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_18) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_18.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_19(player_name) 
 
	if (player_name == REMOTE_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_19) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_19.name) 
 
	end 
 
end 
 
function mFlighTutorial_breadcrumb_20(player_name) 
 
	if (player_name == REMOTE_PLAYER) then 
 
		effect_stop(mFlightTutorial_BreadCrumb_20) 
 
		trigger_clear(mFlightTutorial_trigger.Bread_Crumb_Trigger_20.name) 
 
	end 
 
end 
 
function mFlightTutorial_cluster_collected( player, item ) 
 
 
 
	-- Increment our clusters picked up count 
 
	mFlightTutorial_clusters_collected = mFlightTutorial_clusters_collected + 1 
 
 
 
	object_indicator_remove( item ) 
 
	marker_remove( item ) 
 
 
 
	-- Play the orb collect VFX 
 
	effect_play_on_human("Vfx_soul_collect", player)  
 
 
	-- Check to see if this is the last cluster picked up. 
 
	--if mFlightTutorial_clusters_collected == MFLIGHTTUTORIAL_NUM_CLUSTERS then 
 
	--	 
 
	--	-- play the animation at the given navpoint	 
 
	--	local anim_name = mFlightTutorial_animation_list.clusters_collected.anim_action_name 
 
	--	local morph_name = anim_name 
 
	--	local force_play = true	 
 
	--	local stand_still = true 
 
	--	local zero_movement = true 
 
	--		 
 
	--	character_clear_combat_move( player ) 
 
	--	-- start the action 
 
	--	action_play_non_blocking( player, anim_name, morph_name, force_play, stand_still, zero_movement ) 
 
	--	 
 
	--	-- Wait for player to react 
 
	--	delay(2) 
 
	-- 
 
	--	while not action_play_is_finished(player, 1.0) do 
 
	--		thread_yield() 
 
	--	end 
 
	-- 
 
	--	--if coop_is_active() then 
 
	--	--	while not action_play_is_finished(REMOTE_PLAYER, 1.0) do 
 
	--	--		thread_yield() 
 
	--	--	end 
 
	--	--end 
 
	-- 
 
	--	-- Setup the altar trigger 
 
	--	--trigger_setup( mFlightTutorial_trigger.altar_trigger ) 
 
	--	-- 
 
	--	--while mFlightTutorial_trigger.altar_trigger.disabled == false do 
 
	--	--	thread_yield() 
 
	--	--end 
 
	--	-- 
 
	--	---- Tell the player to go to the altar 
 
	--	---- Dane V.O.? 
 
	--	--objective_text( 0, "GM_FLIGHTTUT_OBJ_CHARGE_HALO", "", "", SYNC_ALL, OI_ASSET_LOCATION ) 
 
	-- 
 
	--end 
 
	 
 
end 
 
 
 
function mFlightTutorial_damned_soul_on_death_cb( dead_character, attacker ) 
 
 
 
	on_death( "", dead_character ) 
 
	 
 
	--explosion_create( "warden_arrive_land", dead_character ) 
 
	character_destroy( dead_character ) 
 
 
 
	-- Unhide the soul cluster 
 
	item_show( mFlightTutorial_group.soul_clusters.cluster04.name ) 
 
end 
 
 
 
function mFlightTutorial_altar_trigger_cb( human, trigger ) 
 
	 
 
	-- do default trigger behavior 
 
	trigger_cb( human, trigger ) 
 
	 
 
	local trigger_table = trigger_get_table( trigger ) 
 
 
 
	-- play the animation at the given navpoint	 
 
	local anim_name = trigger_table.anim_action 
 
	local force_play = true	 
 
	local percentage = 0.8 
 
	local stand_still = true 
 
	local zero_movement = true 
 
		 
 
	character_clear_combat_move( human ) 
 
	-- start the action 
 
	action_play( human, anim_name, anim_name, force_play, percentage, stand_still, zero_movement ) 
 
 
 
end 
 
 
 
-- HUD Prompt expects a callback, but we don't need it to 
 
-- do anything. Kind of wasteful imho. 
 
function mFlightTutorial_empty_cb() 
 
end 
 
 
 
 
 
-- Flight tutorial trigger callback 
 
-- 
 
-- player:		(string) name of the player that tripped the trigger 
 
-- trigger:		(string) name of the trigger 
 
-- 
 
function mFlightTutorial_trigger_cb( player, trigger ) 
 
	-- This may be called multiple times in the same frame.  Never create groups in a trigger callback.  Use show group instead. 
 
	 
 
	-- find this trigger 
 
	local trigger_table = trigger_get_table(trigger) 
 
	 
 
	if trigger_table ~= nil then 
 
		--if trigger_table.hit == true then 
 
		--	return 
 
		--end 
 
	 
 
		trigger_table.last_hit_by = player 
 
		trigger_table.hit = true 
 
		 
 
		--trigger_clear(trigger_table.name) 
 
		--local is_player_standing = player_is_standing( player ) 
 
		--local is_trigger_waypoint_active = trigger_table.waypoint 
 
		-- 
 
		---- Do not consider this trigger hit until we  
 
		--if is_trigger_waypoint_active  == true and is_player_standing then 
 
		--	--mission_waypoint_remove() 
 
		--	marker_remove_trigger( trigger, SYNC_ALL ) 
 
		--end				 
 
	end 
 
 
 
end 
 
 
 
-------------------------------------------------------------------------------------------------- 
 
								--[[**********************]]-- 
 
								--[[                      ]]-- 
 
								--[[   Thread functions   ]]-- 
 
								--[[                      ]]-- 
 
								--[[**********************]]-- 
 
 
 
-- [[ mFlightTutorial_lava_trigger_thread_func ]] 
 
-- 
 
-- Resets the trigger and in order to 
 
-- allow the players to independently 
 
-- hit this trigger multiple times. 
 
--  
 
function mFlightTutorial_lava_trigger_thread_func( player ) 
 
	 
 
	while not mFlightTutorial_trigger.end_trigger.hit do 
 
		 
 
		if trigger_is_enabled( mFlightTutorial_trigger.lava_trigger.name ) == false and get_num_humans_in_trigger( mFlightTutorial_trigger.lava_trigger.name ) == 0 then 
 
					 
 
			trigger_setup( mFlightTutorial_trigger.lava_trigger ) 
 
 
 
		end 
 
 
 
		thread_yield() 
 
	end 
 
 
 
end 
 
 
 
flight_state_machine_active = true 
 
AmStandingPromptActiveLocal = false 
 
AmJumpingPromptActiveLocal = false 
 
CanFlapPromptActiveLocal = false 
 
AmStandingPromptActiveRemote = false 
 
AmJumpingPromptActiveRemote = false 
 
CanFlapPromptActiveRemote = false 
 
testint = 999 
 
 
 
-- Check if the player used Flap thread 
 
function flight_state_machine_local() 
 
	-- if its a local player then 
 
	while ( flight_state_machine_active) do 
 
			--[[ 
 
			-- if the LOCAL PLAYER is standing 
 
			if (player_is_standing(player)) then 
 
				-- if the standing HUD prompt is OFF 
 
				if (AmStandingPromptActiveLocal == false) then 
 
					-- Turn on the HUD prompt for Local Player 
 
					hud_prompt_clear(player) 
 
					hud_prompt(player, "GM_FLIGHTTUT_HUD_USE_JUMP", "", true) 
 
					AmStandingPromptActiveLocal = true 
 
					AmJumpingPromptActiveLocal = false 
 
					CanFlapPromptActiveLocal = false 
 
 
 
				end 
 
			]]-- 
 
			-- if player is jumping 
 
			 if (player_is_jumping(LOCAL_PLAYER)) then 
 
				-- if the LOCAL jump prompt is off 
 
				if (AmJumpingPromptActiveLocal == false) then 
 
					-- turn on the HUD prompt for Local player 
 
					hud_prompt_clear(LOCAL_PLAYER) 
 
					hud_prompt(LOCAL_PLAYER, "GM_FLIGHTTUT_HUD_USE_FLIGHT", "", true) 
 
					AmJumpingPromptActiveLocal = true 
 
					AmStandingPromptActiveLocal = false 
 
					CanFlapPromptActiveLocal = false 
 
				end 
 
			-- elseif the LOCAL player is Flying && if the Local Player Can flap 
 
			elseif (player_is_gliding(LOCAL_PLAYER)) and (player_get_num_flaps(LOCAL_PLAYER, iCurrentFlapsLocal) > 0) then --and player_is_flying(player)) then 
 
				testint = player_get_num_flaps(LOCAL_PLAYER, iCurrentFlapsLocal) 
 
				-- if the LOCAL FLAP prompt is off 
 
				if (CanFlapPromptActiveLocal == false) then 
 
					-- turn on the HUD prompt for Local player 
 
					hud_prompt_clear(LOCAL_PLAYER) 
 
					hud_prompt(LOCAL_PLAYER, "GM_FLIGHTTUT_HUD_USE_FLAP", "", true) 
 
					CanFlapPromptActiveLocal = true 
 
					AmJumpingPromptActiveLocal = false 
 
					AmStandingPromptActiveLocal = false 
 
				end 
 
			elseif ((AmJumpingPromptActiveLocal == true) or (CanFlapPromptActiveLocal == true) or (AmStandingPromptActiveLocal == true)) then 
 
				hud_prompt_clear(LOCAL_PLAYER) 
 
				CanFlapPromptActiveLocal = false 
 
				AmJumpingPromptActiveLocal = false 
 
				AmStandingPromptActiveLocal = false 
 
			end 
 
		-- else if the player is not local (he's the remote player 
 
		thread_yield() 
 
	end 
 
end 
 
function flight_state_machine_remote() 
 
	-- if its a local player then 
 
	while ( flight_state_machine_active) do 
 
		-- if the REMOTE PLAYER is standing 
 
			--[[ 
 
			if (player_is_standing(player)) then 
 
				-- if the standing HUD prompt is OFF 
 
				if (AmStandingPromptActiveRemote == false) then 
 
					-- Turn on the HUD prompt for REMOTE Player 
 
					hud_prompt_clear(player) 
 
					hud_prompt(player, "GM_FLIGHTTUT_HUD_USE_JUMP", "", true) 
 
					AmStandingPromptActiveRemote = true 
 
					AmJumpingPromptActiveRemote = false 
 
					CanFlapPromptActiveRemote = false 
 
				end 
 
			]]-- 
 
			-- if player is jumping 
 
			if (player_is_jumping(REMOTE_PLAYER)) then 
 
				-- if the REMOTE jump prompt is off 
 
				if (AmJumpingPromptActiveRemote == false) then 
 
					-- turn on the HUD prompt for Local player 
 
					hud_prompt_clear(REMOTE_PLAYER) 
 
					hud_prompt(REMOTE_PLAYER, "GM_FLIGHTTUT_HUD_USE_FLIGHT", "", true) 
 
					AmJumpingPromptActiveRemote = true 
 
					AmStandingPromptActiveRemote = false 
 
					CanFlapPromptActiveRemote = false 
 
				end 
 
			-- elseif the REMOTE player is Flying && if the Local Player Can flap 
 
			elseif ((player_is_gliding(REMOTE_PLAYER)) and (player_get_num_flaps(REMOTE_PLAYER, iCurrentFlapsRemote) > 0)) then  
 
				-- if the REMOTE FLAP prompt is off 
 
				local intFlaps = player_get_num_flaps(REMOTE_PLAYER, iCurrentFlapsRemote) 
 
				if (CanFlapPromptActiveRemote == false) then 
 
					-- turn on the HUD prompt for Local player 
 
					hud_prompt_clear(REMOTE_PLAYER) 
 
					hud_prompt(REMOTE_PLAYER, "GM_FLIGHTTUT_HUD_USE_FLAP", "", true) 
 
					CanFlapPromptActiveRemote = true 
 
					AmJumpingPromptActiveRemote = false 
 
					AmStandingPromptActiveRemote = false 
 
				end 
 
			-- nothing is on 
 
			elseif ((AmJumpingPromptActiveRemote == true) or (CanFlapPromptActiveRemote == true) or (AmStandingPromptActiveRemote == true)) then 
 
				hud_prompt_clear(REMOTE_PLAYER) 
 
				CanFlapPromptActiveRemote = false 
 
				AmJumpingPromptActiveRemote = false 
 
				AmStandingPromptActiveRemote = false 
 
			end 
 
		thread_yield() 
 
	end 
 
end			 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
-- [[ mFlightTutorial_leash_thread ]] 
 
-- 
 
-- Checks to see if the players are trying to fly away from the tutorial area 
 
--  
 
 local_warping = false 
 
 remote_warping = false 
 
function mFlightTutorial_leash_thread(player) 
 
 
 
	while mFlightTutorial_UsePlayerLeash do	 
 
		if ((player == LOCAL_PLAYER) and (not local_warping))  then 
 
			if get_dist(LOCAL_PLAYER, mLastIslandTriggered_Local) > mImpfest_leash_distance then 
 
				local_warping = true 
 
				ResetLocalPlayerStuff() 
 
				--convo_start(mFlightTutorial_convo.leash_gat) 
 
				 
 
			end 
 
		elseif ((player == REMOTE_PLAYER) and (not remote_warping)) then 
 
			if get_dist(REMOTE_PLAYER, mLastIslandTriggered_Remote) > mImpfest_leash_distance then 
 
				remote_warping = true 
 
				ResetRemotePlayerStuff() 
 
				 
 
			end 
 
		end 
 
		thread_yield() 
 
	end 
 
end 
 
 
 
-- [[ mFlightTutorial_tutorial_triggers_thread_func ]] 
 
-- 
 
-- Sets up the tutorial triggers for each of the players 
 
-- so that they may independently hit each marker on their on.  
 
iNumPlayersFinishedFirstFlight = 0 
 
iNumPlayersFinishedClimbFlight = 0 
 
function mFlightTutorial_tutorial_triggers_thread_func( player ) 
 
	 
 
		------------------------- 
 
	-- 
 
	-- [[ Jump Trigger ]] -- 
 
	-- 
 
	------------------------- 
 
	-- Figure out the sync type. (TWO THREADS, ONE FOR EACH PLAYER) 
 
	local sync_type = SYNC_LOCAL 
 
	local sync_index = 0 
 
	if player == REMOTE_PLAYER then 
 
		sync_type = SYNC_REMOTE 
 
		sync_index = 1 
 
	end 
 
	--convo_end_all() 
 
	-- "Let's start slow, try to jump over to that next island 
 
	mFlightTutorial_convo.charge.sync = sync_type 
 
	convo_start(mFlightTutorial_convo.charge) 
 
	-- Tap 'A' to Jump 
 
	mFlightTutorial_set_tutorial_text( "flight_tut_jump", player )	 
 
	-- SET OBJECIVE 
 
	objective_text_clear( sync_index ) 
 
	objective_text( sync_index, "SRG_FLIGHTTUT_OBJ_JUMP", nil, nil, sync_type, OI_ASSET_LOCATION )	 
 
	 
 
	-- Set up the first jump trigger	 
 
	trigger_setup( mFlightTutorial_trigger.jump_trigger_01 ) 
 
	if (player == LOCAL_PLAYER) then 
 
		mFlightTutorial_set_trigger_marker( mFlightTutorial_trigger.jump_trigger_01.name, SYNC_LOCAL ) 
 
	else 
 
		mFlightTutorial_set_trigger_marker( mFlightTutorial_trigger.jump_trigger_01.name, SYNC_REMOTE ) 
 
	end 
 
 
 
	while not( object_is_in_trigger( mFlightTutorial_trigger.jump_trigger_01.name, player ) and player_is_standing( player ) ) do 
 
		thread_yield() 
 
	end 
 
 
 
	-- Since we've activated this trigger, save this as the teleport to location. 
 
	marker_remove_trigger( mFlightTutorial_trigger.jump_trigger_01.name, sync_type ) 
 
	mFlightTutorial_trigger_transition( player, "jump_respawn_nav_host", mFlightTutorial_trigger.walljump_trigger_01.name ) 
 
	 
 
	------------------------- 
 
	-- 
 
	-- [[  Charge Jump Trigger ]] 
 
	-- 
 
	------------------------- 
 
	 
 
	-- set up the wall jump trigger 
 
	trigger_setup( mFlightTutorial_trigger.walljump_trigger_01 ) 
 
	--  
 
	mFlightTutorial_set_tutorial_text( "flight_tut_charge_jump", player ) 
 
	-- SET OBJECIVE 
 
 
 
	objective_text_clear( sync_index ) 
 
	objective_text( sync_index, "SRG_FLIGHTTUT_OBJ_CHARGEJUMP", nil, nil, sync_type, OI_ASSET_LOCATION )	 
 
 
 
	while not( object_is_in_trigger( mFlightTutorial_trigger.walljump_trigger_01.name, player ) and player_is_standing( player ) ) do 
 
		thread_yield() 
 
	end 
 
		------------------------- 
 
	-- 
 
	-- [[ Wall Jump Trigger ]] 
 
	-- 
 
	------------------------- 
 
	-- Since we've activated this trigger, save this as the teleport to location.	 
 
	marker_remove_trigger( mFlightTutorial_trigger.walljump_trigger_01.name, sync_type ) 
 
 
 
	-- conversation For Wall Jump STart 
 
	mFlightTutorial_convo.charge.sync = sync_type 
 
	convo_end(mFlightTutorial_convo.charge) 
 
	--convo_end_all() 
 
	mFlightTutorial_convo.wall_jump.sync = sync_type 
 
	convo_start(mFlightTutorial_convo.wall_jump) 
 
 
 
	mFlightTutorial_set_tutorial_text( "flight_tut_wall_jump", player )	 
 
	-- SET OBJECIVE 
 
	objective_text_clear( sync_index ) 
 
	objective_text( sync_index, "SRG_FLIGHTTUT_OBJ_WALLJUMP", nil, nil, sync_type, OI_ASSET_LOCATION ) 
 
 
 
	mFlightTutorial_trigger_transition( player, "walljump_respawn_nav_host", mFlightTutorial_trigger.runningjump_trigger_01.name ) 
 
	trigger_setup( mFlightTutorial_trigger.runningjump_trigger_01 ) 
 
	while not( object_is_in_trigger( mFlightTutorial_trigger.runningjump_trigger_01.name, player ) and player_is_standing( player ) ) do 
 
		thread_yield() 
 
	end 
 
 
 
		------------------------- 
 
	-- 
 
	-- [[ Formerly Sprint, now first flight Trigger ]] 
 
	-- 
 
	------------------------- 
 
	-- Since we've activated this trigger, save this as the teleport to location.	 
 
	marker_remove_trigger( mFlightTutorial_trigger.runningjump_trigger_01.name, sync_type ) 
 
 
 
	--convo_end_all() 
 
	--convo_start(mFlightTutorial_convo.dash_start) 
 
	 
 
	mFlightTutorial_trigger_transition( player, "runningjump_respawn_nav_host", mFlightTutorial_trigger.glide_trigger_01.name ) 
 
	-- this is actually the wall jump! 
 
	mFlightTutorial_set_tutorial_text( "flight_tut_sprint_jump", player )	 
 
	-- SET OBJECIVE 
 
	objective_text_clear( sync_index ) 
 
	objective_text( sync_index, "SRG_FLIGHTTUT_OBJ_FIRSTFLIGHT", nil, nil, sync_type, OI_ASSET_LOCATION ) 
 
	 
 
	mFlightTutorial_convo.wall_jump.sync = sync_type 
 
	convo_end(mFlightTutorial_convo.wall_jump) 
 
	--convo_end_all() 
 
	mFlightTutorial_convo.flight_variant.sync = sync_type 
 
	convo_start(mFlightTutorial_convo.flight_variant) 
 
	-- Give the player the power of flight!!! 
 
	player_flight_unlock( player, true ) 
 
	-- Get the boost orb! 
 
 
 
		if (player == REMOTE_PLAYER) then 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_06) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_07) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_08) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_09) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_10) 
 
			mFlightTutorial_BreadCrumb_6 = effect_play("Vfx Hb Boostnode<006>", true, SYNC_REMOTE)  
			mFlightTutorial_BreadCrumb_7 = effect_play("Vfx Hb Boostnode<007>", true, SYNC_REMOTE)  
			mFlightTutorial_BreadCrumb_8 = effect_play("Vfx Hb Boostnode<008>", true, SYNC_REMOTE)  
			mFlightTutorial_BreadCrumb_9 = effect_play("Vfx Hb Boostnode<009>", true, SYNC_REMOTE)  
			mFlightTutorial_BreadCrumb_10 = effect_play("Vfx Hb Boostnode<010>", true, SYNC_REMOTE)  
		else 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_01) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_02) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_03) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_04) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_05) 
 
			mFlightTutorial_BreadCrumb_1 = effect_play("Vfx Hb Boostnode<001>", true, SYNC_LOCAL)  
			mFlightTutorial_BreadCrumb_2 = effect_play("Vfx Hb Boostnode<002>", true, SYNC_LOCAL)  
			mFlightTutorial_BreadCrumb_3 = effect_play("Vfx Hb Boostnode<003>", true, SYNC_LOCAL)  
			mFlightTutorial_BreadCrumb_4 = effect_play("Vfx Hb Boostnode<004>", true, SYNC_LOCAL)  
			mFlightTutorial_BreadCrumb_5 = effect_play("Vfx Hb Boostnode<005>", true, SYNC_LOCAL)  
		end 
 
 
 
 
 
	-- Start the state machine for HUD propts 
 
	if (player == REMOTE_PLAYER) then 
 
		mFlightTutorial_thread.flight_state_machine = thread_new( "flight_state_machine_remote" ) 
 
	else 
 
		mFlightTutorial_thread.flight_state_machine = thread_new( "flight_state_machine_local" ) 
 
	end 
 
	-- Set up the next trigger 
 
	trigger_setup( mFlightTutorial_trigger.glide_trigger_01 )	 
 
	--message( "Basic Flight.", 10.0, false ) 
 
 
 
	while not( object_is_in_trigger( mFlightTutorial_trigger.glide_trigger_01.name, player ) and player_is_standing( player ) )do 
 
		thread_yield() 
 
	end 
 
 
 
	iNumPlayersFinishedFirstFlight = iNumPlayersFinishedFirstFlight + 1 
 
	-- cleanup triggers and orbs 
 
	if (player == REMOTE_PLAYER) then 
 
 
 
			mFlighTutorial_breadcrumb_6(REMOTE_PLAYER) 
 
			mFlighTutorial_breadcrumb_7(REMOTE_PLAYER) 
 
			mFlighTutorial_breadcrumb_8(REMOTE_PLAYER) 
 
			mFlighTutorial_breadcrumb_9(REMOTE_PLAYER) 
 
			mFlighTutorial_breadcrumb_10(REMOTE_PLAYER) 
 
	else 
 
			mFlighTutorial_breadcrumb_1(LOCAL_PLAYER) 
 
			mFlighTutorial_breadcrumb_2(LOCAL_PLAYER) 
 
			mFlighTutorial_breadcrumb_3(LOCAL_PLAYER) 
 
			mFlighTutorial_breadcrumb_4(LOCAL_PLAYER) 
 
			mFlighTutorial_breadcrumb_5(LOCAL_PLAYER) 
 
	end 
 
 
 
 
 
	-- Since we've activated this trigger, save this as the teleport to location. 
 
	marker_remove_trigger( mFlightTutorial_trigger.glide_trigger_01.name, sync_type ) 
 
 
 
 
 
	mFlightTutorial_trigger_transition( player, "glide_respawn_nav_host", mFlightTutorial_trigger.dive_trigger_01.name ) 
 
	------------------------- 
 
	-- 
 
	-- [[ First Dive Trigger ]] -- 
 
	-- 
 
	------------------------- 
 
	mFlightTutorial_convo.flight_variant.sync = sync_type 
 
	convo_end(mFlightTutorial_convo.flight_variant) 
 
	--convo_end_all() 
 
	mFlightTutorial_convo.dive_start.sync = sync_type 
 
	convo_start(mFlightTutorial_convo.dive_start)	 
 
 
 
	-- first dive (after learning to fly) 
 
	mFlightTutorial_set_tutorial_text( "flight_tut_glide", player ) 
 
 
 
	objective_text_clear( sync_index ) 
 
	objective_text( sync_index, "SRG_FLIGHTTUT_OBJ_DIVE", nil, nil, sync_type, OI_ASSET_LOCATION ) 
 
	 
 
	-- this is used for the propper fail callback in the lava trigger 
 
	trigger_setup( mFlightTutorial_trigger.dive_trigger_01 ) 
 
 
 
 
 
	while not ( object_is_in_trigger( mFlightTutorial_trigger.dive_trigger_01.name, player ) and player_is_standing( player ) ) do 
 
		thread_yield() 
 
	end 
 
 
 
	-- Since we've activated the dive trigger, save it as the teleport to location. 
 
	marker_remove_trigger( mFlightTutorial_trigger.dive_trigger_01.name, sync_type ) 
 
	mFlightTutorial_convo.dive_start.sync = sync_type 
 
	convo_end(mFlightTutorial_convo.dive_start)		 
 
	--convo_end_all() 
 
	mFlightTutorial_convo.get_boost.sync = sync_type 
 
	convo_start(mFlightTutorial_convo.get_boost)		 
 
 
 
	------------------------- 
 
	-- 
 
	-- [[ Boost with Boost Node Trigger ]] -- 
 
	-- 
 
	------------------------- 
 
 
 
	-- Go to the island 
 
	mFlightTutorial_trigger_transition( player, "dive_respawn_nav_host", mFlightTutorial_trigger.flap_trigger_01.name ) 
 
	-- Set up the next trigger and save this trigger as the most recently hit. 
 
	trigger_setup( mFlightTutorial_trigger.flap_trigger_01 ) 
 
	mFlightTutorial_set_tutorial_text( "flight_tut_dive_climb", player ) 
 
	-- SET OBJECIVE 
 
	objective_text_clear( sync_index ) 
 
	objective_text( sync_index, "SRG_FLIGHTTUT_OBJ_GETFLAP", nil, nil, sync_type, OI_ASSET_LOCATION ) 
 
	 
 
 
 
	-- Set the FLAP orb! 
 
	if 	player == REMOTE_PLAYER then 
 
		trigger_setup( mFlightTutorial_trigger.give_flap_trigger_02) 
 
		object_indicator_add( mFlightTutorial_group.use_flap_orbs.use_flap_orb_2, OI_ASSET_LOCATION, OI_FLAGS_DEFAULT, SYNC_REMOTE ) 
 
		marker_add(mFlightTutorial_group.use_flap_orbs.use_flap_orb_2, MINIMAP_ICON_LOCATION,OI_ASSET_LOCATION, OI_FLAGS_DEFAULT, SYNC_REMOTE)  
 
		mFlightTutorial_FlapVFX_2 = effect_play("Vfx Hb Xtraflap 01<002>", true, SYNC_REMOTE)  
	else 
 
	   mFlightTutorial_FlapVFX_1 = effect_play("Vfx Hb Xtraflap 01<001>", true, SYNC_LOCAL)  
	   trigger_setup( mFlightTutorial_trigger.give_flap_trigger_01) 
 
	   object_indicator_add( mFlightTutorial_group.use_flap_orbs.use_flap_orb_1, OI_ASSET_LOCATION, OI_FLAGS_DEFAULT, SYNC_LOCAL ) 
 
		marker_add(mFlightTutorial_group.use_flap_orbs.use_flap_orb_1, MINIMAP_ICON_LOCATION,OI_ASSET_LOCATION, OI_FLAGS_DEFAULT, SYNC_LOCAL )  
 
	-- marker_add_trigger( mFlightTutorial_group.use_flap_orbs.use_flap_orb_1, FLIGHTTUT_CUSTOM_TRIGGER_LOCATION.minimap_icon_name, FLIGHTTUT_CUSTOM_TRIGGER_LOCATION.ingame_effect_name, FLIGHTTUT_CUSTOM_TRIGGER_LOCATION.object_indicator_id, FLIGHTTUT_CUSTOM_TRIGGER_LOCATION.object_indicator_flags, sync_type ) 
 
	   trigger_setup(mFlightTutorial_trigger.missed_flap_trigger_1) 
 
	end 
 
 
 
	-- Wait until they've hit the island trigger 
 
	if player == REMOTE_PLAYER then 
 
		while not ( object_is_in_trigger( mFlightTutorial_trigger.flap_trigger_01.name, player ) and player_is_standing( player ) and (Remote_CollectedOrb_B == true)) do 
 
			thread_yield() 
 
		end 
 
	else 
 
		while not ( object_is_in_trigger( mFlightTutorial_trigger.flap_trigger_01.name, player ) and player_is_standing( player ) and (Local_CollectedOrb_A == true)) do 
 
			thread_yield() 
 
		end 
 
	end 
 
	-- Since we've activated this trigger, save this as the teleport to location. 
 
	marker_remove_trigger( mFlightTutorial_trigger.flap_trigger_01.name, sync_type ) 
 
 
 
	------------------------- 
 
	-- 
 
	-- [[ Flap on your own Trigger ]] -- 
 
	-- 
 
	------------------------- 
 
 
 
	-- Award the player their first flap 
 
	if player == LOCAL_PLAYER then 
 
		super_jump_set_flap_max( 1, SYNC_LOCAL, true ) 
 
		iCurrentFlapsLocal = 1 
 
	else 
 
		super_jump_set_flap_max( 1, SYNC_REMOTE, true ) 
 
		iCurrentFlapsRemote = 1 
 
	end 
 
	-- turning off double jump / wall jump for now 
 
	--TODO: Change this so that it only affects the current player (whoever's thread this is) 
 
	player_super_power_set_wall_jump_and_sprint_disabled(true, false, player) 
 
	-- set up the hud prompt for the player to use flap 
 
	--mFlightTutorial_thread.check_flap_thread = thread_new( "Local_check_flap_thread(player)") 
 
 
 
	--if coop_is_active() then 
 
	--	mFlightTutorial_Remote_check_flap_thread()Bread_Crumb_Trigger_11 
 
	--end 
 
	mFlightTutorial_convo.get_boost.sync = sync_type 
 
	convo_end(mFlightTutorial_convo.get_boost)	 
 
	--convo_end_all() 
 
	mFlightTutorial_convo.give_flap.sync = sync_type 
 
	convo_start(mFlightTutorial_convo.give_flap) 
 
	mImpfest_leash_distance = 400 
 
	mFlightTutorial_trigger_transition( player, "flap_respawn_nav_host", mFlightTutorial_trigger.climb_trigger_01.name ) 
 
 
 
	-- Set up the next trigger and save this trigger as the most recently hit. 
 
	mFlightTutorial_set_tutorial_text( "flight_tut_dive_climb_1", player ) 
 
	-- SET OBJECIVE 
 
	objective_text_clear( sync_index ) 
 
	objective_text( sync_index, "SRG_FLIGHTTUT_OBJ_FIRSTFLIGHT", nil, nil, sync_type, OI_ASSET_LOCATION ) 
 
	 
 
	trigger_setup( mFlightTutorial_trigger.climb_trigger_01 ) 
 
	while not( object_is_in_trigger( mFlightTutorial_trigger.climb_trigger_01.name, player ) and player_is_standing( player ) )do 
 
		thread_yield() 
 
	end		 
 
	--	tweak_table_override_value("superjump_flap_energy_boost",800)  
 
 
 
 
	-------------------------- 
 
	-- 
 
	-- [[ Climb trigger ]] -- 
 
	-- 
 
	-------------------------- 
 
 
 
		if (player == REMOTE_PLAYER) then 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_16) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_17) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_18) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_19) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_20) 
 
			mFlightTutorial_BreadCrumb_16 = effect_play("Vfx Hb Boostnode<016>", true, SYNC_REMOTE)  
			mFlightTutorial_BreadCrumb_17 = effect_play("Vfx Hb Boostnode<017>", true, SYNC_REMOTE)  
			mFlightTutorial_BreadCrumb_18 = effect_play("Vfx Hb Boostnode<018>", true, SYNC_REMOTE)  
			mFlightTutorial_BreadCrumb_19 = effect_play("Vfx Hb Boostnode<019>", true, SYNC_REMOTE)  
			mFlightTutorial_BreadCrumb_20 = effect_play("Vfx Hb Boostnode<020>", true, SYNC_REMOTE)  
		else 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_11) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_12) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_13) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_14) 
 
			trigger_setup( mFlightTutorial_trigger.Bread_Crumb_Trigger_15) 
 
			mFlightTutorial_BreadCrumb_11 = effect_play("Vfx Hb Boostnode<011>", true, SYNC_LOCAL)  
			mFlightTutorial_BreadCrumb_12 = effect_play("Vfx Hb Boostnode<012>", true, SYNC_LOCAL)  
			mFlightTutorial_BreadCrumb_13 = effect_play("Vfx Hb Boostnode<013>", true, SYNC_LOCAL)  
			mFlightTutorial_BreadCrumb_14 = effect_play("Vfx Hb Boostnode<014>", true, SYNC_LOCAL)  
			mFlightTutorial_BreadCrumb_15 = effect_play("Vfx Hb Boostnode<015>", true, SYNC_LOCAL)  
		end 
 
 
 
 
 
 
 
	marker_remove_trigger( mFlightTutorial_trigger.climb_trigger_01.name, sync_type ) 
 
	-- Since we've activated this trigger, save this as the teleport to location.	 
 
	 
 
	-- Let the player know their controls are set and how to steer left and right during flight. 
 
	mFlightTutorial_set_tutorial_text( "flight_tut_flight_controls", player ) 
 
	-- SET OBJECIVE 
 
	objective_text_clear( sync_index ) 
 
	objective_text( sync_index, "SRG_FLIGHTTUT_OBJ_CLIMB", nil, nil, sync_type, OI_ASSET_LOCATION ) 
 
	 
 
	mFlightTutorial_convo.give_flap.sync = sync_type 
 
	convo_end(mFlightTutorial_convo.give_flap) 
 
	--convo_end_all() 
 
	mFlightTutorial_convo.flap.sync = sync_type 
 
	convo_start(mFlightTutorial_convo.flap) 
 
--	mFlightTutorial_thread.check_flap_thread = thread_new( "Local_check_flap_thread") 
 
	------------------------- 
 
	-- 
 
	-- [[ Stamina / Manuever Trigger ]] --mLastIslandTriggered_Local 
 
	-- 
 
	------------------------- 
 
 
 
	mFlightTutorial_trigger_transition( player, "climb_respawn_nav_host", mFlightTutorial_trigger.turn_trigger_01.name )		 
 
	-- Set up the next trigger and save this trigger as the most recently hit. 
 
	trigger_setup( mFlightTutorial_trigger.turn_trigger_01 )	 
 
	while not( object_is_in_trigger( mFlightTutorial_trigger.turn_trigger_01.name, player ) and player_is_standing( player ) ) do 
 
		thread_yield() 
 
	end 
 
	iNumPlayersFinishedClimbFlight = iNumPlayersFinishedClimbFlight + 1 
 
	if (player == REMOTE_PLAYER) then 
 
			mFlighTutorial_breadcrumb_16(REMOTE_PLAYER) 
 
			mFlighTutorial_breadcrumb_17(REMOTE_PLAYER) 
 
			mFlighTutorial_breadcrumb_18(REMOTE_PLAYER) 
 
			mFlighTutorial_breadcrumb_19(REMOTE_PLAYER) 
 
			mFlighTutorial_breadcrumb_20(REMOTE_PLAYER) 
 
	else 
 
			mFlighTutorial_breadcrumb_11(LOCAL_PLAYER) 
 
			mFlighTutorial_breadcrumb_12(LOCAL_PLAYER) 
 
			mFlighTutorial_breadcrumb_13(LOCAL_PLAYER) 
 
			mFlighTutorial_breadcrumb_14(LOCAL_PLAYER) 
 
			mFlighTutorial_breadcrumb_15(LOCAL_PLAYER) 
 
	end 
 
	-- turning back on wall / double jump 
 
	player_super_power_set_wall_jump_and_sprint_disabled(false, false, player) 
 
	if player == LOCAL_PLAYER then 
 
		flight_tutorial_stamina(false, LOCAL_PLAYER) 
 
	else 
 
		flight_tutorial_stamina(false, REMOTE_PLAYER) 
 
	end 
 
	mFlightTutorial_set_tutorial_text( "flight_tut_glide_steer", player ) 
 
	-- SET OBJECIVE 
 
	objective_text_clear( sync_index ) 
 
	objective_text( sync_index, "SRG_FLIGHTTUT_OBJ_FINAL", nil, nil, sync_type, OI_ASSET_LOCATION ) 
 
	 
 
	marker_remove_trigger( mFlightTutorial_trigger.turn_trigger_01.name, sync_type ) 
 
	if player == LOCAL_PLAYER then 
 
		mLastIslandTriggered_Local = "climb_respawn_nav_host" 
 
		mLocalTurnTriggerHit = true 
 
	else 
 
		mLastIslandTriggered_Remote = "climb_respawn_nav_client" 
 
		mRemoteTurnTriggerHit = true 
 
	end 
 
 
 
	-- Since we've activated this trigger, save this as the teleport to location.	 
 
	if player == LOCAL_PLAYER then 
 
		mLastIslandTriggered_Local = "turn_respawn_nav_host" 
 
		mLocalTurnTriggerHit = true 
 
	else 
 
		mLastIslandTriggered_Remote = "turn_respawn_nav_client" 
 
		mRemoteTurnTriggerHit = true 
 
	end 
 
	delay( 1.0 ) 
 
 
 
	mFlightTutorial_convo.flap.sync = sync_type 
 
	convo_end(mFlightTutorial_convo.flap) 
 
	--convo_end_all() 
 
	mFlightTutorial_convo.turn.sync = sync_type 
 
	convo_start(mFlightTutorial_convo.turn) 
 
 
 
	 
 
	mFlightTutorial_final_trigger_setup( mFlightTutorial_trigger.end_trigger, sync_type )	 
 
 
 
end