---Groups
execs = {"sh_tss_ugmall_$c000", "sh_tss_ugmall_$c000 (0)", "sh_tss_ugmall_$c000 (1)", "sh_tss_ugmall_$c000 (2)", "sh_tss_ugmall_$c000 (3)", "sh_tss_ugmall_$c000 (4)", "sh_tss_ugmall_$c000 (5)", "sh_tss_ugmall_$c000 (6)", "sh_tss_ugmall_$c000 (7)"}
chase = {"sh_tss_ugmall_$n000", "sh_tss_ugmall_$n001", "sh_tss_ugmall_$n002", "sh_tss_ugmall_$n003", "sh_tss_ugmall_$n004", "sh_tss_ugmall_$n005", "sh_tss_ugmall_$n006", "sh_tss_ugmall_$n000", "sh_tss_ugmall_$n001", "sh_tss_ugmall_$n002", "sh_tss_ugmall_$n003", "sh_tss_ugmall_$n004", "sh_tss_ugmall_$n005", "sh_tss_ugmall_$n006", "sh_tss_ugmall_$n007", "sh_tss_ugmall_$n008", "sh_tss_ugmall_$n009", "sh_tss_ugmall_$n010", "sh_tss_ugmall_$n011", "sh_tss_ugmall_$n012", "sh_tss_ugmall_$n013", "sh_tss_ugmall_$n014", "sh_tss_ugmall_$n015", "sh_tss_ugmall_$n016", "sh_tss_ugmall_$n017", "sh_tss_ugmall_$n018", "sh_tss_ugmall_$n019", "sh_tss_ugmall_$n020", "sh_tss_ugmall_$n021", "sh_tss_ugmall_$n022", "sh_tss_ugmall_$n023", "sh_tss_ugmall_$n024", "sh_tss_ugmall_$n025", "sh_tss_ugmall_$n026", "sh_tss_ugmall_$n027", "sh_tss_ugmall_$n028", "sh_tss_ugmall_$n029", "sh_tss_ugmall_$n030", "sh_tss_ugmall_$n031", "sh_tss_ugmall_$n032", "sh_tss_ugmall_$n033", "sh_tss_ugmall_$n034", "sh_tss_ugmall_$n035", "sh_tss_ugmall_$n036", "sh_tss_ugmall_$n037", "sh_tss_ugmall_$n038", "sh_tss_ugmall_$n039", "sh_tss_ugmall_$n040", "sh_tss_ugmall_$n041", "sh_tss_ugmall_$n042", "sh_tss_ugmall_$n043", "sh_tss_ugmall_$n044", "sh_tss_ugmall_$n045", "sh_tss_ugmall_$n046", "sh_tss_ugmall_$n047", "sh_tss_ugmall_$n007", "sh_tss_ugmall_$n008", "sh_tss_ugmall_$n009", "sh_tss_ugmall_$n010", "sh_tss_ugmall_$n011", "sh_tss_ugmall_$n012", "sh_tss_ugmall_$n013", "sh_tss_ugmall_$n014", "sh_tss_ugmall_$n015", "sh_tss_ugmall_$n016", "sh_tss_ugmall_$n017", "sh_tss_ugmall_$n018", "sh_tss_ugmall_$n019", "sh_tss_ugmall_$n020", "sh_tss_ugmall_$n021", "sh_tss_ugmall_$n022", "sh_tss_ugmall_$n023", "sh_tss_ugmall_$n024", "sh_tss_ugmall_$n025", "sh_tss_ugmall_$n026", "sh_tss_ugmall_$n027", "sh_tss_ugmall_$n028", "sh_tss_ugmall_$n029", "sh_tss_ugmall_$n030", "sh_tss_ugmall_$n031", "sh_tss_ugmall_$n032", "sh_tss_ugmall_$n033", "sh_tss_ugmall_$n034", "sh_tss_ugmall_$n035", "sh_tss_ugmall_$n036", "sh_tss_ugmall_$n037", "sh_tss_ugmall_$n038", "sh_tss_ugmall_$n039", "sh_tss_ugmall_$n040", "sh_tss_ugmall_$n041", "sh_tss_ugmall_$n042", "sh_tss_ugmall_$n043", "sh_tss_ugmall_$n044", "sh_tss_ugmall_$n045", "sh_tss_ugmall_$n046", "sh_tss_ugmall_$n047"}
wander = {"sh_tss_ugmall_$c005", "sh_tss_ugmall_$c005 (0)", "sh_tss_ugmall_$c005 (1)", "sh_tss_ugmall_$c005 (2)"}
bd1 = {"sh_tss_ugmall_$cwander1", "sh_tss_ugmall_$cwander1 (0)", "sh_tss_ugmall_$cwander1 (1)"}
bd2 = {"sh_tss_ugmall_$cwander2 (2)", "sh_tss_ugmall_$cwander2 (3)", "sh_tss_ugmall_$cwander2 (4)"}
bd3 = {"sh_tss_ugmall_$cwander3", "sh_tss_ugmall_$cwander3 (0)", "sh_tss_ugmall_$cwander3 (1)"}
bd4 = {"sh_tss_ugmall_$cwander4", "sh_tss_ugmall_$cwander4 (0)", "sh_tss_ugmall_$cwander4 (1)"}
thugs = {"sh_tss_ugmall_$c002", "sh_tss_ugmall_$c002 (0)", "sh_tss_ugmall_$c002 (3)", "sh_tss_ugmall_$c002 (4)", "sh_tss_ugmall_$c002 (5)", "sh_tss_ugmall_$c002 (6)", "sh_tss_ugmall_$c002 (9)", "sh_tss_ugmall_$c002 (10)", "sh_tss_ugmall_$c002 (11)", "sh_tss_ugmall_$c002 (12)", "sh_tss_ugmall_$c002 (13)", "sh_tss_ugmall_$c002 (14)", "sh_tss_ugmall_$c002 (15)", "sh_tss_ugmall_$c004", "sh_tss_ugmall_$c004 (0)", "sh_tss_ugmall_$c004 (1)", "sh_tss_ugmall_$c004 (2)", "sh_tss_ugmall_$c004 (3)"}
--bd5 = {"sh_tss_ugmall_$cwander1 (2)", "sh_tss_ugmall_$cwander1 (3)", "sh_tss_ugmall_$cwander1 (4)"}
bodyguards = {bd1, bd2, bd3, bd4}
barricades = {"sh_tss_ugmall__main_barripolc15000", "sh_tss_ugmall__main_barripolc14000", "sh_tss_ugmall__main_barripolc13000", "sh_tss_ugmall__main_barripolc12000", "sh_tss_ugmall__main_barripolc11000", "sh_tss_ugmall__main_barripolc28000", "sh_tss_ugmall__main_barripolc27000", "sh_tss_ugmall__main_barripolc26000", "sh_tss_ugmall__main_barripolc25000", "sh_tss_ugmall__main_barripolc24000", "sh_tss_ugmall__main_barripolc23000", "sh_tss_ugmall__main_barripolc20000", "sh_tss_ugmall__main_barripolc19000", "sh_tss_ugmall__main_barripolc18000", "sh_tss_ugmall__main_barripolc17000", "sh_tss_ugmall__main_barripolc16000", "sh_tss_ugmall__main_barripolc01000", "sh_tss_ugmall__main_barripolc02000", "sh_tss_ugmall__main_barripolc03000", "sh_tss_ugmall__main_barripolc04000", "sh_tss_ugmall__main_barripolc05000", "sh_tss_ugmall__main_barripolc10000", "sh_tss_ugmall__main_barripolc09000", "sh_tss_ugmall__main_barripolc08000", "sh_tss_ugmall__main_barripolc07000", "sh_tss_ugmall__main_barripolc06000"}
wander_idx = {
["sh_tss_ugmall_$c005"] = 1,
["sh_tss_ugmall_$c005 (0)"] = 2,
["sh_tss_ugmall_$c005 (1)"] = 3,
["sh_tss_ugmall_$c005 (2)"] = 4
}
--Tables
execs_total = sizeof_table( execs )
execs_count = 0
chase_total = sizeof_table( chase )
chase_count = 0
wander_count = 0
wander_total = sizeof_table( wander )
bd1_total = sizeof_table( bd1 )
bd2_total = sizeof_table( bd2 )
bd3_total = sizeof_table( bd3 )
bd4_total = sizeof_table( bd4 )
--bd5_total = sizeof_table( bd5 )
bodygaurds_total = sizeof_table( bodyguards )
thugscount = 0
thugs_total = sizeof_table( thugs )
---addtional Tables
bd_totals = {bd1_total, bd2_total, bd3_total, bd4_total}
bd_total_size = sizeof_table( bd_totals )
barricades_total= sizeof_table ( barricades )
function sh_tss_ugmall_start(checkpoint, is_restart)
if checkpoint == MISSION_START_CHECKPOINT then
set_mission_author("David Bowring")
mission_start_fade_out()
teleport_coop("sh_tss_ugmall_$nstart","sh_tss_ugmall_$napc1")
--[[
teleport("#PLAYER1#","sh_tss_ugmall_$nstart")
if (coop_is_active()) then
teleport("#PLAYER2#","sh_tss_ugmall_$napc1")
end
--]]
--notoriety_set_max("ultor", 3)
--thread_new("sh_tss_ugmall_barricades", true)
sh_tss_ugmall_barricades(true)
if (not is_restart) then
cutscene_play("sh_tss_ugmallct1")
end
notoriety_set_max("police", 3)
--group_create("sh_tss_ugmall_$GCars", true)
group_create("sh_tss_ugmall_$GWander", true)
objective_text(0, "sh_tss_ugmall_instruct_two", wander_count, wander_total)
on_trigger("sh_tss_ugmall_escape","sh_tss_ugmall_$tescape")
mission_help_table_nag("sh_tss_ugmall_instruct_one")
delay(5)
on_trigger("sh_tss_ugmall_execs_trigger", "sh_tss_ugmall_$tconf")
mission_help_table("sh_tss_ugmall_instruct_wander")
door_lock("sh_tss_ugmall_DoorMM020", true)
door_lock("sh_tss_ugmall_DoorMM030", true)
door_lock("sh_tss_ugmall_DoorMM140", true)
door_lock("sh_tss_ugmall_DoorMM130", true)
door_lock("sh_tss_ugmall_DoorMM090", true)
door_lock("sh_tss_ugmall_DoorMM100", true)
--cutscene_play("sh_tss_ugmallct2")
sh_tss_ugmall_setup_wander()
--sh_tss_ugmall_chase()
--sh_tss_ugmall_phaseTwo()
mission_start_fade_in()
else
fade_in(1)
on_trigger("sh_tss_ugmall_escape","sh_tss_ugmall_$tescape")
sh_tss_ugmall_phaseTwo()
end
end
function sh_tss_ugmall_setup_wander()
for i = 1, wander_total, 1 do
marker_add_npc(wander[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL)
on_death("sh_tss_ugmall_killwander", wander[i])
wander_start(wander[i], wander[i], 20)
sh_tss_ugmall_alert_handeler(wander[i])
end
-- Go through each wander and each bodyguard group
for i = 1, wander_total, 1 do
-- Go through each person in group bodyguard[i]
on_detection("sh_tss_ugmall_wanderer", wander[i])
set_attack_player_flag( wander[i], true )
set_cower_flee_mode( wander[i], "never cower or flee")
for j = 1, bd_totals[i], 1 do
-- Add each person in bodyguard[i] to the wander npc at index i
npc_follow_npc(bodyguards[i][j], wander[i])
on_detection("sh_tss_ugmall_bodyguard", bodyguards[i][j])
if (j == 1) then
set_blitz_flag(bodyguards[i][j], true)
end
end
end
end
function sh_tss_ugmall_barricades(bool)
--function to hid and unhide movers
if bool then
for i = 1, barricades_total, 1 do
mesh_mover_hide(barricades[i])
mission_debug(" hide="..barricades[i])
end
else
for i = 1, barricades_total, 1 do
mission_debug("show="..barricades[i])
mesh_mover_show(barricades[i])
end
end
end
function sh_tss_ugmall_wanderer(char)
--Make the shopping execs shop.
mission_debug("DETECTED")
set_attack_player_flag( char, false )
set_cower_flee_mode( char, "always flee when attacked")
flee(char,LOCAL_PLAYER,false,true)
for j = 1, bd_totals[wander_idx[char]], 1 do
-- Add each person in bodyguard[wander_idx[char]] to the wander npc at index wander_idx[char]
npc_stop_following(bodyguards[wander_idx[char]][j])
attack(bodyguards[wander_idx[char]][j])
end
end
function sh_tss_ugmall_bodyguard(char)
mission_debug("PLAYER DETECTED")
npc_stop_following(char)
attack(char)
end
function sh_tss_ugmall_alert_handeler(char)
on_take_damage("sh_tss_ugmall_alert",char)
end
function sh_tss_ugmall_alert(char)
for j = 1, bd_totals[wander_idx[char]], 1 do
-- Add each person in bodyguard[wander_idx[char]] to the wander npc at index wander_idx[char]
npc_stop_following(bodyguards[wander_idx[char]][j])
attack(bodyguards[wander_idx[char]][j])
end
end
function sh_tss_ugmall_execs_trigger()
on_trigger("sh_tss_ugmall_execs_trigger_two", "sh_tss_ugmall_$texectwo")
marker_remove_navpoint("sh_tss_ugmall_$tconf")
trigger_enable("sh_tss_ugmall_$texectwo", true)
marker_add_navpoint("sh_tss_ugmall_$texectwo", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION)
end
function sh_tss_ugmall_execs_trigger_two()
sh_tss_ugmall_execs()
end
function sh_tss_ugmall_execs()
--Kill the execs in the conference room
--group_create("sh_tss_ugmall_$Gultorexecs")
marker_remove_navpoint("sh_tss_ugmall_$texectwo")
trigger_enable("sh_tss_ugmall_$texectwo", false)
--mission_help_table("sh_tss_ugmall_instruct_wanderfinish")
objective_text(0, "sh_tss_ugmall_instruct_two", execs_count, execs_total)
trigger_enable("sh_tss_ugmall_$tconf", false)
door_lock("sh_tss_ugmall_DoorMM090", false)
door_lock("sh_tss_ugmall_DoorMM100", false)
door_lock("sh_tss_ugmall_DoorMM140", false)
door_lock("sh_tss_ugmall_DoorMM130", false)
for i = 1, execs_total, 1 do
marker_add_npc(execs[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL)
on_death("sh_tss_ugmall_killcount", execs[i])
end
end
function sh_tss_ugmall_killwander(char)
wander_count = wander_count+1
marker_remove_npc(char)
--objective_text_clear()
objective_text(0, "sh_tss_ugmall_instruct_two", wander_count, wander_total)
release_to_world(char)
if (wander_count == 1) then
notoriety_set("police", 3)
end
if (wander_count == wander_total) then
objective_text_clear(0)
release_to_world("sh_tss_ugmall_$GWander")
delay(1)
trigger_enable("sh_tss_ugmall_$tconf", true)
marker_add_navpoint("sh_tss_ugmall_$tconf", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION)
mission_help_table("sh_tss_ugmall_instruct_wanderfinish")
--sh_tss_ugmall_chase()
--sh_tss_ugmall_phaseTwo()
group_create("sh_tss_ugmall_$Gultorexecs")
for i = 1, execs_total, 1 do
--marker_add_npc(execs[i], MINIMAP_ICON_KILL, INGAME_EFFECT_KILL)
on_death("sh_tss_ugmall_killcount", execs[i])
end
end
end
function sh_tss_ugmall_escape()
mission_end_success("sh_tss_ugmall")
end
function sh_tss_ugmall_killcount(char)
execs_count = execs_count+1
marker_remove_npc(char)
objective_text(0, "sh_tss_ugmall_instruct_two", execs_count, execs_total)
release_to_world(char)
if (execs_count == execs_total) then
objective_text_clear(0)
release_to_world("sh_tss_ugmall_$Gultorexecs")
delay(1)
--sh_tss_ugmall_chase()
mission_set_checkpoint("escape")
sh_tss_ugmall_phaseTwo()
end
if (execs_count == 1) then
door_lock("sh_tss_ugmall_DoorMM020", false)
door_lock("sh_tss_ugmall_DoorMM030", false)
door_open("sh_tss_ugmall_DoorMM020")
door_open("sh_tss_ugmall_DoorMM030")
door_open("sh_tss_ugmall_DoorMM140")
door_open("sh_tss_ugmall_DoorMM130")
end
end
function sh_tss_ugmall_chase()
group_create("sh_tss_ugmall_$Gexectwo", true)
vehicle_enter_teleport("sh_tss_ugmall_$c003", "sh_tss_ugmall_$v001", 0)
on_death("sh_tss_ugmall_phaseTwo", "sh_tss_ugmall_$c003")
marker_add_npc("sh_tss_ugmall_$c003", MINIMAP_ICON_KILL, INGAME_EFFECT_KILL)
vehicle_infinite_mass("sh_tss_ugmall_$v001", true)
mission_help_table("sh_tss_ugmall_instruct_three")
vehicle_pathfind_to("sh_tss_ugmall_$v001", "sh_tss_ugmall_$pathdrive", true, true)
end
function sh_tss_ugmall_phaseTwo()
local teleport_points = {"sh_tss_ugmall_$nTele","sh_tss_ugmall_$nTele (0)"}
marker_remove_npc("sh_tss_ugmall_$c003")
delay(3)
cutscene_play("sh_tss_ugmallct2","sh_tss_ugmall_$GUltorThugs",teleport_points,true)
thread_new("sh_tss_ugmall_barricades", false)
trigger_enable("sh_tss_ugmall_$tescape", true)
marker_add_trigger("sh_tss_ugmall_$tescape", MINIMAP_ICON_LOCATION, INGAME_EFFECT_LOCATION)
group_show("sh_tss_ugmall_$GUltorThugs")
mission_help_table("sh_tss_ugmall_instruct_four")
notoriety_set_max("police", 5)
notoriety_set_min("police", 5)
notoriety_set("police", 5)
for i = 1, thugs_total, 1 do
while (1) do
delay(3)
attack(thugs[i])
end
end
end
function sh_tss_ugmall_cleanup()
on_trigger("", "sh_tss_ugmall_$tconf")
on_trigger("", "sh_tss_ugmall_$texectwo")
marker_remove_trigger("sh_tss_ugmall_$tescape")
marker_remove_navpoint("sh_tss_ugmall_$tconf")
marker_remove_navpoint("sh_tss_ugmall_$texectwo")
trigger_enable("sh_tss_ugmall_$tescape", false)
trigger_enable("sh_tss_ugmall_$tconf", false)
trigger_enable("sh_tss_ugmall_$texectwo", false)
door_lock("sh_tss_ugmall_DoorMM020", false)
door_lock("sh_tss_ugmall_DoorMM030", false)
door_lock("sh_tss_ugmall_DoorMM140", false)
door_lock("sh_tss_ugmall_DoorMM130", false)
door_lock("sh_tss_ugmall_DoorMM090", false)
door_lock("sh_tss_ugmall_DoorMM100", false)
on_trigger("","sh_tss_ugmall_$tescape")
for i = 1, execs_total, 1 do
if group_is_loaded("sh_tss_ugmall_$Gultorexecs") == true then
if character_is_dead(execs[i]) == false then
marker_remove_npc(execs[i])
on_death("", execs[i])
end
end
end
--cleanup stuff here
end
function sh_tss_ugmall_success()
--success stuff here
end