-   
- --[[  
- 	MM_K_01.lua  
- 	SR3 Mission Script  
- 	DATE: 10-29-2010  
- 	AUTHOR:	Jimmy Cross  
- ]]--  
-   
-   
- -- Debug flags --  
-   
- -- Tweakable Parameters --  
-   
- -- Groups --  
-   
-   
- -- Navpoints --  
- 	MM_K_01_navs = {		 
- 		cp_start = { "local_player", "remote_player" } 
- 	}  
- 	  
- -- Triggers --  
- 	MM_K_01_trigger = { 
- 		tb = { 
- 			name = "TB_trigger",  
- 			hit = false  
- 		}  
- 	}  
- 				  
- -- Characters --  
-   
- -- Vehicles --  
-   
- -- Mesh Movers --  
-   
- -- Text --  
-   
- -- Threads --  
-   
- -- Checkpoints --  
- 	MM_K_01_checkpoint = { 
- 		start = { 
- 			name = MISSION_START_CHECKPOINT,  
- 			nav1 = "start_nav 001",  
- 			nav2 = "start_nav 002"  
- 		}  
- 	}  
- 	  
- -- Cutscenes --  
- MM_K_01_cutscene = { 
- 	kinzie_intro = "K_Z01"  
- 	--kinzie_intro = ""  
- }  
- 	CUTSCENE_MISSION_INTRO = ""  
- 	CUTSCENE_MISSION_OUTRO = ""  
-   
- -- Conversations --  
- 	MM_K_01_convo = { 
- 		--[[mission_start = { 
- 			name = "MM_K_01_convo_1",  
- 			handle = INVALID_CONVERSATION_HANDLE  
- 		}  
- 		]]--  
- 	}  
- 		  
- -- Other --  
-   
-   
- -- *************************  
- --  
- -- 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  
- --  
- -- checkpoint:	The checkpoint the mission should begin at  
- -- is_restart:					TRUE if the mission is restarting, FALSE otherwise  
- --  
- function MM_K_01_start(checkpoint, is_restart)  
- 	-- Check if this mission starting from the beginning  
- 	if (checkpoint == MM_K_01_checkpoint.start.name) then  
- 		if (is_restart == false) then  
- 			-- First time playing mission  
- 			if (MM_K_01_cutscene.kinzie_intro ~= "") then  
- 				zscene_prep( MM_K_01_cutscene.kinzie_intro )  
- 				  
- 				while( not zscene_is_loaded(MM_K_01_cutscene.kinzie_intro) ) do  
- 					thread_yield()  
- 				end  
- 				  
- 				--cutscene_out()  
- 				cutscene_play( MM_K_01_cutscene.kinzie_intro, nil, MM_K_01_navs.cp_start, false )  
- 				--cutscene_in()  
- 			else  
- 				fade_out( 0.5 )  
- 				fade_out_block()  
- 				  
- 				delay( 1.5 )  
- 				  
- 				fade_in( 0.5 )  
- 				fade_in_block()  
- 			end  
- 		end  
-   
- 		mission_end_to_activity("MM_K_01", "_A_TB_NW_01") 
- 	end  
-   
-   
- 	-- Handle mission initialization for the current checkpoint  
- 	--MM_K_01_initialize(checkpoint)  
-   
- 	-- Run the mission from the current checkpoint  
- 	--MM_K_01_run(checkpoint)  
- 	  
- end  
-   
- -- This is the primary function responsible for running the entire mission from start to finish.  
- --  
- -- first_checkpoint:	The first checkpoint to begin running the mission at  
- --  
- function MM_K_01_run(first_checkpoint)  
- 	local current_checkpoint = first_checkpoint  
-   
- 	-- Run the mission from the beginning  
- 	if( current_checkpoint == MM_K_01_checkpoint.start.name  ) then  
- 		--[[ INSERT PROCESSING FOR THE FIRST CHECKPOINT HERE ]]--  
- 		  
- 		--mission_end_to_activity("MM_K_01", "_A_TB_NW_01") 
- 		  
- 		--zscene_prep( MM_K_01_cutscene.kinzie_intro )  
- 		--cutscene_in()  
- 		--cutscene_play( MM_K_01_cutscene.kinzie_intro, nil, MM_K_01_navs.cp_start, false )  
- 		--cutscene_out()  
- 		  
- 		-- set GPS to Trail Blazing instance #1  
- 		--trigger_enable( MM_K_01_trigger.tb.name, true )  
- 		--waypoint_add( MM_K_01_trigger.tb.name ) -- add GPS marker at the start of the TB activity  
- 		--marker_add_trigger( MM_K_01_trigger.tb.name, MINIMAP_ICON_LOCATION, "VFX_TrailBlazingIcon", nil, OI_FLAGS_LOCATION, SYNC_ALL )  
- 		  
- 		--on_trigger( "MM_K_01_tb_trigger_cb", MM_K_01_trigger.tb.name ) -- register the callback for the trigger  
- 		--objective_text( 0, "MM_K_01_obj_meet_kinzie", "", "", SYNC_ALL ) -- tell the player to meet Kinzie  
- 		--objective_text( 0, "MM_K_01_obj_goto_tb", nil, nil, SYNC_ALL, OI_ASSET_LOCATION )  
- 		  
- 		--while not MM_K_01_trigger.tb.hit do -- wait for the player to hit the trigger at the TB start point  
- 			--thread_yield()  
- 		--end   
- 		  
- 	end  
- end  
-   
- -- This is the primary function responsible for cleaning up the entire mission  
- -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)  
- --  
- function MM_K_01_cleanup()  
- 	--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--  
- 	MM_K_01_clear_trigger( MM_K_01_trigger.tb.name )  
- end  
-   
- -- Called when the mission has ended with success  
- -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)  
- --  
- function MM_K_01_success()  
- 	--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]--  
- 	  
- end  
-   
-   
- -- *************************  
- --  
- -- Local functions  
- --  
- -- *************************  
-   
- -- Initialize the mission for the specified checkpoint  
- --  
- -- checkpoint:		Checkpoint to initialize the mission to  
- --  
- function MM_K_01_initialize(checkpoint)  
- 	-- Make sure the screen is completly faded out  
- 	mission_start_fade_out(0.0)  
-   
- 	-- Set the mission author  
- 	set_mission_author("Jimmy Cross") 
-   
- 	-- Common initialization  
- 	MM_K_01_initialize_common()  
-   
- 	-- Checkpoint specific initialization  
- 	MM_K_01_initialize_checkpoint(checkpoint)  
-   
- 	-- Start fading in   
- 	mission_start_fade_in()  
-   
- end  
-   
-   
- -- ***************************************************  
- -- MM_K_01_run Helper Functions  
- -- ***************************************************  
-   
-   
- -- ***************************************************  
- -- MM_K_01_initialize Helper Functions  
- -- ***************************************************  
-   
- -- Handle any common initialization  
- --  
- function MM_K_01_initialize_common()  
- 	--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]--  
- 	  
- end  
-   
- -- Checkpoint specific initialization  
- --  
- -- checkpoint:		The checkpoint to be initialized  
- function MM_K_01_initialize_checkpoint(checkpoint)  
-   
- 	if (checkpoint == MM_K_01_checkpoint.start.name) then  
- 		--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]--  
-   
- 	end  
-   
- end  
-   
-   
- -- ***************************************************  
- -- Miscellaneous MM_K_01 Helper Functions  
- -- ***************************************************  
- function MM_K_01_clear_trigger(trigger)  
- 	on_trigger( "", trigger )  
- 	trigger_enable( trigger, false )  
- 	marker_remove_trigger( trigger, SYNC_ALL )  
- end  
-   
- -- *************************  
- --  
- -- Callback functions  
- --  
- -- *************************  
-   
- -- Trigger callback, used to handle the start of the activity and silent failing of the mission  
- --  
- --   
- function MM_K_01_tb_trigger_cb()  
- 	-- clear the trigger, waypoint, and objective  
- 	MM_K_01_trigger.tb.hit = true  
- 	MM_K_01_clear_trigger( MM_K_01_trigger.tb.name )  
- 	waypoint_remove()  
- 	objective_text_clear(0) -- clear the objective text  
- 	  
- 	-- activity start triggered  
- 	mission_end_to_activity("MM_K_01", "_A_TB_NW_01") 
- 	  
- end  
-   
-   
- -- *************************  
- --  
- -- Thread functions  
- --  
- -- *************************  
-   
-