--[[
mm_p_06.lua
SR3 Mission Script
DATE: 9-2-2010
AUTHOR: Jimmy Cross
]]--
-- Debug flags --
-- Tweakable Parameters --
MM_P_06_PIERCE_TRIGGER_DIST = 4.0 -- distance at which to start the Zscene ("close", by definition of the spec)
MM_P_06_PIERCE_SPAWN_DIST = 200.0
-- Groups --
MM_P_06_group = {
}
-- Navpoints --
MM_P_06_navs = {
hq = "MM_P_06_Nav_Saints_HQ",
cp_start = { "local_player", "remote_player" }
}
-- Triggers --
-- Characters --.
MM_P_06_char = {
--pierce = "NPC Pierce"
}
-- Vehicles --
-- Mesh Movers --
-- Text --
-- Threads --
-- Checkpoints --
MM_P_06_checkpoint = {
start = {
name = MISSION_START_CHECKPOINT,
nav1 = "start_nav 001",
nav2 = "start_nav 002"
}
}
-- Cutscenes --
MM_P_06_cutscene = {
pierce_outro = "P_Z02"
}
CUTSCENE_MISSION_INTRO = ""
CUTSCENE_MISSION_OUTRO = ""
-- Conversations --
MM_P_06_convo = {
--[[
mission_start = {
name = "mm_p_06_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_p_06_start(checkpoint, is_restart)
-- Check if this mission starting from the beginning
if (checkpoint == MM_P_06_checkpoint.start.name) then
if (is_restart == false) then
-- First time playing mission
-- Play an intro cutscene???
zscene_prep( MM_P_06_cutscene.pierce_outro )
while( not zscene_is_loaded(MM_P_06_cutscene.pierce_outro) ) do
thread_yield()
end
--cutscene_in()
cutscene_play( MM_P_06_cutscene.pierce_outro, nil, MM_P_06_navs.cp_start, false )
end
fade_out(0)
end
-- Handle mission initialization for the current checkpoint
mm_p_06_initialize(checkpoint)
-- Run the mission from the current checkpoint
mm_p_06_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_06_run(first_checkpoint)
local current_checkpoint = first_checkpoint
-- Run the mission from the beginning
if( current_checkpoint == MM_P_06_checkpoint.start.name ) then
-- conversation with Pierce on phone, tells the Player to meet him and they'll talk about how to hurt the Syndicate
-- audio_conversation_play( MM_P_06_convo.mission_start.handle )
--cutscene_out()
--[[
-- Player(s) look cool GO!
local anim_name = "M06 Player Mission Start"
local morph_name = "M06 Player Mission Start"
local force_play = false
local stand_still = false
local zero_movement = false
action_play_non_blocking(LOCAL_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement)
player_script_controlled_clear(LOCAL_PLAYER) -- let player escape this animation
if (coop_is_active()) then
action_play_non_blocking(REMOTE_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement)
player_script_controlled_clear(REMOTE_PLAYER) -- let player escape this animation
end
delay(3)
--while action_play_is_finished( LOCAL_PLAYER, 1.5 ) == false or action_play_is_finished( REMOTE_PLAYER, 1.5 ) == false do
--thread_yield()
--end
]]--
mission_unlock("_A_IF_DT_01")
mission_unlock("_A_HA_DT_01")
mission_set_completed("mm_p_06")
mission_end_silently(false)
mission_autosave()
end
end
-- This is the primary function responsible for cleaning up the entire mission
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function mm_p_06_cleanup()
--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--
--group_destroy( MM_P_06_group.npcs.name )
end
-- Called when the mission has ended with success
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function mm_p_06_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_06_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_06_initialize_common()
-- Checkpoint specific initialization
mm_p_06_initialize_checkpoint(checkpoint)
-- Start fading in
mission_start_fade_in()
end
-- Getting the player to the Saints HQ
--
--
function mm_p_06_go_to_saints_hq()
-- set GPS to Saints HQ
mission_waypoint_add( MM_P_06_navs.hq ) -- add GPS marker at Saints HQ
marker_add( MM_P_06_navs.hq, MINIMAP_ICON_LOCATION, OI_ASSET_LOCATION )
objective_text( 0, "mm_p_06_obj_meet_pierce", nil, nil, SYNC_ALL, OI_ASSET_LOCATION )
--don't spawn Pierce until the player is close
--repeat thread_yield() until ( get_dist_closest_player_to_object( MM_P_06_group.npcs.pierce ) < MM_P_06_PIERCE_SPAWN_DIST )
--group_create( MM_P_06_group.npcs.name, true ) --create the NPC group
--Wait for one of the players to get close to Pierce
repeat thread_yield() until ( get_dist_closest_player_to_object( MM_P_06_navs.hq ) < MM_P_06_PIERCE_TRIGGER_DIST )
mission_waypoint_remove(SYNC_ALL)
marker_remove(MM_P_06_navs.hq, SYNC_ALL)
-- trigger zscene with Pierce explaining city takeover
if( MM_P_06_cutscene.pierce_outro ~= "" ) then
--cutscene_in()
--fade_out( 0.5 )
--fade_out_block()
cutscene_in()
delay( 2 )
--bink_play( MM_P_06_cutscene.pierce_outro )
cutscene_play( MM_P_06_cutscene.pierce_outro, nil, MM_P_06_navs.cp_start, false )
--cutscene_play( MM_P_06_cutscene.pierce_outro )
--teleport_coop( MM_P_06_navs.cp_start.player_local, MM_P_06_navs.cp_start.player_remote, true )
cutscene_out()
--fade_in( 0.5 )
--fade_in_block()
else --just fade out and fade back
fade_out( 0.5 )
fade_out_block()
delay( 1.5 )
fade_in( 0.5 )
fade_in_block()
end
end
-- ***************************************************
-- mm_p_06_run Helper Functions
-- ***************************************************
-- ***************************************************
-- mm_p_06_initialize Helper Functions
-- ***************************************************
-- Handle any common initialization
--
function mm_p_06_initialize_common()
--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]--
end
-- Checkpoint specific initialization
--
-- checkpoint: The checkpoint to be initialized
function mm_p_06_initialize_checkpoint(checkpoint)
if (checkpoint == MM_P_06_checkpoint.start.name) then
--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]--
end
end
-- ***************************************************
-- Miscellaneous mm_p_06 Helper Funcrtions
-- ***************************************************
-- *************************
--
-- Callback functions
--
-- *************************
-- *************************
--
-- Thread functions
--
-- *************************