--[[ USING THE MISSION START TEMPLATE
1. Read "SR3 Mission Scripting Standards" if you haven't already.
2. Save this file as "mmBlastTutorial.lua" in the missions directory.
3. Replace "mmBlastTutorial" with the name of your mission (must use the same name as your mission start node).
3a. Replace "mmBlastTutorial" with the capitalized name of your mission
4. Replace "3-3-2014" with today's date.
5. Replace "Arturo Mata" with your name.
6. Replace "Ultor" with the name of the first location to go to
7. Replace "fcp with a 3-4 letter abbreviation for the first checkpoint.
8. Replace "" with the second checkpoint name (first is named start)
9. Replace "" with a 3-4 letter abbreviation for the next checkpoint.succes
10. If you find an error with this template, fix it and check it in!!!!
11. Remove these instructions. You're on your own now!
]]--
--[[
mmBlastTutorial.lua
SR3 Mission Script
DATE: 3-3-2014
AUTHOR: Arturo Mata
]]--
-- Debug flags --
-- Tweakable Parameters --
--------------------------------------------------------------------------------------------------
--[[ GROUPS ]]--
--------------------------------------------------------------------------------------------------
mmBlastTutorial_group = {
--[[ startup GROUPS ]]--
wave_1 =
{
name = "wave_1",
members =
{
"Demon_Grunt<001>",
},
coop_name = "coop_wave_1",
coop_only_members =
{
"Demon_Grunt<002>",
},
damage_threads = { },
},
wave_2 =
{
name = "wave_2",
members =
{
"Demon_Grunt<003>",
"Demon_Grunt<004>",
"Demon_Grunt<005>",
},
coop_name = "coop_wave_2",
coop_only_members =
{
"Demon_Grunt<006>",
"Demon_Grunt<007>",
"Demon_Grunt<008>",
},
damage_threads = { },
},
wave_3 =
{
name = "wave_3",
members =
{
"Demon_Grunt<009>",
"Demon_Grunt<010>",
"Demon_Grunt<011>",
"Demon_Grunt<012>",
"Demon_Grunt<013>",
"Demon_Grunt<014>",
},
coop_name = "coop_wave_3",
coop_only_members =
{
"Demon_Grunt<015>",
"Demon_Grunt<016>",
"Demon_Grunt<017>",
"Demon_Grunt<018>",
"Demon_Grunt<019>",
"Demon_Grunt<020>",
},
damage_threads = { },
},
wave_4 =
{
name = "wave_4",
members =
{
"Winged_Militia<001>",
},
destination_1 = "Winged_Militia_Dest<001>",
destination_2 = "Winged_Militia_Dest<002>",
coop_name = "coop_wave_4",
coop_only_members =
{
"Winged_Militia<002>",
},
damage_threads = { },
},
wave_5 =
{
name = "wave_5",
members =
{
"Winged_Militia<003>",
"Winged_Militia<004>",
"Winged_Militia<005>",
},
destination_3 = "Winged_Militia_Dest<003>",
destination_4 = "Winged_Militia_Dest<004>",
destination_5 = "Winged_Militia_Dest<005>",
destination_6 = "Winged_Militia_Dest<006>",
destination_7 = "Winged_Militia_Dest<007>",
coop_name = "coop_wave_5",
coop_only_members =
{
"Winged_Militia<006>",
"Winged_Militia<007>",
},
damage_threads = { },
},
wave_6 =
{
name = "wave_6",
members =
{
"Dark_Inciter<001>",
},
destination_8 = "Respawn_Navpoint_inciter<001>",
destination_9 = "Respawn_Navpoint_inciter<002>",
coop_name = "coop_wave_6",
coop_only_members =
{
"Dark_Inciter<002>"
},
damage_threads = { },
},
--[[ GROUPS ]]--
}
mmBlastTutorial_respawn_points =
{
-- wave_1
[ "Demon_Grunt<001>" ] = "Respawn_Navpoint<001>",
[ "Demon_Grunt<002>" ] = "Respawn_Navpoint<002>",
-- wave_2
[ "Demon_Grunt<003>" ] = "Respawn_Navpoint<003>",
[ "Demon_Grunt<004>" ] = "Respawn_Navpoint<004>",
[ "Demon_Grunt<005>" ] = "Respawn_Navpoint<005>",
[ "Demon_Grunt<006>" ] = "Respawn_Navpoint<006>",
[ "Demon_Grunt<007>" ] = "Respawn_Navpoint<007>",
[ "Demon_Grunt<008>" ] = "Respawn_Navpoint<008>",
-- wave_3
[ "Demon_Grunt<009>" ] = "Respawn_Navpoint<009>",
[ "Demon_Grunt<010>" ] = "Respawn_Navpoint<010>",
[ "Demon_Grunt<011>" ] = "Respawn_Navpoint<011>",
[ "Demon_Grunt<012>" ] = "Respawn_Navpoint<012>",
[ "Demon_Grunt<013>" ] = "Respawn_Navpoint<013>",
[ "Demon_Grunt<014>" ] = "Respawn_Navpoint<014>",
[ "Demon_Grunt<015>" ] = "Respawn_Navpoint<015>",
[ "Demon_Grunt<016>" ] = "Respawn_Navpoint<016>",
[ "Demon_Grunt<017>" ] = "Respawn_Navpoint<017>",
[ "Demon_Grunt<018>" ] = "Respawn_Navpoint<018>",
[ "Demon_Grunt<019>" ] = "Respawn_Navpoint<019>",
[ "Demon_Grunt<020>" ] = "Respawn_Navpoint<020>",
-- wave_4
[ "Winged_Militia<001>" ] = "Respawn_Navpoint_winged<001>",
[ "Winged_Militia<002>" ] = "Respawn_Navpoint_winged<002>",
-- wave_5
[ "Winged_Militia<003>" ] = "Respawn_Navpoint_winged<003>",
[ "Winged_Militia<004>" ] = "Respawn_Navpoint_winged<004>",
[ "Winged_Militia<005>" ] = "Respawn_Navpoint_winged<005>",
[ "Winged_Militia<006>" ] = "Respawn_Navpoint_winged<006>",
[ "Winged_Militia<007>" ] = "Respawn_Navpoint_winged<007>",
-- wave_6
[ "Dark_Inciter<001>" ] = "Respawn_Navpoint_inciter<001>",
[ "Dark_Inciter<002>" ] = "Respawn_Navpoint_inciter<002>",
}
--------------------------------------------------------------------------------------------------
--[[ THREADS ]]--
--------------------------------------------------------------------------------------------------
mmBlastTutorial_thread = {
-- = INVALID_THREAD_HANDLE,
lava_trigger_threads = { INVALID_THREAD_HANDLE, INVALID_THREAD_HANDLE },
}
--------------------------------------------------------------------------------------------------
--[[ EFFECTS ]]--
--------------------------------------------------------------------------------------------------
mmBlastTutorial_effects = {
respawn_effect = "Vfx Hell Teleport 01<001>",
}
--------------------------------------------------------------------------------------------------
--[[ CHECKPOINTS ]]--
--------------------------------------------------------------------------------------------------
mmBlastTutorial_checkpoint = {
{
name = MISSION_START_CHECKPOINT, -- First Checkpoint (fcp)
init = "mmBlastTutorial_fcp_init", -- init(bool mission_restart)
run = "mmBlastTutorial_fcp_run", -- run()
cleanup = "mmBlastTutorial_fcp_cleanup", -- cleanup(bool mission_exit) (+++MUST RETURN IMMEDIATELY+++)
--next_checkpoint = "mmBlastTutorial_",
next_checkpoint = nil,
host_start = "Player_start_nav_host",
client_start = "Player_start_nav_client",
p1_car_nav = "",
p2_car_nav = "",
start_groups = { },
cp_only_groups = { },
},
}
--------------------------------------------------------------------------------------------------
--[[ CUTSCENES ]]--
--------------------------------------------------------------------------------------------------
mmBlastTutorial_scene = {
intro = "",
outro = ""
}
--------------------------------------------------------------------------------------------------
--[[ CONVERSATIONS ]]--
--------------------------------------------------------------------------------------------------
mmBlastTutorial_persona = {
Kiki = {
persona_name = "KIKI",
persona_id = INVALID_PERSONA_HANDLE
},
Viola = {
persona_name = "SUKO",
persona_id = INVALID_PERSONA_HANDLE
},
}
mmBlastTutorial_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)
},]]
-- Welcome�to�the�Inferno�room.�A�place�we�are�free�to�experiment.�Now�lets�test out your�Stone�Blast power. Try turning these�demons�to�stone�then�use�your�pistol�to�shatter�them.
intro = {
name = "mmblasttutorial_intro",
player_talks = 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,
},
-- So go ahead and blast these�demons�to turn them to�stone! Then�use�your�pistol�to�shatter�them into lots of little bits.
wave = {
name = "mmBlastTutorial_wave",
player_talks = 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,
},
-- Exquisite.�I�think�you'll�find�the�power�particularly�useful�against�flying�demons,�like�this�one.
flying = {
name = "mmBlastTutorial_flying",
player_talks = 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,
},
-- Nicely,�done.�Let's�see�you�drop�a�few�more.
more_flying = {
name = "mmBlastTutorial_flying_more",
player_talks = 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,
},
-- Blast�powers�also�deactivate�enemy�shields.�Use�the�blast�to�take�out�the�shield�on�a�Dark�Inciter�then�give�it�a�face�full�of�bullets!
inciter = {
name = "mmBlastTutorial_dark_inciter",
player_talks = 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,
},
-- Didn�t�doubt�you�for�a�second.�Weird�saying�this,�but�that�halo�fits�you�nicely.
success = {
name = "mmBlastTutorial_success",
player_talks = 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,
},
-- I�know�it's�fun�to�blast�these�things�back�to...�hell,�but�you�will�need�to�use�Stone�Blast�first�to�complete�this�exercise.
chide = {
name = "mmBlastTutorial_chide",
player_talks = 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,
},
}
mmBlastTutorial_convo_queue = {
--[[start_drive_queue = {
{ delay = 2.0, convo = mmBlastTutorial_convo.goto_Ultor },
{ delay = 4.0, convo = mmBlastTutorial_convo.goto_Ultor2 },
{ delay = 3.0, convo = mmBlastTutorial_convo.goto_Ultor3 },
{ delay = 5.0, convo = mmBlastTutorial_convo.goto_Ultor4 }
},
]]--
}
--------------------------------------------------------------------------------------------------
--[[ TRIGGERS ]]--
--------------------------------------------------------------------------------------------------
mTutorial_trigger = {
-- = {
-- name = "_trigger",
-- hit = false,
-- last_hit_by = nil, -- last```````````r`r_hit_human = nil (set to the last human to enter the trigger in the default trigger callback)
-- (optional)callback = "mmBlastTutorial_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 = mmBlastTutorial_convo.convo_name -- play a conversation
-- (optional)next_trigger = "next_trigger_name" sets up next trigger when triggered (breadcrumbs)
--},
--[[ Ultor TRIGGERS ]]--
--[[ Lava TRIGGERS ]]--
lava_trigger =
{
name = "lava_trigger",
callback = "mmTutorial_lava_trigger_callback",
},
--[[ TRIGGERS ]]--
}
--------------------------------------------------------------------------------------------------
--[[ INTERROGATION DATA ]]--
--------------------------------------------------------------------------------------------------
--mmBlastTutorial_interrogate = {
-- leader = {
-- target = mmBlastTutorial_group.friendly_fire.owner,
-- persona = "Interrogation",
-- objective = "mmBlastTutorial_INTERROGATE_OWNER",
-- -- (optional)conversation = mmBlastTutorial_convo.convo_name -- play a conversation while interrogating
-- },
--}
--------------------------------------------------------------------------------------------------
--[[ OTHER ]]--
--------------------------------------------------------------------------------------------------
mmBlast_runtime =
{
bPersonaLoaded = false,
}
--mmBlastTutorial_PowerEquipped_Local = false
--mmBlastTutorial_PowerEquipped_Remote = false
SUPERPOWER_BLAST = 3
PLAYER_SUPERPOWER_BLAST_STONE = 9
mmBlastTutorial_CurrentActiveEnemies = 0
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Standard functions ]]--
--[[ ]]--
--[[**********************]]--
-- This is the primary entry point for the mission, and is responsible for starting up the mission
-- at the specified checkpoint.
-- CALLED FROM CODE
--
-- start_checkpoint_name: (string) The checkpoint the mission should begin at
-- is_restart: (bool) TRUE if the mission is restarting, FALSE otherwise
--
function mmBlastTutorial_start(start_checkpoint_name, is_restart)
mission_start_fade_out(0.0)
disable_diversions(true)
ui_hud_set_current_challenge(-1)
-- turn off all pickup drops
health_pickups_enable(false)
human_all_stop_dropping_weapons(true)
human_all_stop_dropping_cash(true)
-- Swap to the training facility.
city_zone_swap( "u_train", true )
set_ped_override_density(.1)
set_traffic_density(.1)
parking_spot_disable_all(true)
-- initialize systems
mission_startup(mTutorial_trigger, mmBlastTutorial_convo) -- mmBlastTutorial_checkpoint
-- if using interrogations
--interrogate_startup(mmBlastTutorial_interrogate)
local start_cp = get_table_by_name(mmBlastTutorial_checkpoint, MISSION_START_CHECKPOINT)
-- Check if this mission starting from the beginning
if (start_checkpoint_name == start_cp.name) then
if (is_restart == false and mmBlastTutorial_scene.intro ~= "") then
-- First time playing mission
local fade_in_after = false
cutscene_play(mmBlastTutorial_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
mmBlastTutorial_initialize(start_checkpoint_name)
-- Run the mission from the current checkpoint
checkpoint_run_mission(mmBlastTutorial_checkpoint, start_checkpoint_name)
mission_end_success("mmBlastTutorial", nil, { "player_end_nav_client", "player_end_nav_host" } ) -- mmBlastTutorial_scene.outro, {, })
end
-- This is the primary function responsible for cleaning up the entire mission
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++)
--
function mmBlastTutorial_cleanup()
--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--
city_zone_swap( "u_train", false, true )
-- Re-enable all superpowers and weapon radial
local enable = true
player_super_attacks_enable( enable, "Stomp" )
player_super_attacks_enable( enable, "Aura" )
player_super_attacks_enable( enable, "Summon" )
player_super_power_lock_to_tutorial_element( false )
hud_inventory_disable( false )
player_super_power_set_regen_scalar_buff(1.0)
npc_respawn_dist_reset()
hud_prompt_clear()
set_ped_override_density(-1)
set_traffic_density(1)
parking_spot_disable_all(false)
disable_diversions(false)
ui_hud_set_current_challenge(-2)
-- cleanup all threads
cleanup_threads(mmBlastTutorial_thread)
-- run checkpoint cleanups (move into mission_shutdown?)
checkpoint_cleanup_mission(mmBlastTutorial_checkpoint)
-- cleanup triggers, convos, kill_list and interrogations
mission_shutdown()
-- cleanup all groups
cleanup_groups(mmBlastTutorial_group)
-- turn back on pickup drops
health_pickups_enable(true)
human_all_stop_dropping_weapons(false)
human_all_stop_dropping_cash(false)
--ensure warp to shore is back on
player_warp_to_shore_enable( LOCAL_PLAYER )
if coop_is_active() == true then
player_warp_to_shore_enable( REMOTE_PLAYER )
end
--fade_out_block()
-- delay(1.5)
-- city_zone_swap( "u_train", false )
-- teleport the player
-- teleport_coop("player_end_nav_host", "player_end_nav_client", true)
-- delay(3.0)
--fade_in_block()
end
-- Called when the mission has ended with success
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++)
--
function mmBlastTutorial_success()
--[[ INSERT ANY MISSION SPECIFIC SUCCESS STUFF ]]--
end
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Initialize functions ]]--
--[[ ]]--
--[[**********************]]--
-- Initialize the mission for the specified checkpoint
--
-- checkpoint_name: (string) Checkpoint to initialize the mission to
--
function mmBlastTutorial_initialize(checkpoint_name)
-- Common initialization
mmBlastTutorial_initialize_common()
-- Checkpoint specific initialization
checkpoint_init(mmBlastTutorial_checkpoint, checkpoint_name)
-- Setup the lava trigger
trigger_setup( mTutorial_trigger.lava_trigger )
-- Remove any present subtitles
message_remove_all()
-- Start fading in
mission_start_fade_in()
audio_object_post_event( "Play_BlastTutorialMusic" )
end
-- Handle any common initialization
--
function mmBlastTutorial_initialize_common()
--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]--
waypoint_remove()
mission_set_cancel_warp_location("player_end_nav_host", "player_end_nav_client")
if mmBlast_runtime.bPersonaLoaded == false then
load_persona(mmBlastTutorial_persona.Kiki)
load_persona(mmBlastTutorial_persona.Viola)
mmBlast_runtime.bPersonaLoaded = true
end
-- Enable superpower stuffs
player_super_movement_enable( true )
player_super_attacks_enable( true )
-- Disable all superpowers and weapon radial
local enable = false
player_super_attacks_enable( enable, "Stomp" )
player_super_attacks_enable( enable, "Aura" )
player_super_attacks_enable( enable, "Summon" )
player_super_power_lock_to_tutorial_element( true, "blast_stone", SYNC_ALL )
player_super_power_select( "Blast", SYNC_ALL, "blast_stone" )
hud_inventory_disable( true )
end
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Checkpoint functions ]]--
--[[ ]]--
--[[**********************]]--
--------------------------------------------------------------------------------------------------
--[[ First Checkpoint Name ]]--
--------------------------------------------------------------------------------------------------
-- Initialize this checkpoint.
--
-- mission_start: (bool) Whether we're initializing from a mission (re)start or from
-- a natural play-through.
--
function mmBlastTutorial_fcp_init(mission_start)
-- Set up the players as invulnerable
turn_invulnerable( LOCAL_PLAYER )
if coop_is_active() == true then
turn_invulnerable( REMOTE_PLAYER )
end
-- Disable warp to shore
player_warp_to_shore_disable( LOCAL_PLAYER )
if coop_is_active() == true then
player_warp_to_shore_disable( REMOTE_PLAYER )
end
--Remove all summons
player_super_power_clear_summons(LOCAL_PLAYER)
-- In the case that this power isn't unlocked, unlock it.
-- Really only here for debug purposes when jumping into the mission at hvslice 0.
player_unlock_super_power( SUPERPOWER_BLAST, LOCAL_PLAYER, true )
if coop_is_active() then
player_unlock_super_power( SUPERPOWER_BLAST, REMOTE_PLAYER, true )
end
-- Disable melee (because if the co-op client melees, they gain ownership of the enemy and that messes up our death callbacks)
set_player_can_take_human_shields( LOCAL_PLAYER, false )
set_player_can_take_human_shields( REMOTE_PLAYER, false )
player_allow_weapon_melee( false )
-- Disable notoriety
notoriety_set_min_and_max( "luchadores", 0, 0 )
notoriety_set_min_and_max( "police", 0, 0 )
end
-- The first objective
--
function mmBlastTutorial_fcp_run()
-- Default to no power selected so that they have to select the power.
--player_super_power_select( "none", SYNC_ALL )
-- Give the player a pistol and make it the only available weapon
-- Give the player a pistol and make it the only available weapon
inv_weapon_add_temporary( LOCAL_PLAYER, "Pistol-Gang", 100, true, true, false, true )
inv_item_equip("Pistol-Gang", LOCAL_PLAYER)
if coop_is_active() == true then
inv_weapon_add_temporary( REMOTE_PLAYER, "Pistol-Gang", 100, true, true, false, true )
inv_item_equip("Pistol-Gang", REMOTE_PLAYER)
end
inv_weapon_disable_all_but_this_slot( WEAPON_SLOT_PISTOL, true, SYNC_ALL )
-- player_super_power_set_temp_charge( 1.5 )
-- player_super_power_set_temp_strength( "freeze", 1.0 )
player_super_power_set_regen_scalar_buff(5.0)
-- Do not allow weapon pick ups
auto_pickup_weapons(false)
-- Do not allow access to the hub menu
cellphone_lock(true)
convo_start(mmBlastTutorial_convo.intro)
convo_wait_for_end()
convo_start(mmBlastTutorial_convo.wave)
-- local tutorial_to_play = "super_radial_select"
-- if game_is_active_input_gamepad() == false then
-- tutorial_to_play = "super_radial_select_pc"
-- end
-- Reset our power equipped global.
-- mmBlastTutorial_PowerEquipped_Local = false
-- mmBlastTutorial_PowerEquipped_Remote = false
--tutorial_start(tutorial_to_play, 1, true, true, true)
--on_superpower_equip("mmBlastTutorial_stone_blast_equipped_cb", LOCAL_PLAYER)
--on_superpower_equip("mmBlastTutorial_stone_blast_equipped_cb", REMOTE_PLAYER)
--if( coop_is_active() == false ) then
--- while not mmBlastTutorial_PowerEquipped_Local do
-- thread_yield()
-- end
--else
-- while not (mmBlastTutorial_PowerEquipped_Local and mmBlastTutorial_PowerEquipped_Remote ) do
-- thread_yield()
-- end
--end
-- Freeze equipped, clear the tutorial and start the process
-- on_superpower_equip("", LOCAL_PLAYER)
-- on_superpower_equip("", REMOTE_PLAYER)
-- tutorial_stop(tutorial_to_play)
objective_text( 0, "SRG_MMBLAST_OBJECTIVE_ENEMIES", "", "", SYNC_ALL, OI_ASSET_POWER_BLAST )
-- tutorial_stop_current()
hud_prompt(LOCAL_PLAYER, "SRG_MMBLAST_USE_NAG", "", true)
-- Play the tutorial text
local tutorial_name = "blast_enemies"
local delay_ms = 0
local auto_unlock = false
local allow_redisplay = false
local infinite_display = true
tutorial_start(tutorial_name, delay_ms, auto_unlock, allow_redisplay, infinite_display)
mmBlastTutorial_wave_setup( mmBlastTutorial_group.wave_1 )
while mmBlastTutorial_CurrentActiveEnemies > 0 do
thread_yield()
end
hud_prompt_clear()
mmBlastTutorial_wave_setup( mmBlastTutorial_group.wave_2 )
while mmBlastTutorial_CurrentActiveEnemies > 0 do
thread_yield()
end
-- mmBlastTutorial_wave_setup( mmBlastTutorial_group.wave_3 )
-- while mmBlastTutorial_CurrentActiveEnemies > 0 do
-- thread_yield()
-- end
objective_text_clear(0)
objective_text( 0, "SRG_MMBLAST_OBJECTIVE_FLYING", "", "", SYNC_ALL, OI_ASSET_POWER_BLAST )
convo_start(mmBlastTutorial_convo.flying)
mmBlastTutorial_wave_setup( mmBlastTutorial_group.wave_4 )
tutorial_stop_current()
-- Play the tutorial text
tutorial_name = "blast_flying"
tutorial_start(tutorial_name, delay_ms, auto_unlock, allow_redisplay, infinite_display)
ai_attack_region("Winged_Militia<001>", mmBlastTutorial_group.wave_4.destination_1, 5.0)
if coop_is_active() == true then
ai_attack_region("Winged_Militia<002>", mmBlastTutorial_group.wave_4.destination_2, 5.0)
end
while mmBlastTutorial_CurrentActiveEnemies > 0 do
thread_yield()
end
convo_start(mmBlastTutorial_convo.more_flying)
mmBlastTutorial_wave_setup( mmBlastTutorial_group.wave_5 )
ai_attack_region("Winged_Militia<003>", mmBlastTutorial_group.wave_5.destination_3, 5.0)
ai_attack_region("Winged_Militia<004>", mmBlastTutorial_group.wave_5.destination_4, 5.0)
ai_attack_region("Winged_Militia<005>", mmBlastTutorial_group.wave_5.destination_5, 5.0)
if coop_is_active() == true then
ai_attack_region("Winged_Militia<006>", mmBlastTutorial_group.wave_5.destination_6, 5.0)
ai_attack_region("Winged_Militia<007>", mmBlastTutorial_group.wave_5.destination_7, 5.0)
end
while mmBlastTutorial_CurrentActiveEnemies > 0 do
thread_yield()
end
objective_text_clear(0)
objective_text( 0, "SRG_MMBLAST_OBJECTIVE_INCITER", "", "", SYNC_ALL, OI_ASSET_POWER_BLAST )
convo_start(mmBlastTutorial_convo.inciter)
tutorial_stop_current()
-- Play the tutorial text
tutorial_name = "blast_inciter"
tutorial_start(tutorial_name, delay_ms, auto_unlock, allow_redisplay, infinite_display)
mmBlastTutorial_final_wave_setup( mmBlastTutorial_group.wave_6)
while mmBlastTutorial_CurrentActiveEnemies > 0 do
thread_yield()
end
objective_text_clear(0)
convo_start(mmBlastTutorial_convo.success)
convo_wait_for_end()
delay(1.0)
-- Fade the screen so we can zone swap.
fade_out(0.0)
delay(2.0)
end
-- Do any cleanup for this checkpoint.
--
-- (+++THIS IS CALLED FROM MISSION CLEANUP, MUST RETURN IMMEDIATELY+++)
--
-- mission_exit: (bool) Whether we're exiting the mission entirely, or just
-- moving on to the next checkpoint.
--
function mmBlastTutorial_fcp_cleanup(mission_exit)
-- clean up the lava trigger
trigger_cb( "", mTutorial_trigger.lava_trigger )
-- turn back on all pickup drops
health_pickups_enable(true)
human_all_stop_dropping_weapons(false)
human_all_stop_dropping_cash(false)
-- Allow weapon pick ups
auto_pickup_weapons(true)
-- Re-enable all superpowers and weapon radial
inv_weapon_remove_temporary( LOCAL_PLAYER, "Pistol-Gang")
if coop_is_active() == true then
inv_weapon_remove_temporary( REMOTE_PLAYER, "Pistol-Gang")
end
-- Re-enable all weapon slots
inv_weapon_disable_all_slots( false, SYNC_ALL )
inv_weapon_remove_temporary( LOCAL_PLAYER, "Pistol-Gang" )
if coop_is_active() == true then
inv_weapon_remove_temporary( REMOTE_PLAYER, "Pistol-Gang" )
end
-- Re-enable access to the hub menu
cellphone_lock( false )
turn_vulnerable( LOCAL_PLAYER )
if coop_is_active() == true then
turn_vulnerable( REMOTE_PLAYER )
end
-- Enable warp to shore
player_warp_to_shore_enable( LOCAL_PLAYER )
if coop_is_active() == true then
player_warp_to_shore_enable( REMOTE_PLAYER )
end
-- Clean up superpower tweaks.
player_super_power_set_temp_charge( -1 )
player_super_power_set_temp_strength( "freeze", -1 )
-- on_superpower_equip( "", LOCAL_PLAYER )
--on_superpower_equip( "", REMOTE_PLAYER )
dark_inciter_ultra_shield_only_vulnerable_to_superpowers( false )
npc_respawn_dist_reset()
-- Re-enable melee
set_player_can_take_human_shields( LOCAL_PLAYER, true )
set_player_can_take_human_shields( REMOTE_PLAYER, true )
player_allow_weapon_melee( true )
-- Re-enable notoriety
notoriety_set_min_and_max( "luchadores", 0, MAX_NOTORIETY_LEVEL )
notoriety_set_min_and_max( "police", 0, MAX_NOTORIETY_LEVEL )
end
------------------------------------
--
-- Checkpoint helper functions
--
------------------------------------
function mmBlastTutorial_wave_setup( wave_group )
-- Reset our enemy counter
mmBlastTutorial_CurrentActiveEnemies = 0
-- Allow respawning at a close distance
npc_respawn_dist_override( 100000.0 )
-- Create the wave
group_create( wave_group.name )
-- Set special tutorial wave properties.
for i, wave_member in pairs( wave_group.members ) do
-- Ensure they know about and see the players
ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true )
if coop_is_active() then
ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true )
end
--turn_invulnerable( wave_member )
npc_respawn_after_death( wave_member, true )
npc_respawn_after_death_time_override( wave_member, 10, true )
on_death( "mmBlastTutorial_on_death_cb", wave_member )
marker_add( wave_member, MINIMAP_ICON_BLAST, OI_ASSET_POWER_BLAST, OI_FLAGS_DEFAULT, SYNC_ALL )
mmBlastTutorial_CurrentActiveEnemies = mmBlastTutorial_CurrentActiveEnemies + 1
end
if coop_is_active() then
-- Create the co-op wave
group_create( wave_group.coop_name )
-- Set special tutorial wave properties.
for i, wave_member in pairs( wave_group.coop_only_members ) do
-- Ensure they know about and see the players
ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true )
ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true )
npc_respawn_after_death( wave_member, true )
npc_respawn_after_death_time_override( wave_member, 10, true )
on_death( "mmBlastTutorial_on_death_cb", wave_member )
marker_add( wave_member, MINIMAP_ICON_BLAST, OI_ASSET_POWER_BLAST, OI_FLAGS_DEFAULT, SYNC_ALL )
mmBlastTutorial_CurrentActiveEnemies = mmBlastTutorial_CurrentActiveEnemies + 1
end
end
end
function mmBlastTutorial_final_wave_setup( wave_group )
-- Reset our enemy counter
mmBlastTutorial_CurrentActiveEnemies = 0
-- Create the wave
group_create( wave_group.name )
-- Set special tutorial wave properties.
for i, wave_member in pairs( wave_group.members ) do
-- Ensure they know about and see the players
-- ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true )
if coop_is_active() then
-- ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true )
end
turn_invulnerable( wave_member )
wave_group.damage_threads[ wave_member ] = thread_new("mmBlastTutorial_npc_frozen_thread", wave_member )
on_death( "mmBlastTutorial_final_wave_on_death_cb", wave_member )
on_take_damage( "mmTutorial_final_wave_on_damage", wave_member )
marker_add( wave_member, MINIMAP_ICON_BLAST, OI_ASSET_POWER_BLAST, OI_FLAGS_DEFAULT, SYNC_ALL )
mmBlastTutorial_CurrentActiveEnemies = mmBlastTutorial_CurrentActiveEnemies + 1
--Set dark inciters' ultra shields to be immune to non-superpowers
tutorial_ultra_shield_only_vulnerable_to_superpowers( wave_member, true)
end
if coop_is_active() then
-- Create the wave
group_create( wave_group.coop_name )
-- Set special tutorial wave properties.
for i, wave_member in pairs( wave_group.coop_only_members ) do
-- Ensure they know about and see the players
-- ai_add_enemy_target( wave_member, LOCAL_PLAYER, ATTACK_ON_SIGHT, false, true )
-- ai_add_enemy_target( wave_member, REMOTE_PLAYER, ATTACK_ON_SIGHT, false, true )
turn_invulnerable( wave_member )
wave_group.damage_threads[ wave_member ] = thread_new("mmBlastTutorial_npc_frozen_thread", wave_member )
on_death( "mmBlastTutorial_final_wave_on_death_cb", wave_member )
on_take_damage( "mmTutorial_final_wave_on_damage", wave_member )
tutorial_ultra_shield_only_vulnerable_to_superpowers( wave_member, true)
marker_add( wave_member, MINIMAP_ICON_BLAST, OI_ASSET_POWER_BLAST, OI_FLAGS_DEFAULT, SYNC_ALL )
mmBlastTutorial_CurrentActiveEnemies = mmBlastTutorial_CurrentActiveEnemies + 1
end
end
end
function mmBlastTutorial_get_npc_respawn_navpoint( npc_name )
return mmBlastTutorial_respawn_points[ npc_name ]
end
------------------------------------
--
-- Checkpoint callback functions
--
------------------------------------
--function mmBlastTutorial_stone_blast_equipped_cb( player, power )
-- if( power == "freeze" ) then
-- if player == LOCAL_PLAYER then
-- mmBlastTutorial_PowerEquipped_Local = true
-- else
-- mmBlastTutorial_PowerEquipped_Remote = true
-- end
-- end
--end
function mmBlastTutorial_on_death_cb( npc )
if( human_is_frozen( npc ) == true ) then
mmBlastTutorial_CurrentActiveEnemies = mmBlastTutorial_CurrentActiveEnemies - 1
on_death( "", npc )
marker_remove( npc )
else
-- Play the VFX at the death location
npc_fade_out( npc, 1.0, false, 0 )
human_set_invulnerable_to_freeze(npc, true)
delay( 1.0 )
human_set_invulnerable_to_freeze(npc, false)
-- TODO: Play the VO for an unsuccessful kill.
if (convo_is_playing() == false) then
convo_start(mmBlastTutorial_convo.chide)
end
-- Teleport them to their respawn navpoint
teleport( npc, mmBlastTutorial_get_npc_respawn_navpoint( npc ) )
-- Respawn the character (teleport and revive)
npc_revive( npc )
-- Give him a decent weapon
inv_item_add( "Rifle-LavaBolter", 1, npc, true )
delay(1.0)
-- Play the VFX
effect_play_on_human( mmBlastTutorial_effects.respawn_effect, npc )
-- Show the character and mark them as a target
character_show( npc )
marker_add( npc, MINIMAP_ICON_BLAST, OI_ASSET_POWER_BLAST, OI_FLAGS_DEFAULT, SYNC_ALL )
end
end
function mmBlastTutorial_final_wave_on_death_cb( npc )
mmBlastTutorial_CurrentActiveEnemies = mmBlastTutorial_CurrentActiveEnemies - 1
on_death( "", npc )
on_take_damage( "", npc )
marker_remove( npc )
end
function mmTutorial_final_wave_on_damage(npc, attacker, dam_pct, explosion, melee, vomit, dam, tk, dfa, energy_blast, stomp, headshot, sidescroller, buff)
-- Ensure that the shield doesn't go down if we weren't hit by a blast.
if energy_blast == false and character_has_ultra_shield_up( npc ) == false then
npc_ultra_shield_enable( npc, true )
end
end
------------------------------------
--
-- Checkpoint thread functions
--
------------------------------------
function mmBlastTutorial_npc_frozen_thread(npc)
while( true )do
if( character_has_ultra_shield_up( npc ) == true )then
turn_invulnerable( npc )
else
turn_vulnerable( npc )
end
thread_yield()
end
end
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Common functions ]]--
--[[ ]]--
--[[**********************]]--
local processing_lava_player_local = false
local processing_lava_player_remote = false
function mmTutorial_lava_trigger_callback( human, trigger )
if human == LOCAL_PLAYER then
if (processing_lava_player_local == false) then
-- if we aren't currently trying to warp the player, then warp them
processing_lava_player_local = true
delay( 1.0 )
fade_out( 0, 0, SYNC_LOCAL )
delay( 1.0 )
teleport( LOCAL_PLAYER, "Player_start_nav_host" )
fade_in( 0, 0, SYNC_LOCAL )
-- done warping the player
processing_lava_player_local = false
end
elseif human == REMOTE_PLAYER then
if (processing_lava_player_remote == false) then
processing_lava_player_remote = true
-- if we aren't currently trying to warp the player, then warp them
delay( 1.0 )
fade_out( 0, 0, SYNC_REMOTE )
delay( 1.0 )
teleport( REMOTE_PLAYER, "Player_start_nav_client" )
fade_in( 0, 0, SYNC_REMOTE )
-- done warping the player
processing_lava_player_remote = false
end
end
end
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Callback functions ]]--
--[[ ]]--
--[[**********************]]--
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Thread functions ]]--
--[[ ]]--
--[[**********************]]--