--[[
mm_p_04.lua
SR3 Mission Script
DATE: 9-3-2010
AUTHOR: Jimmy Cross
]]--
-- Debug flags --
-- Tweakable Parameters --
-- Groups --
MM_P_04_group = {
--[[ = {
name = "name from editor",
members = { "optional", "list", "of", "members" },
},
= {
name = "next group name"
},]]
}
-- Navpoints --
-- Triggers --
MM_P_04_trigger = {
tm = {
name = "TM_trigger",
hit = false
}
}
-- Characters --
-- Vehicles --
-- Mesh Movers --
-- Text --
-- Threads --
-- Checkpoints --
MM_P_04_checkpoint = {
start = {
name = MISSION_START_CHECKPOINT,
nav1 = "start_nav 001",
nav2 = "start_nav 002"
}
}
-- Cutscenes --
CUTSCENE_MISSION_INTRO = ""
CUTSCENE_MISSION_OUTRO = ""
-- Conversations --
-- 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_04_start(checkpoint, is_restart)
-- Check if this mission starting from the beginning
if (checkpoint == MM_P_04_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_04", "_A_TM_DT_01")
end
-- Handle mission initialization for the current checkpoint
--mm_p_04_initialize(checkpoint)
-- Run the mission from the current checkpoint
--mm_p_04_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_04_run(first_checkpoint)
local current_checkpoint = first_checkpoint
-- Run the mission from the beginning
if( current_checkpoint == MM_P_04_checkpoint.start.name ) then
--[[ INSERT PROCESSING FOR THE FIRST CHECKPOINT HERE ]]--
mission_end_to_activity("mm_p_04", "_A_TM_DT_01")
--[[
-- set GPS to Tank Mayhem instance #1
trigger_enable( MM_P_04_trigger.tm.name, true )
waypoint_add( MM_P_04_trigger.tm.name ) -- add GPS marker at TM instance #1
marker_add_trigger( MM_P_04_trigger.tm.name, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL )
on_trigger( "mm_p_04_tm_trigger_cb", MM_P_04_trigger.tm.name ) -- register the callback for the trigger
objective_text( 0, "mm_p_04_obj_goto_tm", nil, nil, SYNC_ALL, OI_ASSET_LOCATION ) -- tell the player to go to the marker
while not MM_P_04_trigger.tm.hit do -- wait for the player to hit the trigger at the TM start point
thread_yield()
end
-- Call mission success??
mission_end_success( "mm_p_04", 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_04_cleanup()
--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--
mm_p_04_clear_trigger( MM_P_04_trigger.tm.name )
waypoint_remove()
objective_text_clear(0) -- clear the objective text
end
-- Called when the mission has ended with success
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function mm_p_04_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_04_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_04_initialize_common()
-- Checkpoint specific initialization
mm_p_04_initialize_checkpoint(checkpoint)
-- Start fading in
mission_start_fade_in()
end
-- ***************************************************
-- mm_p_04_run Helper Functions
-- ***************************************************
function mm_p_04_clear_trigger(trigger)
on_trigger( "", trigger )
trigger_enable( trigger, false )
marker_remove_trigger( trigger, SYNC_ALL )
end
-- ***************************************************
-- mm_p_04_initialize Helper Functions
-- ***************************************************
-- Handle any common initialization
--
function mm_p_04_initialize_common()
--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]--
end
-- Checkpoint specific initialization
--
-- checkpoint: The checkpoint to be initialized
function mm_p_04_initialize_checkpoint(checkpoint)
if (checkpoint == MM_P_04_checkpoint.start.name) then
--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]--
end
end
-- ***************************************************
-- Miscellaneous mm_p_04 Helper Funcrtions
-- ***************************************************
-- *************************
--
-- Callback functions
--
-- *************************
function mm_p_04_tm_trigger_cb()
-- clear the trigger, waypoint, and objective
mm_p_04_clear_trigger( MM_P_04_trigger.tm.name )
waypoint_remove()
objective_text_clear(0) -- clear the objective text
--[[ TODO: add functionality for silent fail, when available, and start activity ]]--
-- activity start triggered
-- fade out, load activity
-- end mission somehow
-- Player plays activity, returns
--[[ /TODO ]]--
MM_P_04_trigger.tm.hit = true
objective_text_clear(0) -- clear the objective text
mission_end_to_activity("mm_p_04", "_A_TM_DT_01")
--[[
-- "fake" the activity, for now
message( "Tank Mayhem activity starting now" )
delay( 3.0 )
message( "Tank Mayhem activity end now" )
]]--
end
-- *************************
--
-- Thread functions
--
-- *************************