--[[
MM_A_01.lua
SR3 Mission Script
DATE: 10-28-2010
AUTHOR: Jimmy Cross
]]--
-- Debug flags --
-- Tweakable Parameters --
-- Groups --
MM_A_01_group = {
vehicles = {
name = "MM_A_01_VEH",
car = "MM_A_01_CAR"
}
}
-- Navpoints --
MM_A_01_navs = {
cp_start = { "local_player", "remote_player" }
}
-- Triggers --
MM_A_01_trigger = {
i_f = {
name = "IF_trigger",
hit = false
}
}
-- Characters --
-- Vehicles --
-- Mesh Movers --
-- Text --
-- Threads --
-- Checkpoints --
MM_A_01_checkpoint = {
start = {
name = MISSION_START_CHECKPOINT,
}
}
-- Cutscenes --
MM_A_01_cutscene = {
angel_intro = "A_Z01"
--angel_intro = ""
}
CUTSCENE_MISSION_INTRO = ""
CUTSCENE_MISSION_OUTRO = ""
-- Conversations --
MM_A_01_convo = {
--[[mission_start = {
name = "MM_A_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_A_01_start(checkpoint, is_restart)
-- Check if this mission starting from the beginning
if (checkpoint == MM_A_01_checkpoint.start.name) then
if (is_restart == false) then
-- First time playing mission
if( MM_A_01_cutscene.angel_intro ~= "" ) then
zscene_prep( MM_A_01_cutscene.angel_intro )
--cutscene_in()
cutscene_play( MM_A_01_cutscene.angel_intro, nil, MM_A_01_navs.cp_start, false )
--cutscene_out()
else
fade_out( 0.5 )
fade_out_block()
group_create( MM_A_01_group.npcs.name, true ) --create the NPC group
group_create( MM_A_01_group.vehicles.name, true ) --create the vehicles group
vehicle_car_alarm_enable( MM_A_01_group.vehicles.car, false )
delay( 1.5 )
fade_in( 0.5 )
fade_in_block()
end
end
-- start activity
mission_end_to_activity("MM_A_01", "_A_IF_SW01")
end
-- Handle mission initialization for the current checkpoint
MM_A_01_initialize(checkpoint)
-- Run the mission from the current checkpoint
MM_A_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_A_01_run(first_checkpoint)
local current_checkpoint = first_checkpoint
-- Run the mission from the beginning
if( current_checkpoint == MM_A_01_checkpoint.start.name ) then
--[[ INSERT PROCESSING FOR THE FIRST CHECKPOINT HERE ]]--
--[[
-- Intro animations
-- 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
-- set GPS to Insurance Fraud instance #1
trigger_enable( MM_A_01_trigger.i_f.name, true )
waypoint_add( MM_A_01_trigger.i_f.name ) -- add GPS marker at the start of the DT activity
marker_add_trigger( MM_A_01_trigger.i_f.name, MINIMAP_ICON_LOCATION, "VFX_InsuranceFraudIcon", nil, OI_FLAGS_LOCATION, SYNC_ALL ) -- INGAME_EFFECT_CHECKPOINT
on_trigger( "MM_A_01_if_trigger_cb", MM_A_01_trigger.i_f.name ) -- register the callback for the trigger
--objective_text( 0, "MM_A_01_obj_meet_angel", "", "", SYNC_ALL ) -- tell the player to meet Angel
objective_text( 0, "MM_A_01_obj_goto_if", nil, nil, SYNC_ALL, OI_ASSET_LOCATION ) -- tell the player to go to insurance fraud start
while not MM_A_01_trigger.i_f.hit do -- wait for the player to hit the trigger at the IF 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_A_01_cleanup()
--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--
MM_A_01_clear_trigger( MM_A_01_trigger.i_f.name )
group_destroy( MM_A_01_group.vehicles )
end
-- Called when the mission has ended with success
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function MM_A_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_A_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_A_01_initialize_common()
-- Checkpoint specific initialization
MM_A_01_initialize_checkpoint(checkpoint)
-- Start fading in
mission_start_fade_in()
end
-- ***************************************************
-- MM_A_01_run Helper Functions
-- ***************************************************
-- ***************************************************
-- MM_A_01_initialize Helper Functions
-- ***************************************************
-- Handle any common initialization
--
function MM_A_01_initialize_common()
--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]--
end
-- Checkpoint specific initialization
--
-- checkpoint: The checkpoint to be initialized
function MM_A_01_initialize_checkpoint(checkpoint)
if (checkpoint == MM_A_01_checkpoint.start.name) then
--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]--
end
end
-- ***************************************************
-- Miscellaneous MM_A_01 Helper Funcrtions
-- ***************************************************
function MM_A_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_A_01_if_trigger_cb()
-- clear the trigger, waypoint, and objective
MM_A_01_trigger.i_f.hit = true
MM_A_01_clear_trigger( MM_A_01_trigger.i_f.name )
waypoint_remove()
objective_text_clear(0) -- clear the objective text
-- activity start triggered
mission_end_to_activity("MM_A_01", "_A_IF_SW01")
end
-- *************************
--
-- Thread functions
--
-- *************************