--[[
mm_p_07.lua
SR3 Mission Script
DATE: 11-15-2010
AUTHOR: Jimmy Cross
]]--
-- Debug flags --
-- Tweakable Parameters --
MM_P_07_PIERCE_TRIGGER_DIST = 4.0 -- distance at which to start the Zscene ("close", by definition of the spec)
MM_P_07_PIERCE_SPAWN_DIST = 200.0
-- Groups --
MM_P_07_group = {
}
-- Navpoints --
MM_P_07_navs = {
hq = "MM_P_07_Nav_Saints_HQ",
cp_start = { "local_player", "remote_player" }
}
-- Triggers --
-- Characters --.
MM_P_07_char = {
--pierce = "NPC Pierce"
}
-- Vehicles --
-- Mesh Movers --
-- Text --
-- Threads --
-- Checkpoints --
MM_P_07_checkpoint = {
start = {
name = MISSION_START_CHECKPOINT,
nav1 = "start_nav 001",
nav2 = "start_nav 002"
}
}
-- Cutscenes --
MM_P_07_cutscene = {
pierce_outro = "P_Z03"
}
CUTSCENE_MISSION_INTRO = ""
CUTSCENE_MISSION_OUTRO = ""
-- Conversations --
MM_P_07_convo = {
pierce_call = {
name = "MM_P_07_End_Phone_Call",
handle = INVALID_CONVERSATION_HANDLE,
pierce_persona_name = "Phone_Call",
pierce_persona_id = INVALID_PERSONA_HANDLE,
}
}
-- Other --
Mm_p_07_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_p_07_start(checkpoint, is_restart)
-- Check if this mission starting from the beginning
if (checkpoint == MM_P_07_checkpoint.start.name) then
if (is_restart == false) then
-- First time playing mission
end
--fade_out(0)
end
-- Handle mission initialization for the current checkpoint
mm_p_07_initialize(checkpoint)
-- Run the mission from the current checkpoint
mm_p_07_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_p_07_run(first_checkpoint)
Mm_p_07_call_ended = false
MM_P_07_convo.pierce_call.persona_id = audio_persona_load_2d( MM_P_07_convo.pierce_call.pierce_persona_name)
-- Play the conversation
audio_play_for_mission_cellphone( MM_P_07_convo.pierce_call.name, true, true, "", "mm_p_07_end_call")
while not Mm_p_07_call_ended do
thread_yield()
end
mission_set_completed("mm_p_07")
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_p_07_cleanup()
--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--
--group_destroy( MM_P_07_group.npcs.name )
audio_remove_mission_cellphone(MM_P_07_convo.pierce_call.name)
if (MM_P_07_convo.pierce_call.persona_id ~= INVALID_PERSONA_HANDLE) then
audio_persona_remove_2d(MM_P_07_convo.pierce_call.persona_id)
MM_P_07_convo.pierce_call.persona_id = INVALID_PERSONA_HANDLE
end
end
-- Called when the mission has ended with success
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function mm_p_07_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_p_07_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_p_07_initialize_common()
-- Checkpoint specific initialization
mm_p_07_initialize_checkpoint(checkpoint)
-- Start fading in
mission_start_fade_in()
end
-- Getting the player to the Saints HQ
--
--
function mm_p_07_go_to_saints_hq()
-- set GPS to Saints HQ
waypoint_add( MM_P_07_navs.hq ) -- add GPS marker at Saints HQ
marker_add( MM_P_07_navs.hq, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION )
objective_text( 0, "mm_p_07_obj_meet_pierce", nil, nil, SYNC_ALL, OI_ASSET_LOCATION )
end
-- ***************************************************
-- mm_p_07_run Helper Functions
-- ***************************************************
-- ***************************************************
-- mm_p_07_initialize Helper Functions
-- ***************************************************
-- Handle any common initialization
--
function mm_p_07_initialize_common()
--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]--
end
-- Checkpoint specific initialization
--
-- checkpoint: The checkpoint to be initialized
function mm_p_07_initialize_checkpoint(checkpoint)
if (checkpoint == MM_P_07_checkpoint.start.name) then
--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]--
end
end
-- ***************************************************
-- Miscellaneous mm_p_07 Helper Funcrtions
-- ***************************************************
-- *************************
--
-- Callback functions
--
-- *************************
function mm_p_07_end_call()
Mm_p_07_call_ended = true
end
-- *************************
--
-- Thread functions
--
-- *************************