--[[
_____ _ ____ ____
|_ _| | | | _ \| _ \
_ __ ___ | | _ __ | |_ _ __ ___ | |_) | |_) |
| '_ ` _ \ | | | '_ \| __| '__/ _ \| _ <| _ <
| | | | | |_| |_| | | | |_| | | (_) | |_) | |_) |
|_| |_| |_|_____|_| |_|\__|_| \___/|____/|____/
--]]
--[[
mIntroBB.lua
SRG Map Event Script
DATE: 2014-05-05
AUTHOR: Eric Stoll
]]--
-- Tweakable Parameters --
mIntroBB_far_distance = 75
mIntroBB_hud_time_ms = 10000
mIntroBB_wave_1 = 15
mIntroBB_wave_2 = 20
mIntroBB_wave_3 = 25
mIntroBB_imp_animation_state = "attach ship"
SUPERPOWER_SUMMON = 0
local local_player_had_hammer = 0
local remote_player_had_hammer = 0
--------------------------------------------------------------------------------------------------
--[[
_____
/ ____|
| | __ _ __ ___ _ _ _ __ ___
| | |_ | '__/ _ \| | | | '_ \/ __|
| |__| | | | (_) | |_| | |_) \__ \
\_____|_| \___/ \__,_| .__/|___/
| |
|_|
]]--
--------------------------------------------------------------------------------------------------
mIntroBB_group = {
start_blackbeard = {
name = "blackbeard_group",
blackbeard = "npc_Blackbeard",
},
ship = {
name = "ship_group",
ship = "Blackbeard_ship",
},
cin_imp = {
name = "cin_imp_group",
imp = { "cin_imp<001>", "cin_imp<002>" },
},
imp_wave = {
name = "imp_wave1_group",
npcs = { "imp<001>", "imp<002>", "imp<003>", "imp<004>", "imp<005>","imp<006>", "imp<007>", "imp<008>", "imp<009>", "imp<010>",
"imp<011>", "imp<012>", "imp<013>", "imp<014>", "imp<015>","imp<016>", "imp<017>", "imp<018>", "imp<019>", "imp<020>",
"imp<021>", "imp<022>", "imp<023>", "imp<024>", "imp<025>"},
},
}
--------------------------------------------------------------------------------------------------
--[[
_ _ _ _
| \ | | (_) | |
| \| | __ ___ ___ __ ___ _ _ __ | |_ ___
| . ` |/ _` \ \ / / '_ \ / _ \| | '_ \| __/ __|
| |\ | (_| |\ V /| |_) | (_) | | | | | |_\__ \
|_| \_|\__,_| \_/ | .__/ \___/|_|_| |_|\__|___/
| |
|_|
]]--
--------------------------------------------------------------------------------------------------
mIntroBB_navpoints = {
warhammer_crate = "whammer_nav",
}
--------------------------------------------------------------------------------------------------
--[[
_______ _ _
|__ __| | | |
| | | |__ _ __ ___ __ _ __| |___
| | | '_ \| '__/ _ \/ _` |/ _` / __|
| | | | | | | | __/ (_| | (_| \__ \
|_| |_| |_|_| \___|\__,_|\__,_|___/
]]--
--------------------------------------------------------------------------------------------------
mIntroBB_thread = {
navpoint_reset = INVALID_THREAD_HANDLE,
killzone_thread = INVALID_THREAD_HANDLE,
distance_thread = INVALID_THREAD_HANDLE,
ship_health_thread = INVALID_THREAD_HANDLE,
imp_attack_thread = INVALID_THREAD_HANDLE,
}
--------------------------------------------------------------------------------------------------mIntroBB
--[[
_ _ _ _ _____ _
/\ (_) | \ | | | | | __ \ | |
/ \ _ __ _ _ __ ___ | \| | ___ __| | ___ | | | | __ _| |_ __ _
/ /\ \ | '_ \| | '_ ` _ \ | . ` |/ _ \ / _` |/ _ \ | | | |/ _` | __/ _` |
/ ____ \| | | | | | | | | | | |\ | (_) | (_| | __/ | |__| | (_| | || (_| |
/_/ \_\_| |_|_|_| |_| |_| |_| \_|\___/ \__,_|\___| |_____/ \__,_|\__\__,_|
]]--
--------------------------------------------------------------------------------------------------
mIntroBB_anim_node = {
raise_ship = "SAM_Raise_Ship",
impfestation = "SAM_Impfestation",
power = "SAM_BB_Power",
}
--------------------------------------------------------------------------------------------------
--[[
_____ _ _ _ _
/ ____| | | | (_) | |
| | | |__ ___ ___| | ___ __ ___ _ _ __ | |_ ___
| | | '_ \ / _ \/ __| |/ / '_ \ / _ \| | '_ \| __/ __|
| |____| | | | __/ (__| <| |_) | (_) | | | | | |_\__ \
\_____|_| |_|\___|\___|_|\_\ .__/ \___/|_|_| |_|\__|___/
| |
|_|
]]--
--------------------------------------------------------------------------------------------------
mIntroBB_checkpoint = {
{
name = MISSION_START_CHECKPOINT, -- First Checkpoint (imp)
init = "mIntroBB_imp_init",
run = "mIntroBB_imp_run",
cleanup = "mIntroBB_imp_cleanup",
next_checkpoint = "mIntroBB_imp_battle",
host_start = "player_ship_host",
client_start = "player_ship_client",
p1_car_nav = "",
p2_car_nav = "",
start_groups = {},
cp_only_groups = {},
},
{
name = "mIntroBB_imp_battle", -- Imp Battle (bat)
init = "mIntroBB_bat_init",
run = "mIntroBB_bat_run",
cleanup = "mIntroBB_bat_cleanup",
next_checkpoint = "nil",
host_start = "player_ship_host",
client_start = "player_ship_client",
p1_car_nav = "",
p2_car_nav = "",
start_groups = {},
cp_only_groups = {},
},
}
--------------------------------------------------------------------------------------------------
--[[
_____ _
/ ____| | |
| | _ _| |_ ___ ___ ___ _ __ ___ ___
| | | | | | __/ __|/ __/ _ \ '_ \ / _ \/ __|
| |___| |_| | |_\__ \ (_| __/ | | | __/\__ \
\_____\__,_|\__|___/\___\___|_| |_|\___||___/
]]--
--------------------------------------------------------------------------------------------------
mIntroBB_scene = {
intro = "",
outro = "Bink_Blackbeard_Aided"
}
--------------------------------------------------------------------------------------------------
--[[
_____ _ _
/ ____| | | (_)
| | ___ _ ____ _____ _ __ ___ __ _| |_ _ ___ _ __ ___
| | / _ \| '_ \ \ / / _ \ '__/ __|/ _` | __| |/ _ \| '_ \/ __|
| |___| (_) | | | \ V / __/ | \__ \ (_| | |_| | (_) | | | \__ \
\_____\___/|_| |_|\_/ \___|_| |___/\__,_|\__|_|\___/|_| |_|___/
]]--
--------------------------------------------------------------------------------------------------
mIntroBB_persona = {
Johnny = {
persona_name = "Johnny_Gat",
persona_id = INVALID_PERSONA_HANDLE
},
Kinzie = {
persona_name = "Kinzie",
persona_id = INVALID_PERSONA_HANDLE
},
Blackbeard = {
persona_name = "Blackbeard",
persona_id = INVALID_PERSONA_HANDLE
},
}
mIntroBB_convo = {
--[[ = {
name = "file_name without voice (_bm, _wm, _bf...",
player_talks = true or false,
handle = INVALID_CONVERSATION_HANDLE,
convo_thread = INVALID_THREAD_HANDLE,
max_wait_seconds = 60, -- if the conversation doesn't complete before this time, kill it
timer_thread = INVALID_THREAD_HANDLE,
priority = CONVO_PRIORITY_HIGH or CONVO_PRIORITY_NORMAL or CONVO_PRIORITY_OPTIONAL
(optional) persona_line = true, -- this is a single line
(required if persona_line) speaker_name = "name of speaker", -- single line speaker (might be set before call to play is made?)
(optional)phone_call = true, -- this is a phone conversation (phone persona must be preloaded)
(required if phone_call) receiving_call = true or false -- auto-answer is always true in missions (until proven otherwise)
},]]
get_warhammer = {
name = "mIntroBB_BB_Get_War_Hammer",
player_talks = false,
handle = INVALID_CONVERSATION_HANDLE,
convo_thread = INVALID_THREAD_HANDLE,
max_wait_seconds = 60,
timer_thread = INVALID_THREAD_HANDLE,
priority = CONVO_PRIORITY_NORMAL,
},
gat_warhammer = {
name = "mIntroBB_Gat_Warhammer_01",
player_talks = false,
handle = INVALID_CONVERSATION_HANDLE,
convo_thread = INVALID_THREAD_HANDLE,
max_wait_seconds = 60,
timer_thread = INVALID_THREAD_HANDLE,
priority = CONVO_PRIORITY_NORMAL,
},
kinzie_warhammer = {
name = "mIntroBB_Kinzie_Warhammer_01",
player_talks = false,
handle = INVALID_CONVERSATION_HANDLE,
convo_thread = INVALID_THREAD_HANDLE,
max_wait_seconds = 60,
timer_thread = INVALID_THREAD_HANDLE,
priority = CONVO_PRIORITY_NORMAL,
},
gat_convo = {
name = "mIntroBB_Con_Gat_A",
player_talks = false,
handle = INVALID_CONVERSATION_HANDLE,
convo_thread = INVALID_THREAD_HANDLE,
max_wait_seconds = 60,
timer_thread = INVALID_THREAD_HANDLE,
priority = CONVO_PRIORITY_NORMAL,
},
kinzie_convo = {
name = "mIntroBB_Con_Kinzie_A",
player_talks = false,
handle = INVALID_CONVERSATION_HANDLE,
convo_thread = INVALID_THREAD_HANDLE,
max_wait_seconds = 60,
timer_thread = INVALID_THREAD_HANDLE,
priority = CONVO_PRIORITY_NORMAL,
},
bb_frustrated = {
name = "mIntroBB_BB_Blackbeard_Frustrat",
player_talks = false,
handle = INVALID_CONVERSATION_HANDLE,
convo_thread = INVALID_THREAD_HANDLE,
max_wait_seconds = 60,
timer_thread = INVALID_THREAD_HANDLE,
priority = CONVO_PRIORITY_NORMAL,
},
imp_explain_1 = {
name = "mIntroBB_BB_Imp_Explain_01",
player_talks = false,
handle = INVALID_CONVERSATION_HANDLE,
convo_thread = INVALID_THREAD_HANDLE,
max_wait_seconds = 60,
timer_thread = INVALID_THREAD_HANDLE,
priority = CONVO_PRIORITY_NORMAL,
},
imp_explain_2 = {
name = "mIntroBB_BB_Imp_Explain_02",
player_talks = false,
handle = INVALID_CONVERSATION_HANDLE,
convo_thread = INVALID_THREAD_HANDLE,
max_wait_seconds = 60,
timer_thread = INVALID_THREAD_HANDLE,
priority = CONVO_PRIORITY_NORMAL,
},
grant_power = {
name = "mIntroBB_Blackbeard_grant_power",
player_talks = false,
handle = INVALID_CONVERSATION_HANDLE,
convo_thread = INVALID_THREAD_HANDLE,
max_wait_seconds = 60,
timer_thread = INVALID_THREAD_HANDLE,
priority = CONVO_PRIORITY_NORMAL,
},
bb_swarmed = {
name = "Mission_Intro_BB_Blackbeard_BB_Attack",
player_talks = false,
handle = INVALID_CONVERSATION_HANDLE,
convo_thread = INVALID_THREAD_HANDLE,
max_wait_seconds = 10, -- if the conversation doesn't complete before this time, kill it
timer_thread = INVALID_THREAD_HANDLE,
priority = CONVO_PRIORITY_NORMAL,
persona_line = true,
speaker_name = mIntroBB_group.start_blackbeard.blackbeard,
},
}
mIntroBB_convo_queue = {
--[[start_drive_queue = {
{ delay = 2.0, convo = mIntroBB_convo.goto_first_checkpoint_nav },
{ delay = 4.0, convo = mIntroBB_convo.goto_first_checkpoint_nav2 },
{ delay = 3.0, convo = mIntroBB_convo.goto_first_checkpoint_nav3 },
{ delay = 5.0, convo = mIntroBB_convo.goto_first_checkpoint_nav4 }
},
]]--
}
--------------------------------------------------------------------------------------------------
--[[
_______ _
|__ __| (_)
| |_ __ _ __ _ __ _ ___ _ __ ___
| | '__| |/ _` |/ _` |/ _ \ '__/ __|
| | | | | (_| | (_| | __/ | \__ \
|_|_| |_|\__, |\__, |\___|_| |___/
__/ | __/ |
|___/ |___/
]]--
--------------------------------------------------------------------------------------------------
mIntroBB_trigger = {
-- = {
-- name = "_trigger",
-- hit = false,
-- last_hit_by = nil, -- last_hit_human = nil (set to the last human to enter the trigger in the default trigger callback)
-- (optional)callback = "mIntroBB_function_name_cb"
-- (optional)marker = TRIGGER_LOCATION or TRIGGER_USE or custom or don't include for no marker
-- (optional)waypoint = true,
-- (optional)teleport_to = {
-- host = "host_nav",
-- client = "client_nav"
-- },
-- (optional)conversation = mIntroBB_convo.convo_name -- play a conversation
-- (optional)next_trigger = "next_trigger_name" sets up next trigger when triggered (breadcrumbs)
--},
--[[ first_checkpoint_nav TRIGGERS ]]--
-- Killzone triggers
kt_ship_killzone_trigger = {
name = "ship_killzone_trigger",
hit = false,
},
open_chest_trig = {
name = "chest_open_trig<001>",
hit = false,
marker = TRIGGER_USE,
--callback = "open_chest_cb",
},
}
--------------------------------------------------------------------------------------------------
--[[ INTERROGATION DATA ]]--
--------------------------------------------------------------------------------------------------
--mIntroBB_interrogate = {
-- leader = {
-- target = mIntroBB_group.friendly_fire.owner,
-- persona = "Interrogation",
-- objective = "mIntroBB_INTERROGATE_OWNER",
-- -- (optional)conversation = mIntroBB_convo.convo_name -- play a conversation while interrogating
-- },
--}
--------------------------------------------------------------------------------------------------
--[[
_____ _____ _
|_ _| | __ \ | |
| | _ __ ___ _ __ | | | | __ _| |_ __ _
| | | '_ ` _ \| '_ \ | | | |/ _` | __/ _` |
_| |_| | | | | | |_) | | |__| | (_| | || (_| |
|_____|_| |_| |_| .__/ |_____/ \__,_|\__\__,_|
| |
|_|
]]--
--------------------------------------------------------------------------------------------------
mIntroBB_imp_navs = {
{ start_pos = "imp_spawn<001>", in_use = false },
{ start_pos = "imp_spawn<002>", in_use = false },
{ start_pos = "imp_spawn<003>", in_use = false },
{ start_pos = "imp_spawn<004>", in_use = false },
{ start_pos = "imp_spawn<005>", in_use = false },
{ start_pos = "imp_spawn<006>", in_use = false },
{ start_pos = "imp_spawn<007>", in_use = false },
{ start_pos = "imp_spawn<008>", in_use = false },
{ start_pos = "imp_spawn<009>", in_use = false },
}
imp_attack_navs = {
{ name = "ship_attack_point<001>", taken = false },
{ name = "ship_attack_point<002>", taken = false },
{ name = "ship_attack_point<003>", taken = false },
{ name = "ship_attack_point<004>", taken = false },
{ name = "ship_attack_point<005>", taken = false },
{ name = "ship_attack_point<006>", taken = false },
{ name = "ship_attack_point<007>", taken = false },
{ name = "ship_attack_point<008>", taken = false },
{ name = "ship_attack_point<009>", taken = false },
{ name = "ship_attack_point<010>", taken = false },
{ name = "ship_attack_point<011>", taken = false },
{ name = "ship_attack_point<012>", taken = false },
{ name = "ship_attack_point<013>", taken = false },
{ name = "ship_attack_point<014>", taken = false },
{ name = "ship_attack_point<015>", taken = false },
{ name = "ship_attack_point<016>", taken = false },
{ name = "ship_attack_point<017>", taken = false },
{ name = "ship_attack_point<018>", taken = false },
{ name = "ship_attack_point<019>", taken = false },
{ name = "ship_attack_point<020>", taken = false },
{ name = "ship_attack_point<021>", taken = false },
}
--------------------------------------------------------------------------------------------------
--[[
____ _ _
/ __ \| | | |
| | | | |_| |__ ___ _ __
| | | | __| '_ \ / _ \ '__|
| |__| | |_| | | | __/ |
\____/ \__|_| |_|\___|_|
]]--
--------------------------------------------------------------------------------------------------
mIntroBB_homie = {
blackbeard = "",
}
mIntroBB_saints = {
--Will be filled in when the mission starts
}
mIntroBB_tweakables = {
--chances that an imp has to attack the ship during the wave (range 0-1)
wave1_chance = 1.0,
wave2_chance = .5,
wave3_chance = 0.0,
max_ship_health = 10000,
damage_per_sec_imp = 20.0, -- this is per imp that is attacking the ship.
}
mIntroBB_is_defending = false
mIntroBB_runtime = {
rs_sam_complete = false,
if_sam_complete = false,
power_sam_complete = false,
}
mIntroBB_current_ship_health = mIntroBB_tweakables.max_ship_health
mIntroBB_attacking_imps = { --stores the imps that are attacking the ship
}
mIntroBB_attacking_effects = { --stores the imps that are attacking the ship
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
{imp = "",
effect = 0,},
}
mIntroBB_attacking_effects_num = 0
mIntroBB_num_attack_imps = 0
--------------------------------------------------------------------------------------------------
--[[
_____ _ _ _ ______ _ _
/ ____| | | | | | | ____| | | (_)
| (___ | |_ __ _ _ __ __| | __ _ _ __ __| | | |__ _ _ _ __ ___| |_ _ ___ _ __ ___
\___ \| __/ _` | '_ \ / _` |/ _` | '__/ _` | | __| | | | '_ \ / __| __| |/ _ \| '_ \/ __|
____) | || (_| | | | | (_| | (_| | | | (_| | | | | |_| | | | | (__| |_| | (_) | | | \__ \
|_____/ \__\__,_|_| |_|\__,_|\__,_|_| \__,_| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
]]--
-- This is the primary entry point for the mission, and is responsible for starting up the mission
-- at the specified checkpoint.
-- CALLED FROM CODE
--
-- start_checkpoint_name: (string) The checkpoint the mission should begin at
-- is_restart: (bool) TRUE if the mission is restarting, FALSE otherwise
--
function mIntroBB_start(start_checkpoint_name, is_restart)
mIntroBB_saints[1] = LOCAL_PLAYER
mIntroBB_saints[2] = mIntroBB_homie.blackbeard
if (coop_is_active() == true) then
mIntroBB_saints[2] = REMOTE_PLAYER
end
set_ped_override_density(.1)
set_traffic_density(.1)
parking_spot_disable_all(true)
mission_start_fade_out(0.0)
-- initialize systems
mission_startup(mIntroBB_trigger, mIntroBB_convo) -- mIntroBB_checkpoint
-- HVS_BDF: we don't necessarily want to call load_persona() because this creates a 2D
-- version, which can prevent actual in-game characters from lip syncing their VO if
-- the 2D persona was loaded prior to their character being spawned.
-- In the case of PC characters, they are present in the world
-- and their characters should lip sync their VO. Same with BB.
--load_persona(mIntro_persona.Johnny)
--load_persona(mIntro_persona.Kinzie)
--load_persona(mIntroBB_persona.Blackbeard)
-- if using interrogations
--interrogate_startup(mIntroBB_interrogate)
local start_cp = get_table_by_name(mIntroBB_checkpoint, MISSION_START_CHECKPOINT)
-- TEMPORARY: give player approximate loadout of weapons & superpowers
-- TODO: remove this before the game ships!!!
--hvUnlockLoadout("mIntroBB")
-- Check if this mission starting from the beginning
player_movement_disable(LOCAL_PLAYER)
if( coop_is_active() == true) then
player_movement_disable(REMOTE_PLAYER)
end
if (start_checkpoint_name == start_cp.name) then
if (is_restart == false and mIntroBB_scene.intro ~= "") then
-- First time playing mission
local fade_in_after = false
cutscene_play(mIntroBB_scene.intro, nil, {start_cp.host_start, start_cp.client_start}, fade_in_after)
else
teleport_coop(start_cp.host_start, start_cp.client_start, true)
end
fade_out(0)
end
-- Handle mission initialization for the current checkpoint
mIntroBB_initialize(start_checkpoint_name)
player_movement_enable(LOCAL_PLAYER)
if( coop_is_active() == true) then
player_movement_enable(REMOTE_PLAYER)
end
local_player_had_hammer = inv_has_item("Melee-Warhammer", LOCAL_PLAYER)
inv_item_remove("Melee-Warhammer", LOCAL_PLAYER)
if( coop_is_active() == true) then
remote_player_had_hammer = inv_has_item("Melee-Warhammer", REMOTE_PLAYER)
inv_item_remove("Melee-Warhammer", REMOTE_PLAYER)
end
-- Run the mission from the current checkpoint
checkpoint_run_mission(mIntroBB_checkpoint, start_checkpoint_name)
mission_end_success("mIntroBB") --, mIntroBB_scene.outro, {start_cp.host_start, start_cp.client_start})
end
-- This is the primary function responsible for cleaning up the entire mission
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++)
--
function mIntroBB_cleanup()
--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--
imp_jump_occasionals_enable( true )
set_ped_override_density(-1)
set_traffic_density(1)
parking_spot_disable_all(false)
-- cleanup all threads
cleanup_threads(mIntroBB_thread)
-- run checkpoint cleanups (move into mission_shutdown?)
checkpoint_cleanup_mission(mIntroBB_checkpoint)
-- cleanup triggers, convos, kill_list and interrogations
mission_shutdown()
-- cleanup all groups
cleanup_groups(mIntroBB_group)
-- cleanup all sams
seamless_animated_moment_cleanup()
on_seamless_animated_moment_end("")
--return normal player jump/sprint values
tweak_table_restore_value ("Jump_super_max_height_scripted")
tweak_table_restore_value ("Sprint_super_max_speed_scripted")
notoriety_set_min_and_max("police", 0, MAX_NOTORIETY_LEVEL)
player_movement_enable(LOCAL_PLAYER)
if( coop_is_active() == true) then
player_movement_enable(REMOTE_PLAYER)
end
player_controls_enable(LOCAL_PLAYER)
if( coop_is_active() == true) then
player_controls_enable(REMOTE_PLAYER)
end
set_player_can_enter_exit_vehicles(LOCAL_PLAYER, true)
if coop_is_active then
set_player_can_enter_exit_vehicles(REMOTE_PLAYER, true)
end
if mission_is_failed() then
--inv_item_remove("Melee-Warhammer", LOCAL_PLAYER);
inv_weapon_remove_temporary(LOCAL_PLAYER,"Melee-Warhammer")
if coop_is_active then
--inv_item_remove("Melee-Warhammer", REMOTE_PLAYER);
inv_weapon_remove_temporary(REMOTE_PLAYER,"Melee-Warhammer")
end
end
if not mission_is_failed() then
player_unlock_super_power( SUPERPOWER_SUMMON, LOCAL_PLAYER, true )
if coop_is_active() then
player_unlock_super_power( SUPERPOWER_SUMMON, REMOTE_PLAYER, true )
end
end
if local_player_had_hammer or not mission_is_failed()then
inv_item_add("Melee-Warhammer", 1, LOCAL_PLAYER, true, 0)
end
if (coop_is_active() == true) then
if remote_player_had_hammer or not mission_is_failed() then
inv_item_add("Melee-Warhammer", 1, REMOTE_PLAYER, true, 0)
end
end
end
-- Called when the mission has ended with success
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++)
--
function mIntroBB_success()
--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]--
-- Equip the superpower if we finished successfully
audio_object_post_event("PirateShip_Music_Stop")
end
--------------------------------------------------------------------------------------------------
--[[
_____ _ _ _ _ _ ______ _ _
|_ _| (_) | (_) | (_) | ____| | | (_)
| | _ __ _| |_ _ __ _| |_ _______ | |__ _ _ _ __ ___| |_ _ ___ _ __ ___
| | | '_ \| | __| |/ _` | | |_ / _ \ | __| | | | '_ \ / __| __| |/ _ \| '_ \/ __|
_| |_| | | | | |_| | (_| | | |/ / __/ | | | |_| | | | | (__| |_| | (_) | | | \__ \
|_____|_| |_|_|\__|_|\__,_|_|_/___\___| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
]]--
-- Initialize the mission for the specified checkpoint
--
-- checkpoint_name: (string) Checkpoint to initialize the mission to
--
function mIntroBB_initialize(checkpoint_name)
-- Common initialization
mIntroBB_initialize_common()
-- Checkpoint specific initialization
checkpoint_init(mIntroBB_checkpoint, checkpoint_name)
-- Remove any present subtitles
message_remove_all()
-- Start fading in
mission_start_fade_in()
end
-- Handle any common initialization
--
function mIntroBB_initialize_common()
--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]--
notoriety_set_min_and_max("police", 0, 4)
imp_jump_occasionals_enable( false )
audio_object_post_event("PirateShip_Music")
end
--------------------------------------------------------------------------------------------------
--[[
_____ _ _ _ _ ______ _ _
/ ____| | | | (_) | | | ____| | | (_)
| | | |__ ___ ___| | ___ __ ___ _ _ __ | |_ | |__ _ _ _ __ ___| |_ _ ___ _ __ ___
| | | '_ \ / _ \/ __| |/ / '_ \ / _ \| | '_ \| __| | __| | | | '_ \ / __| __| |/ _ \| '_ \/ __|
| |____| | | | __/ (__| <| |_) | (_) | | | | | |_ | | | |_| | | | | (__| |_| | (_) | | | \__ \
\_____|_| |_|\___|\___|_|\_\ .__/ \___/|_|_| |_|\__| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
| |
|_|
]]--
--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
--[[
_____ _ _____ __ __
|_ _| | | / ____| /\ | \/ |
| | _ __ | |_ _ __ ___ | (___ / \ | \ / |
| | | '_ \| __| '__/ _ \ \___ \ / /\ \ | |\/| |
_| |_| | | | |_| | | (_) | ____) / ____ \| | | |
|_____|_| |_|\__|_| \___/ |_____/_/ \_\_| |_|
]]--
--------------------------------------------------------------------------------------------------
function mIntroBB_imp_init(mission_start)
fade_out(0.0)
-- TP the players into position
group_create( mIntroBB_group.cin_imp.name, true)
mIntroBB_create_blackbeard(mIntroBB_group.start_blackbeard)
--teleport_coop("tele_host", "tele_client", true)
-- Create Blackbeard and the imp for the cinema
-- Give BB his weapon
inv_item_add( "Pistol-HandCrossbow", 1, mIntroBB_homie.blackbeard, true )
-- Register a callback for when the seamless animated moment completes
on_seamless_animated_moment_end("mIntroBB_ext_cb_impfestation_complete")
--Determine and assign appropriate player character actor
local Johnny_SAM = ""
local Kinzie_SAM = ""
if character_get_anim_set(LOCAL_PLAYER) == "PLYM" then
Johnny_SAM = LOCAL_PLAYER
else
Kinzie_SAM = LOCAL_PLAYER
end
local actor_list2 = { mIntroBB_homie.blackbeard, Johnny_SAM, mIntroBB_group.cin_imp.imp[1], mIntroBB_group.cin_imp.imp[2], Kinzie_SAM}
-- Play the SAM
seamless_animated_moment_prep(mIntroBB_anim_node.impfestation, actor_list2)
seamless_animated_moment_start(mIntroBB_anim_node.impfestation, actor_list2)
--mission_start_fade_in()
audio_object_post_event("Play_MKing_BB_Intro")
-- audio_object_post_event("PirateShip_Music")
fade_in(0.2)
end
function mIntroBB_imp_run()
--failsafe so players don't get their controls enabled. SAM will do it upon completion and there is an enable call in the cleanup in case player exits during SAM.
player_controls_disable(LOCAL_PLAYER)
if coop_is_active() then
player_controls_disable(REMOTE_PLAYER)
end
-- Wait until the SAM is finished
while not mIntroBB_runtime.if_sam_complete do
thread_yield()
end
-- Remove callback
on_seamless_animated_moment_end("")
--player_controls_enable(LOCAL_PLAYER)
--if( coop_is_active() == true) then
--player_controls_enable(REMOTE_PLAYER)
--end
end
function mIntroBB_imp_cleanup(mission_exit)
if mission_exit then
mIntroBB_cleanup_blackbeard()
player_super_attacks_enable( true )
end
on_seamless_animated_moment_end("")
end
--------------------------------------------------------------------------------------------------
--[[
_ ___ _ _ _____
| |/ (_) | | |_ _|
| ' / _| | | | | _ __ ___ _ __ ___
| < | | | | | | | '_ ` _ \| '_ \/ __|
| . \| | | | _| |_| | | | | | |_) \__ \
|_|\_\_|_|_| |_____|_| |_| |_| .__/|___/
| |
|_|
]]--
--------------------------------------------------------------------------------------------------
-- Initialize this checkpoint.
--
-- mission_start: (bool) Whether we're initializing from a mission (re)start or from
-- a natural play-through.
--
function mIntroBB_bat_init(mission_start)
--camera_shake_play_looping("pirate_ship_deck", 1.0)
mIntroBB_create_blackbeard(mIntroBB_group.start_blackbeard)
-- Setup how BB takes damage
character_limb_immune_to_imp( mIntroBB_homie.blackbeard,3)
--on_take_damage("mImpest_blackbeard_hit_cb", mIntroBB_homie.blackbeard)
if mIntroBB_homie.blackbeard ~= nil and mIntroBB_homie.blackbeard ~= "" then
set_attack_enemies_flag(mIntroBB_homie.blackbeard)
end
-- Set the sprint/jump limitations
--[[
trigger_setup(mIntroBB_trigger.js_ship_limit_trigger)
on_trigger("mIntroBB_ship_limit_enter_cb", mIntroBB_trigger.js_ship_limit_trigger.name)
on_trigger_exit("mIntroBB_trigger_limit_exit_cb", mIntroBB_trigger.js_ship_limit_trigger.name)
--]]
--no notoriety during this checkpoint
notoriety_set_max("police", 0)
notoriety_set_can_decay(true)
hud_bar_set_ship_health_percent(mIntroBB_current_ship_health / mIntroBB_tweakables.max_ship_health)
-- Lock the crate containing the warhammer
door_lock("whammer_crate_mover", true)
--HVS_BAS - we need to make sure that the chest is hidden
mesh_mover_show("Chest_Mover<001>")
mesh_mover_hide("Chest_Mover<001>")
end
-- The next objective
--
function mIntroBB_bat_run()
objective_text_clear(0)
objective_text(0,"GM_IMPFEST_OBJ_PROTECT_SHIP","","",SYNC_ALL,OI_ASSET_DEFEND)
marker_add( mIntroBB_homie.blackbeard, MINIMAP_ICON_PROTECT_ACQUIRE, OI_ASSET_DEFEND)
convo_start(mIntroBB_convo.bb_frustrated)
imp_attack_face(true)
mIntroBB_imp_waves()
marker_remove( mIntroBB_homie.blackbeard )
objective_text_clear(0)
if character_get_anim_set(LOCAL_PLAYER) == "PLYM" then
convo_start(mIntroBB_convo.gat_convo)
else
convo_start(mIntroBB_convo.kinzie_convo)
end
convo_wait_for_end()
delay(2.0)
player_controls_disable(LOCAL_PLAYER)
if coop_is_active() then
player_controls_enable(REMOTE_PLAYER)
end
local start_cp = get_table_by_name(mIntroBB_checkpoint, MISSION_START_CHECKPOINT)
cutscene_play(mIntroBB_scene.outro, nil, {"player_end_host", "player_end_client"}, true )
party_dismiss(mIntroBB_homie.blackbeard)
teleport( mIntroBB_homie.blackbeard, "Blackbeard_point")
npc_leash_to_nav( mIntroBB_homie.blackbeard, "Blackbeard_point", 1)
set_script_animation_state(mIntroBB_homie.blackbeard,"stand")
if cutscene_check_exiting() then
thread_yield()
end
convo_start(mIntroBB_convo.grant_power)
on_seamless_animated_moment_end("mIntroBB_PowerSAM_Complete")
local actor_list = { LOCAL_PLAYER, mIntroBB_group.start_blackbeard.blackbeard}
seamless_animated_moment_prep(mIntroBB_anim_node.power, actor_list)
seamless_animated_moment_start(mIntroBB_anim_node.power, actor_list)
effect_play_on_human( "vfx_Altars_PowerUp", LOCAL_PLAYER, "spine2" )
while(mIntroBB_runtime.power_sam_complete == false) do
thread_yield()
end
-- Have player(s) fully power up (non-blocking)
-- local anim_name = "altars_powerup"
-- local morph_name = anim_name
-- local force_play = false
-- local stand_still = true
-- local zero_movement = true
-- action_play_non_blocking(LOCAL_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement)
-- if coop_is_active() then
-- effect_play_on_human( "vfx_Altars_PowerUp", REMOTE_PLAYER, "spine2" )
-- action_play_non_blocking(REMOTE_PLAYER, anim_name, morph_name, force_play, stand_still, zero_movement)
-- end
-- Wait for player to react
--delay(6)
fade_out(1)
fade_out_block()
force_spawn_contacts()
player_super_power_select( "summon", SYNC_ALL, "summon_imp" )
end
-- Do any cleanup for this checkpoint.
--
-- (+++THIS IS CALLED FROM MISSION CLEANUP, MUST RETURN IMMEDIATELY+++)
--
-- mission_exit: (bool) Whether we're exiting the mission entirely, or just
-- moving on to the next checkpoint.
--
function mIntroBB_bat_cleanup(mission_exit)
imp_attack_face(false)
if mission_exit then
mIntroBB_cleanup_blackbeard()
player_super_attacks_enable( true )
end
hud_critical_timer_stop()
thread_kill(mIntroBB_thread.killzone_thread)
thread_kill(mIntroBB_thread.distance_thread)
thread_kill(mIntroBB_thread.ship_health_thread)
thread_kill(mIntroBB_thread.imp_attack_thread)
hud_bar_set_ship_health_percent(0)
notoriety_set_min_and_max("police", 0, MAX_NOTORIETY_LEVEL)
--camera_shake_stop()
for i, npc in pairs(mIntroBB_group.imp_wave.npcs) do
on_anim_trigger("", npc)
end
for i, entry in pairs(mIntroBB_attacking_effects) do
if(entry.imp ~= "") then
on_death("", entry.imp)
end
end
inv_weapon_remove_temporary(LOCAL_PLAYER,"Melee-Warhammer")
if (coop_is_active() == true) then
inv_weapon_remove_temporary(REMOTE_PLAYER,"Melee-Warhammer")
end
if local_player_had_hammer then
inv_item_add("Melee-Warhammer", 1, LOCAL_PLAYER, true, 0)
end
if (coop_is_active() == true) then
if remote_player_had_hammer then
inv_item_add("Melee-Warhammer", 1, REMOTE_PLAYER, true, 0)
end
end
on_door_opened("", "whammer_crate_mover")
on_seamless_animated_moment_end("")
end
------------------------------------
--
-- Checkpoint helper functions
--
------------------------------------
--control how we want the spawning of the imps to go
function mIntroBB_imp_waves()
--check continuously for NPCs that fall off the ship
mIntroBB_thread.killzone_thread = thread_new("mIntroBB_killzone_check")
mIntroBB_thread.distance_thread = thread_new("mIntroBB_player_too_far_thread")
mIntroBB_thread.ship_health_thread = thread_new("mIntroBB_ship_health_thread")
mIntroBB_thread.imp_attack_thread = thread_new("mIntroBB_attack_ship_thread")
-- wave 1
mIntroBB_num_attack_imps = 0
group_create_hidden(mIntroBB_group.imp_wave.name, true)
for i, npc in pairs(mIntroBB_group.imp_wave.npcs) do
-- space them out a little
if i >= mIntroBB_wave_1 then
break
end
mIntroBB_spawn_imp(npc, mIntroBB_tweakables.wave1_chance, false)
local delay_time = rand_float(0.2, 0.4)
if coop_is_active() then
delay_time = delay_time * 1.5
end
delay(delay_time)
-- ai_add_enemy_target( npc, mIntroBB_homie.blackbeard, ATTACK_NOW, true, true )
end
--character_make_priority_target( mIntroBB_homie.blackbeard, true)
--keep spawning until we killed alot
while (kill_list_get_count() > 0) do
thread_yield()
end
mIntroBB_cleanup_wave()
-- Get the warhammer (blocking)
mIntroBB_get_warhammer()
-- wave 2
group_create_hidden(mIntroBB_group.imp_wave.name, true)
for i, npc in pairs(mIntroBB_group.imp_wave.npcs) do
if i >= mIntroBB_wave_2 then
break
end
-- space them out a little
mIntroBB_spawn_imp(npc, mIntroBB_tweakables.wave2_chance, false)
local delay_time = rand_float(0.2, 0.4)
if coop_is_active() then
delay_time = delay_time * 1.5
end
-- delay(delay_time)
--ai_add_enemy_target( npc, mIntroBB_homie.blackbeard, ATTACK_NOW, true, true )
end
--character_make_priority_target( mIntroBB_homie.blackbeard, true)
--keep spawning until we killed alot
while (kill_list_get_count() > 0) do
thread_yield()
end
convo_start(mIntroBB_convo.imp_explain_1)
convo_wait_for_end()
convo_start(mIntroBB_convo.imp_explain_2)
convo_wait_for_end()
mIntroBB_cleanup_wave()
-- wave 3
group_create_hidden(mIntroBB_group.imp_wave.name, true)
for i, npc in pairs(mIntroBB_group.imp_wave.npcs) do
if i >= mIntroBB_wave_3 then
break
end
-- space them out a little
mIntroBB_spawn_imp(npc, mIntroBB_tweakables.wave3_chance)
local delay_time = 0.1
if coop_is_active() then
delay_time =.25
end
delay(delay_time)
-- ai_add_enemy_target( npc, mIntroBB_homie.blackbeard, ATTACK_NOW, true, true )
end
delay(1.0)
convo_start(mIntroBB_convo.bb_swarmed)
--character_make_priority_target( mIntroBB_homie.blackbeard, true)
--keep spawning until we killed alot
while (kill_list_get_count() > 0) do
thread_yield()
end
thread_kill(mIntroBB_thread.killzone_thread)
thread_kill(mIntroBB_thread.distance_thread)
thread_kill(mIntroBB_thread.ship_health_thread)
thread_kill(mIntroBB_thread.imp_attack_thread)
--turn off the ship bar
hud_bar_set_ship_health_percent(0)
end
function mIntroBB_get_warhammer()
-- Clear the current objective
objective_text_clear(0)
objective_text(0,"GM_IMPFEST_OBJ_WARHAMMER","","",SYNC_ALL,OI_ASSET_USE)
--door_message_override("whammer_crate_mover", "GM_INTROBB_OPEN_CHEST")
trigger_setup(mIntroBB_trigger.open_chest_trig)
marker_add(mIntroBB_trigger.open_chest_trig, MINIMAP_ICON_USE, OI_ASSET_USE )
convo_start(mIntroBB_convo.get_warhammer)
while(mIntroBB_trigger.open_chest_trig.hit == false) do
thread_yield()
end
local human = LOCAL_PLAYER
if (coop_is_active() == true) then
if (mIntroBB_trigger.open_chest_trig.last_hit_by == REMOTE_PLAYER) then
human = REMOTE_PLAYER
end
end
--Make sure they cant do any wierd stuff right before the animation
player_controls_disable(human)
player_pos_correct(human, "whammer_crate_mover")
-- Unlock the crate containing the warhammer
door_lock("whammer_crate_mover", false)
door_open("whammer_crate_mover", false, true, human, "open crate", "chest_anim_sync_nav")
--on_door_opened("mIntroBB_warhammer_crate_opened_cb", "whammer_crate_mover")
--Wait until animation is done so hammer does not clip into chest.
delay(2.5)
-- Wait until the player has picked up the warhammer
mIntroBB_give_warhammer()
while not inv_has_item("Melee-Warhammer") do
thread_yield()
end
player_controls_enable(human)
--marker_remove(mIntroBB_navpoints.warhammer_crate)
objective_text_clear(0)
objective_text(0,"GM_IMPFEST_OBJ_PROTECT_SHIP","","",SYNC_ALL,OI_ASSET_DEFEND)
end
function mIntroBB_killzone_check()
while(true) do
mIntroBB_killzone_exit_check()
thread_yield()
end
end
function mIntroBB_cleanup_wave()
mIntroBB_num_attack_imps = 0
--set all the points to go after it again.
for i,nav in pairs(imp_attack_navs) do
nav.taken = false
end
for i, imp in pairs(mIntroBB_attacking_imps) do
mIntroBB_attacking_imps[i] = nil
end
for i, entry in pairs(mIntroBB_attacking_effects) do
if(entry.imp ~= "") then
on_death("", entry.imp)
end
entry.imp = ""
entry.effect = ""
end
mIntroBB_attacking_effects_num = 0
delay(2)
group_destroy(mIntroBB_group.imp_wave.name)
end
function mIntroBB_spawn_imp(imp_name, percent, spawn_anyway)
spawn_anyway = spawn_anyway or true
--character_hide(imp_name)
npc_revive(imp_name)
local nav_table = nil
repeat
local nav_idx = rand_int(1, #mIntroBB_imp_navs)
for i=1, #mIntroBB_imp_navs do
if (mIntroBB_imp_navs[nav_idx].in_use == false or spawn_anyway) then
nav_table = mIntroBB_imp_navs[nav_idx]
nav_table.in_use = true -- mark the navpoint as in use
break
end
nav_idx = nav_idx + 1
if (nav_idx > #mIntroBB_imp_navs) then
nav_idx = 2
end
end
thread_yield()
until(nav_table ~= nil)
teleport(imp_name, nav_table.start_pos, false, true, 0.0, 0.0, 0.0, false, false)
--Only show them when they are at their destination
while (get_dist(imp_name, nav_table.start_pos) > 1) do
thread_yield()
end
--make sure no superpower's interrupt the animation
character_enable_superpower_immunity(imp_name, true)
-- Show and play the climb animation
ai_clear_scripted_action(imp_name)
clear_animation_state(imp_name)
character_show(imp_name)
character_collision_enable(imp_name, false)
human_gravity_enable(imp_name, false)
on_anim_trigger("mIntroBB_imp_cb", imp_name)
--do the blocking ourselves considering that death is a consideration
local random = rand_int(1,10)
if random < 7 then
action_play_non_blocking(imp_name, "spawn_tube")
else
action_play_non_blocking(imp_name, "spawn_tube_a")
end
delay(.5)
kill_list_add( imp_name, OI_ASSET_KILL )
--make some go after the ship
local chance = rand_float(0,1)
if chance <= percent then
--attack the ship!!!
local attack_point = nil
local attempts = 0
while( (attack_point == nil or attack_point.taken == true) and attempts < 50) do
attack_point = get_random_table_entry(imp_attack_navs)
attempts = attempts + 1
end
if(attack_point.taken == false) then
ai_do_scripted_move(imp_name, attack_point.name, true, false)
attack_point.taken = true
thread_new("mIntroBB_get_to_nav_thread",imp_name,attack_point.name)
end
end
mIntroBB_thread.navpoint_reset = thread_new("mIntroBB_Reset_navpoint", nav_table)
end
-- wait for Imp to finish spawning before navpoint can be used again
function mIntroBB_Reset_navpoint(nav_table)
delay(.5)
-- Mark the navpoint as available
nav_table.in_use = false
end
function mIntroBB_cleanup_blackbeard()
if mIntroBB_homie.blackbeard ~= nil and mIntroBB_homie.blackbeard ~= "" then
on_death("", mIntroBB_homie.blackbeard)
on_dismiss("", mIntroBB_homie.blackbeard)
on_take_damage("", mIntroBB_homie.blackbeard)
marker_remove( mIntroBB_homie.blackbeard)
end
end
--check to see if everyone is on the ship
function mIntroBB_killzone_exit_check()
local radius = trigger_get_radius(mIntroBB_trigger.kt_ship_killzone_trigger.name)
local members = kill_list_get_members()
for i, npc in pairs(members) do
if not character_is_dead (npc) and (get_dist(npc,mIntroBB_trigger.kt_ship_killzone_trigger.name) > radius) then
character_kill(npc)
end
if(character_hidden(npc)) then
character_kill(npc)
end
end
if not character_is_dead (mIntroBB_homie.blackbeard) and (get_dist(mIntroBB_homie.blackbeard,mIntroBB_trigger.kt_ship_killzone_trigger.name) > radius) then
character_kill(mIntroBB_homie.blackbeard)
end
end
------------------------------------
--
-- Checkpoint callback functions
--
------------------------------------
function mIntroBB_ship_limit_enter_cb()
message("Jump/Sprint Limits On", 1.0, false)
tweak_table_override_value("Sprint_super_max_speed_scripted", 26)
end
function mIntroBB_imp_cb(imp_name)
character_enable_superpower_immunity(imp_name, false)
human_gravity_enable(imp_name, true)
character_collision_enable(imp_name, true)
end
function mIntroBB_imp_death_cb(imp)
for i, entry in pairs(mIntroBB_attacking_effects) do
if entry.imp == imp then
effect_stop(entry.effect)
end
end
kill_list_clear(imp)
end
function mIntroBB_warhammer_crate_opened_cb()
mIntroBB_give_warhammer()
end
-- Give player(s) war hammer
function mIntroBB_give_warhammer()
thread_yield()
local weapon_name = "Melee-Warhammer"
local count = 1
local unlimited = true
local equip_now = true
local dual_wielding = false
local force_override = false
local upgrade_flags = 0
local allow_downgrade = true
inv_weapon_add_temporary(LOCAL_PLAYER, weapon_name, count, unlimited, equip_now, dual_wielding, force_override, upgrade_flags, allow_downgrade)
if (coop_is_active() == true) then
inv_weapon_add_temporary(REMOTE_PLAYER, weapon_name, count, unlimited, equip_now, dual_wielding, force_override, upgrade_flags, allow_downgrade)
convo_start(mIntroBB_convo.gat_warhammer)
convo_wait_for_end()
convo_start(mIntroBB_convo.kinzie_warhammer)
end
if not coop_is_active() then
if character_get_anim_set(LOCAL_PLAYER) == "PLYM" then
convo_start(mIntroBB_convo.gat_warhammer)
else
convo_start(mIntroBB_convo.kinzie_warhammer)
end
end
end
--when the player is too far for too long, end it
function mIntroBB_too_far_cb()
mission_end_failure("mIntroBB", "GM_IMPFEST_FAIL_BB_DISMISSED")
end
------------------------------------
--
-- Checkpoint thread functions
--
------------------------------------
function playSAMRaise()
-- Register a callback for when the seamless animated moment completes
on_seamless_animated_moment_end("mIntroBB_ext_cb_raise_complete")
local actor_list = { LOCAL_PLAYER, "" }
seamless_animated_moment_prep(mIntroBB_anim_node.raise_ship, actor_list)
seamless_animated_moment_start(mIntroBB_anim_node.raise_ship, actor_list)
while not mIntroBB_runtime.rs_sam_complete do
thread_yield()
end
-- Remove callback
on_seamless_animated_moment_end("")
end
--this will keep track of the imps we sent to attack the ship
function mIntroBB_attack_ship_thread()
while true do
--figure out how many imps are attacking the ship
local attacking_imps = 0
for i, imp in pairs(mIntroBB_attacking_imps) do
if imp ~= nil and not character_is_dead(imp) then
--make sure they are there and doing their attack animation
if check_script_animation_state(imp, mIntroBB_imp_animation_state) and not human_is_frozen(imp) then
attacking_imps = attacking_imps + 1
end
--deal with the on/off vfx
for i, entry in pairs(mIntroBB_attacking_effects) do
if entry.imp == imp then
if entry.effect == 0 and not human_is_frozen(imp) then
entry.effect = effect_play_on_human(imp_attack_navs[1].name, imp, nil, true)
else if human_is_frozen(imp) then
effect_stop(entry.effect)
entry.effect = 0
end
end
break
end
end
end
end
mIntroBB_current_ship_health = mIntroBB_current_ship_health - attacking_imps * mIntroBB_tweakables.damage_per_sec_imp /10 --divided due to the delay, since we are do this every 1/10 of a sec
delay(.1)
end
end
--this determines if we have reached our navpoint to attack the ship
function mIntroBB_get_to_nav_thread(imp_name, nav)
local reached = false
while not character_is_dead(imp_name) and not reached do
if ai_scripted_action_is_complete(imp_name) then
ai_clear_scripted_action(imp_name)
reached = true
--put them in the animation state, but only if they have successfully reached the destination
if(get_dist(imp_name,nav) <= 1.5) then
--hold on to these imps for later use
mIntroBB_attacking_imps[mIntroBB_num_attack_imps] = imp_name
mIntroBB_num_attack_imps = mIntroBB_num_attack_imps + 1
set_script_animation_state(imp_name, mIntroBB_imp_animation_state)
--make sure thye are facing the right way
character_set_orient_from_nav(imp_name,nav)
--play effect
mIntroBB_attacking_effects_num = mIntroBB_attacking_effects_num + 1
mIntroBB_attacking_effects[mIntroBB_attacking_effects_num].effect = effect_play_on_human(nav, imp_name, nil, true)
mIntroBB_attacking_effects[mIntroBB_attacking_effects_num].imp = imp_name
on_death("mIntroBB_imp_death_cb", imp_name)
character_enable_supersprint_immunity(imp_name)
end
end
thread_yield()
end
end
--this will keep track of the ship health for usPistol-HandCrossbow
function mIntroBB_ship_health_thread()
while true do
if mIntroBB_current_ship_health <= 0 then
mIntroBB_current_ship_health = 0
--we failed
mission_end_failure("mIntroBB", "GM_IMPFEST_FAIL_SHIP")
end
hud_bar_set_ship_health_percent(mIntroBB_current_ship_health / mIntroBB_tweakables.max_ship_health)
thread_yield()
end
end
function mIntroBB_player_too_far_thread()
local is_too_far = false
while true do
thread_yield()
--check to see if the player is too far away
local dist = get_dist(LOCAL_PLAYER,mIntroBB_homie.blackbeard)
if coop_is_active() then
local dist_remote = get_dist(REMOTE_PLAYER,mIntroBB_homie.blackbeard)
if dist_remote > dist then
dist = dist_remote
end
end
if dist > mIntroBB_far_distance then
if not is_too_far then
is_too_far = true
hud_critical_timer_set(mIntroBB_hud_time_ms, "GM_IMPFEST_OBJ_WARN_CLOSER", "mIntroBB_too_far_cb")
end
else
if is_too_far then
--reset the timer
is_too_far = false
hud_critical_timer_stop()
end
end
end
end
--------------------------------------------------------------------------------------------------
--[[
_____ ______ _ _
/ ____| | ____| | | (_)
| | ___ _ __ ___ _ __ ___ ___ _ __ | |__ _ _ _ __ ___| |_ _ ___ _ __ ___
| | / _ \| '_ ` _ \| '_ ` _ \ / _ \| '_ \ | __| | | | '_ \ / __| __| |/ _ \| '_ \/ __|
| |___| (_) | | | | | | | | | | | (_) | | | | | | | |_| | | | | (__| |_| | (_) | | | \__ \
\_____\___/|_| |_| |_|_| |_| |_|\___/|_| |_| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
]]--
function mIntroBB_create_blackbeard(blackbeard_group)
if not group_is_loaded(blackbeard_group) then
group_create(blackbeard_group, true)
end
inv_item_add( "Pistol-HandCrossbow", 1, blackbeard_group.blackbeard, true )
character_enable_superpower_immunity(blackbeard_group.blackbeard, true)
mIntroBB_homie.blackbeard = blackbeard_group.blackbeard
--need to make him immune to player damage
--turn_invulnerable(mIntroBB_homie.blackbeard)
character_allow_ragdoll(mIntroBB_homie.blackbeard,false)
follower_remain_in_car(mIntroBB_homie.blackbeard, true)
on_death("mIntroBB_failure_blackbeard_died_cb", mIntroBB_homie.blackbeard)
on_dismiss("mIntroBB_failure_dismissed_cb", mIntroBB_homie.blackbeard)
end
function mIntroBB_setup_and_wait_trigger(trigger, callback)
trigger_setup(trigger)
if callback ~= nil then
on_trigger(callback, trigger.name)
end
while trigger.hit == false do
thread_yield()
end
on_trigger("", trigger.name)
trigger_clear(trigger.name)
end
--------------------------------------------------------------------------------------------------
--[[
_____ _ _ _ _ ______ _ _
/ ____| | | | | | | | ____| | | (_)
| | __ _| | | |__ __ _ ___| | __ | |__ _ _ _ __ ___| |_ _ ___ _ __ ___
| | / _` | | | '_ \ / _` |/ __| |/ / | __| | | | '_ \ / __| __| |/ _ \| '_ \/ __|
| |___| (_| | | | |_) | (_| | (__| < | | | |_| | | | | (__| |_| | (_) | | | \__ \
\_____\__,_|_|_|_.__/ \__,_|\___|_|\_\ |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
]]--
function mIntroBB_failure_dismissed_cb()
mission_end_failure("mIntroBB", "GM_IMPFEST_FAIL_BB_DISMISSED")
end
function mIntroBB_failure_blackbeard_died_cb()
-- End the mission, blackbeard died
mission_end_failure("mIntroBB", "GM_IMPFEST_FAIL_BLACKBEARD")
end
function mIntroBB_trigger_limit_exit_cb()
message("Jump/Sprint Limits Off", 1.0, false)
tweak_table_restore_value("Jump_super_max_height_scripted")
tweak_table_restore_value("Sprint_super_max_speed_scripted")
end
--function to actually hurt blackbeard if it's not from the player. A workaround from the player shooting and blowing him up
function mImpest_blackbeard_hit_cb(character, attacker, health_percent, from_explosion, from_melee, vomit, damage)
if damage ~= nil and( attacker == nil or (not character_is_dead(attacker) and not character_is_player(attacker) ))then
turn_vulnerable(character)
character_damage(character, damage, true, attacker)
turn_invulnerable(character)
end
end
-- Callback for when the Raise Ship SAM completes
function mIntroBB_ext_cb_raise_ship_complete()
group_destroy(mIntroBB_group.ship)
mIntroBB_runtime.rs_sam_complete = true
message("SAM Raise Ship complete", 2.0, false)
end
-- Callback for when the Raise Ship SAM completes
function mIntroBB_ext_cb_raise_complete()
mIntroBB_runtime.rs_sam_complete = true
end
-- Callback for when the Impfestation SAM completes
function mIntroBB_ext_cb_impfestation_complete()
group_destroy(mIntroBB_group.cin_imp)
mIntroBB_runtime.if_sam_complete = true
end
-- Callback for when gaining the summon power sam is complete
function mIntroBB_PowerSAM_Complete()
mIntroBB_runtime.power_sam_complete = true
end
--------------------------------------------------------------------------------------------------
--[[
_______ _ _ ______ _ _
|__ __| | | | | ____| | | (_)
| | | |__ _ __ ___ __ _ __| | | |__ _ _ _ __ ___| |_ _ ___ _ __ ___
| | | '_ \| '__/ _ \/ _` |/ _` | | __| | | | '_ \ / __| __| |/ _ \| '_ \/ __|
| | | | | | | | __/ (_| | (_| | | | | |_| | | | | (__| |_| | (_) | | | \__ \
|_| |_| |_|_| \___|\__,_|\__,_| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
]]--