--[[
sh02.lua
Stronghold 02 Script
DATE: 08/04/2010
AUTHOR: Nicholas Zippmann
]]--
-- CONSTANTS --
TRIG_LOC = 0
TRIG_INV = 1
TRIG_USE_LOC = 2
TRIG_USE_INV = 3
-- GROUPS --
sh02_group = {
homies = {
name = "grp_homies",
members = { "npc_zimos" }
},
collection_guards = {
name = "grp_collection_guards",
members = { "npc_collection_guard<001>", "npc_collection_guard<002>", "npc_collection_guard<003>" }
},
collection_hos = {
name = "grp_collection_hos",
members = { "npc_collection_ho<001>", "npc_collection_ho<002>", "npc_collection_ho<003>" }
},
collection_wave = {
name = "grp_collection_wave",
members = { "npc_collection_wave<001>", "npc_collection_wave<002>", "npc_collection_wave<003>" }
},
lounge_guards = {
name = "grp_lounge_guards",
members = { "npc_lounge_guard<001>", "npc_lounge_guard<002>", "npc_lounge_guard<003>",
"npc_lounge_guard<004>", "npc_lounge_guard<005>", "npc_lounge_guard<006>" }
},
lounge_snipers = {
name = "grp_lounge_snipers",
members = { "npc_lounge_sniper<001>", "npc_lounge_sniper<002>", "npc_lounge_sniper<003>",
"npc_lounge_sniper<004>" }
},
lounge_flee01 = {
name = "grp_lounge_flee<001>",
members = { "npc_lounge_flee<001>", "npc_lounge_flee<002>" }
},
lounge_flee02 = {
name = "grp_lounge_flee<002>",
members = { "npc_lounge_flee<003>", "npc_lounge_flee<004>" }
},
lounge_flee03 = {
name = "grp_lounge_flee<003>",
members = { "npc_lounge_flee<005>", "npc_lounge_flee<006>" }
},
lounge_flee04 = {
name = "grp_lounge_flee<004>",
members = { "npc_lounge_flee<007>", "npc_lounge_flee<008>" }
},
jailcell01_guards = {
name = "grp_jailcell01_guards",
members = { "npc_jailcell01_guard<001>", "npc_jailcell01_guard<002>", "npc_jailcell01_guard<003>",
"npc_jailcell01_guard<004>" }
},
jailcell01_hos = {
name = "grp_jailcell01_hos",
members = { "npc_jailcell01_ho<001>", "npc_jailcell01_ho<002>", "npc_jailcell01_ho<003>",
"npc_jailcell01_ho<004>", "npc_jailcell01_ho<005>" }
},
jailcell01_wave = {
name = "grp_jailcell01_wave",
members = { "npc_jailcell01_wave<001>", "npc_jailcell01_wave<002>" }
},
jailcell02_guards = {
name = "grp_jailcell02_guards",
members = { "npc_jailcell02_guard<001>", "npc_jailcell02_guard<002>", "npc_jailcell02_guard<003>",
"npc_jailcell02_guard<004>" }
},
jailcell02_brutella = {
name = "grp_jailcell02_brutella",
members = { "npc_jailcell02_brutella" }
},
jailcell02_hos = {
name = "grp_jailcell02_hos",
members = { "npc_jailcell02_ho<001>", "npc_jailcell02_ho<002>", "npc_jailcell02_ho<003>",
"npc_jailcell02_ho<004>", "npc_jailcell02_ho<005>" }
},
jailcell02_wave = {
name = "grp_jailcell02_wave",
members = { "npc_jailcell02_wave<001>", "npc_jailcell02_wave<002>", "npc_jailcell02_wave<003>" }
},
jailcell03_guards = {
name = "grp_jailcell03_guards",
members = { "npc_jailcell03_guard<001>", "npc_jailcell03_guard<002>", "npc_jailcell03_guard<003>",
"npc_jailcell03_guard<004>", "npc_jailcell03_guard<005>", "npc_jailcell03_guard<006>" }
},
jailcell03_hos = {
name = "grp_jailcell03_hos",
members = { "npc_jailcell03_ho<001>", "npc_jailcell03_ho<002>", "npc_jailcell03_ho<003>",
"npc_jailcell03_ho<004>", "npc_jailcell03_ho<005>", "npc_jailcell03_ho<006>",
"npc_jailcell03_ho<007>", "npc_jailcell03_ho<008>", "npc_jailcell03_ho<009>",
"npc_jailcell03_ho<010>" }
},
jailcell03_wave = {
name = "grp_jailcell03_wave",
members = { "npc_jailcell03_wave<001>", "npc_jailcell03_wave<002>", "npc_jailcell03_wave<003>",
"npc_jailcell03_wave<004>" }
},
jailcell03_final = {
name = "grp_jailcell03_final",
members = { "npc_jailcell03_final<001>", "npc_jailcell03_final<002>", "npc_jailcell03_final<003>",
"npc_jailcell03_final<004>" }
},
cont_spawn01 = {
name = "grp_cont_spawn<001>",
members = { "npc_cont_spawn<001>", "npc_cont_spawn<002>" }
},
cont_spawn02 = {
name = "grp_cont_spawn<002>",
members = { "npc_cont_spawn<003>", "npc_cont_spawn<004>" }
},
cont_spawn03 = {
name = "grp_cont_spawn<003>",
members = { "npc_cont_spawn<005>", "npc_cont_spawn<006>" }
},
cont_spawn04 = {
name = "grp_cont_spawn<004>",
members = { "npc_cont_spawn<007>", "npc_cont_spawn<008>" }
},
cont_spawn05 = {
name = "grp_cont_spawn<005>",
members = { "npc_cont_spawn<009>", "npc_cont_spawn<010>" }
},
cont_spawn06 = {
name = "grp_cont_spawn<006>",
members = { "npc_cont_spawn<011>", "npc_cont_spawn<012>" }
},
cte_npcs = {
name = "grp_cte_npc"
},
garage_vehicles = {
name = "grp_garage_vehicles",
vehicles = { "veh_garage<001>", "veh_garage<002>", "veh_garage<003>" }
},
garage_brute = {
name = "grp_garage_brute",
members = { "npc_garage_brute" }
}
}
sh02_zimos = sh02_group.homies.members[1]
-- NAVPOINTS --
NAV_CANCEL = { "nav_cancel<001>", "nav_cancel<002>" }
NAV_CHKPNT01 = { "nav_checkpoint01<001>", "nav_checkpoint01<002>", "nav_checkpoint01<003>" }
NAV_HACKING = { "nav_hacking<001>", "nav_hacking<002>", "nav_hacking<003>", "nav_hacking<004>" }
NAV_HOS = { "nav_hos<001>", "nav_hos<002>", "nav_hos<003>", "nav_hos<004>",
"nav_hos<005>", "nav_hos<006>", "nav_hos<007>", "nav_hos<008>" }
NAV_LEASH01 = { "nav_leash01<001>", "nav_leash01<002>", "nav_leash01<003>", "nav_leash01<004>",
"nav_leash01<005>", "nav_leash01<006>" }
NAV_CHKPNT02 = { "nav_checkpoint02<001>", "nav_checkpoint02<002>", "nav_checkpoint02<003>" }
NAV_COLLECTION = { "nav_collection<001>", "nav_collection<002>", "nav_collection<003>" }
NAV_CHKPNT03 = { "nav_checkpoint03<001>", "nav_checkpoint03<002>", "nav_checkpoint03<003>" }
NAV_LEASH02 = { "nav_leash02<001>", "nav_leash02<002>", "nav_leash02<003>", "nav_leash02<004>" }
NAV_JAILCELL01 = { "nav_jailcell01<001>", "nav_jailcell01<002>" }
NAV_LEASH03 = { "nav_leash03<001>", "nav_leash03<002>", "nav_leash03<003>", "nav_leash03<004>" }
NAV_JAILCELL02 = { "nav_jailcell02<001>", "nav_jailcell02<002>", "nav_jailcell02<003>" }
NAV_CHKPNT04 = { "nav_checkpoint04<001>", "nav_checkpoint04<002>", "nav_checkpoint04<003>" }
NAV_LEASH04 = { "nav_leash04<001>", "nav_leash04<002>", "nav_leash04<003>", "nav_leash04<004>",
"nav_leash04<005>", "nav_leash04<006>" }
NAV_JAILCELL03 = { "nav_jailcell03<001>", "nav_jailcell03<002>", "nav_jailcell03<003>", "nav_jailcell03<004>" }
NAV_JAILCELL04 = { "nav_jailcell04<001>", "nav_jailcell04<002>", "nav_jailcell04<003>", "nav_jailcell04<004>" }
NAV_CHKPNT05 = { "nav_checkpoint05<001>", "nav_checkpoint05<002>", "nav_checkpoint05<003>" }
NAV_FINAL = { "nav_final_local", "nav_final_remote"}
NAV_CP_START = { "nav_checkpoint01<001>", "nav_checkpoint01<002>" }
-- SPAWN REGIONS --
sh02_spawn = {
lounge = "sr_lounge",
stairwell = "sr_stairwell",
jailcell01 = "sr_jailcell01",
jailcell02 = "sr_jailcell02",
jailcell03 = "sr_jailcell03"
}
-- SCRIPT MOVERS --
sh02_door = {
auction = "door_auction",
coll_hos = "door_collect_hos",
coll_out = "door_collect_out",
flee01 = "door_flee<001>",
flee02 = "door_flee<002>",
flee03 = "door_flee<003>",
flee04 = "door_flee<004>",
stairwell = "door_stairwell",
cells01 = "door_cells<001>",
spawn01 = "door_spawn<001>",
cells02 = "door_cells<002>",
spawn02 = "door_spawn<002>",
spawn03 = "door_spawn<003>",
cells03 = "door_cells<003>",
spawn04 = "door_spawn<004>",
garage = "door_garage"
}
-- TEXT --
-- Objective: Go To The Collection Room
SH02_OBJ_COLLECTION = "sh02_obj_collection_room"
-- Objective: Disable Security
SH02_OBJ_OVERRIDE = "sh02_obj_override_button"
-- Objective: Go To The Security Center
SH02_OBJ_BASEMENT = "sh02_obj_basement"
-- Objective: Free Hos
SH02_OBJ_FREE_HOS = "sh02_obj_free_hos"
-- Objective: Eliminate Morningstar
SH02_OBJ_CLEAN_HOUSE = "sh02_obj_clean_house"
-- Objective: Head To The Garage
SH02_OBJ_GARAGE = "sh02_obj_garage"
-- Objective: Kill Brute
SH02_OBJ_KILL_BRUTE = "sh02_obj_kill_brute"
-- Failure: Zimos Died
SH02_FAILURE_ZIMOS_DIED = "sh02_failure_zimos_died"
-- Failure: Zimos Abandoned
SH02_FAILURE_ABANDON_ZIMOS = "sh02_failure_abandon_zimos"
-- TRIGGERS --
sh02_trigger = {
collection01 = {
name = "trig_collection<001>",
callback = "sh02_collection01_cb",
triggered = false,
style = TRIG_INV
},
collection02 = {
name = "trig_collection<002>",
callback = "sh02_collection02_cb",
triggered = false,
style = TRIG_INV
},
collection03 = {
name = "trig_override<001>",
callback = "sh02_collection03_cb",
triggered = false,
style = TRIG_LOC
},
override01 = {
name = "trig_override<001>",
callback = "sh02_override01_cb",
triggered = false,
style = TRIG_USE_LOC
},
lounge = {
name = "trig_lounge",
callback = "sh02_lounge_cb",
triggered = false,
style = TRIG_INV
},
hallway = {
name = "trig_hallway",
callback = "sh02_hallway_cb",
triggered = false,
style = TRIG_INV
},
stairwell01 = {
name = "trig_stairwell<001>",
callback = "sh02_stairwell01_cb",
triggered = false,
style = TRIG_LOC
},
stairwell02 = {
name = "trig_stairwell<002>",
callback = "sh02_stairwell02_cb",
triggered = false,
style = TRIG_LOC
},
stairwell03 = {
name = "trig_stairwell<003>",
callback = "sh02_stairwell03_cb",
triggered = false,
style = TRIG_LOC
},
stairwell04 = {
name = "trig_stairwell<004>",
callback = "sh02_stairwell04_cb",
triggered = false,
style = TRIG_LOC
},
wrongway = {
name = "trig_wrong_way",
callback = "sh02_wrongway_cb",
triggered = false,
style = TRIG_INV
},
jailcell01_01 = {
name = "trig_jailcell01<001>",
callback = "sh02_jailcell01_01_cb",
triggered = false,
style = TRIG_LOC
},
freehos01 = {
name = "trig_free_hos<001>",
callback = "sh02_freehos01_cb",
triggered = false,
style = TRIG_INV
},
override02 = {
name = "trig_override<002>",
callback = "sh02_override02_cb",
triggered = false,
style = TRIG_USE_INV
},
jailcell01_02 = {
name = "trig_jailcell01<002>",
callback = "sh02_jailcell01_02_cb",
triggered = false,
style = TRIG_LOC
},
freehos02 = {
name = "trig_free_hos<002>",
callback = "sh02_freehos02_cb",
triggered = false,
style = TRIG_INV
},
override03 = {
name = "trig_override<003>",
callback = "sh02_override03_cb",
triggered = false,
style = TRIG_USE_INV
},
jailcell02_01 = {
name = "trig_jailcell02<001>",
callback = "sh02_jailcell02_01_cb",
triggered = false,
style = TRIG_LOC
},
jailcell02_02 = {
name = "trig_jailcell02<002>",
callback = "sh02_jailcell02_02_cb",
triggered = false,
style = TRIG_LOC
},
jailcell03_01 = {
name = "trig_jailcell03<001>",
callback = "sh02_jailcell03_01_cb",
triggered = false,
style = TRIG_LOC
},
jailcell03_02 = {
name = "trig_jailcell03<002>",
callback = "sh02_jailcell03_02_cb",
triggered = false,
style = TRIG_INV
},
backroom = {
name = "trig_backroom",
callback = "sh02_backroom_cb",
triggered = false,
style = TRIG_INV
},
override04 = {
name = "trig_override<004>",
callback = "sh02_override04_cb",
triggered = false,
style = TRIG_USE_LOC
},
garage = {
name = "trig_garage",
callback = "sh02_garage_cb",
triggered = false,
style = TRIG_LOC
}
}
-- PERSONA LINES --
sh02_persona = {
-- Player: "Whoa, pretty colors... Ok, let's do this." X
woozy = {
speaker = LOCAL_PLAYER,
line = "SH02_Player_Woozy_Start"
},
-- Zimos: "We'll have to shut down security. Should be up ahead." X
follow = {
speaker = sh02_zimos,
line = "SH02_Follow_Me"
},
-- Zimos: "Find somethin' to shut off those alarms." X
unlock = {
speaker = sh02_zimos,
line = "SH02_Unlock_Doors"
},
-- Zimos: "We'll have to go down to find the security room." X
godown = {
speaker = sh02_zimos,
line = "SH02_Down_To_Security"
},
-- Zimos: "Where you headed? We gotta go down, remember?" X
wrongway = {
speaker = sh02_zimos,
line = "SH02_Wrong_Way"
},
-- Zimos: "Shit, we can't leave them like this. I say we let 'em out." X
helphos = {
speaker = sh02_zimos,
line = "SH02_Help_People"
},
-- Zimos: "Damn things are still goin'�" X
override01 = {
speaker = sh02_zimos,
line = "SH02_Security_Override_01"
},
-- Zimos: "Override these doors and let's keep movin'."
override02 = {
speaker = sh02_zimos,
line = "SH02_Security_Override_02"
},
-- Zimos: "More to let out. Get on that." X
override03 = {
speaker = sh02_zimos,
line = "SH02_Security_Override_03"
},
-- Player: "None of these things are labeled�" X
hacking01 = {
speaker = LOCAL_PLAYER,
line = "SH02_Commenting_On_Hacking_01"
},
-- Player: "Perhaps that button�" X
hacking02 = {
speaker = LOCAL_PLAYER,
line = "SH02_Commenting_On_Hacking_02"
},
-- Player: "Come on, everyone out." X
release01 = {
speaker = LOCAL_PLAYER,
line = "SH02_Release_Prisoners_01"
},
-- Player: "Get some fresh air!" X
release02 = {
speaker = LOCAL_PLAYER,
line = "SH02_Release_Prisoners_02"
},
-- Player: "Move along! Don't waste time!" X
release03 = {
speaker = LOCAL_PLAYER,
line = "SH02_Release_Prisoners_03"
},
-- Morningstar: Mission specific attack lines
ms_attack = {
speaker = nil,
line = "SH02_Attack"
},
-- Morningstar: Attacked lines when ho attacks
ms_attacked = {
speaker = nil,
line = "SH02_Scared"
},
-- Ho: Attack lines when attacking Morningstar
ho_attack = {
speaker = nil,
line = "SH02_Freedom"
}
}
-- CHATTER LINES --
sh02_chatter = {
-- Chatter data
playing = false,
main_thd = INVALID_THREAD_HANDLE,
wait_thd = INVALID_THREAD_HANDLE,
-- Player: "Oh my god...the floor is so wobbly!" X
drugged_out = {
{
speaker = LOCAL_PLAYER,
line = "SH02_Drugged_Out_01",
spoken = false
},
{
speaker = LOCAL_PLAYER,
line = "SH02_Drugged_Out_02",
spoken = false
},
{
speaker = LOCAL_PLAYER,
line = "SH02_Drugged_Out_03",
spoken = false
},
{
speaker = LOCAL_PLAYER,
line = "SH02_Drugged_Out_04",
spoken = false
},
{
speaker = LOCAL_PLAYER,
line = "SH02_Drugged_Out_05",
spoken = false
}
},
-- Player: "Think these girls are pissed off?" X
hos_fighting = {
{
speaker = LOCAL_PLAYER,
line = "SH02_Hos_Fighting_01",
spoken = false
},
{
speaker = LOCAL_PLAYER,
line = "SH02_Hos_Fighting_02",
spoken = false
}
},
-- Zimos: "What are you doing!?" X
ho_killed = {
{
speaker = sh02_zimos,
line = "SH02_No_Kill_Hos_01",
spoken = false
},
{
speaker = sh02_zimos,
line = "SH02_No_Kill_Hos_02",
spoken = false
},
{
speaker = sh02_zimos,
line = "SH02_No_Kill_Hos_03",
spoken = false
}
}
}
-- CONVERSATIONS --
sh02_convo = {
-- Convo data
playing = false,
main_thd = INVALID_THREAD_HANDLE,
-- Player/Zimos: "Here's your guns back." X
mission_start = {
name = "SH02_Convo_2",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = false
},
-- Player/Zimos: "You're handling this naked thing better than I thought you would." X
combat02 = {
name = "SH02_Combat_2",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = false
},
-- Player/Zimos: "Don't expect me to be down with doin' this again. It's a one time thing." X
combat03 = {
name = "SH02_Combat_3",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = false
},
-- Player/Zimos: "Time to go after their head of security, only�" X
kill_brute = {
name = "SH02_Kill_Brute",
handle = INVALID_CONVERSATION_HANDLE,
load_direct = false
},
}
-- THREADS --
sh02_thread = {
player = INVALID_THREAD_HANDLE,
homies = INVALID_THREAD_HANDLE,
enemies = INVALID_THREAD_HANDLE,
ms_wait = INVALID_THREAD_HANDLE,
ho_wait = INVALID_THREAD_HANDLE,
chatter_main = sh02_chatter.main_thd,
chatter_wait = sh02_chatter.wait_thd,
convo_main = sh02_convo.main_thd
}
-- CHECKPOINTS --
SH02_CHECKPOINT_START = MISSION_START_CHECKPOINT -- defined in ug_lib.lua
SH02_CHECKPOINT_COLLECTION = "sh02_checkpoint_collection_room"
SH02_CHECKPOINT_BASEMENT = "sh02_checkpoint_basement"
SH02_CHECKPOINT_CLEAN_HOUSE = "sh02_checkpoint_clean_house"
SH02_CHECKPOINT_KILL_BRUTE = "sh02_checkpoint_kill_brute"
-- CUTSCENES --
SH02_CUTSCENE_MISSION_INTRO = "MS_SH02"
SH02_CUTSCENE_BRUTE_CTE = "sh02_cte_01"
-- GLOBAL VARIABLES --
sh02_in_coop = false
sh02_hos_nav = 1
sh02_prompt01 = -1
sh02_prompt02 = -1
sh02_guys_killed = 0
sh02_brute_killed = false
-- ***************************************************
-- SH02 Main Functions
-- ***************************************************
-- CALLED FROM CODE
-- This is the primary entry point for the mission, and is
-- responsible for starting up the mission at the specified checkpoint.
-- sh02_checkpoint: The checkpoint the mission should begin at
-- is_restart: TRUE if the mission is restarting, FALSE otherwise
function sh02_start(sh02_checkpoint, is_restart)
-- Check if mission is starting from the beginning
if (sh02_checkpoint == SH02_CHECKPOINT_START) then
if (is_restart == false) then
-- Play intro cutscene (no fade in after)
cutscene_play(SH02_CUTSCENE_MISSION_INTRO, nil, NAV_CP_START, false, false)
-- Teleport player(s) to Auction Room
--teleport_coop(NAV_CHKPNT01[1], NAV_CHKPNT01[2], true)
-- Play intro audio sequence
audio_object_post_event("sh02_intro_sequence")
-- Wait some time
delay(15.0)
end
end
-- Init the mission from the current checkpoint
sh02_initialize(sh02_checkpoint)
-- Run the mission from the current checkpoint
sh02_run(sh02_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 sh02_run(first_checkpoint)
local current_checkpoint = first_checkpoint
-- Run the mission from the beginning
if (current_checkpoint == SH02_CHECKPOINT_START) then
-- Setup player(s) being drugged (strongest)
sh02_setup_player_drugged(1.0)
-- Have player(s) stumble to ground
sh02_players_stumble_thd()
-- Set persona situation override (Drugged).
persona_set_global_situation_override(PS_OVERRIDE_SH02)
-- Player: "Whoa, pretty colors... Ok, let's do this."
sh02_play_persona_line(sh02_persona.woozy)
-- Wait until player is done speaking
while sh02_persona_line_playing() do
thread_yield()
end
-- Set Collection 01 trigger
sh02_set_trigger(sh02_trigger.collection01)
-- Have Zimos greet player and wait for it
sh02_zimos_greet_player_thd()
while not sh02_check_homies_thread() do
thread_yield()
end
-- Give back player(s) weapons
inv_weapon_disable_all_slots(false)
-- Player/Zimos: "Here's your guns back."
sh02_start_convo_thread(sh02_convo.mission_start)
-- Objective: Go To The Collection Room
sh02_show_objective_loc(SH02_OBJ_COLLECTION)
-- Set Collection 02/03 triggers
sh02_set_trigger(sh02_trigger.collection02)
sh02_set_trigger(sh02_trigger.collection03)
-- Wait until Collection 01 trigger is reached
while not sh02_check_trigger(sh02_trigger.collection01) do
thread_yield()
end
-- Wait until Collection 02 trigger is reached
while not sh02_check_trigger(sh02_trigger.collection02) do
thread_yield()
end
-- Wait until Override 01 trigger is reached
while not sh02_check_trigger(sh02_trigger.override01) do
thread_yield()
end
-- Reset Checkpoint 02 doors
sh02_reset_doors_chkpnt02()
-- Goto next checkpoint
current_checkpoint = SH02_CHECKPOINT_COLLECTION
mission_set_checkpoint(SH02_CHECKPOINT_COLLECTION, true)
end
-- Run the mission from the Collection Room checkpoint
if (current_checkpoint == SH02_CHECKPOINT_COLLECTION) then
-- Setup player(s) being drugged (medium)
sh02_setup_player_drugged(0.5)
-- Zimos: "Damn things are still goin'�"
sh02_play_persona_line(sh02_persona.override01)
-- Setup Collection hos to join player
sh02_setup_collection_hos()
-- Open Collection Hos door
door_open(sh02_door.coll_hos, true)
-- Setup Collection wave to move in
sh02_setup_collection_wave()
-- Setup Lounge guards/snipers
sh02_setup_lounge_enemies()
-- Open Collection Out door
door_open(sh02_door.coll_out, true)
-- Wait until Zimos is done speaking
while sh02_persona_line_playing() do
thread_yield()
end
-- Have player(s) come down from drugs
sh02_player_come_down_thd()
-- Zimos: "We'll have to go down to find the security room."
sh02_play_persona_line(sh02_persona.godown)
-- Objective: Go To The Security Center
sh02_show_objective_loc(SH02_OBJ_BASEMENT)
-- Set Lounge/Hallway triggers
sh02_set_trigger(sh02_trigger.lounge)
sh02_set_trigger(sh02_trigger.hallway)
-- Set Stairwell 01 trigger and wait for it
sh02_set_trigger(sh02_trigger.stairwell01)
while not sh02_check_trigger(sh02_trigger.stairwell01) do
thread_yield()
end
-- Player/Zimos: "You're handling this naked thing better than I thought you would."
sh02_start_convo_thread(sh02_convo.combat02)
-- Set Wrong Way trigger
sh02_set_trigger(sh02_trigger.wrongway)
-- Start Stairwell continuous spawning
sh02_stairwell_spawn_start_thd()
-- Open Stairwell door
door_open(sh02_door.stairwell, true, false)
-- Set Stairwell 02 trigger and wait for it
sh02_set_trigger(sh02_trigger.stairwell02)
while not sh02_check_trigger(sh02_trigger.stairwell02) do
thread_yield()
end
-- Set Stairwell 03 trigger and wait for it
sh02_set_trigger(sh02_trigger.stairwell03)
while not sh02_check_trigger(sh02_trigger.stairwell03) do
thread_yield()
end
-- Set Stairwell 04 trigger and wait for it
sh02_set_trigger(sh02_trigger.stairwell04)
while not sh02_check_trigger(sh02_trigger.stairwell04) do
thread_yield()
end
-- Cleanup Checkpoint 01/02 enemies
sh02_cleanup_enemies_chkpnt01()
sh02_cleanup_enemies_chkpnt02()
-- Cleanup remaining npcs
sh02_cleanup_npcs()
-- Reset Checkpoint 03 doors
sh02_reset_doors_chkpnt03()
-- Stop chatter/convo threads
sh02_stop_chatter_thread()
sh02_stop_convo_thread()
-- Goto next checkpoint
current_checkpoint = SH02_CHECKPOINT_BASEMENT
mission_set_checkpoint(SH02_CHECKPOINT_BASEMENT, true)
end
-- Run the mission from the Basement checkpoint
if (current_checkpoint == SH02_CHECKPOINT_BASEMENT) then
-- Cleanup player(s) being drugged
sh02_cleanup_player_drugged()
-- Set Morningstar notoriety (2.0)
notoriety_set("Morningstar", 2.0)
notoriety_set_min("Morningstar", 2.0)
-- Clear persona situation override (Drugged).
persona_clear_global_situation_override()
-- Set persona situation override (Brutella).
persona_set_global_situation_override(PS_OVERRIDE_SH02_BRUTE)
-- Have Jailcell 01 guards leash to navpoints
sh02_group_leash_to(sh02_group.jailcell01_guards, NAV_LEASH02, 4.0)
-- Objective: Go To The Security Center
sh02_show_objective_loc(SH02_OBJ_BASEMENT)
-- Set Jailcell 01-01 trigger
sh02_set_trigger(sh02_trigger.jailcell01_01)
-- Set Free Hos 01 trigger and wait for it
sh02_set_trigger(sh02_trigger.freehos01)
while not sh02_check_trigger(sh02_trigger.freehos01) do
thread_yield()
end
-- Zimos: "Shit, we can't leave them like this. I say we let 'em out."
sh02_play_persona_line(sh02_persona.helphos)
-- Set Override 02 trigger
sh02_set_trigger(sh02_trigger.override02)
sh02_prompt01 = effect_play_finisher(NAV_HACKING[2], 2.5)
-- Wait until Jailcell 01-01 trigger is reached
while not sh02_check_trigger(sh02_trigger.jailcell01_01) do
thread_yield()
end
-- Have all hos leash to next navpoint
sh02_hos_nav = 4
sh02_all_hos_leash_to(7.5, NAV_HOS[sh02_hos_nav])
-- Set Jailcell 01-02 trigger and wait for it
sh02_set_trigger(sh02_trigger.jailcell01_02)
while not sh02_check_trigger(sh02_trigger.jailcell01_02) do
thread_yield()
end
-- Have all hos leash to next navpoint
sh02_hos_nav = 5
sh02_all_hos_leash_to(5.0, NAV_HOS[sh02_hos_nav])
-- Stop Jailcell 01 continuous spawning
sh02_jailcell01_spawn_stop_thd()
-- Have Jailcell 02 guards leash to navpoints
sh02_group_leash_to(sh02_group.jailcell02_guards, NAV_LEASH03, 4.0)
-- Set Jailcell 02-01 trigger
sh02_set_trigger(sh02_trigger.jailcell02_01)
-- Set Free Hos 02 trigger and wait for it
sh02_set_trigger(sh02_trigger.freehos02)
while not sh02_check_trigger(sh02_trigger.freehos02) do
thread_yield()
end
-- Wait until Jailcell 02-01 trigger is reached
while not sh02_check_trigger(sh02_trigger.jailcell02_01) do
thread_yield()
end
-- Have all hos leash to next navpoint
sh02_hos_nav = 6
sh02_all_hos_leash_to(7.5, NAV_HOS[sh02_hos_nav])
-- Set Jailcell 02-02 trigger and wait for it
sh02_set_trigger(sh02_trigger.jailcell02_02)
while not sh02_check_trigger(sh02_trigger.jailcell02_02) do
thread_yield()
end
-- Have all hos leash to next navpoint
sh02_hos_nav = 7
sh02_all_hos_leash_to(7.5, NAV_HOS[sh02_hos_nav])
-- Cleanup Checkpoint 03 enemies
sh02_cleanup_enemies_chkpnt03()
-- Reset Checkpoint 04 doors
sh02_reset_doors_chkpnt04()
-- Goto next checkpoint
current_checkpoint = SH02_CHECKPOINT_CLEAN_HOUSE
mission_set_checkpoint(SH02_CHECKPOINT_CLEAN_HOUSE, true)
end
-- Run the mission from Clean House checkpoint
if (current_checkpoint == SH02_CHECKPOINT_CLEAN_HOUSE) then
-- Set Morningstar notoriety (3.0)
notoriety_set("Morningstar", 3.0)
notoriety_set_min("Morningstar", 3.0)
-- Have Jailcell 03 guards leash to navpoints
sh02_group_leash_to(sh02_group.jailcell03_guards, NAV_LEASH04, 4.0)
-- Player/Zimos: "Don't expect me to be down with doin' this again. It's a one time thing."
sh02_start_convo_thread(sh02_convo.combat03)
-- Objective: Go To The Security Center
sh02_show_objective_loc(SH02_OBJ_BASEMENT)
-- Set Jailcell 03-01 trigger and wait for it
sh02_set_trigger(sh02_trigger.jailcell03_01)
while not sh02_check_trigger(sh02_trigger.jailcell03_01) do
thread_yield()
end
-- Have all hos leash to last navpoint
sh02_hos_nav = 8
sh02_all_hos_leash_to(10.0, NAV_HOS[sh02_hos_nav])
-- Set Jailcell 03-02 trigger and wait for it
sh02_set_trigger(sh02_trigger.jailcell03_02)
while not sh02_check_trigger(sh02_trigger.jailcell03_02) do
thread_yield()
end
-- Zimos: "Override these doors and let's keep movin'."
sh02_play_persona_line(sh02_persona.override02)
-- Objective: Disable Security
sh02_show_objective_use(SH02_OBJ_OVERRIDE)
-- Set Backroom trigger.
sh02_set_trigger(sh02_trigger.backroom)
-- Set Override 04 trigger and wait for it
sh02_set_trigger(sh02_trigger.override04)
while not sh02_check_trigger(sh02_trigger.override04) do
thread_yield()
end
-- Stop Jailcell 03 continuous spawning
sh02_jailcell03_spawn_stop_thd()
-- Create Jailcell 03 final
sh02_setup_jailcell03_final()
-- Setup Jailcell 03 guards/wave as must kill
sh02_enemies_must_kill(sh02_group.jailcell03_guards)
sh02_enemies_must_kill(sh02_group.jailcell03_wave)
-- Open Spawn 04 door
door_open(sh02_door.spawn04)
-- Objective: Eliminate Morningstar
sh02_show_objective_kill(SH02_OBJ_CLEAN_HOUSE)
-- Wait until Morningstar are dead
while (sh02_guys_killed > 0) do
thread_yield()
end
-- Player/Zimos: "Time to go after their head of security, only�"
sh02_start_convo_thread(sh02_convo.kill_brute)
-- Objective: Head To The Garage
sh02_show_objective_loc(SH02_OBJ_GARAGE)
-- Open Garage door
door_open(sh02_door.garage, true)
-- Set Garage Trigger and wait for it
sh02_set_trigger(sh02_trigger.garage)
while not sh02_check_trigger(sh02_trigger.garage) do
thread_yield()
end
-- Fade out
fade_out(0.5)
fade_out_block()
-- Cleanup Checkpoint 04 enemies
sh02_cleanup_enemies_chkpnt04()
-- Reset Checkpoint 05 doors
sh02_reset_doors_chkpnt05()
-- Stop chatter/convo threads
sh02_stop_chatter_thread()
sh02_stop_convo_thread(sh02_convo.kill_brute)
-- Goto next checkpoint
current_checkpoint = SH02_CHECKPOINT_KILL_BRUTE
mission_set_checkpoint(SH02_CHECKPOINT_KILL_BRUTE, true)
end
-- Run the mission from Kill Brute checkpoint
if (current_checkpoint == SH02_CHECKPOINT_KILL_BRUTE) then
-- Set Morningstar notoriety (4.0)
notoriety_set("Morningstar", 4.0)
notoriety_set_min("Morningstar", 4.0)
-- Clear persona situation override (Brutella).
persona_clear_global_situation_override()
-- Spawn Garage vehicles
group_create(sh02_group.garage_vehicles, true)
-- Play Brute CTE
cutscene_in()
group_create(sh02_group.cte_npcs.name, true)
cutscene_play(SH02_CUTSCENE_BRUTE_CTE, nil, nil, false)
group_destroy(sh02_group.cte_npcs.name)
cutscene_out()
-- Setup Garage brute
sh02_setup_garage_brute()
-- Teleport player(s)/Zimos to Garage
sh02_teleport_to_chkpnt(NAV_CHKPNT05)
-- Reset Checkpoint 05 doors
sh02_reset_doors_chkpnt05()
-- Fade in
fade_in(0.5)
fade_in_block()
-- Objective: Kill Brute
sh02_show_objective_kill(SH02_OBJ_KILL_BRUTE)
-- Wait until Brute is dead
while not sh02_brute_killed do
thread_yield()
end
-- Wait some time
delay(4.0)
end
-- Teleport player(s) to final positions
--fade_out(0.5)
--fade_out_block()
--teleport_coop(NAV_FINAL[1], NAV_FINAL[2], true)
-- Complete mission
mission_end_success("sh02")
end
-- Initialize the mission for the specified checkpoint
-- checkpoint: checkpoint to initialize the mission to
function sh02_initialize(checkpoint)
-- Make sure the screen is completly faded out
mission_start_fade_out(0.0)
-- Common initialization
sh02_initialize_common()
-- Checkpoint specific initialization
sh02_initialize_checkpoint(checkpoint)
-- Start fading in
mission_start_fade_in()
end
-- Handle any common initialization
function sh02_initialize_common()
-- Set the mission author
set_mission_author("Nicholas Zippmann")
-- Reset doors
sh02_reset_doors()
-- Set in co-op status
sh02_in_coop = coop_is_active()
-- Clear any hanging text
objective_text_clear(0)
-- Remove player(s) clothes
players_naked()
-- Allow max followers
party_allow_max_followers(true)
-- Make sure not to auto-spawn cops/gangs
notoriety_force_no_spawn("police", true)
notoriety_force_no_spawn("morningstar", true)
-- Setup players cancel warp locations
mission_set_cancel_warp_location(NAV_CANCEL[1], NAV_CANCEL[2])
end
-- Checkpoint specific initialization
-- checkpoint: the checkpoint to be initialized
function sh02_initialize_checkpoint(checkpoint)
-- Initialize the mission from the beginning
if (checkpoint == SH02_CHECKPOINT_START) then
-- Remove player(s) weapons
inv_weapon_disable_all_slots(true)
-- Setup player(s) being drugged (strongest)
sh02_setup_player_drugged(1.0)
-- Create homies (Zimos)
group_create(sh02_group.homies.name, true)
-- Teleport player(s)/Zimos to Auction Room
sh02_teleport_to_chkpnt(NAV_CHKPNT01)
-- Reset Checkpoint 01 doors
sh02_reset_doors_chkpnt01()
-- Set persona situation override (Drugged).
persona_set_global_situation_override(PS_OVERRIDE_SH02)
end
-- Initialize the mission from the Collection Room checkpoint
if (checkpoint == SH02_CHECKPOINT_COLLECTION) then
-- Setup player(s) being drugged (medium)
sh02_setup_player_drugged(0.5)
-- Setup homies (Zimos)
sh02_setup_homies()
-- Teleport player(s)/Zimos to Collection Room
sh02_teleport_to_chkpnt(NAV_CHKPNT02)
-- Reset Checkpoint 02 doors
sh02_reset_doors_chkpnt02()
-- Set Morningstar notoriety (1.0)
notoriety_set("Morningstar", 1.0)
notoriety_set_min("Morningstar", 1.0)
-- Start alarms
sh02_start_alarms()
-- Set persona situation override (Drugged).
persona_set_global_situation_override(PS_OVERRIDE_SH02)
end
-- Initialize the mission from the Basement checkpoint
if (checkpoint == SH02_CHECKPOINT_BASEMENT) then
-- Cleanup player(s) being drugged
sh02_cleanup_player_drugged()
-- Setup homies (Zimos)
sh02_setup_homies()
-- Create Jailcell 01 guards/hos
sh02_setup_jailcell01_npcs()
-- Teleport player(s)/Zimos to Jail Cell Area
sh02_teleport_to_chkpnt(NAV_CHKPNT03)
-- Reset Checkpoint 03 doors
sh02_reset_doors_chkpnt03()
-- Set Morningstar notoriety (2.0)
notoriety_set("Morningstar", 2.0)
notoriety_set_min("Morningstar", 2.0)
-- Start alarms
sh02_start_alarms()
-- Set persona situation override (Brutella).
persona_set_global_situation_override(PS_OVERRIDE_SH02_BRUTE)
end
-- Initialize the mission from the Clean House checkpoint
if (checkpoint == SH02_CHECKPOINT_CLEAN_HOUSE) then
-- Setup homies (Zimos)
sh02_setup_homies()
-- Create Jailcell 03 guards/hos
sh02_setup_jailcell03_npcs()
-- Teleport player(s)/Zimos to Garage
sh02_teleport_to_chkpnt(NAV_CHKPNT04)
-- Reset Checkpoint 04 doors
sh02_reset_doors_chkpnt04()
-- Set Morningstar notoriety (3.0)
notoriety_set("Morningstar", 3.0)
notoriety_set_min("Morningstar", 3.0)
-- Set persona situation override (Brutella).
persona_set_global_situation_override(PS_OVERRIDE_SH02_BRUTE)
end
-- Initialize the mission from the Kill Brute checkpoint
if (checkpoint == SH02_CHECKPOINT_KILL_BRUTE) then
-- Fade out
fade_out(0.5)
fade_out_block()
-- Setup homies (Zimos)
sh02_setup_homies()
-- Teleport player(s)/Zimos to Garage
sh02_teleport_to_chkpnt(NAV_CHKPNT05)
-- Reset Checkpoint 05 doors
sh02_reset_doors_chkpnt05()
-- Set Morningstar notoriety (4.0)
notoriety_set("Morningstar", 4.0)
notoriety_set_min("Morningstar", 4.0)
end
end
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
-- This is the primary function responsible for cleaning up the entire mission
function sh02_cleanup()
-- Cleanup NPCs
sh02_cleanup_homies()
sh02_cleanup_enemies()
sh02_cleanup_hos()
sh02_cleanup_npcs()
-- Cleanup spawn regions/groups
sh02_cleanup_spawn_regions()
sh02_cleanup_spawn_groups()
-- Clear triggers
sh02_clear_triggers()
-- Remove y-prompts, if needed
if (sh02_prompt01 ~= -1) then
effect_stop(sh02_prompt01)
sh02_prompt01 = -1
end
if (sh02_prompt02 ~= -1) then
effect_stop(sh02_prompt02)
sh02_prompt02 = -1
end
-- Reset doors
sh02_reset_doors()
-- Cleanup conversations
cleanup_conversations(sh02_convo)
-- Cleanup threads
cleanup_threads(sh02_thread)
-- Clear ragdoll last resort position
character_ragdoll_clear_last_resort_position()
-- Give back player(s) weapons and clothes
inv_weapon_disable_all_slots(false)
customization_item_revert()
-- Clear player(s) being drugged
sh02_cleanup_player_drugged()
-- Disallow max followers
party_allow_max_followers(false)
-- Allow notoriety spawning again
notoriety_force_no_spawn("police", false)
notoriety_force_no_spawn("morningstar", false)
-- Stop alarms
sh02_stop_alarms()
-- Clear persona situation override (Drugged/Brutella).
persona_clear_global_situation_override()
end
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)
-- Called when the mission has ended with success
function sh02_success()
local skip_teleport = true
sh02_coop_skip(skip_teleport)
teleport( LOCAL_PLAYER, NAV_FINAL[1] )
if coop_is_active() == true then
teleport( REMOTE_PLAYER, NAV_FINAL[2] )
end
end
-- ***************************************************
-- SH02 Setup Functions
-- ***************************************************
-- Setup homies
function sh02_setup_homies()
if not group_is_loaded(sh02_group.homies) then
group_create(sh02_group.homies.name, true)
end
sh02_zimos_join_player()
end
-- Setup Checkpoint 01 NPCs
function sh02_setup_collection_guards()
if not group_is_loaded(sh02_group.collection_guards.name) then
group_create(sh02_group.collection_guards.name, true)
end
sh02_enemies_join_fight(sh02_group.collection_guards)
end
-- Setup Checkpoint 02 NPCs
function sh02_setup_collection_hos()
group_create(sh02_group.collection_hos.name, true)
sh02_hos_join_player(sh02_group.collection_hos, true)
sh02_hos_leash_to(sh02_group.collection_hos, 6.0, NAV_HOS[sh02_hos_nav])
end
function sh02_setup_collection_wave()
group_create(sh02_group.collection_wave.name, true)
sh02_enemies_join_fight(sh02_group.collection_wave)
sh02_group_move_to(sh02_group.collection_wave, NAV_COLLECTION, 2.0)
end
function sh02_setup_lounge_enemies()
group_create(sh02_group.lounge_guards.name, true)
sh02_enemies_join_fight(sh02_group.lounge_guards)
group_create(sh02_group.lounge_snipers.name, true)
sh02_enemies_join_fight(sh02_group.lounge_snipers)
end
function sh02_setup_lounge_flee01_npcs()
if not group_is_loaded(sh02_group.lounge_flee01.name) then
group_create(sh02_group.lounge_flee01.name, true)
end
sh02_group_flee_to(sh02_group.lounge_flee01, "nav_flee", 1.0)
door_open(sh02_door.flee01, true)
end
function sh02_setup_lounge_flee02_npcs()
if not group_is_loaded(sh02_group.lounge_flee02.name) then
group_create(sh02_group.lounge_flee02.name, true)
end
sh02_group_flee_to(sh02_group.lounge_flee02, "nav_flee", 1.0)
door_open(sh02_door.flee02, true)
end
function sh02_setup_lounge_flee03_npcs()
if not group_is_loaded(sh02_group.lounge_flee03.name) then
group_create(sh02_group.lounge_flee03.name, true)
end
sh02_group_flee_to(sh02_group.lounge_flee03, "nav_flee", 1.0)
door_open(sh02_door.flee03)
end
function sh02_setup_lounge_flee04_npcs()
if not group_is_loaded(sh02_group.lounge_flee04.name) then
group_create(sh02_group.lounge_flee04.name, true)
end
sh02_group_flee_to(sh02_group.lounge_flee04, "nav_flee", 1.0)
door_open(sh02_door.flee04)
end
-- Setup Checkpoint 03 NPCs
function sh02_setup_jailcell01_npcs()
if not group_is_loaded(sh02_group.jailcell01_guards.name)then
group_create(sh02_group.jailcell01_guards.name, true)
end
sh02_enemies_join_fight(sh02_group.jailcell01_guards)
if not group_is_loaded(sh02_group.jailcell01_hos.name) then
group_create(sh02_group.jailcell01_hos.name, true)
end
sh02_hos_incarcerate(sh02_group.jailcell01_hos)
end
function sh02_setup_jailcell01_wave()
if not group_is_loaded(sh02_group.jailcell01_wave.name) then
group_create(sh02_group.jailcell01_wave.name, true)
end
sh02_enemies_join_fight(sh02_group.jailcell01_wave)
sh02_group_move_to(sh02_group.jailcell01_wave, NAV_JAILCELL01, 2.0)
end
function sh02_setup_jailcell02_npcs()
if not group_is_loaded(sh02_group.jailcell02_guards.name) then
group_create(sh02_group.jailcell02_guards.name, true)
end
sh02_enemies_join_fight(sh02_group.jailcell02_guards)
if not group_is_loaded(sh02_group.jailcell02_brutella.name) then
group_create(sh02_group.jailcell02_brutella.name, true)
end
npc_combat_enable(sh02_group.jailcell02_brutella.members[1], false)
wander_start(sh02_group.jailcell02_brutella.members[1], nil, 8)
if not group_is_loaded(sh02_group.jailcell02_hos.name)then
group_create(sh02_group.jailcell02_hos.name, true)
end
sh02_hos_incarcerate(sh02_group.jailcell02_hos)
end
function sh02_setup_jailcell02_wave()
if not group_is_loaded(sh02_group.jailcell02_wave.name) then
group_create(sh02_group.jailcell02_wave.name, true)
end
sh02_enemies_join_fight(sh02_group.jailcell02_wave)
sh02_group_move_to(sh02_group.jailcell02_wave, NAV_JAILCELL02, 2.0)
end
-- Setup Checkpoint 04 NPCs
function sh02_setup_jailcell03_npcs()
if not group_is_loaded(sh02_group.jailcell03_guards.name)then
group_create(sh02_group.jailcell03_guards.name, true)
end
sh02_enemies_join_fight(sh02_group.jailcell03_guards)
if not group_is_loaded(sh02_group.jailcell03_hos.name) then
group_create(sh02_group.jailcell03_hos.name, true)
end
sh02_hos_incarcerate(sh02_group.jailcell03_hos)
end
function sh02_setup_jailcell03_wave()
if not group_is_loaded(sh02_group.jailcell03_wave.name)then
group_create(sh02_group.jailcell03_wave.name, true)
end
sh02_enemies_join_fight(sh02_group.jailcell03_wave)
sh02_group_move_to(sh02_group.jailcell03_wave, NAV_JAILCELL03, 2.0)
end
function sh02_setup_jailcell03_final()
group_create(sh02_group.jailcell03_final.name, true)
sh02_enemies_join_fight(sh02_group.jailcell03_final)
sh02_enemies_must_kill(sh02_group.jailcell03_final)
sh02_group_move_to(sh02_group.jailcell03_final, NAV_JAILCELL03, 2.0)
end
-- Setup Checkpoint 05 NPCs
function sh02_setup_garage_vehicles()
group_create(sh02_group.garage_vehicles, true)
end
function sh02_setup_garage_brute()
group_create(sh02_group.garage_brute.name, true)
sh02_brute_must_kill(sh02_group.garage_brute.members[1])
end
-- ***************************************************
-- SH02 Cleanup Functions
-- ***************************************************
-- Cleanup homies
function sh02_cleanup_homies()
sh02_zimos_leave_player()
if group_is_loaded(sh02_group.homies) then
group_destroy(sh02_group.homies)
end
end
-- Cleanup enemies
function sh02_cleanup_enemies_chkpnt01()
if group_is_loaded(sh02_group.collection_guards) then
sh02_enemies_leave_fight(sh02_group.collection_guards)
release_to_world(sh02_group.collection_guards.name)
end
end
function sh02_cleanup_enemies_chkpnt02()
if group_is_loaded(sh02_group.collection_wave) then
sh02_enemies_leave_fight(sh02_group.collection_wave)
release_to_world(sh02_group.collection_wave.name)
end
if group_is_loaded(sh02_group.lounge_guards) then
sh02_enemies_leave_fight(sh02_group.lounge_guards)
release_to_world(sh02_group.lounge_guards.name)
end
if group_is_loaded(sh02_group.lounge_snipers) then
sh02_enemies_leave_fight(sh02_group.lounge_snipers)
release_to_world(sh02_group.lounge_snipers.name)
end
end
function sh02_cleanup_enemies_chkpnt03()
if group_is_loaded(sh02_group.jailcell01_guards) then
sh02_enemies_leave_fight(sh02_group.jailcell01_guards)
release_to_world(sh02_group.jailcell01_guards.name)
end
if group_is_loaded(sh02_group.jailcell01_wave) then
sh02_enemies_leave_fight(sh02_group.jailcell01_wave)
release_to_world(sh02_group.jailcell01_wave.name)
end
if group_is_loaded(sh02_group.jailcell02_guards) then
sh02_enemies_leave_fight(sh02_group.jailcell02_guards)
release_to_world(sh02_group.jailcell02_guards.name)
end
if group_is_loaded(sh02_group.jailcell02_wave) then
sh02_enemies_leave_fight(sh02_group.jailcell02_wave)
release_to_world(sh02_group.jailcell02_wave.name)
end
end
function sh02_cleanup_enemies_chkpnt04()
if group_is_loaded(sh02_group.jailcell03_guards) then
sh02_enemies_leave_fight(sh02_group.jailcell03_guards)
sh02_enemies_kill_done(sh02_group.jailcell03_guards)
group_destroy(sh02_group.jailcell03_guards)
end
if group_is_loaded(sh02_group.jailcell03_wave) then
sh02_enemies_leave_fight(sh02_group.jailcell03_wave)
sh02_enemies_kill_done(sh02_group.jailcell03_wave)
group_destroy(sh02_group.jailcell03_wave)
end
if group_is_loaded(sh02_group.jailcell03_final) then
sh02_enemies_leave_fight(sh02_group.jailcell03_final)
sh02_enemies_kill_done(sh02_group.jailcell03_final)
group_destroy(sh02_group.jailcell03_final)
end
end
function sh02_cleanup_enemies_chkpnt05()
if group_is_loaded(sh02_group.garage_vehicles) then
group_destroy(sh02_group.garage_vehicles)
end
if group_is_loaded(sh02_group.garage_brute) then
sh02_brute_kill_done(sh02_group.garage_brute.members[1])
group_destroy(sh02_group.garage_brute)
end
end
function sh02_cleanup_enemies()
sh02_cleanup_enemies_chkpnt01()
sh02_cleanup_enemies_chkpnt02()
sh02_cleanup_enemies_chkpnt03()
sh02_cleanup_enemies_chkpnt04()
sh02_cleanup_enemies_chkpnt05()
end
-- Cleanup hos
function sh02_cleanup_hos()
if group_is_loaded(sh02_group.collection_hos) then
sh02_hos_leave_player(sh02_group.collection_hos)
group_destroy(sh02_group.collection_hos)
end
if group_is_loaded(sh02_group.jailcell01_hos) then
sh02_hos_leave_player(sh02_group.jailcell01_hos)
group_destroy(sh02_group.jailcell01_hos)
end
if group_is_loaded(sh02_group.jailcell02_brutella) then
sh02_hos_leave_player(sh02_group.jailcell02_brutella)
group_destroy(sh02_group.jailcell02_brutella)
end
if group_is_loaded(sh02_group.jailcell02_hos) then
sh02_hos_leave_player(sh02_group.jailcell02_hos)
group_destroy(sh02_group.jailcell02_hos)
end
if group_is_loaded(sh02_group.jailcell03_hos) then
sh02_hos_leave_player(sh02_group.jailcell03_hos)
group_destroy(sh02_group.jailcell03_hos)
end
end
-- Cleanup npcs
function sh02_cleanup_npcs()
if group_is_loaded(sh02_group.lounge_flee01) then
release_to_world(sh02_group.lounge_flee01.name)
end
if group_is_loaded(sh02_group.lounge_flee02) then
release_to_world(sh02_group.lounge_flee02.name)
end
if group_is_loaded(sh02_group.lounge_flee03) then
release_to_world(sh02_group.lounge_flee03.name)
end
if group_is_loaded(sh02_group.lounge_flee04) then
release_to_world(sh02_group.lounge_flee04.name)
end
end
-- Cleanup spawn regions/groups
function sh02_cleanup_spawn_regions()
spawn_region_enable(sh02_spawn.lounge, false)
spawn_region_enable(sh02_spawn.jailcell01, false)
spawn_region_enable(sh02_spawn.jailcell02, false)
spawn_region_enable(sh02_spawn.jailcell03, false)
spawn_region_enable(sh02_spawn.stairwell, false)
end
function sh02_cleanup_spawn_groups()
continuous_spawn_stop(sh02_group.cont_spawn01.name)
continuous_spawn_stop(sh02_group.cont_spawn02.name)
continuous_spawn_stop(sh02_group.cont_spawn03.name)
continuous_spawn_stop(sh02_group.cont_spawn04.name)
continuous_spawn_stop(sh02_group.cont_spawn05.name)
continuous_spawn_stop(sh02_group.cont_spawn06.name)
end
-- Reset doors
function sh02_reset_doors_locked()
mesh_mover_reset("door_locked<001>")
door_close("door_locked<001>", false)
door_lock("door_locked<001>", true)
mesh_mover_reset("door_locked<002>")
door_close("door_locked<002>", false)
door_lock("door_locked<002>", true)
mesh_mover_reset("door_locked<003>")
door_close("door_locked<003>", false)
door_lock("door_locked<003>", true)
end
function sh02_reset_doors_chkpnt01()
mesh_mover_reset(sh02_door.auction)
door_close(sh02_door.auction, false)
door_lock(sh02_door.auction, true)
end
function sh02_reset_doors_chkpnt02()
mesh_mover_reset(sh02_door.coll_hos)
door_close(sh02_door.coll_hos, false)
door_lock(sh02_door.coll_hos, true)
mesh_mover_reset(sh02_door.coll_out)
door_close(sh02_door.coll_out, false)
door_lock(sh02_door.coll_out, true)
mesh_mover_reset(sh02_door.flee01)
door_close(sh02_door.flee01, false)
door_lock(sh02_door.flee01, true)
mesh_mover_reset(sh02_door.flee02)
door_close(sh02_door.flee02, false)
door_lock(sh02_door.flee02, true)
mesh_mover_reset(sh02_door.flee03)
door_close(sh02_door.flee03, false)
door_lock(sh02_door.flee03, true)
mesh_mover_reset(sh02_door.flee04)
door_close(sh02_door.flee04, false)
door_lock(sh02_door.flee04, true)
mesh_mover_reset(sh02_door.stairwell)
door_close(sh02_door.stairwell, false)
door_lock(sh02_door.stairwell, true)
end
function sh02_reset_doors_chkpnt03()
mesh_mover_reset(sh02_door.cells01)
door_close(sh02_door.cells01, false)
door_lock(sh02_door.cells01, true)
mesh_mover_reset(sh02_door.spawn01)
door_close(sh02_door.spawn01, false)
door_lock(sh02_door.spawn01, true)
mesh_mover_reset(sh02_door.cells02)
door_close(sh02_door.cells02, false)
door_lock(sh02_door.cells02, true)
mesh_mover_reset(sh02_door.spawn02)
door_close(sh02_door.spawn02, false)
door_lock(sh02_door.spawn02, true)
end
function sh02_reset_doors_chkpnt04()
mesh_mover_reset(sh02_door.cells03)
door_close(sh02_door.cells03, false)
door_lock(sh02_door.cells03, true)
mesh_mover_reset(sh02_door.spawn03)
door_close(sh02_door.spawn03, false)
door_lock(sh02_door.spawn03, true)
mesh_mover_reset(sh02_door.spawn04)
door_close(sh02_door.spawn04, false)
door_lock(sh02_door.spawn04, true)
end
function sh02_reset_doors_chkpnt05()
mesh_mover_reset(sh02_door.garage)
door_close(sh02_door.garage, false)
door_lock(sh02_door.garage, true)
end
function sh02_reset_doors()
sh02_reset_doors_locked()
sh02_reset_doors_chkpnt01()
sh02_reset_doors_chkpnt02()
sh02_reset_doors_chkpnt03()
sh02_reset_doors_chkpnt04()
sh02_reset_doors_chkpnt05()
end
-- ***************************************************
-- SH02 Player Functions
-- ***************************************************
-- Teleport player(s)/Zimos to checkpoint
function sh02_teleport_to_chkpnt(navpoints)
teleport_coop(navpoints[1], navpoints[2], true)
teleport(sh02_zimos, navpoints[3])
character_ragdoll_set_last_resort_position(navpoints[1])
end
-- Setup player(s) being drugged
function sh02_setup_player_drugged(scalar)
drug_effect_set_override_values(scalar, scalar)
if (scalar >= 1.0) then
refraction_situation_set("drug strong")
audio_object_post_event("sh02_drug_pitch", nil, nil, LOCAL_PLAYER)
elseif (scalar >= 0.75) then
refraction_situation_set("drug weak")
elseif (scalar >= 0.5) then
refraction_situation_set("drug weakest")
audio_object_post_event("sh02_drug_pitch_50", nil, nil, LOCAL_PLAYER)
elseif (scalar >= 0.25) then
refraction_situation_clear()
end
end
-- Cleanup player(s) being drugged
function sh02_cleanup_player_drugged()
refraction_situation_clear()
audio_object_post_event("sh02_drug_pitch_normal", nil, nil, LOCAL_PLAYER)
end
-- Have player hack a computer console
function sh02_player_hacking(player, navpoint, vomit)
--player_movement_disable(player)
if vomit then
action_play(player, "sh03 vomit hack", "sh03 vomit hack", false, 1.0, true, true, navpoint) --true, false, true, "", navpoint)
while action_play_is_finished( player, 1.0 ) == false do
thread_yield()
end
else
action_play(player, "m24 computer hack", "m24 computer hack", false, 1.0, true, true, navpoint)
while action_play_is_finished( player, 1.0 ) == false do
thread_yield()
end
end
--player_movement_enable(player)
end
-- Have player play vomit hack noises
function sh02_player_vomit_hack_noises()
delay(0.5)
audio_object_post_event("anim_plym_cmptr_hack", nil, nil, LOCAL_PLAYER)
delay(3.0)
audio_play_persona_line(LOCAL_PLAYER, "voc_vomit")
end
-- ***************************************************
-- SH02 NPC Functions
-- ***************************************************
-- Setup zimos to join player
function sh02_zimos_join_player()
party_add(sh02_zimos, LOCAL_PLAYER)
follower_set_can_abandon(sh02_zimos, true)
on_death("sh02_zimos_died_cb", sh02_zimos)
on_dismiss("sh02_zimos_abandoned_cb", sh02_zimos)
end
-- Setup zimos to leave player
function sh02_zimos_leave_player()
on_death("", sh02_zimos)
on_dismiss("", sh02_zimos)
end
-- Setup ho to be incarcerated
function sh02_ho_incarcerate(name)
npc_use_closest_action_node_of_type(name, "ColdHo", 1.0)
end
-- Setup ho group to be incarcerated
function sh02_hos_incarcerate(group)
for i, member in pairs(group.members) do
sh02_ho_incarcerate(member)
end
end
-- Setup ho to join player
function sh02_ho_join_player(name, armed)
set_team(name, "playas")
set_cant_flee_flag(name, true)
set_cant_cower_flag(name, true)
set_always_cower_flag(name, false)
ai_set_personality(name, "gang offensive")
character_use_synced_finishers(name, true)
if armed then
inv_item_add("dildo_bat", 1, name, false)
end
on_attack_performed("sh02_ho_attack_cb", name)
on_take_damage("sh02_ho_attacked_cb", name)
end
-- Setup ho group to join player
function sh02_hos_join_player(group, armed)
for i, member in pairs(group.members) do
sh02_ho_join_player(member, armed)
end
end
-- Setup ho to leash to player/navpoint
function sh02_ho_leash_to(name, dist, navpoint)
if (navpoint ~= nil) then
ai_attack_region(name, navpoint, dist)
else
npc_leash_to_object(name, LOCAL_PLAYER, dist)
end
end
-- Setup ho group to leash to player/navpoint
function sh02_hos_leash_to(group, dist, navpoint)
for i, member in pairs(group.members) do
sh02_ho_leash_to(member, dist, navpoint)
end
end
-- Setup all ho groups to leash to player/navpoint
function sh02_all_hos_leash_to(dist, navpoint)
if sh02_check_trigger(sh02_trigger.override01) then
if group_is_loaded(sh02_group.collection_hos) then
sh02_hos_leash_to(sh02_group.collection_hos, dist, navpoint)
end
end
if sh02_check_trigger(sh02_trigger.override02) then
if group_is_loaded(sh02_group.jailcell01_hos) then
sh02_hos_leash_to(sh02_group.jailcell01_hos, dist, navpoint)
end
end
if sh02_check_trigger(sh02_trigger.override03) then
if group_is_loaded(sh02_group.jailcell02_hos) then
sh02_hos_leash_to(sh02_group.jailcell02_hos, dist, navpoint)
end
end
if sh02_check_trigger(sh02_trigger.override04) then
if group_is_loaded(sh02_group.jailcell03_hos) then
sh02_hos_leash_to(sh02_group.jailcell03_hos, dist, navpoint)
end
end
end
-- Setup ho to leave player
function sh02_ho_leave_player(name)
set_cant_cower_flag(name, false)
set_cant_flee_flag(name, false)
npc_leash_remove(name)
on_attack_performed("", name)
on_take_damage("", name)
end
-- Setup ho group to leave player
function sh02_hos_leave_player(group)
for i, member in pairs(group.members) do
sh02_ho_leave_player(member)
end
end
-- Setup enemy to join fight
function sh02_enemy_join_fight(name)
set_cant_cower_flag(name, true)
set_cant_flee_flag(name, true)
on_attack_performed("sh02_enemy_attack_cb", name)
on_take_damage("sh02_enemy_attacked_cb", name)
end
-- Setup enemy group to join fight
function sh02_enemies_join_fight(group)
for i, member in pairs(group.members) do
sh02_enemy_join_fight(member)
end
end
-- Setup enemy to leave fight
function sh02_enemy_leave_fight(name)
set_cant_cower_flag(name, false)
set_cant_flee_flag(name, false)
on_attack_performed("", name)
on_take_damage("", name)
end
-- Setup enemy group to leave fight
function sh02_enemies_leave_fight(group)
for i, member in pairs(group.members) do
sh02_enemy_leave_fight(member)
end
end
-- Setup enemy as must kill
function sh02_enemy_must_kill(name)
if not character_is_dead(name) then
on_death("sh02_enemy_killed_cb", name)
marker_add(name, MINIMAP_ICON_KILL, OI_ASSET_KILL, OI_FLAGS_DEFAULT, SYNC_ALL)
sh02_guys_killed = sh02_guys_killed + 1
end
end
-- Setup enemy group as must kill
function sh02_enemies_must_kill(group)
for i, member in pairs(group.members) do
sh02_enemy_must_kill(member)
end
end
-- Cleanup enemy as must kill
function sh02_enemy_kill_done(name)
on_death("", name)
marker_remove(name, SYNC_ALL)
end
-- Cleanup enemy group as must kill
function sh02_enemies_kill_done(group)
for i, member in pairs(group.members) do
sh02_enemy_kill_done(member)
end
end
-- Setup brute as must kill
function sh02_brute_must_kill(name)
on_death("sh02_brute_killed_cb", name)
marker_add(name, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_DEFAULT, SYNC_ALL)
end
-- Cleanup brute as must kill
function sh02_brute_kill_done(name)
on_death("", name)
marker_remove(name, SYNC_ALL)
end
-- Setup group to move to nav points
function sh02_group_move_to(group, navpoints, stagger)
local wait = 0.0
for i, member in pairs(group.members) do
sh02_ai_move_to_thd(member, navpoints[i], wait)
wait = wait + stagger
end
end
-- Setup group to leash to nav points
function sh02_group_leash_to(group, navpoints, dist)
for i, member in pairs(group.members) do
npc_leash_to_nav(member, navpoints[i], dist)
--ai_attack_region(member, navpoints[i], dist)
end
end
-- Setup group to flee to nav point
function sh02_group_flee_to(group, navpoint, stagger)
local wait = 0.0
for i, member in pairs(group.members) do
npc_leash_to_nav(member, navpoint, 10.0)
override_npc_run_and_cower_run(member, "Cower Run", "Cower Run")
sh02_ai_move_to_thd(member, navpoint, wait)
wait = wait + stagger
end
end
--[[ SAVE: May need this for something...
-- Setup enemy to start attacking player
function sh02_enemy_start_attack(name)
set_ignore_ai_flag(name, false)
set_attack_player_flag(name, true)
set_attack_enemies_flag(name, true)
set_always_sees_player_flag(name, true)
end
]]--
-- ***************************************************
-- SH02 Attack/Death/Abandon Callbacks
-- ***************************************************
-- Zimos died callback
function sh02_zimos_died_cb()
mission_end_failure("sh02", SH02_FAILURE_ZIMOS_DIED)
end
-- Zimos abandoned callback
function sh02_zimos_abandoned_cb()
mission_end_failure("sh02", SH02_FAILURE_ABANDON_ZIMOS)
end
-- Enemy attack callback
function sh02_enemy_attack_cb(name, weapon, attack)
-- Check if Morningstar wait thread is done
if not sh02_check_ms_wait_thread() then
return
end
-- Start Morningstar wait thread
sh02_start_ms_wait_thread(10.0)
-- Morningstar: Mission specific attack lines
sh02_persona.ms_attack.speaker = name
sh02_play_persona_line(sh02_persona.ms_attack)
end
-- Enemy attacked callback
function sh02_enemy_attacked_cb(attackee, attacker, hp)
-- Check if player(s)/Zimos aren't attacker
if not (attacker == LOCAL_PLAYER)
and not (attacker == REMOTE_PLAYER)
and not (attacker == sh02_zimos) then
-- Check if Morningstar wait thread is done
if not sh02_check_ms_wait_thread() then
return
end
-- Start Morningstar wait thread
sh02_start_ms_wait_thread(10.0)
-- Morningstar: Attacked lines when ho attacks
sh02_persona.ms_attacked.speaker = attackee
sh02_play_persona_line(sh02_persona.ms_attacked)
end
end
-- Enemy killed callback
function sh02_enemy_killed_cb(name)
sh02_enemy_kill_done(name)
sh02_guys_killed = sh02_guys_killed - 1
end
-- Brute killed callback
function sh02_brute_killed_cb(name)
sh02_brute_kill_done(name)
sh02_brute_killed = true
end
-- Ho attack callback
function sh02_ho_attack_cb(name, weapon, attack)
-- Check if Ho wait thread is done
if not sh02_check_ho_wait_thread() then
return
end
-- Start Ho wait thread
sh02_start_ho_wait_thread(10.0)
-- Ho: Attack lines when attacking Morningstar
sh02_persona.ho_attack.speaker = name
sh02_play_persona_line(sh02_persona.ho_attack)
end
-- Ho attacked callback
function sh02_ho_attacked_cb(attackee, attacker, hp)
-- Check if player(s) are attacker
if (attacker == LOCAL_PLAYER)
or (attacker == REMOTE_PLAYER) then
-- Zimos: "What are you doing!?"
sh02_start_chatter_thread(sh02_chatter.ho_killed, 0.0, 0.0)
end
end
-- ***************************************************
-- SH02 Trigger Functions
-- ***************************************************
-- Set trigger according to type
function sh02_set_trigger(trigger)
trigger.triggered = false
trigger_enable(trigger.name, true)
if (trigger.style == TRIG_LOC) then
marker_add_trigger(trigger.name, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL)
elseif (trigger.style == TRIG_USE_LOC) then
marker_add(trigger.name, MINIMAP_ICON_USE, OI_ASSET_USE, OI_FLAGS_FULL)
end
on_trigger(trigger.callback, trigger.name)
end
-- Check if trigger has been triggered
function sh02_check_trigger(trigger)
return trigger.triggered
end
-- Set trigger as triggered
function sh02_set_triggered(trigger)
trigger.triggered = true
end
-- Clear trigger according to type
function sh02_clear_trigger(trigger, clear_obj)
if (trigger.style == TRIG_USE_LOC) then
marker_remove(trigger.name)
end
on_trigger("", trigger.name)
trigger_enable(trigger.name, false)
marker_remove_trigger(trigger.name, SYNC_ALL)
mission_waypoint_remove()
if (trigger.style == TRIG_LOC)
or (trigger.style == TRIG_USE_LOC) then
waypoint_remove(SYNC_ALL)
if not (clear_obj == nil) and clear_obj then
objective_text_clear(0)
end
end
end
-- Clear triggers according to type
function sh02_clear_triggers()
for i, trigger in pairs(sh02_trigger) do
sh02_clear_trigger(trigger)
sh02_set_triggered(trigger)
end
end
-- ***************************************************
-- SH02 Trigger Callbacks
-- ***************************************************
-- Collection 01 trigger callback
function sh02_collection01_cb()
sh02_clear_trigger(sh02_trigger.collection01)
-- Setup player(s) being drugged (strong)
sh02_setup_player_drugged(0.75)
-- Have player(s) stumble to ground
sh02_players_stumble_thd()
-- Setup Collection guards
sh02_setup_collection_guards()
-- Wait until player/Zimos are done speaking
while sh02_conversation_playing() do
thread_yield()
end
-- Zimos: "We'll have to shut down security. Should be up ahead."
sh02_play_persona_line(sh02_persona.follow)
sh02_set_triggered(sh02_trigger.collection01)
end
-- Collection 02 trigger callback
function sh02_collection02_cb()
sh02_clear_trigger(sh02_trigger.collection02)
-- Wait some time
delay(2.0)
-- Set Morningstar notoriety (1.0)
notoriety_set("Morningstar", 1.0)
notoriety_set_min("Morningstar", 1.0)
-- Start alarms
sh02_start_alarms()
-- Wait some time
delay(2.0)
-- Wait until player/Zimos are done speaking
while sh02_persona_line_playing()
or sh02_conversation_playing() do
thread_yield()
end
-- Zimos: "Find somethin' to shut off those alarms."
sh02_play_persona_line(sh02_persona.unlock)
-- Clear Collection 03 trigger
sh02_clear_trigger(sh02_trigger.collection03)
-- Objective: Disable Security
sh02_show_objective_use(SH02_OBJ_OVERRIDE)
-- Set Override 01 trigger
sh02_set_trigger(sh02_trigger.override01)
sh02_set_triggered(sh02_trigger.collection02)
end
-- Collection 03 trigger callback
function sh02_collection03_cb()
sh02_clear_trigger(sh02_trigger.collection03)
sh02_set_triggered(sh02_trigger.collection03)
end
-- Override 01 trigger callback
function sh02_override01_cb(player)
sh02_clear_trigger(sh02_trigger.override01, true)
-- Have player do vomit hack animation
player_movement_disable(player)
thread_new("sh02_player_vomit_hack_noises")
sh02_player_hacking(player, NAV_HACKING[1], true)
player_movement_enable(player)
sh02_set_triggered(sh02_trigger.override01)
end
-- Lounge trigger callback
function sh02_lounge_cb()
sh02_clear_trigger(sh02_trigger.lounge)
sh02_set_triggered(sh02_trigger.lounge)
-- Have all hos leash to next navpoint
sh02_hos_nav = 2
sh02_all_hos_leash_to(20.0, NAV_HOS[sh02_hos_nav])
-- Have Lounge guards leash to navpoints
sh02_group_leash_to(sh02_group.lounge_guards, NAV_LEASH01, 4.0)
-- Start Lounge continuous spawning
sh02_lounge_spawn_start_thd()
-- Wait some time
delay(8.0)
-- Setup Lounge Flee 01 npcs to flee
sh02_setup_lounge_flee01_npcs()
-- Wait some time
delay(8.0)
-- Setup Lounge Flee 02 npcs to flee
sh02_setup_lounge_flee02_npcs()
-- Wait some time
delay(8.0)
-- Setup Lounge Flee 03 npcs to flee
sh02_setup_lounge_flee03_npcs()
-- Wait some time
delay(8.0)
-- Setup Lounge Flee 04 npcs to flee
sh02_setup_lounge_flee04_npcs()
end
-- Hallway trigger callback
function sh02_hallway_cb()
sh02_clear_trigger(sh02_trigger.hallway)
sh02_set_triggered(sh02_trigger.hallway)
-- Have all hos leash to player
sh02_all_hos_leash_to(10.0)
-- Stop Lounge continuous spawning
sh02_lounge_spawn_stop_thd()
end
-- Stairwell 01 trigger callback
function sh02_stairwell01_cb()
sh02_clear_trigger(sh02_trigger.stairwell01)
sh02_set_triggered(sh02_trigger.stairwell01)
end
-- Wrong Way trigger callback
function sh02_wrongway_cb()
sh02_clear_trigger(sh02_trigger.wrongway)
sh02_set_triggered(sh02_trigger.wrongway)
-- Wait until player/Zimos are done speaking
while sh02_persona_line_playing()
or sh02_conversation_playing() do
thread_yield()
end
-- Zimos: "Where you headed? We gotta go down, remember?"
sh02_play_persona_line(sh02_persona.wrongway)
end
-- Stairwell 02 trigger callback
function sh02_stairwell02_cb()
sh02_clear_trigger(sh02_trigger.stairwell02)
sh02_set_triggered(sh02_trigger.stairwell02)
end
-- Stairwell 03 trigger callback
function sh02_stairwell03_cb()
sh02_clear_trigger(sh02_trigger.stairwell03)
sh02_set_triggered(sh02_trigger.stairwell03)
-- Stop Stairwell continuous spawning
sh02_stairwell_spawn_stop_thd()
-- Create Jailcell 01 guards/hos
sh02_setup_jailcell01_npcs()
end
-- Stairwell 04 trigger callback
function sh02_stairwell04_cb()
sh02_clear_trigger(sh02_trigger.stairwell04)
sh02_set_triggered(sh02_trigger.stairwell04)
end
-- Free Hos 01 trigger callback
function sh02_freehos01_cb()
sh02_clear_trigger(sh02_trigger.freehos01)
sh02_set_triggered(sh02_trigger.freehos01)
end
-- Override 02 trigger callback
function sh02_override02_cb(player)
sh02_clear_trigger(sh02_trigger.override02)
-- Remove y-prompt 01, if needed
if (sh02_prompt01 ~= -1) then
effect_stop(sh02_prompt01)
sh02_prompt01 = -1
end
-- Player: "None of these things are labeled�"
sh02_play_persona_line(sh02_persona.hacking01)
-- Have player do normal hack animation
player_movement_disable(player)
sh02_player_hacking(player, NAV_HACKING[2], false)
player_movement_enable(player)
-- Open Cells 01 door
door_open(sh02_door.cells01)
-- Play jail cells opening sound
audio_object_post_event("sh02_release_the_hos")
-- Have Jailcell 01 hos join player (unarmed)
sh02_hos_join_player(sh02_group.jailcell01_hos, false)
-- Have Jailcell 01 hos leash to next navpoint
if (sh02_hos_nav < 3) then
sh02_hos_nav = 3
end
sh02_hos_leash_to(sh02_group.jailcell01_hos, 5.0, NAV_HOS[sh02_hos_nav])
-- Wait some time
delay(1.0)
-- Player: "Come on, everyone out."
sh02_play_persona_line(sh02_persona.release01)
-- Player: "Think these girls are pissed off?"
sh02_start_chatter_thread(sh02_chatter.hos_fighting, 10.0, 10.0)
sh02_set_triggered(sh02_trigger.override02)
end
-- Jailcell 01-01 trigger callback
function sh02_jailcell01_01_cb()
sh02_clear_trigger(sh02_trigger.jailcell01_01)
sh02_set_triggered(sh02_trigger.jailcell01_01)
-- Setup Jailcell 01 wave to move in
sh02_setup_jailcell01_wave()
-- Open Spawn 01 door
door_open(sh02_door.spawn01)
-- Start Jailcell 01 continuous spawning
sh02_jailcell01_spawn_start_thd()
-- Create Jailcell 02 guards/hos
sh02_setup_jailcell02_npcs()
end
-- Jailcell 01-02 trigger callback
function sh02_jailcell01_02_cb()
sh02_clear_trigger(sh02_trigger.jailcell01_02)
sh02_set_triggered(sh02_trigger.jailcell01_02)
end
-- Free Hos 01 trigger callback
function sh02_freehos02_cb()
sh02_clear_trigger(sh02_trigger.freehos02)
sh02_set_triggered(sh02_trigger.freehos02)
-- Zimos: "More to let out. Get on that."
sh02_play_persona_line(sh02_persona.override03)
-- Set Override 03 trigger
sh02_set_trigger(sh02_trigger.override03)
sh02_prompt02 = effect_play_finisher(NAV_HACKING[3], 2.5)
-- Setup Jailcell 02 wave to move in
sh02_setup_jailcell02_wave()
-- Open Spawn 02 door
door_open(sh02_door.spawn02)
-- Start Jailcell 02 continuous spawning
sh02_jailcell02_spawn_start_thd()
end
-- Override 03 trigger callback
function sh02_override03_cb(player)
sh02_clear_trigger(sh02_trigger.override03)
-- Remove y-prompt 02, if needed
if (sh02_prompt02 ~= -1) then
effect_stop(sh02_prompt02)
sh02_prompt02 = -1
end
-- Player: "Perhaps that button�"
sh02_play_persona_line(sh02_persona.hacking02)
-- Have player do normal hack animation
player_movement_disable(player)
sh02_player_hacking(player, NAV_HACKING[3], false)
player_movement_enable(player)
-- Open Cells 02 door
door_open(sh02_door.cells02)
-- Play jail cells opening sound
audio_object_post_event("sh02_release_the_hos")
-- Have Jailcell 02 hos join player (armed)
sh02_hos_join_player(sh02_group.jailcell02_hos, true)
-- Have Jailcell 02 hos leash to next navpoint
if (sh02_hos_nav < 5) then
sh02_hos_nav = 5
end
sh02_hos_leash_to(sh02_group.jailcell02_hos, 5.0, NAV_HOS[sh02_hos_nav])
-- Wait some time
delay(1.0)
-- Player: "Get some fresh air!"
sh02_play_persona_line(sh02_persona.release02)
-- Player: "Think these girls are pissed off?"
sh02_start_chatter_thread(sh02_chatter.hos_fighting, 10.0, 10.0)
sh02_set_triggered(sh02_trigger.override03)
end
-- Jailcell 02-01 trigger callback
function sh02_jailcell02_01_cb()
sh02_clear_trigger(sh02_trigger.jailcell02_01)
sh02_set_triggered(sh02_trigger.jailcell02_01)
-- Stop Jailcell 02 continuous spawning
sh02_jailcell02_spawn_stop_thd()
-- Create Jailcell 03 guards/hos
sh02_setup_jailcell03_npcs()
end
-- Jailcell 02-02 trigger callback
function sh02_jailcell02_02_cb()
sh02_clear_trigger(sh02_trigger.jailcell02_02)
sh02_set_triggered(sh02_trigger.jailcell02_02)
end
-- Jailcell 03-01 trigger callback
function sh02_jailcell03_01_cb()
sh02_clear_trigger(sh02_trigger.jailcell03_01)
sh02_set_triggered(sh02_trigger.jailcell03_01)
-- Setup Jailcell 03 wave to move in
sh02_setup_jailcell03_wave()
-- Open Spawn 03 door
door_open(sh02_door.spawn03)
-- Start Jailcell 03 continuous spawning
sh02_jailcell03_spawn_start_thd()
end
-- Jailcell 03-02 trigger callback
function sh02_jailcell03_02_cb()
sh02_clear_trigger(sh02_trigger.jailcell03_02)
sh02_set_triggered(sh02_trigger.jailcell03_02)
end
-- Backroom trigger callback
function sh02_backroom_cb()
sh02_clear_trigger(sh02_trigger.backroom)
sh02_set_triggered(sh02_trigger.backroom)
-- Stop Jailcell 03 continuous spawning
sh02_jailcell03_spawn_stop_thd()
end
-- Override 04 trigger callback
function sh02_override04_cb(player)
sh02_clear_trigger(sh02_trigger.override04)
-- Player: "None of these things are labeled�"
if (rand_int(1, 10000) < 5000) then
sh02_play_persona_line(sh02_persona.hacking01)
-- Player: "Perhaps that button�"
else
sh02_play_persona_line(sh02_persona.hacking02)
end
-- Have player do normal hack animation
player_movement_disable(player)
sh02_player_hacking(player, NAV_HACKING[4], false)
player_movement_enable(player)
-- Open Cells 03 door
door_open(sh02_door.cells03)
-- Play jail cells opening sound
audio_object_post_event("sh02_release_the_hos")
-- Have Jailcell 03 hos join player (unarmed)
sh02_hos_join_player(sh02_group.jailcell03_hos, false)
-- Have Jailcell 03 hos leash to next navpoint
if (sh02_hos_nav < 8) then
sh02_hos_nav = 8
end
sh02_hos_leash_to(sh02_group.jailcell03_hos, 5.0, NAV_HOS[sh02_hos_nav])
-- Wait some time
delay(1.0)
-- Player: "Move along! Don't waste time!"
sh02_play_persona_line(sh02_persona.release03)
-- Player: "Think these girls are pissed off?"
sh02_start_chatter_thread(sh02_chatter.hos_fighting, 10.0, 10.0)
sh02_set_triggered(sh02_trigger.override04)
end
-- Garage trigger callback
function sh02_garage_cb()
sh02_clear_trigger(sh02_trigger.garage)
sh02_set_triggered(sh02_trigger.garage)
end
-- ***************************************************
-- SH02 Thread Functions (Tracked)
-- ***************************************************
-- Check if player thread is done
function sh02_check_player_thread()
return thread_check_done(sh02_thread.player)
end
-- Stop player thread, if needed
function sh02_stop_player_thread()
if not sh02_check_player_thread() then
thread_kill(sh02_thread.player)
end
end
-- Have player(s) come down from drugs
function sh02_player_come_down()
-- Wait some time
delay(20.0)
-- Setup player(s) being drugged (weak)
sh02_setup_player_drugged(0.25)
-- Have player(s) stumble to ground
sh02_players_stumble_thd()
-- Player: "Oh my god...the floor is so wobbly!"
sh02_start_chatter_thread(sh02_chatter.drugged_out, 0.0, 10.0)
-- Wait until player is done speaking
while sh02_chatter_lines_playing() do
thread_yield()
end
-- Cleanup player(s) being drugged
sh02_cleanup_player_drugged()
-- Clear persona situation override (Drugged).
persona_clear_global_situation_override()
end
-- Have player(s) come down from drugs (start thread)
function sh02_player_come_down_thd()
sh02_thread.player = thread_new("sh02_player_come_down")
end
-- Check if homies thread is done
function sh02_check_homies_thread()
return thread_check_done(sh02_thread.homies)
end
-- Stop homies thread, if needed
function sh02_stop_homies_thread()
if not sh02_check_homies_thread() then
thread_kill(sh02_thread.homies)
end
end
-- Have Zimos greet player
function sh02_zimos_greet_player()
-- Have Zimos ignore everyone
set_ignore_ai_flag(sh02_zimos, true)
-- Have Zimos kick open Auction door
door_open(sh02_door.auction, false, true, sh02_zimos, "kick door")
-- Wait some time
delay(2.5)
-- Have Zimos stop ignoring everyone
set_ignore_ai_flag(sh02_zimos, false)
-- Setup homies (Zimos)
sh02_setup_homies()
end
-- Have Zimos greet player (start thread)
function sh02_zimos_greet_player_thd()
sh02_thread.homies = thread_new("sh02_zimos_greet_player")
end
-- Check if enemies thread is done
function sh02_check_enemies_thread()
return thread_check_done(sh02_thread.enemies)
end
-- Stop enemies thread, if needed
function sh02_stop_enemies_thread()
if not sh02_check_enemies_thread() then
thread_kill(sh02_thread.enemies)
end
end
-- Lounge continuous spawning
function sh02_lounge_spawn()
-- Wait some time
delay(20.0)
-- Enable Lounge spawn region
spawn_region_enable(sh02_spawn.lounge, true)
-- Increase continuous spawning as time passes
continuous_spawn_start(sh02_group.cont_spawn01.name, 1, 4.0)
delay(40.0)
continuous_spawn_stop(sh02_group.cont_spawn01.name)
continuous_spawn_start(sh02_group.cont_spawn02.name, 2, 4.0)
continuous_spawn_start(sh02_group.cont_spawn03.name, 2, 8.0)
delay(80.0)
continuous_spawn_stop(sh02_group.cont_spawn02.name)
continuous_spawn_stop(sh02_group.cont_spawn03.name)
continuous_spawn_start(sh02_group.cont_spawn04.name, 3, 4.0)
continuous_spawn_start(sh02_group.cont_spawn05.name, 3, 8.0)
continuous_spawn_start(sh02_group.cont_spawn06.name, 3, 12.0)
end
-- Lounge continuous spawning (start thread)
function sh02_lounge_spawn_start_thd()
sh02_thread.enemies = thread_new("sh02_lounge_spawn")
end
-- Lounge continuous spawning (stop thread)
function sh02_lounge_spawn_stop_thd()
-- Stop enemies thread, if needed
sh02_stop_enemies_thread()
-- Disable Lounge spawn region/groups
spawn_region_enable(sh02_spawn.lounge, false)
sh02_cleanup_spawn_groups()
end
-- Stairwell continuous spawning
function sh02_stairwell_spawn()
-- Wait some time
delay(20.0)
-- Enable Stairwell spawn region
spawn_region_enable(sh02_spawn.stairwell, true)
-- Increase continuous spawning as time passes
continuous_spawn_start(sh02_group.cont_spawn01.name, 1, 4.0)
delay(20.0)
continuous_spawn_stop(sh02_group.cont_spawn01.name)
continuous_spawn_start(sh02_group.cont_spawn02.name, 1, 4.0)
delay(20.0)
continuous_spawn_stop(sh02_group.cont_spawn02.name)
continuous_spawn_start(sh02_group.cont_spawn03.name, 1, 4.0)
delay(20.0)
continuous_spawn_stop(sh02_group.cont_spawn03.name)
continuous_spawn_start(sh02_group.cont_spawn04.name, 1, 4.0)
delay(20.0)
continuous_spawn_stop(sh02_group.cont_spawn04.name)
continuous_spawn_start(sh02_group.cont_spawn05.name, 1, 4.0)
delay(20.0)
continuous_spawn_stop(sh02_group.cont_spawn05.name)
continuous_spawn_start(sh02_group.cont_spawn06.name, 1, 4.0)
end
-- Stairwell continuous spawning (start thread)
function sh02_stairwell_spawn_start_thd()
sh02_thread.enemies = thread_new("sh02_stairwell_spawn")
end
-- Stairwell continuous spawning (stop thread)
function sh02_stairwell_spawn_stop_thd()
-- Stop enemies thread, if needed
sh02_stop_enemies_thread()
-- Disable Stairwell spawn region/groups
spawn_region_enable(sh02_spawn.stairwell, false)
sh02_cleanup_spawn_groups()
end
-- Jailcell 01 continuous spawning
function sh02_jailcell01_spawn()
-- Wait some time
delay(20.0)
-- Enable Jailcell 01 spawn region
spawn_region_enable(sh02_spawn.jailcell01, true)
-- Increase continuous spawning as time passes
continuous_spawn_start(sh02_group.cont_spawn01.name, 1, 4.0)
delay(10.0)
continuous_spawn_stop(sh02_group.cont_spawn01.name)
continuous_spawn_start(sh02_group.cont_spawn02.name, 1, 4.0)
delay(10.0)
continuous_spawn_stop(sh02_group.cont_spawn02.name)
continuous_spawn_start(sh02_group.cont_spawn03.name, 1, 4.0)
end
-- Jailcell 01 continuous spawning (start thread)
function sh02_jailcell01_spawn_start_thd()
sh02_thread.enemies = thread_new("sh02_jailcell01_spawn")
end
-- Jailcell 01 continuous spawning (stop thread)
function sh02_jailcell01_spawn_stop_thd()
-- Stop enemies thread, if needed
sh02_stop_enemies_thread()
-- Disable Jailcell 01 spawn region/groups
spawn_region_enable(sh02_spawn.jailcell01, false)
sh02_cleanup_spawn_groups()
end
-- Jailcell 02 continuous spawning
function sh02_jailcell02_spawn()
-- Wait some time
delay(20.0)
-- Enable Jailcell 02 spawn region
spawn_region_enable(sh02_spawn.jailcell02, true)
-- Increase continuous spawning as time passes
continuous_spawn_start(sh02_group.cont_spawn04.name, 1, 4.0)
delay(10.0)
continuous_spawn_stop(sh02_group.cont_spawn04.name)
continuous_spawn_start(sh02_group.cont_spawn05.name, 1, 4.0)
delay(10.0)
continuous_spawn_stop(sh02_group.cont_spawn05.name)
continuous_spawn_start(sh02_group.cont_spawn06.name, 1, 4.0)
end
-- Jailcell 02 continuous spawning (start thread)
function sh02_jailcell02_spawn_start_thd()
sh02_thread.enemies = thread_new("sh02_jailcell02_spawn")
end
-- Jailcell 02 continuous spawning (stop thread)
function sh02_jailcell02_spawn_stop_thd()
-- Stop enemies thread, if needed
sh02_stop_enemies_thread()
-- Disable Jailcell 02 spawn region/groups
spawn_region_enable(sh02_spawn.jailcell02, false)
sh02_cleanup_spawn_groups()
end
-- Jailcell 03 continuous spawning
function sh02_jailcell03_spawn()
-- Wait some time
delay(20.0)
-- Enable Jailcell 03 spawn region
spawn_region_enable(sh02_spawn.jailcell03, true)
-- Increase continuous spawning as time passes
continuous_spawn_start(sh02_group.cont_spawn01.name, 1, 4.0)
delay(10.0)
continuous_spawn_stop(sh02_group.cont_spawn01.name)
continuous_spawn_start(sh02_group.cont_spawn02.name, 1, 4.0)
delay(10.0)
continuous_spawn_stop(sh02_group.cont_spawn02.name)
continuous_spawn_start(sh02_group.cont_spawn03.name, 1, 4.0)
end
-- Jailcell 03 continuous spawning (start thread)
function sh02_jailcell03_spawn_start_thd()
sh02_thread.enemies = thread_new("sh02_jailcell03_spawn")
end
-- Jailcell 03 continuous spawning (stop thread)
function sh02_jailcell03_spawn_stop_thd()
-- Stop enemies thread, if needed
sh02_stop_enemies_thread()
-- Disable Jailcell 03 spawn region/groups
spawn_region_enable(sh02_spawn.jailcell03, false)
sh02_cleanup_spawn_groups()
end
-- Check if Morningstar wait thread is done
function sh02_check_ms_wait_thread()
return thread_check_done(sh02_thread.ms_wait)
end
-- Stop Morningstar wait thread, if needed
function sh02_stop_ms_wait_thread()
if not sh02_check_ms_wait_thread() then
thread_kill(sh02_thread.ms_wait)
end
end
-- Start Morningstar wait thread
function sh02_start_ms_wait_thread(wait)
sh02_stop_ms_wait_thread()
sh02_thread.ms_wait = thread_new("delay", wait)
end
-- Check if Ho wait thread is done
function sh02_check_ho_wait_thread()
return thread_check_done(sh02_thread.ho_wait)
end
-- Stop Ho wait thread, if needed
function sh02_stop_ho_wait_thread()
if not sh02_check_ho_wait_thread() then
thread_kill(sh02_thread.ho_wait)
end
end
-- Start Ho wait thread
function sh02_start_ho_wait_thread(wait)
sh02_stop_ho_wait_thread()
sh02_thread.ho_wait = thread_new("delay", wait)
end
-- ***************************************************
-- SH02 Thread Functions (Untracked)
-- ***************************************************
-- Have player stumble to ground
function sh02_player_stumble(player)
if (not character_is_dead(player) and not human_is_downed(player)) then
player_movement_disable(player)
action_play(player, "plym drunk stumble", "", false, 1.0, true, true)
player_movement_enable(player)
end
end
-- Have player(s) stumble to ground (start thread(s))
function sh02_players_stumble_thd()
thread_new("sh02_player_stumble", LOCAL_PLAYER)
if (sh02_in_coop) then
thread_new("sh02_player_stumble", REMOTE_PLAYER)
end
end
-- Update ai move to nav point
function sh02_ai_move_to(name, navpoint, wait)
-- Wait for desired time before moving
delay(wait)
-- Update ai scripted move until close
local close = false
while not close do
ai_do_scripted_move(name, navpoint, true, true)
thread_yield()
while not ai_scripted_action_is_complete(name) do
thread_yield()
end
close = (get_dist(name, navpoint) < 4.0)
end
end
-- Update ai move to nav point (start thread)
function sh02_ai_move_to_thd(name, navpoint, wait)
thread_new("sh02_ai_move_to", name, navpoint, wait)
end
-- ***************************************************
-- SH02 Text Functions
-- ***************************************************
-- Show objective (generic)
function sh02_show_objective(tag, icon)
objective_text_clear(0)
objective_text(0, tag, "", "", SYNC_ALL, icon)
end
-- Show objective (location)
function sh02_show_objective_loc(tag)
sh02_show_objective(tag, OI_ASSET_LOCATION)
end
-- Show objective (use target)
function sh02_show_objective_use(tag)
sh02_show_objective(tag, OI_ASSET_USE)
end
-- Show objective (kill target(s))
function sh02_show_objective_kill(tag)
sh02_show_objective(tag, OI_ASSET_KILL)
end
-- ***************************************************
-- SH02 Audio Functions
-- ***************************************************
-- Start alarms
function sh02_start_alarms()
audio_ambient_emitter_start("sh02_alarm_a")
audio_ambient_emitter_start("sh02_alarm_b")
end
-- Stop alarms
function sh02_stop_alarms()
audio_ambient_emitter_stop("sh02_alarm_a")
audio_ambient_emitter_stop("sh02_alarm_b")
end
-- Check if a persona line is playing (player/Zimos)
function sh02_persona_line_playing()
return (audio_persona_line_playing(LOCAL_PLAYER)
or audio_persona_line_playing(sh02_zimos))
end
-- Play persona line
function sh02_play_persona_line(persona)
if (persona == nil) then
return
end
audio_play_persona_line(persona.speaker, persona.line)
end
-- Check if chatter lines are playing
function sh02_chatter_lines_playing()
return sh02_chatter.playing
end
-- Play chatter line
function sh02_play_chatter_line(chat, buff)
audio_play_persona_line(chat.speaker, chat.line)
sh02_chatter.playing = true
chat.spoken = true
sh02_chatter.wait_thd = thread_new("delay", buff)
delay(1.0)
while sh02_persona_line_playing()
or not thread_check_done(sh02_chatter.wait_thd) do
thread_yield()
end
sh02_chatter.playing = false
end
-- Play chatter lines
function sh02_play_chatter_lines(chatter, wait, buff)
delay(wait)
for i, chat in pairs(chatter) do
if not chat.spoken then
while sh02_persona_line_playing()
or sh02_conversation_playing() do
thread_yield()
end
sh02_play_chatter_line(chat, buff)
end
end
end
-- Stop chatter thread
function sh02_stop_chatter_thread()
sh02_chatter.playing = false
if not thread_check_done(sh02_chatter.main_thd) then
thread_kill(sh02_chatter.main_thd)
end
if not thread_check_done(sh02_chatter.wait_thd) then
thread_kill(sh02_chatter.wait_thd)
end
end
-- Start chatter thread
function sh02_start_chatter_thread(chatter, wait, buff)
if (chatter == nil) then
return
end
if (wait <= 0.0) and (buff <= 0.0) then
if sh02_persona_line_playing()
or sh02_chatter_lines_playing()
or sh02_conversation_playing() then
return
end
end
sh02_stop_chatter_thread()
sh02_chatter.main_thd = thread_new("sh02_play_chatter_lines", chatter, wait, buff)
end
-- Check if conversation is playing
function sh02_conversation_playing()
return sh02_convo.playing
end
-- Play conversation
function sh02_play_conversation(convo)
while sh02_persona_line_playing()
or sh02_chatter_lines_playing()
or sh02_conversation_playing() do
thread_yield()
end
if (convo.load_direct) then
convo.handle = audio_conversation_load_direct(convo.name)
else
convo.handle = audio_conversation_load(convo.name)
end
audio_conversation_play(convo.handle)
sh02_convo.playing = true
delay(1.0)
audio_conversation_wait_for_end(convo.handle)
convo.handle = INVALID_CONVERSATION_HANDLE
sh02_convo.playing = false
end
-- Stop conversation thread
function sh02_stop_convo_thread(convo)
sh02_convo.playing = false
if not thread_check_done(sh02_convo.main_thd) then
thread_kill(sh02_convo.main_thd)
end
if not (convo == nil) then
if audio_conversation_playing(convo.handle) then
audio_conversation_end(convo.handle)
end
end
end
-- Start conversation thread
function sh02_start_convo_thread(convo)
if (convo == nil) then
return
end
sh02_stop_convo_thread()
sh02_convo.main_thd = thread_new("sh02_play_conversation", convo)
end