--[[ USING THE MISSION START TEMPLATE
1. Read "SR3 Mission Scripting Standards" if you haven't already.
2. Save this file as "tUltor.lua" in the missions directory.
3. Replace "tUltor" with the name of your mission (must use the same name as your mission start node).
3a. Replace "tUltor" with the capitalized name of your mission
4. Replace "20130821" with today's date.
5. Replace "hvs" with your name.
6. Replace "first_checkpoint_nav" with the name of the first location to go to
7. Replace "fcp with a 3-4 letter abbreviation for the first checkpoint.
8. Replace "next_checkpoint_nav" with the second checkpoint name (first is named start)
9. Replace "ncp" with a 3-4 letter abbreviation for the next checkpoint.
10. If you find an error with this template, fix it and check it in!!!!
11. Remove these instructions. You're on your own now!
]]--
--[[
tUltor.lua
SR3 Mission Script
DATE: 2013-09-23
AUTHOR: Arturo Mata
]]--
-- Debug flags --
-- Tweakable Parameters --
--------------------------------------------------------------------------------------------------
--[[ GROUPS ]]--
--------------------------------------------------------------------------------------------------
tUltor_group = {
--[[ startup GROUPS ]]--
--[[ first_checkpoint_nav GROUPS ]]--
--[[ next_checkpoint_nav GROUPS ]]--
}
--------------------------------------------------------------------------------------------------
--[[ THREADS ]]--
--------------------------------------------------------------------------------------------------
tUltor_thread = {
-- = INVALID_THREAD_HANDLE,
}
--------------------------------------------------------------------------------------------------
--[[ CHECKPOINTS ]]--
--------------------------------------------------------------------------------------------------
tUltor_checkpoint = {
{
name = MISSION_START_CHECKPOINT, -- First Checkpoint (fcp)
init = "tUltor_fcp_init", -- init(bool mission_restart)
run = "tUltor_fcp_run", -- run()
cleanup = "tUltor_fcp_cleanup", -- cleanup(bool mission_exit) (+++MUST RETURN IMMEDIATELY+++)
next_checkpoint = "tUltor_next_checkpoint_nav",
host_start = "player_start_nav_host",
client_start = "player_start_nav_client",
p1_car_nav = "",
p2_car_nav = "",
start_groups = { },
cp_only_groups = { },
},
{
name = "tUltor_next_checkpoint_nav", -- Second Checkpoint (ncp)
init = "tUltor_ncp_init",
run = "tUltor_ncp_run",
cleanup = "tUltor_ncp_cleanup",
next_checkpoint = nil,
host_start = "player_end_host",
client_start = "player_end_client",
p1_car_nav = "",
p2_car_nav = "",
start_groups = { },
cp_only_groups = { },
},
}
--------------------------------------------------------------------------------------------------
--[[ CUTSCENES ]]--
--------------------------------------------------------------------------------------------------
tUltor_scene = {
intro = "",
outro = ""
}
--------------------------------------------------------------------------------------------------
--[[ CONVERSATIONS ]]--
--------------------------------------------------------------------------------------------------
tUltor_convo = {
--[[ = {
name = "file_name without voice (_bm, _wm, _bf...",
player_talks = true or false,
handle = INVALID_CONVERSATION_HANDLE,
convo_thread = INVALID_THREAD_HANDLE,
max_wait_seconds = 60, -- if the conversation doesn't complete before this time, kill it
timer_thread = INVALID_THREAD_HANDLE,
priority = CONVO_PRIORITY_HIGH or CONVO_PRIORITY_NORMAL or CONVO_PRIORITY_OPTIONAL
(optional) persona_line = true, -- this is a single line
(required if persona_line) speaker_name = "name of speaker", -- single line speaker (might be set before call to play is made?)
(optional)phone_call = true, -- this is a phone conversation (phone persona must be preloaded)
(required if phone_call) receiving_call = true or false -- auto-answer is always true in missions (until proven otherwise)
},]]
}
tUltor_convo_queue = {
--[[start_drive_queue = {
{ delay = 2.0, convo = tUltor_convo.goto_first_checkpoint_nav },
{ delay = 4.0, convo = tUltor_convo.goto_first_checkpoint_nav2 },
{ delay = 3.0, convo = tUltor_convo.goto_first_checkpoint_nav3 },
{ delay = 5.0, convo = tUltor_convo.goto_first_checkpoint_nav4 }
},
]]--
}
--------------------------------------------------------------------------------------------------
--[[ TRIGGERS ]]--
--------------------------------------------------------------------------------------------------
tUltor_trigger = {
-- = {
-- name = "_trigger",
-- hit = false,
-- last_hit_by = nil, -- last_hit_human = nil (set to the last human to enter the trigger in the default trigger callback)
-- (optional)callback = "tUltor_function_name_cb"
-- (optional)marker = TRIGGER_LOCATION or TRIGGER_USE or custom or don't include for no marker
-- (optional)waypoint = true,
-- (optional)teleport_to = {
-- host = "host_nav",
-- client = "client_nav"
-- },
-- (optional)conversation = tUltor_convo.convo_name -- play a conversation
-- (optional)next_trigger = "next_trigger_name" sets up next trigger when triggered (breadcrumbs)
--},
--[[ first_checkpoint_nav TRIGGERS ]]--
end_trigger = {
name = "end_mission_trigger",
hit = false,
marker = TRIGGER_LOCATION,
waypoint = false,
},
--[[ next_checkpoint_nav TRIGGERS ]]--
--trigger_01 = {
-- name = "trigger<001>",
-- hit = false,
-- marker = TRIGGER_LOCATION,
-- waypoint = true,
--},
}
--------------------------------------------------------------------------------------------------
--[[ INTERROGATION DATA ]]--
--------------------------------------------------------------------------------------------------
--tUltor_interrogate = {
-- leader = {
-- target = tUltor_group.friendly_fire.owner,
-- persona = "Interrogation",
-- objective = "tUltor_INTERROGATE_OWNER",
-- -- (optional)conversation = tUltor_convo.convo_name -- play a conversation while interrogating
-- },
--}
--------------------------------------------------------------------------------------------------
--[[ 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
--
-- start_checkpoint_name: (string) The checkpoint the mission should begin at
-- is_restart: (bool) TRUE if the mission is restarting, FALSE otherwise
--
function tUltor_start(start_checkpoint_name, is_restart)
mission_start_fade_out(0.0)
city_zone_swap("u_train", true)
-- initialize systems
mission_startup(tUltor_trigger, tUltor_convo) -- tUltor_checkpoint
-- if using interrogations
--interrogate_startup(tUltor_interrogate)
local start_cp = get_table_by_name(tUltor_checkpoint, MISSION_START_CHECKPOINT)
-- Check if this mission starting from the beginning
if (start_checkpoint_name == start_cp.name) then
if (is_restart == false and tUltor_scene.intro ~= "") then
-- First time playing mission
local fade_in_after = false
cutscene_play(tUltor_scene.intro, nil, {start_cp.host_start, start_cp.client_start}, fade_in_after)
else
teleport_coop(start_cp.host_start, start_cp.client_start, true)
end
fade_out(0)
end
-- Handle mission initialization for the current checkpoint
tUltor_initialize(start_checkpoint_name)
-- Run the mission from the current checkpoint
checkpoint_run_mission(tUltor_checkpoint, start_checkpoint_name)
mission_end_success("tUltor")--, tUltor_scene.outro, {, })
end
-- This is the primary function responsible for cleaning up the entire mission
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++)
--
function tUltor_cleanup()
--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--
--make sure zone is off
city_zone_swap("u_train", false)
-- cleanup all threads
cleanup_threads(tUltor_thread)
-- run checkpoint cleanups (move into mission_shutdown?)
checkpoint_cleanup_mission(tUltor_checkpoint)
-- cleanup triggers, convos, kill_list and interrogations
mission_shutdown()
-- cleanup all groups
cleanup_groups(tUltor_group)
end
-- Called when the mission has ended with success
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++)
--
function tUltor_success()
--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]--
end
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Initialize functions ]]--
--[[ ]]--
--[[**********************]]--
-- Initialize the mission for the specified checkpoint
--
-- checkpoint_name: (string) Checkpoint to initialize the mission to
--
function tUltor_initialize(checkpoint_name)
-- Common initialization
tUltor_initialize_common()
-- Checkpoint specific initialization
checkpoint_init(tUltor_checkpoint, checkpoint_name)
-- Remove any present subtitles
message_remove_all()
-- Start fading in
mission_start_fade_in()
end
-- Handle any common initialization
--
function tUltor_initialize_common()
--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]--
end
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Checkpoint functions ]]--
--[[ ]]--
--[[**********************]]--
--------------------------------------------------------------------------------------------------
--[[ First Checkpoint Name ]]--
--------------------------------------------------------------------------------------------------
-- Initialize this checkpoint.
--
-- mission_start: (bool) Whether we're initializing from a mission (re)start or from
-- a natural play-through.
--
function tUltor_fcp_init(mission_start)
--trigger_setup( tUltor_trigger.trigger_01 )
end
-- The first objective
--
function tUltor_fcp_run()
objective_text(0,"","","",SYNC_ALL,OI_ASSET_LOCATION)
trigger_setup(tUltor_trigger.end_trigger)
while not tUltor_trigger.end_trigger.hit do
thread_yield()
end
end
-- Do any cleanup for this checkpoint.
--
-- (+++THIS IS CALLED FROM MISSION CLEANUP, MUST RETURN IMMEDIATELY+++)
--
-- mission_exit: (bool) Whether we're exiting the mission entirely, or just
-- moving on to the next checkpoint.
--
function tUltor_fcp_cleanup(mission_exit)
end
------------------------------------
--
-- Checkpoint helper functions
--
------------------------------------
------------------------------------
--
-- Checkpoint callback functions
--
------------------------------------
------------------------------------
--
-- Checkpoint thread functions
--
------------------------------------
--------------------------------------------------------------------------------------------------
--[[ next_checkpoint_nav ]]--
--------------------------------------------------------------------------------------------------
-- Initialize this checkpoint.
--
-- mission_start: (bool) Whether we're initializing from a mission (re)start or from
-- a natural play-through.
--
function tUltor_ncp_init(mission_start)
if not mission_start then
mission_start_fade_out()
local cp = get_table_by_name(tUltor_checkpoint, "tUltor_next_checkpoint_nav")
teleport_coop(cp.host_start, cp.client_start, true)
city_zone_swap("u_train", false)
mission_start_fade_in()
end
end
-- The next objective
--
function tUltor_ncp_run()
delay( 1.0 )
end
-- Do any cleanup for this checkpoint.
--
-- (+++THIS IS CALLED FROM MISSION CLEANUP, MUST RETURN IMMEDIATELY+++)
--
-- mission_exit: (bool) Whether we're exiting the mission entirely, or just
-- moving on to the next checkpoint.
--
function tUltor_ncp_cleanup(mission_exit)
end
------------------------------------
--
-- Checkpoint helper functions
--
------------------------------------
------------------------------------
--
-- Checkpoint callback functions
--
------------------------------------
------------------------------------
--
-- Checkpoint thread functions
--
------------------------------------
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Common functions ]]--
--[[ ]]--
--[[**********************]]--
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Callback functions ]]--
--[[ ]]--
--[[**********************]]--
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Thread functions ]]--
--[[ ]]--
--[[**********************]]--