--[[
mm_p_02.lua
SR3 Mission Script
DATE: 9-3-2010
AUTHOR: Jimmy Cross
]]--
-- Debug flags --
-- Tweakable Parameters --
MM_P_02_PIERCE_SPAWN_DIST = 43.0 -- distance at which to spawn Pierce so he isn't seen spwaning
-- Groups --
MM_P_02_group = {
npcs = {
name = "MM_P_02_NPC",
pierce = "MM_P_02_NPC_Pierce"
}
}
-- Navpoints --
-- Triggers --
MM_P_02_trigger = {
dt = {
name = "DT_trigger",
hit = false
}
}
-- Characters --
-- Vehicles --
-- Mesh Movers --
-- Text --
-- Threads --
-- Checkpoints --
MM_P_02_checkpoint = {
start = {
name = MISSION_START_CHECKPOINT,
nav1 = "start_nav 001",
nav2 = "start_nav 002"
}
}
-- Cutscenes --
CUTSCENE_MISSION_INTRO = ""
CUTSCENE_MISSION_OUTRO = ""
-- Conversations --
MM_P_02_convo = {
--[[mission_start = {
name = "mm_p_02_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_02_start(checkpoint, is_restart)
-- Check if this mission starting from the beginning
if (checkpoint == MM_P_02_checkpoint.start.name) then
if (is_restart == false) then
-- First time playing mission
-- Play an intro cutscene???
if (CUTSCENE_MISSION_INTRO ~= "") then
cutscene_play(CUTSCENE_MISSION_INTRO)
end
end
fade_out(0)
fade_out_block()
mission_end_to_activity("mm_p_02", "_A_DT_DT_01")
end
-- Handle mission initialization for the current checkpoint
--mm_p_02_initialize(checkpoint)
-- Run the mission from the current checkpoint
--mm_p_02_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_02_run(first_checkpoint)
local current_checkpoint = first_checkpoint
-- Run the mission from the beginning
if( current_checkpoint == MM_P_02_checkpoint.start.name ) then
--[[ INSERT PROCESSING FOR THE FIRST CHECKPOINT HERE ]]--
mission_end_to_activity("mm_p_02", "_A_DT_DT_01")
--[[
-- call Pierce and tell him you'll meet him
--message( "Calling Pierce" )
delay( 1.5 )
-- set GPS to Drug Trafficing instance #1
trigger_enable( MM_P_02_trigger.dt.name, true )
waypoint_add( MM_P_02_trigger.dt.name ) -- add GPS marker at the start of the DT activity
marker_add_trigger( MM_P_02_trigger.dt.name, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL )
on_trigger( "mm_p_02_dt_trigger_cb", MM_P_02_trigger.dt.name ) -- register the callback for the trigger
objective_text( 0, "mm_p_02_obj_meet_pierce", nil, nil, SYNC_ALL, OI_ASSET_LOCATION ) -- tell the player to meet Pierce
repeat thread_yield() until ( get_dist_closest_player_to_object( MM_P_02_trigger.dt.name ) < MM_P_02_PIERCE_SPAWN_DIST )
group_create( MM_P_02_group.npcs.name, true ) --create the NPC group
while not MM_P_02_trigger.dt.hit do -- wait for the player to hit the trigger at the DT start point
thread_yield()
end
-- Call mission success??
mission_end_success( "mm_p_02", CUTSCENE_MISSION_OUTRO )
-- tell Player new mission available
message( "!!A new mission is available", 6.0 )
-- mission_unlock( "next_mission" ) -- unlock the next mission
]]--
end
end
-- This is the primary function responsible for cleaning up the entire mission
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function mm_p_02_cleanup()
--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--
mm_p_02_clear_trigger( MM_P_02_trigger.dt.name )
end
-- Called when the mission has ended with success
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function mm_p_02_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_02_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_02_initialize_common()
-- Checkpoint specific initialization
mm_p_02_initialize_checkpoint(checkpoint)
-- Start fading in
mission_start_fade_in()
end
-- ***************************************************
-- mm_p_02_run Helper Functions
-- ***************************************************
-- ***************************************************
-- mm_p_02_initialize Helper Functions
-- ***************************************************
-- Handle any common initialization
--
function mm_p_02_initialize_common()
--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]--
end
-- Checkpoint specific initialization
--
-- checkpoint: The checkpoint to be initialized
function mm_p_02_initialize_checkpoint(checkpoint)
if (checkpoint == MM_P_02_checkpoint.start.name) then
--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]--
end
end
-- ***************************************************
-- Miscellaneous mm_p_02 Helper Funcrtions
-- ***************************************************
function mm_p_02_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_p_02_dt_trigger_cb()
-- clear the trigger, waypoint, and objective
mm_p_02_clear_trigger( MM_P_02_trigger.dt.name )
waypoint_remove()
objective_text_clear(0) -- clear the objective text
-- activity start triggered
MM_P_02_trigger.dt.hit = true
mission_end_to_activity("mm_p_02", "_A_DT_DT_01")
--[[
-- "fake" the activity, for now
message( "Drug trafficing activity starting now" )
delay( 3.0 )
message( "Drug trafficing activity end now" )
]]--
end
-- *************************
--
-- Thread functions
--
-- *************************