--[[
sh01.lua
SR3 Mission Script
DATE: 07/06/10
AUTHOR: Anne Chilldon
]]--
-- Debug flags --
-- Tweakable Parameters --
-- Timer for attack persona lines
SH01_Attack_Line_Time = 10.0
-- Groups �-
SH01_group = {
alley_grunts_001 = {
name = "grp_Alley_Grunts",
members = { "Alley_Grunt 001", "Alley_Grunt 002", "Alley_Grunt 003", "Alley_Grunt 010",
"Alley_Grunt 011", "Alley_Grunt 012", "Alley_Grunt 013", "Alley_Grunt 014"}
},
warehouse_snipers_001 = {
name = "grp_Warehouse_Snipers",
members = { "Warehouse_Sniper 002", "Warehouse_Sniper 003", --"Warehouse_Sniper 004",
"Warehouse_Sniper 005" }
},
warehouse_grunts_001 = {
name = "grp_Warehouse_Grunts",
members = { "Warehouse_Grunt 001", "Warehouse_Grunt 002", "Warehouse_Grunt 003", "Warehouse_Grunt 004",}
--"Warehouse_Grunt 005" , "Warehouse_Grunt 008", "Warehouse_Grunt 009", "Warehouse_Grunt 010" }
},
warehouse_brute_001 = {
name = "grp_Warehouse_Brute",
members = { "MiniGun_Brute 001" }
},
warehouse_brute_002 = {
name = "grp_Warehouse_Brute2",
members = { "Warehouse_Grunt 006", "Warehouse_Grunt 007", "Warehouse_Grunt 011", "Warehouse_Grunt 012" }
},
warehouse_office_001 = {
name = "grp_Warehouse_Office1",
members = { "Office_Grunt 001", "Office_Grunt 002", "Office_Grunt 003", "Office_Grunt 004" }
},
warehouse_office_002 = {
name = "grp_Warehouse_Office2",
members = { "Office2_Grunt 004", "Office2_Grunt 005", "Office2_Grunt 006", "Office2_Grunt 007",
"Office2_Grunt 008", "Office2_Grunt 009", "Office2_Grunt 010", "Office2_Grunt 011" }
},
stairwell_grunts = {
name = "grp_Stair_Grunts",
members = { "npc_StairGrunt 001", "npc_StairGrunt 002", "npc_StairGrunt 003", "npc_StairGrunt 004",
"npc_StairGrunt 005", "npc_StairGrunt 006", "npc_StairGrunt 007", "npc_StairGrunt 008",
"npc_StairGrunt 009", "npc_StairGrunt 010", "npc_StairGrunt 011", "npc_StairGrunt 012" }
},
breakroom_grunts_001 = {
name = "grp_Breakroom_Grunts",
members = { --"Breakroom_Grunt 001", "Breakroom_Grunt 002", "Breakroom_Grunt 003",
"Breakroom_Grunt 004", "Breakroom_Grunt 005", "Breakroom_Grunt 006"}
},
catwalk_grunts = {
name = "grp_CatwalkGrunts",
members = { "npc_CatwalkGrunt 001", "npc_CatwalkGrunt 002", "npc_CatwalkGrunt 003",
"npc_CatwalkGrunt 004", "npc_CatwalkGrunt 005" }
},
spawn_wave1 = {
name = "grp_SpawnWave1",
members = { "npc_SpawnWave 001", "npc_SpawnWave 002" }
},
spawn_wave2 = {
name = "grp_SpawnWave2",
members = { "npc_SpawnWave 003", "npc_SpawnWave 004" }
},
spawn_wave3 = {
name = "grp_SpawnWave3",
members = { "npc_SpawnWave 005", "npc_SpawnWave 006" }
},
spawn_wave4 = {
name = "grp_SpawnWave4",
members = { "npc_SpawnWave 007", "npc_SpawnWave 008" }
},
spawn_wave5 = {
name = "grp_SpawnWave5",
members = { "npc_SpawnWave 009", "npc_SpawnWave 010" }
},
spawn_wave6 = {
name = "grp_SpawnWave6",
members = { "npc_SpawnWave 011", "npc_SpawnWave 012" }
},
spawn_wave7 = {
name = "grp_SpawnWave7",
members = { "npc_SpawnWave 013", "npc_SpawnWave 014" }
},
spawn_wave8 = {
name = "grp_SpawnWave8",
members = { "npc_SpawnWave 015", "npc_SpawnWave 016" }
},
homies = {
name = "grp_Homies",
members = { "Pierce", "Shaundi" }
},
cte_brute = {
name = "grp_cte_brute",
},
}
-- Navpoints --
OFFICE_MARK = { "Office_Mark 004", "Office_Mark 005", "Office_Mark 006", "Office_Mark 007",
"Office_Mark 008", "Office_Mark 009", "Office_Mark 010", "Office_Mark 011"}
STAIR_MARK = { "nav_Stairs 001", "nav_Stairs 002", "nav_Stairs 003", "nav_Stairs 004",
"nav_Stairs 005", "nav_Stairs 006", "nav_Stairs 007", "nav_Stairs 008",
"nav_Stairs 009", "nav_Stairs 010", "nav_Stairs 011", "nav_Stairs 012" }
CATWALK_MARK = { "nav_Catwalk_Mark 001", "nav_Catwalk_Mark 002", "nav_Catwalk_Mark 003",
"nav_Catwalk_Mark 004" }
CATWALKS = { "nav_Catwalk 001", "nav_Catwalk 002", "nav_Catwalk 003", "nav_Catwalk 004",
"nav_Catwalk 005" }
BRUTE_TELEPORT = { "local_brute_teleport", "remote_brute_teleport", "pierce_brute_teleport", "shaundi_brute_teleport" }
SH01_S_TELEPORT_2 = { "Shaundi_Teleport 002" }
SH01_S_TELEPORT_3 = { "Shaundi_Teleport 003" }
SH01_S_TELEPORT_4 = { "Shaundi_Teleport 004" }
SH01_P_TELEPORT_2 = { "Pierce_Teleport 002" }
SH01_P_TELEPORT_3 = { "Pierce_Teleport 003" }
SH01_P_TELEPORT_4 = { "Pierce_Teleport 004" }
SH01_PLAYER_START = { "sh01_local_player_start" }
SH01_COOP_START = { "sh01_remote_player_start" }
SH01_PLAYER_CHECKPOINT_2 = { "sh01_local_checkpoint_ 002" }
SH01_COOP_CHECKPOINT_2 = { "sh01_remote_checkpoint_ 002" }
SH01_PLAYER_CHECKPOINT_3 = { "sh01_local_checkpoint_ 003" }
SH01_COOP_CHECKPOINT_3 = { "sh01_remote_checkpoint_ 003" }
SH01_PLAYER_CHECKPOINT_4 = { "sh01_local_checkpoint_4" }
SH01_COOP_CHECKPOINT_4 = { "sh01_remote_checkpoint_4" }
HACK_POINT = "nav_HackPoint"
-- Triggers --
-- Vehicle Trigger -- In front of Gun Warehouse. Once entered triggers CTE cutscene
-- Warehouse Door Trigger -- Checkpoint trigger
WAREHOUSE_DOOR_TRIGGER = "Warehouse_Door_Trigger 001"
-- Second Floor Trigger -- Location Trigger
UPSTAIRS_TRIGGER = "Upstairs_Trigger 001"
-- Manager�s Office Trigger -- Pick up items inside manager�s office
OFFICE_TRIGGER = "Office_Trigger 001"
-- Break room Trigger --
BREAKROOM_TRIGGER = "trig_BreakRoom"
COMPUTER_TRIGGER = "trig_Computer"
SHOWROOM_TRIGGER = "trig_ShowRoom"
TOPSTAIRWELL_TRIGGER = "trig_StairwellTop"
-- Dialog Triggers --
ALLEY_TRIGGER = "trig_AlleyConvo"
CATWALK_TRIGGER = "trig_CatwalkCombat"
INSIDE_TRIGGER = "trig_InsideCombat"
-- Characters --
-- Player --
-- Remote Player --
-- Pierce --
-- Vehicles --
-- Starting Vehicle --
-- Mesh Movers --
-- Spawn Regions --
sh01_Spawn = {
catwalk1 = "sr_Catwalk 001",
catwalk2 = "sr_Catwalk 002",
catwalk3 = "sr_Catwalk 003",
catwalk4 = "sr_Catwalk 004",
office1 = "sr_Office 001",
office2 = "sr_Office 002",
office3 = "sr_Office 003",
office4 = "sr_Office 004",
}
-- Text --
-- Help Text/Objective --
-- Go to the Gun Warehouse --
SH01_OBJ_MEET_PIERCE = "sh01_obj_head_to_gun_warehouse"
-- Enter the Gun Warehouse --
SH01_OBJ_ENTER_WAREHOUSE = "sh01_obj_enter_warehouse"
-- Find a way upstairs
SH01_OBJ_UPSTAIRS = "sh01_obj_upstairs"
-- Head to the Manager�s Office --
SH01_OBJ_MANAGER_OFFICE = "sh01_obj_manager_office"
-- Clear out the Store --
SH01_OBJ_CLEAN_HOUSE = "sh01_obj_clean_house"
-- Use the computer --
SH01_OBJ_USE_COMPUTER = "sh01_obj_use_computer"
-- Head to the ShowRoom
SH01_OBJ_SHOWROOM = "sh01_obj_showroom"
-- Kill the Brute --
SH01_OBJ_KILL_BRUTE = "sh01_obj_kill_brute"
-- Failure Text --
-- Player Dies --
-- Pierce Dies --
SH01_FAILURE_PIERCE_DIED = "sh01_failure_pierce_died"
SH01_FAILURE_ABANDON_PIERCE = "sh01_failure_abandon_pierce"
-- Shaundi Dies --
SH01_FAILURE_SHAUNDI_DIED = "sh01_failure_shaundi_died"
SH01_FAILURE_ABANDON_SHAUNDI = "sh01_failure_abandon_shaundi"
-- Threads --
SH01_thread = {
chatter = INVALID_THREAD_HANDLE,
chatter_timer = INVALID_THREAD_HANDLE,
shaundi_hack = INVALID_THREAD_HANDLE,
attack_line_timer = INVALID_THREAD_HANDLE,
}
-- Checkpoints --
SH01_CHECKPOINT_START = MISSION_START_CHECKPOINT -- defined in ug_lib.lua
SH01_CHECKPOINT_ENTER_WAREHOUSE = "sh01_checkpoint_enter_warehouse"
SH01_CHECKPOINT_MANAGER_OFFICE = "sh01_checkpoint_manager_office"
SH01_CHECKPOINT_BRUTE_FIGHT = "sh01_checkpoint_brute_fight"
SH01_CHECKPOINT_CATWALK = "sh01_checkpoint_catwalk"
SH01_CHECKPOINT_CLEAN_HOUSE = "sh01_checkpoint_clean_house"
-- Cutscenes --
SH01_CUTSCENE_MISSION_INTRO = "MS_SH01"
SH01_CUTSCENE_CTE = "sh01_cte_01"
SH01_CUTSCENE_MISSION_OUTRO = ""
-- Conversations --
SH01_convo = {
retail_combat1 = {
name = "SH01_Combat_In_Front_1",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = true,
},
retail_combat2 = {
name = "SH01_Combat_In_Front_2",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = false,
},
manager_office_enter = {
name = "SH01_Combat_Upstairs",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = false,
},
alley_combat = {
name = "SH01_Combat_Out_Back",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = false,
},
mission_start = {
name = "SH01_Mission_Start",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = true,
},
retail_brute = {
name = "SH01_Front_Of_Store_Brute",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = true,
},
warehouse_combat = {
name = "SH01_Combat_Inside",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = true,
},
go_to_office = {
name = "SH01_Get_To_Office",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = false,
},
warehouse_brute = {
name = "SH01_MiniGun_Brute",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = true,
},
inside_office = {
name = "SH01_Office",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = false,
},
}
SH01_Warehouse_Combat_Chatter = {
{
is_conversation = false,
speaker = SH01_group.homies.members[2],
line = "SH01_Sniper_Inside_Callout",
spoken = false,
},
-- {
-- is_conversation = true,
-- conversation = SH01_convo.warehouse_combat,
-- spoken = false,
-- },
{
is_conversation = true,
conversation = SH01_convo.go_to_office,
spoken = false,
},
}
SH01_Retail_Combat_Chatter = {
{
is_conversation = true,
conversation = SH01_convo.retail_combat1,
spoken = false,
},
{
is_conversation = true,
conversation = SH01_convo.retail_combat2,
spoken = false,
},
}
-- Other --
-- Global variables
Num_guys_to_kill = 0
In_coop = false
Brute_Killed = false
convo_is_playing = false
hack_done = false
spawn_on = false
spawn_office = false
-- Trigger flags
warehouse_door_triggered = false
upstairs_triggered = false
office_triggered = false
breakroom_triggered = false
showroom_triggered = false
computer_triggered = false
alley_triggered = false
catwalk_triggered = false
inside_triggered = false
topstairwell_triggered = false
-- HUD variables
HUD_BAR_MAX_VALUE = 1500
SH01_HACK_PROGRESS = 1
-- *************************
--
-- 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 sh01_start(sh01_checkpoint, is_restart)
-- See if we are in co-op
In_coop = coop_is_active()
-- Check if this mission starting from the beginning
if (sh01_checkpoint == SH01_CHECKPOINT_START) then
if (is_restart == false) then
-- First time playing mission
local cutscene_navs = { "sh01_local_checkpoint_ 002", "sh01_remote_checkpoint_ 002" }
-- Play an intro cutscene???
if (SH01_CUTSCENE_MISSION_INTRO ~= "") then
cutscene_play(SH01_CUTSCENE_MISSION_INTRO, nil, cutscene_navs, false)
end
else
-- Teleport players
teleport_coop(SH01_PLAYER_CHECKPOINT_2[1], SH01_COOP_CHECKPOINT_2[1], true)
end
fade_out(0)
end
-- Handle mission initialization for the current checkpoint
sh01_initialize(sh01_checkpoint)
-- Set the notoriety
notoriety_set("Morningstar", 1)
-- Run the mission from the current checkpoint
sh01_run(sh01_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 sh01_run(first_checkpoint)
local current_checkpoint = first_checkpoint
-- Run the mission from the beginning
if current_checkpoint == SH01_CHECKPOINT_START then
--[[
mission_start_fade_out()
--Play intro cutscene
-- if (SH01_CUTSCENE_MISSION_INTRO ~= "") then
-- bink_play(SH01_CUTSCENE_MISSION_INTRO)
-- end
-- Teleport players
teleport_coop(SH01_PLAYER_CHECKPOINT_2[1], SH01_COOP_CHECKPOINT_2[1], true)
-- Set Pierce & Shaundi as Homie (Not sure if this goes here or during checkpoint initialization)
sh01_setup_crew()
-- Teleport Pierce to checkpoint
teleport(SH01_group.homies.members[1], SH01_P_TELEPORT_2[1])
-- Teleport Shaundi to checkpoint
teleport(SH01_group.homies.members[2], SH01_S_TELEPORT_2[1])
mission_start_fade_in()
]]--
-- We reached a checkpoint, update and what not
current_checkpoint = SH01_CHECKPOINT_ENTER_WAREHOUSE
mission_set_checkpoint(SH01_CHECKPOINT_ENTER_WAREHOUSE, true)
end
-- Check to see if we are on objective 2
if current_checkpoint == SH01_CHECKPOINT_ENTER_WAREHOUSE then
-- Set Pierce & Shaundi as Homie (Not sure if this goes here or during checkpoint initialization)
--sh01_setup_crew()
-- Teleport Pierce to checkpoint
--teleport(SH01_group.homies.members[1], SH01_P_TELEPORT_2[1])
-- Teleport Shaundi to checkpoint
--teleport(SH01_group.homies.members[2], SH01_S_TELEPORT_2[1])
--SH01_convo.mission_start.handle = audio_conversation_load_direct(SH01_convo.mission_start.name)
-- TODO: Player VO
-- message("Player VO: Let's head around back", 4.0)
-- delay(4.0)
-- Set invisible trigger for alley combat dialog
alley_triggered = false
sh01_set_invisible_trigger(ALLEY_TRIGGER, "sh01_reached_alley")
-- Set GPS to Warehouse Door
warehouse_door_triggered = false
sh01_set_trigger(WAREHOUSE_DOOR_TRIGGER, "sh01_reached_warehouse_door")
-- Set Objective Text to GSI
objective_text( 0, "sh01_obj_enter_warehouse", "", "", SYNC_ALL, OI_ASSET_LOCATION )
-- Spawn Enemies
sh01_spawn_second_checkpoint_enemies()
-- audio_conversation_play(SH01_convo.mission_start.handle)
-- thread_new("sh01_convo", SH01_convo.mission_start)
-- Don't continue until they reach the door
while not warehouse_door_triggered do
thread_yield()
end
-- audio_conversation_wait_for_end(SH01_convo.mission_start.handle)
-- SH01_convo.mission_start.handle = INVALID_CONVERSATION_HANDLE
-- Clear Objective Text
objective_text_clear(0)
-- We reached a checkpoint, update and what not
current_checkpoint = SH01_CHECKPOINT_MANAGER_OFFICE
mission_set_checkpoint(SH01_CHECKPOINT_MANAGER_OFFICE, true)
end
-- Check to see if we are on objective 3
if current_checkpoint == SH01_CHECKPOINT_MANAGER_OFFICE then
sh01_set_invisible_trigger(INSIDE_TRIGGER, "sh01_reached_inside")
-- SH01_convo.warehouse_brute.handle = audio_conversation_load_direct(SH01_convo.warehouse_brute.name)
-- TODO: Conversation with Pierce
--message("Player: Head to the Manager's office on the upper level", 4.0)
-- This is temp and needs to be replaced
objective_text( 0, "sh01_obj_upstairs", "", "", SYNC_ALL, OI_ASSET_LOCATION )
--Set up breadcrumb triggers
upstairs_triggered = false
sh01_set_trigger(UPSTAIRS_TRIGGER, "sh01_reached_upstairs")
sh01_spawn_third_checkpoint_enemies_v1()
sh01_set_invisible_trigger(BREAKROOM_TRIGGER, "sh01_reached_breakroom")
while not breakroom_triggered do
thread_yield()
end
-- Cleanup the enemies from the previous objective
sh01_cleanup_second_checkpoint()
Num_guys_to_kill = 0
while not upstairs_triggered do
thread_yield()
end
-- We reached a checkpoint, update and what not
current_checkpoint = SH01_CHECKPOINT_BRUTE_FIGHT
mission_set_checkpoint(SH01_CHECKPOINT_BRUTE_FIGHT, true)
end
--Check to see if we are on objective 4
if (current_checkpoint == SH01_CHECKPOINT_BRUTE_FIGHT) then
-- Pause audio emitters during CTE
audio_ambient_emitter_pause("alarm_bell_store")
audio_ambient_emitter_pause("sh01_alarm_a")
audio_ambient_emitter_pause("sh01_alarm_b")
audio_ambient_emitter_pause("sh01_music")
local teleports = { BRUTE_TELEPORT[1], BRUTE_TELEPORT[2] }
-- CTE Start
fade_out(0.5)
fade_out_block()
-- message("CTE", 4.0)
--sh01_convo(SH01_convo.warehouse_brute)
-- cutscene_in()
group_create( SH01_group.cte_brute.name, true )
cutscene_play( SH01_CUTSCENE_CTE, nil, teleports, false)
group_destroy( SH01_group.cte_brute.name )
sh01_spawn_third_checkpoint_brute()
-- cutscene_out()
-- fade_out(0.5)
-- fade_out_block()
-- make sure doors are closed
-- mesh_mover_reset("sm_Stairwell 001")
-- mesh_mover_reset("sm_Stairwell 002")
-- mesh_mover_reset("sm_Office_Frontdoor 001")
-- mesh_mover_reset("sm_Office_Backdoor_001")
-- CTE Done
group_show( SH01_group.homies.name )
teleport_coop(BRUTE_TELEPORT[1], BRUTE_TELEPORT[2], true)
teleport(SH01_group.homies.members[1], BRUTE_TELEPORT[3])
teleport(SH01_group.homies.members[2], BRUTE_TELEPORT[4])
-- Clear Objective Text
objective_text_clear(0)
-- Set Objective Text to GSI
objective_text( 0, "sh01_obj_kill_brute", "", "", SYNC_ALL, OI_ASSET_KILL)
--audio_conversation_wait_for_end(SH01_convo.warehouse_brute.handle)
--SH01_convo.warehouse_brute.handle = INVALID_CONVERSATION_HANDLE
fade_in(0.5)
fade_in_block()
-- Turn emitters back on
audio_ambient_emitter_resume("alarm_bell_store")
audio_ambient_emitter_resume("sh01_alarm_a")
audio_ambient_emitter_resume("sh01_alarm_b")
audio_ambient_emitter_resume("sh01_music")
-- Wait till brute is killed
while not Brute_Killed do
thread_yield()
end
sh01_spawn_warehouse_wave1()
-- We reached a checkpoint, update and what not
current_checkpoint = SH01_CHECKPOINT_CATWALK
mission_set_checkpoint(SH01_CHECKPOINT_CATWALK, true)
end
-- Check to see if we are at checkpoint 5
if current_checkpoint == SH01_CHECKPOINT_CATWALK then
-- Set invisible trigger
sh01_set_trigger(TOPSTAIRWELL_TRIGGER, "sh01_reached_topstairwell")
-- Setup continuous spawns
sh01_start_continuous_spawns()
objective_text_clear(0)
-- Set GPS to Manager's office
-- Set invisible trigger for dialog
sh01_set_invisible_trigger(CATWALK_TRIGGER, "sh01_reached_catwalk")
Num_guys_to_kill = 0
-- Set Objective Text to GSI
objective_text( 0, "sh01_obj_manager_office", "", "", SYNC_ALL, OI_ASSET_LOCATION )
-- Spawn Enemies
sh01_spawn_third_checkpoint_enemies_v2()
while not office_triggered do
thread_yield()
end
thread_new("sh01_convo", SH01_convo.inside_office)
-- sh01_spawn_fourth_checkpoint_enemies_v1()
SH01_thread.shaundi_hack = thread_new("sh01_shaundi_hack_thread")
-- delay(2.0)
-- Add more continuous spawns
sh01_start_office_spawns()
-- TODO: Set off alarm SFX
-- TODO: Set off loud speaker VO
while SH01_HACK_PROGRESS < 600 do
thread_yield()
end
--Shut off continuous spawn
sh01_stop_continuous_spawns()
sh01_stop_office_spawns()
while not hack_done do
thread_yield()
end
-- Clear Objective Text
objective_text_clear (0)
end
-- Call mission success??
mission_end_success("sh01", SH01_CUTSCENE_MISSION_OUTRO)
end
-- This is the primary function responsible for cleaning up the entire mission
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function sh01_cleanup()
-- Cleanup Groups
sh01_cleanup_first_checkpoint()
sh01_cleanup_second_checkpoint()
sh01_cleanup_third_checkpoint()
sh01_cleanup_fourth_checkpoint()
sh01_cleanup_homies()
-- Cleanup Triggers
sh01_clear_trigger(WAREHOUSE_DOOR_TRIGGER)
sh01_clear_trigger(UPSTAIRS_TRIGGER)
sh01_clear_trigger(OFFICE_TRIGGER)
sh01_clear_trigger(BREAKROOM_TRIGGER)
sh01_clear_trigger(SHOWROOM_TRIGGER)
sh01_clear_trigger(COMPUTER_TRIGGER)
sh01_clear_trigger(ALLEY_TRIGGER)
sh01_clear_trigger(CATWALK_TRIGGER)
sh01_clear_trigger(INSIDE_TRIGGER)
sh01_clear_trigger(TOPSTAIRWELL_TRIGGER)
-- Cleanup continuous spawns
if(spawn_on)then
sh01_stop_continuous_spawns()
end
if(spawn_office)then
sh01_stop_office_spawns()
end
cleanup_spawn_regions(sh01_Spawn)
cleanup_spawn_groups(SH01_group.spawn_wave1)
cleanup_spawn_groups(SH01_group.spawn_wave2)
cleanup_spawn_groups(SH01_group.spawn_wave3)
cleanup_spawn_groups(SH01_group.spawn_wave4)
-- Clear out any conversations
cleanup_conversations(SH01_convo)
-- Turn on audio emitters
audio_ambient_emitter_stop("alarm_bell_store")
audio_ambient_emitter_stop("sh01_alarm_a")
audio_ambient_emitter_stop("sh01_alarm_b")
audio_ambient_emitter_stop("sh01_music")
-- allow notoriety spawning again
notoriety_force_no_spawn("police", false)
notoriety_force_no_spawn("morningstar", false)
-- Reset followers
party_allow_max_followers(false)
-- Teleport players outside at the end
teleport(LOCAL_PLAYER, SH01_PLAYER_START[1])
if(In_coop)then
teleport(REMOTE_PLAYER, SH01_COOP_START[1])
end
-- Lock the doors behind you
door_lock("Outside_Door1", true)
door_lock("Outside_Door2", true)
end
-- Called when the mission has ended with success
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
--
function sh01_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 sh01_initialize(checkpoint)
-- Make sure the screen is completly faded out
mission_start_fade_out(0.0)
-- Set the mission author
set_mission_author("Anne Chilldon")
-- Common initialization
sh01_initialize_common()
-- Checkpoint specific initialization
sh01_initialize_checkpoint(checkpoint)
-- any notoriety is fake for this mission
notoriety_force_no_spawn("police", true)
notoriety_force_no_spawn("morningstar", true)
-- Turn on audio emitters
audio_ambient_emitter_start("alarm_bell_store")
audio_ambient_emitter_start("sh01_alarm_a")
audio_ambient_emitter_start("sh01_alarm_b")
audio_ambient_emitter_start("sh01_music")
-- Unlock the doors
door_lock("Outside_Door1", false)
door_lock("Outside_Door2", false)
-- Start fading in
mission_start_fade_in()
end
-- Spawn Enemies for the first checkpoint
function sh01_spawn_first_checkpoint_enemies()
end
-- Spawn Enemies for the second checkpoint
function sh01_spawn_second_checkpoint_enemies()
-- The Grunts
group_create(SH01_group.alley_grunts_001.name, true)
-- Set up attack persona lines
for i, guard in pairs (SH01_group.alley_grunts_001.members)do
on_attack_performed("sh01_ms_attack_line_cb", guard)
end
end
-- Spawn Enemies for third checkpoint
function sh01_spawn_third_checkpoint_enemies_v1()
-- Group 1
group_create(SH01_group.warehouse_grunts_001.name, true)
-- Set up attack persona lines
for i, guard in pairs (SH01_group.warehouse_grunts_001.members)do
on_attack_performed("sh01_ms_attack_line_cb", guard)
end
-- Group 2 (brute + snipers)
group_create(SH01_group.warehouse_snipers_001.name, true)
-- Set up attack persona lines
for i, guard in pairs (SH01_group.warehouse_snipers_001.members)do
on_attack_performed("sh01_ms_attack_line_cb", guard)
end
-- Breakroom guys
group_create(SH01_group.breakroom_grunts_001.name, true)
for i, guard in pairs(SH01_group.breakroom_grunts_001.members)do
on_attack_performed("sh01_ms_breakroom_persona_cb", guard)
end
end
function sh01_spawn_third_checkpoint_brute()
group_create(SH01_group.warehouse_brute_001.name, true)
on_death("sh01_brute_killed", SH01_group.warehouse_brute_001.members[1])
marker_add(SH01_group.warehouse_brute_001.members[1], MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_DEFAULT, SYNC_ALL)
end
function sh01_spawn_third_checkpoint_enemies_v2()
group_create(SH01_group.warehouse_office_001.name, true)
-- Set up attack persona lines
for i, guard in pairs(SH01_group.warehouse_office_001.members)do
on_attack_performed("sh01_ms_attack_line_cb", guard)
end
end
function sh01_setup_catwalk_grunts()
if not group_is_loaded(SH01_group.catwalk_grunts.name) then
group_create(SH01_group.catwalk_grunts.name, true)
end
delay(1.0)
for i, guard in pairs(SH01_group.catwalk_grunts.members)do
ai_do_scripted_move(SH01_group.catwalk_grunts.members[i], CATWALKS[i])
on_attack_performed("sh01_ms_attack_line_cb", guard)
end
end
function sh01_spawn_warehouse_wave1()
door_open("sm_Stairwell 001")
door_open("sm_Stairwell 002")
door_open("sm_Stairwell 003")
group_create(SH01_group.stairwell_grunts.name, true)
delay(1.0)
for i, guard in pairs(SH01_group.stairwell_grunts.members)do
on_attack_performed("sh01_ms_attack_line_cb", guard)
ai_do_scripted_move(SH01_group.stairwell_grunts.members[i], STAIR_MARK[i], true, false)
delay(0.5)
end
end
-- Spawn Enemies for the last checkpoint
function sh01_spawn_fourth_checkpoint_enemies_v1()
door_open("sm_Office_Backdoor_001")
door_open("sm_Office_Backdoor_002")
-- Group 1 (Manager's office)
group_create(SH01_group.warehouse_office_002.name, true)
delay(1.0)
-- spawn threads to move guards to their mark
for i, guard in pairs(SH01_group.warehouse_office_002.members) do
on_attack_performed("sh01_ms_attack_line_cb", guard)
ai_do_scripted_move(guard, OFFICE_MARK[i])
end
end
function sh01_spawn_fourth_checkpoint_enemies_v2()
-- Create all the people in the retail store
-- Group 2 (Retail Store)
group_create(SH01_group.retail_grunts_001.name, true)
-- Create customers
group_create(SH01_group.retail_customers.name, true)
-- Group 3 (People the NEED to be killed)
group_create(SH01_group.retail_grunts_002.name, true)
-- Place a NPC in the gunner's chair of the APC
vehicle_enter_teleport(SH01_group.retail_grunts_001.members[1], SH01_group.retail_grunts_002.vehicle, 1)
set_unjackable_flag(SH01_group.retail_grunts_002.vehicle, true)
vehicle_suppress_npc_exit(SH01_group.retail_grunts_002.vehicle, true)
follower_remain_in_car(SH01_group.retail_grunts_001.members[1], true)
end
function sh01_spawn_retail_brute()
group_create(SH01_group.retail_brute.name, true)
on_death("sh01_brute_killed", SH01_group.retail_brute.members[1])
marker_add(SH01_group.retail_brute.members[1], MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_DEFAULT, SYNC_ALL)
--door_open("sm_Brute_Office 001")
--door_open("sm_Brute_Office 002")
door_open("sm_Brute_Office 003")
--door_open("sm_Brute_Office 004")
end
function sh01_must_kill_setup()
for i, enemy in pairs(SH01_group.retail_grunts_002.members) do
if (character_is_dead(enemy) == false) then
on_death("sh01_enemy_killed", enemy)
marker_add(enemy, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_DEFAULT, SYNC_ALL)
Num_guys_to_kill = Num_guys_to_kill + 1
end
end
on_vehicle_destroyed("sh01_vehicle_killed", SH01_group.retail_grunts_002.vehicle)
marker_add(SH01_group.retail_grunts_002.vehicle, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_DEFAULT, SYNC_ALL)
Num_guys_to_kill = Num_guys_to_kill + 1
end
function sh01_must_kill_cleanup()
-- Clear enemy callbacks
for i, enemy in pairs(SH01_group.retail_grunts_002.members) do
-- cleanup the callback
on_death("", enemy)
marker_remove(enemy, SYNC_ALL)
end
on_vehicle_destroyed("", SH01_group.retail_grunts_002.vehicle)
marker_remove(SH01_group.retail_grunts_002.vehicle, SYNC_ALL)
end
-- Cleanup all enemies from the first checkpoint
function sh01_cleanup_first_checkpoint()
end
-- Cleanup all enemies from the second checkpoint
function sh01_cleanup_second_checkpoint()
if group_is_loaded(SH01_group.alley_grunts_001.name) then
-- Loop over each guy in the group, and make sure their markers have been removed
for i, enemy in pairs(SH01_group.alley_grunts_001.members) do
on_attack_performed("", enemy)
if (character_is_dead(enemy) == false) then
marker_remove(enemy)
end
end
-- Cleanup the group
group_destroy(SH01_group.alley_grunts_001.name)
end
end
-- Cleanup all enemies from the third checkpoint
function sh01_cleanup_third_checkpoint()
if group_is_loaded(SH01_group.warehouse_grunts_001.name) then
-- Loop over each guy in the group, and make sure their markers have been removed
for i, enemy in pairs(SH01_group.warehouse_grunts_001.members) do
on_attack_performed("", enemy)
if (character_is_dead(enemy) == false) then
marker_remove(enemy)
end
end
-- Cleanup the group
group_destroy(SH01_group.warehouse_grunts_001.name)
end
if group_is_loaded(SH01_group.warehouse_brute_001.name) then
-- Loop over each guy in the group, and make sure their markers have been removed
for i, enemy in pairs(SH01_group.warehouse_brute_001.members) do
if (character_is_dead(enemy) == false) then
marker_remove(enemy)
end
end
-- Cleanup the group
group_destroy(SH01_group.warehouse_brute_001.name)
on_death("", SH01_group.warehouse_brute_001.members[1])
end
if group_is_loaded(SH01_group.warehouse_office_001.name) then
-- Loop over each guy in the group, and make sure their markers have been removed
for i, enemy in pairs(SH01_group.warehouse_office_001.members) do
on_attack_performed("", enemy)
if (character_is_dead(enemy) == false) then
marker_remove(enemy)
end
end
-- Cleanup the group
group_destroy(SH01_group.warehouse_office_001.name)
end
if group_is_loaded(SH01_group.breakroom_grunts_001.name) then
-- Loop over each guy in the group, and make sure their markers have been removed
for i, enemy in pairs(SH01_group.breakroom_grunts_001.members) do
on_attack_performed("", enemy)
if (character_is_dead(enemy) == false) then
marker_remove(enemy)
end
end
-- Cleanup the group
group_destroy(SH01_group.breakroom_grunts_001.name)
end
if group_is_loaded(SH01_group.stairwell_grunts.name) then
-- Loop over each guy in the group, and make sure their markers have been removed
for i, enemy in pairs(SH01_group.stairwell_grunts.members) do
on_attack_performed("", enemy)
if (character_is_dead(enemy) == false) then
marker_remove(enemy)
end
end
-- Cleanup the group
group_destroy(SH01_group.stairwell_grunts.name)
end
if group_is_loaded(SH01_group.catwalk_grunts.name) then
-- Loop over each guy in the group, and make sure their markers have been removed
for i, enemy in pairs(SH01_group.catwalk_grunts.members) do
on_attack_performed("", enemy)
if (character_is_dead(enemy) == false) then
marker_remove(enemy)
end
end
-- Cleanup the group
group_destroy(SH01_group.catwalk_grunts.name)
end
if group_is_loaded(SH01_group.warehouse_snipers_001.name) then
-- Loop over each guy in the group, and make sure their markers have been removed
for i, enemy in pairs(SH01_group.warehouse_snipers_001.members) do
on_attack_performed("", enemy)
if (character_is_dead(enemy) == false) then
marker_remove(enemy)
end
end
-- Cleanup the group
group_destroy(SH01_group.warehouse_snipers_001.name)
end
end
-- Cleanup all the enemies from the fourth checkpoint
function sh01_cleanup_fourth_checkpoint()
-- Cleanup group 1
if group_is_loaded(SH01_group.warehouse_office_002.name) then
-- Loop over each guy in the group, and make sure their markers have been removed
for i, enemy in pairs(SH01_group.warehouse_office_002.members) do
on_attack_performed("", enemy)
if (character_is_dead(enemy) == false) then
marker_remove(enemy)
end
end
-- Cleanup the group
group_destroy(SH01_group.warehouse_office_002.name)
end
--[[
-- Cleanup group 2
if group_is_loaded(SH01_group.retail_grunts_001.name) then
--Loop over each guy in the group, and make sure their markers have been removed
for i, enemy in pairs(SH01_group.retail_grunts_001.members) do
if (character_is_dead(enemy) == false) then
marker_remove(enemy)
end
end
-- Cleanup the group
group_destroy(SH01_group.retail_grunts_001.name)
end
-- Cleanup customers
-- Cleanup group 2
if group_is_loaded(SH01_group.retail_customers.name) then
--Loop over each guy in the group, and make sure their markers have been removed
for i, enemy in pairs(SH01_group.retail_customers.members) do
if (character_is_dead(enemy) == false) then
marker_remove(enemy)
end
end
-- Cleanup the group
group_destroy(SH01_group.retail_customers.name)
end
-- Cleanup group 3
if group_is_loaded(SH01_group.retail_grunts_002.name) then
sh01_must_kill_cleanup()
-- Cleanup the group
group_destroy(SH01_group.retail_grunts_002.name)
end
if group_is_loaded(SH01_group.retail_brute.name) then
--Loop over each guy in the group, and make sure their markers have been removed
for i, enemy in pairs(SH01_group.retail_brute.members) do
if (character_is_dead(enemy) == false) then
marker_remove(enemy)
end
end
-- Cleanup the group
group_destroy(SH01_group.retail_brute.name)
on_death("", SH01_group.retail_brute.members[1])
end
]]--
end
-- Cleanup the homies
function sh01_cleanup_homies()
if group_is_loaded(SH01_group.homies.name) then
-- Remove Pierce as a homie
group_destroy(SH01_group.homies.name)
end
on_death("", SH01_group.homies.members[1])
on_death("", SH01_group.homies.members[2])
on_dismiss("", SH01_group.homies.members[1])
on_dismiss("", SH01_group.homies.members[2])
end
-- TRIGGER HAPPY FUNCTIONS
-- Set a trigger enabled with a mission marker
--
-- trigger: (string) Name of the trigger
-- trigger_callback: (string) Function name to call when trigger is activated
--
function sh01_set_trigger(trigger, trigger_callback)
trigger_enable(trigger, true)
marker_add_trigger(trigger, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL)
on_trigger(trigger_callback, trigger)
end
function sh01_set_use_trigger(trigger, trigger_callback)
trigger_enable(trigger, true)
marker_add(trigger, MINIMAP_ICON_USE, OI_ASSET_USE)
on_trigger(trigger_callback, trigger)
end
function sh01_set_invisible_trigger(trigger, trigger_callback)
trigger_enable(trigger, true)
on_trigger(trigger_callback, trigger)
end
-- Disable trigger
--
-- trigger: (string) Name of the trigger
--
function sh01_clear_trigger(trigger)
on_trigger("", trigger)
trigger_enable(trigger, false)
marker_remove_trigger(trigger, SYNC_ALL)
-- HACK: This function should be removed eventually since it is called in marker_remove_trigger
minimap_icon_remove( trigger, SYNC_ALL )
mission_waypoint_remove()
end
-- ***************************************************
-- sh01_run Helper Functions
-- ***************************************************
-- ***************************************************
-- sh01_initialize Helper Functions
-- ***************************************************
-- Handle any common initialization
--
function sh01_initialize_common()
--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]--
party_allow_max_followers(true)
end
-- Checkpoint specific initialization
--
-- checkpoint: The checkpoint to be initialized
function sh01_initialize_checkpoint(checkpoint)
if (checkpoint == SH01_CHECKPOINT_START) then
--[[ INSERT ANY INITIALIZATION CODE FOR STARTING THE MISSION AT THE BEGINNING ]]--
-- Teleport the players
--teleport_coop(SH01_PLAYER_START[1], SH01_COOP_START[1], true)
-- Teleport players
--teleport_coop(SH01_PLAYER_CHECKPOINT_2[1], SH01_COOP_CHECKPOINT_2[1], true)
-- Set Pierce & Shaundi as Homie (Not sure if this goes here or during checkpoint initialization)
sh01_setup_crew()
-- Teleport Pierce to checkpoint
teleport(SH01_group.homies.members[1], SH01_P_TELEPORT_2[1])
-- Teleport Shaundi to checkpoint
teleport(SH01_group.homies.members[2], SH01_S_TELEPORT_2[1])
end
if (checkpoint == SH01_CHECKPOINT_ENTER_WAREHOUSE) then
teleport_coop(SH01_PLAYER_CHECKPOINT_2[1], SH01_COOP_CHECKPOINT_2[1], true)
-- Set Pierce & Shaundi as Homie (Not sure if this goes here or during checkpoint initialization)
sh01_setup_crew()
-- Teleport Pierce to checkpoint
teleport(SH01_group.homies.members[1], SH01_P_TELEPORT_2[1])
-- Teleport Shaundi to checkpoint
teleport(SH01_group.homies.members[2], SH01_S_TELEPORT_2[1])
end
if (checkpoint == SH01_CHECKPOINT_MANAGER_OFFICE) then
teleport_coop(SH01_PLAYER_CHECKPOINT_3[1], SH01_COOP_CHECKPOINT_3[1], true)
sh01_setup_crew()
-- Teleport Pierce to checkpoint
teleport(SH01_group.homies.members[1], SH01_P_TELEPORT_3[1])
-- Teleport Shaundi to checkpoint
teleport(SH01_group.homies.members[2], SH01_S_TELEPORT_3[1])
end
if (checkpoint == SH01_CHECKPOINT_BRUTE_FIGHT) then
teleport_coop(BRUTE_TELEPORT[1], BRUTE_TELEPORT[2], true)
sh01_setup_crew()
-- Teleport Pierce to checkpoint
teleport(SH01_group.homies.members[1], BRUTE_TELEPORT[3])
-- Teleport Shaundi to checkpoint
teleport(SH01_group.homies.members[2], BRUTE_TELEPORT[4])
end
if (checkpoint == SH01_CHECKPOINT_CATWALK) then
teleport_coop(SH01_PLAYER_CHECKPOINT_4[1], SH01_COOP_CHECKPOINT_4[1], true)
sh01_setup_crew()
-- Teleport Pierce to checkpoint
teleport(SH01_group.homies.members[1], SH01_P_TELEPORT_4[1])
-- Teleport Shaundi to checkpoint
teleport(SH01_group.homies.members[2], SH01_S_TELEPORT_4[1])
-- Open stairwell door
door_open("sm_Stairwell 001")
end
if (checkpoint == SH01_CHECKPOINT_CLEAN_HOUSE) then
teleport_coop(SH01_PLAYER_CHECKPOINT_4[1], SH01_COOP_CHECKPOINT_4[1], true)
sh01_setup_crew()
-- Teleport Pierce to checkpoint
teleport(SH01_group.homies.members[1], SH01_P_TELEPORT_4[1])
-- Teleport Shaundi to checkpoint
teleport(SH01_group.homies.members[2], SH01_S_TELEPORT_4[1])
end
end
-- ***************************************************
-- MiscellaneousHelper Funcrtions
-- ***************************************************
-- Setting up my homies
function sh01_setup_crew ()
-- Spawn Shaundi and add her as a homie
if not group_is_loaded(SH01_group.homies)then
group_create(SH01_group.homies.name, true)
end
party_add(SH01_group.homies.members[2], LOCAL_PLAYER)
-- In coop, remote gets Pierce
if In_coop then
party_add(SH01_group.homies.members[1], REMOTE_PLAYER)
else
party_add(SH01_group.homies.members[1], LOCAL_PLAYER)
end
follower_set_can_abandon(SH01_group.homies.members[1], true)
follower_set_can_abandon(SH01_group.homies.members[2], true)
on_death("sh01_failure_pierce_died", SH01_group.homies.members[1])
on_death("sh01_failure_shaundi_died", SH01_group.homies.members[2])
on_dismiss("sh01_failure_abandon_pierce", SH01_group.homies.members[1])
on_dismiss("sh01_failure_abandon_shaundi", SH01_group.homies.members[2])
end
function must_kill_setup(enemy_table)
for i, enemy in pairs(enemy_table) do
if (character_is_dead(enemy) == false) then
on_death("sh01_enemy_killed", enemy)
marker_add(enemy, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_DEFAULT, SYNC_ALL)
end
end
Num_guys_to_kill = Num_guys_to_kill + sizeof_table(enemy_table)
end
function must_kill_cleanup(enemy_table)
-- Clear enemy callbacks
for i, enemy in pairs(enemy_table) do
-- cleanup the callback
on_death("", enemy)
marker_remove(enemy, SYNC_ALL)
end
end
-- Setup continuous spawns
--
function sh01_start_continuous_spawns()
spawn_on = true
spawn_region_enable(sh01_Spawn.catwalk1, true)
spawn_region_enable(sh01_Spawn.catwalk2, true)
spawn_region_enable(sh01_Spawn.catwalk3, true)
spawn_region_enable(sh01_Spawn.catwalk4, true)
continuous_spawn_start(SH01_group.spawn_wave1.name, 0, 2)
continuous_spawn_start(SH01_group.spawn_wave2.name, 0, 2)
continuous_spawn_start(SH01_group.spawn_wave3.name, 0, 2)
continuous_spawn_start(SH01_group.spawn_wave4.name, 0, 2)
end
-- Turn off continuous spawns
--
function sh01_stop_continuous_spawns()
continuous_spawn_stop(SH01_group.spawn_wave1.name)
continuous_spawn_stop(SH01_group.spawn_wave2.name)
continuous_spawn_stop(SH01_group.spawn_wave3.name)
continuous_spawn_stop(SH01_group.spawn_wave4.name)
spawn_region_enable(sh01_Spawn.catwalk1, false)
spawn_region_enable(sh01_Spawn.catwalk2, false)
spawn_region_enable(sh01_Spawn.catwalk3, false)
spawn_region_enable(sh01_Spawn.catwalk4, false)
spawn_on = false
end
function sh01_start_office_spawns()
spawn_office = true
spawn_region_enable(sh01_Spawn.office1, true)
spawn_region_enable(sh01_Spawn.office2, true)
spawn_region_enable(sh01_Spawn.office3, true)
spawn_region_enable(sh01_Spawn.office4, true)
continuous_spawn_start(SH01_group.spawn_wave5.name, 0, 0)
continuous_spawn_start(SH01_group.spawn_wave6.name, 0, 0)
continuous_spawn_start(SH01_group.spawn_wave7.name, 0, 0)
continuous_spawn_start(SH01_group.spawn_wave8.name, 0, 0)
end
-- Turn off continuous spawns
--
function sh01_stop_office_spawns()
continuous_spawn_stop(SH01_group.spawn_wave5.name)
continuous_spawn_stop(SH01_group.spawn_wave6.name)
continuous_spawn_stop(SH01_group.spawn_wave7.name)
continuous_spawn_stop(SH01_group.spawn_wave8.name)
spawn_region_enable(sh01_Spawn.office1, false)
spawn_region_enable(sh01_Spawn.office2, false)
spawn_region_enable(sh01_Spawn.office3, false)
spawn_region_enable(sh01_Spawn.office4, false)
spawn_office = false
end
-- *************************
--
-- Callback functions
--
-- *************************
-- Callback for when a dude dies
--
function sh01_enemy_killed(enemy)
on_death("",enemy)
Num_guys_to_kill = Num_guys_to_kill - 1
end
function sh01_brute_killed(enemy)
marker_remove(enemy)
on_death("", enemy)
Brute_Killed = true
end
-- End the mission if Pierce dies
function sh01_failure_pierce_died()
mission_end_failure("sh01", SH01_FAILURE_PIERCE_DIED)
end
function sh01_failure_abandon_pierce()
mission_end_failure("sh01", SH01_FAILURE_ABANDON_PIERCE)
end
-- End the mission if Shaundi dies
function sh01_failure_shaundi_died()
mission_end_failure("sh01", SH01_FAILURE_SHAUNDI_DIED)
end
function sh01_failure_abandon_shaundi()
mission_end_failure("sh01", SH01_FAILURE_ABANDON_SHAUNDI)
end
-- Trigger Callback
function sh01_reached_warehouse_door()
audio_play_persona_line(LOCAL_PLAYER, "SH01_Get_Inside")
warehouse_door_triggered = true
sh01_clear_trigger(WAREHOUSE_DOOR_TRIGGER)
end
function sh01_reached_alley()
thread_new("sh01_convo", SH01_convo.alley_combat)
alley_triggered = true
sh01_clear_trigger(ALLEY_TRIGGER)
end
function sh01_reached_inside()
SH01_thread.combat_chatter = thread_new("sh01_enter_warehouse_convo_thread")
inside_triggered = true
sh01_clear_trigger(INSIDE_TRIGGER)
end
function sh01_reached_catwalk()
door_open("sm_Office_Frontdoor 001")
door_open("sm_Office_Frontdoor 002")
thread_new("sh01_convo", SH01_convo.manager_office_enter)
catwalk_triggered = true
sh01_clear_trigger(CATWALK_TRIGGER)
delay(1.0)
for i, guard in pairs(SH01_group.warehouse_office_001.members) do
ai_do_scripted_move(guard, CATWALK_MARK[i])
end
end
function sh01_reached_upstairs()
upstairs_triggered = true
sh01_clear_trigger(UPSTAIRS_TRIGGER)
end
-- Callback for when the player reaches the top of the stairwell
--
-- character: name of character that entered the trigger
-- trig: name of the trigger
function sh01_reached_topstairwell(character, trig)
if not(character == LOCAL_PLAYER)then
return
end
topstairwell_triggered = true
sh01_clear_trigger(TOPSTAIRWELL_TRIGGER)
-- Set trigger to object in manager's office
office_triggered = false
sh01_set_trigger(OFFICE_TRIGGER, "sh01_reached_office")
sh01_setup_catwalk_grunts()
end
-- Callback for when the player reaches the office
--
-- character: name of character that entered the trigger
-- trig: name of the trigger
function sh01_reached_office(character, trig)
if not(character == LOCAL_PLAYER)then
return
end
office_triggered = true
sh01_clear_trigger(OFFICE_TRIGGER)
end
function sh01_reached_breakroom()
breakroom_triggered = true
sh01_clear_trigger(BREAKROOM_TRIGGER)
end
function sh01_reached_showroom()
showroom_triggered = true
sh01_clear_trigger(SHOWROOM_TRIGGER)
end
function sh01_used_computer()
computer_triggered = true
marker_remove(COMPUTER_TRIGGER)
sh01_clear_trigger(COMPUTER_TRIGGER)
audio_play_persona_line(SH01_group.homies.members[2], "SH01_Hack_Success")
end
-- Callback for when a dude dies
--
function sh01_enemy_killed(enemy)
marker_remove(enemy)
on_death("",enemy)
Num_guys_to_kill = Num_guys_to_kill - 1
end
function sh01_vehicle_killed(enemy)
marker_remove(enemy)
on_vehicle_destroyed("",enemy)
Num_guys_to_kill = Num_guys_to_kill - 1
character_kill(SH01_group.retail_grunts_001.members[1])
end
-- Have Morningstar attack persona lines
--
-- name: (string) name of character
-- weapon: (string) name of weapon
-- attack: (string) type of attack performed
--
function sh01_ms_attack_line_cb(name, weapon, attack)
local situation = "SH01_Attack"
-- don't play this if we have done this recently
if(not thread_check_done(SH01_thread.attack_line_timer))then
return
end
-- start timer
SH01_thread.attack_line_timer = thread_new("delay", SH01_Attack_Line_Time)
-- Play situation
audio_play_persona_line(name, situation)
end
-- Have breakroom guys bitch
--
-- name: (string) name of character
-- weapon: (string) name of weapon
-- attack: (string) type of attack performed
--
function sh01_ms_breakroom_persona_cb(name, weapon, attack)
local situation = "SH01_Breakroom"
audio_play_persona_line(name, situation)
end
-- *************************
--
-- Thread functions
--
-- *************************
function sh01_convo(convo)
if(convo == nil)then
return
end
-- If another conversation is already playing, wait for it to finish
if(convo_is_playing)then
repeat
thread_yield()
until (not convo_is_playing)
end
convo_is_playing = true
-- Load the conversation
if (convo.load_direct)then
convo.handle = audio_conversation_load_direct(convo.name)
else
convo.handle = audio_conversation_load(convo.name)
end
-- Play the conversation
audio_conversation_play(convo.handle)
delay(1)
-- Wait for the conversation to end
audio_conversation_wait_for_end(convo.handle)
convo.handle = INVALID_CONVERSATION_HANDLE
convo_is_playing = false
end
function sh01_enter_warehouse_convo_thread()
for i, chat in pairs(SH01_Warehouse_Combat_Chatter)do
if(breakroom_triggered)then
return
end
local playing_line = false
while (not playing_line)do
if convo_is_playing then
thread_yield()
elseif(not thread_check_done(SH01_thread.chatter_timer))then
thread_yield()
elseif(not playing_line) and (not chat.spoken) then
chat.spoken = true
playing_line = true
if chat.is_conversation then
sh01_convo(chat.conversation)
else
audio_play_persona_line(chat.speaker, chat.line)
end
SH01_thread.chatter_timer = thread_new("delay", 5.0)
end
end
delay(8.0)
end
end
function sh01_retail_combat_convo_thread()
for i, chat in pairs(SH01_Retail_Combat_Chatter)do
local playing_line = false
while (not playing_line)do
if convo_is_playing then
thread_yield()
elseif(not thread_check_done(SH01_thread.chatter_timer))then
thread_yield()
elseif(not playing_line) and (not chat.spoken) then
chat.spoken = true
playing_line = true
if chat.is_conversation then
sh01_convo(chat.conversation)
else
audio_play_persona_line(chat.speaker, chat.line)
end
SH01_thread.chatter_timer = thread_new("delay", 10.0)
end
end
delay(10.0)
end
end
function sh01_shaundi_hack_thread()
delay(2.0)
-- Remove Shaundi's leash to the player
-- follower_make_independent(SH01_group.homies.members[2], true)
-- Have Shaudi ignore any other AI commands
set_ignore_ai_flag(SH01_group.homies.members[2], true)
-- Move Shaundi to the computer
ai_do_scripted_move(SH01_group.homies.members[2], HACK_POINT, true, false)
-- Make sure she gets to where she is supposed to be
while (get_dist(SH01_group.homies.members[2], HACK_POINT) > 2.0)do
if not (ai_scripted_action_is_processing(SH01_group.homies.members[2]))then
ai_do_scripted_move(SH01_group.homies.members[2], HACK_POINT, true, false)
end
thread_yield()
end
-- Wait for her to finish walking
--while not(ai_scripted_action_is_complete(SH01_group.homies.members[2])) do
-- thread_yield()
--end
-- Double check to make sure the AI didn't cut out early
-- if (get_dist(SH01_group.homies.members[2]) > 2.0)then
-- ai_do_scripted_move(SH01_group.homies.members[2])
-- while not(get_dist(SH01_group.homies.members[2]) < 2.0)do
-- thread_yield()
-- end
-- end
-- Switch objective to the hacking meter
thread_new("sh01_hack_hud_bar_thread")
-- Set off animation thread so we can loop the hacking animation
thread_new("sh01_shaundi_hack_animation_thread")
-- local current_pct = 0.01
-- local pct_step = 0.01
-- SH01_HACK_PROGRESS = 0
-- while current_pct < 1.0 do
--while not action_play_is_finished(SH01_group.homies.members[2], current_pct) do
-- thread_yield()
--end
--SH01_HACK_PROGRESS = current_pct * 100
--current_pct = current_pct + pct_step
-- alt for different timing
-- while action_play_is_finished(SH01_group.homies.members[2], current_pct) do
-- current_pct = current_pct + pct_step
-- end
-- SH01_HACK_PROGRESS = current_pct * 100
-- thread_yield()
-- end
-- SH01_HACK_PROGRESS = 100
SH01_HACK_PROGRESS = 0
local hack_time = 1500
while SH01_HACK_PROGRESS < hack_time do
if human_is_downed(SH01_group.homies.members[2])then
SH01_HACK_PROGRESS = 0
end
SH01_HACK_PROGRESS = SH01_HACK_PROGRESS + 1
thread_yield()
end
-- Turn Shaundi's AI back on
set_ignore_ai_flag(SH01_group.homies.members[2], false)
audio_play_persona_line(SH01_group.homies.members[2], "SH01_Hack_Success")
hack_done = true
end
function sh01_hack_hud_bar_thread()
objective_text_clear(0)
hud_bar_on(0, "health", "sh01_obj_use_computer", HUD_BAR_MAX_VALUE)
while not hack_done do
hud_bar_set_value(0, SH01_HACK_PROGRESS)
thread_yield()
end
hud_bar_off(0)
end
-- Shaundi's hacking animation thread
function sh01_shaundi_hack_animation_thread()
-- Set up Shaundi to get into hacking animation area
set_script_animation_state(SH01_group.homies.members[2], "SH03 Kenzie hack")
action_play(SH01_group.homies.members[2], "SH03 Kenzie hack enter", "", false, 0.8, false, false, HACK_POINT)
while not hack_done do
-- Play hacking animation
-- action_play(SH01_group.homies.members[2], "SH03 Kenzie hack", "", false, 0.8)
thread_yield()
end
-- Take Shaundi out of hacking animation
-- action_play(SH01_group.homies.members[2], "SH03 Kenzie hack exit", "", false, 0.8)
clear_animation_state(SH01_group.homies.members[2])
end