--[[
MM_Z_05.lua
SR3 Mission Script
DATE: 11-12-2010
AUTHOR: Jimmy Cross
]]--
-- Debug flags --
-- Tweakable Parameters --
-- Groups --
-- Navpoints --
MM_Z_05_navs = {
cp_start = {
player_local = "local_player",
player_remote = "remote_player"
}
}
-- Triggers --
MM_Z_05_trigger = {
crib = {
name = "ZC_trigger",
hit = false
}
}
-- Characters --
-- Vehicles --
-- Mesh Movers --
-- Text --
-- Threads --
-- Checkpoints --
MM_Z_05_checkpoint = {
start = {
name = MISSION_START_CHECKPOINT,
nav1 = "start_nav 001",
nav2 = "start_nav 002"
}
}
-- Cutscenes --
MM_Z_05_cutscene = {
zimos_outro = "Z_Z03"
--zimos_outro = ""
}
CUTSCENE_MISSION_INTRO = ""
CUTSCENE_MISSION_OUTRO = ""
-- Conversations --
MM_Z_05_convo = {
zimos_call = {
name = "MM_Z_05_End_Phone_Call",
handle = INVALID_CONVERSATION_HANDLE,
zimos_persona_name = "Phone_Call",
zimos_persona_id = INVALID_PERSONA_HANDLE,
},
}
-- Other --
local call_ended = false
-- *************************
--
-- 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_Z_05_start(checkpoint, is_restart)
-- Check if this mission starting from the beginning
if (checkpoint == MM_Z_05_checkpoint.start.name) then
if (is_restart == false) then
-- First time playing mission
end
MM_Z_05_convo.zimos_call.zimos_persona_id = audio_persona_load_2d( MM_Z_05_convo.zimos_call.zimos_persona_name)
-- Play the conversation
audio_play_for_mission_cellphone( MM_Z_05_convo.zimos_call.name, true, true, "", "mm_z_05_end_call")
--fade_out(0)
end
-- Handle mission initialization for the current checkpoint
MM_Z_05_initialize(checkpoint)
-- Run the mission from the current checkpoint
MM_Z_05_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_Z_05_run(first_checkpoint)
while call_ended == false do
thread_yield()
end
message("mission complete!!!", 17)
mission_set_completed("mm_z_05")
mission_end_silently(false)
mission_autosave()
end
-- This is the primary function responsible for cleaning up the entire mission
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function MM_Z_05_cleanup()
--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--
audio_remove_mission_cellphone(MM_Z_05_convo.zimos_call.name)
if (MM_Z_05_convo.zimos_call.persona_id ~= INVALID_PERSONA_HANDLE) then
audio_persona_remove_2d(MM_Z_05_convo.zimos_call.persona_id)
MM_Z_05_convo.zimos_call.persona_id = INVALID_PERSONA_HANDLE
end
end
-- Called when the mission has ended with success
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function MM_Z_05_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_Z_05_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_Z_05_initialize_common()
-- Checkpoint specific initialization
MM_Z_05_initialize_checkpoint(checkpoint)
-- Start fading in
mission_start_fade_in()
end
-- ***************************************************
-- MM_Z_05_run Helper Functions
-- ***************************************************
-- ***************************************************
-- MM_Z_05_initialize Helper Functions
-- ***************************************************
-- Handle any common initialization
--
function MM_Z_05_initialize_common()
--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]--
end
-- Checkpoint specific initialization
--
-- checkpoint: The checkpoint to be initialized
function MM_Z_05_initialize_checkpoint(checkpoint)
if (checkpoint == MM_Z_05_checkpoint.start.name) then
--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]--
end
end
-- ***************************************************
-- Miscellaneous MM_Z_05 Helper Funcrtions
-- ***************************************************
function MM_Z_05_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_Z_05_zc_trigger_cb()
-- clear the trigger, waypoint, and objective
MM_Z_05_trigger.crib.hit = true
MM_Z_05_clear_trigger( MM_Z_05_trigger.crib.name )
waypoint_remove()
objective_text_clear(0) -- clear the objective text
end
function mm_z_05_end_call()
call_ended = true
end
-- *************************
--
-- Thread functions
--
-- *************************