--[[ USING THE MISSION START TEMPLATE
1. Read "SR3 Mission Scripting Standards" if you haven't already.
2. Save this file as "mmAuraTutorial.lua" in the missions directory.
3. Replace "mmAuraTutorial" with the name of your mission (must use the same name as your mission start node).
3a. Replace "mmAuraTutorial" 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)cleanup
9. Replace "" with a 3-4 letter abbreviation for the next checkpoint.
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!conv
]]--
--[[
mmAuraTutorial.lua
SR3 Mission Script
DATE: 3-3-2014
AUTHOR: Arturo Mata
]]--
-- Debug flags --
-- Tweakable Parameters --
--------------------------------------------------------------------------------------------------
--[[ GROUPS ]]--
--------------------------------------------------------------------------------------------------
mmAuraTutorial_group = {
--[[ startup GROUPS ]]--
--[[ Ultor GROUPS ]]--
wave_1 =
{
name = "wave_1",
members =
{
"Demon<001>",
},
coop_name = "coop_wave_1",
coop_only_members =
{
"Demon<002>",
},
damage_threads = { },
},
wave_2 =
{
name = "wave_2",
members =
{
"Demon<003>",
"Demon<004>",
"Demon<005>",
},
coop_name = "coop_wave_2",
coop_only_members =
{
"Demon<006>",
"Demon<007>",
"Demon<008>",
},
damage_threads = { },
},
wave_3 =
{
name = "wave_3",
members =
{
"Demon<009>",
"Demon<010>",
"Demon<011>",
-- "Demon<012>",
-- "Demon<013>",
-- "Demon<014>",
},
coop_name = "coop_wave_3",
coop_only_members =
{
"Demon<015>",
"Demon<016>",
"Demon<017>",
-- "Demon<018>",
-- "Demon<019>",
-- "Demon<020>",
},
damage_threads = { },
},
wave_4 =
{
name = "wave_4",
members =
{
"Dark_Inciter<001>",
},
coop_name = "coop_wave_4",
coop_only_members =
{
"Dark_Inciter<002>",
},
damage_threads = { },
},
--[[ GROUPS ]]--
}
mmAuraTutorial_respawn_points =
{
[ "Demon<001>" ] = "DemonSpawn<001>",
[ "Demon<002>" ] = "DemonSpawn<002>",
[ "Demon<003>" ] = "DemonSpawn<003>",
[ "Demon<004>" ] = "DemonSpawn<004>",
[ "Demon<005>" ] = "DemonSpawn<005>",
[ "Demon<006>" ] = "DemonSpawn<006>",
[ "Demon<007>" ] = "DemonSpawn<007>",
[ "Demon<008>" ] = "DemonSpawn<008>",
[ "Demon<009>" ] = "DemonSpawn<009>",
[ "Demon<010>" ] = "DemonSpawn<010>",
[ "Demon<011>" ] = "DemonSpawn<011>",
--[ "Demon<012>" ] = "DemonSpawn<012>",
--[ "Demon<013>" ] = "DemonSpawn<013>",
--[ "Demon<014>" ] = "DemonSpawn<014>",
[ "Demon<015>" ] = "DemonSpawn<015>",
[ "Demon<016>" ] = "DemonSpawn<016>",
[ "Demon<017>" ] = "DemonSpawn<017>",
--[ "Demon<018>" ] = "DemonSpawn<018>",
--[ "Demon<019>" ] = "DemonSpawn<019>",
--[ "Demon<020>" ] = "DemonSpawn<020>",
[ "Dark_Inciter<001>" ] = "DarkInciterSpawn<001>",
[ "Dark_Inciter<002>" ] = "DarkInciterSpawn<003>",
}
mmAuraTutorial_leash_points =
{
[ "Dark_Inciter<001>" ] = "DarkInciterLeash<001>",
[ "Dark_Inciter<002>" ] = "DarkInciterLeash<001>",
}
--------------------------------------------------------------------------------------------------
--[[ THREADS ]]--
--------------------------------------------------------------------------------------------------
mmAuraTutorial_thread = {
-- = INVALID_THREAD_HANDLE,
burn_all_peds_thread = INVALID_THREAD_HANDLE,
}
--------------------------------------------------------------------------------------------------
--[[ EFFECTS ]]--
--------------------------------------------------------------------------------------------------
mmAuraTutorial_effects = {
respawn_effect = "respawn_effect<001>",
}
--------------------------------------------------------------------------------------------------
--[[ CHECKPOINTS ]]--
--------------------------------------------------------------------------------------------------
mmAuraTutorial_checkpoint = {
{
name = MISSION_START_CHECKPOINT, -- First Checkpoint (fcp)
init = "mmAuraTutorial_fcp_init", -- init(bool mission_restart)
run = "mmAuraTutorial_fcp_run", -- run()
cleanup = "mmAuraTutorial_fcp_cleanup", -- cleanup(bool mission_exit) (+++MUST RETURN IMMEDIATELY+++)
--next_checkpoint = "mmAuraTutorial_",
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 ]]--
--------------------------------------------------------------------------------------------------
mmAuraTutorial_scene = {
intro = "",
outro = ""
}
--------------------------------------------------------------------------------------------------
--[[ CONVERSATIONS ]]--
--------------------------------------------------------------------------------------------------
mmAura_persona =
{
Vlad = {
persona_name = "VLAD",
persona_id = INVALID_PERSONA_HANDLE
},
}
mmAuraTutorial_convo =
{
intro = {
name = "mmAuraTutorial_intro",
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,
},
wave = {
name = "mmAuraTutorial_wave",
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,
},
intro_success = {
name = "mmAuraTutorial_success",
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,
},
inciter_intro = {
name = "mmAuraTutorial_inciter_intro",
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,
},
complete = {
name = "mmAuraTutorial_complete",
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,
},
scold = {
name = "mmAuraTutorial_scold",
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,
},
}
mmAuraTutorial_convo_queue = {
--[[start_drive_queue = {
{ delay = 2.0, convo = mmAuraTutorial_convo.goto_Ultor },
{ delay = 4.0, convo = mmAuraTutorial_convo.goto_Ultor2 },
{ delay = 3.0, convo = mmAuraTutorial_convo.goto_Ultor3 },
{ delay = 5.0, convo = mmAuraTutorial_convo.goto_Ultor4 }
},
]]--
}
--------------------------------------------------------------------------------------------------
--[[ TRIGGERS ]]--
--------------------------------------------------------------------------------------------------
mmAuraTutorial_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 = "mmAuraTutorial_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 = mmAuraTutorial_convo.convo_name -- play a conversation
-- (optional)next_trigger = "next_trigger_name" sets up next trigger when triggered (breadcrumbs)
--},
--[[ Ultor TRIGGERS ]]--
lava_trigger = {
name = "lava_trigger",
callback = "mmTutorial_lava_trigger_callback",
},
}
--------------------------------------------------------------------------------------------------
--[[ INTERROGATION DATA ]]--
--------------------------------------------------------------------------------------------------
--mmAuraTutorial_interrogate = {
-- leader = {
-- target = mmAuraTutorial_group.friendly_fire.owner,
-- persona = "Interrogation",
-- objective = "mmAuraTutorial_INTERROGATE_OWNER",
-- -- (optional)conversation = mmAuraTutorial_convo.convo_name -- play a conversation while interrogating
-- },
--}
--------------------------------------------------------------------------------------------------
--[[ OTHER ]]--
--------------------------------------------------------------------------------------------------
mmAura_runtime =
{
bPersonaLoaded = false,
}
mmAuraTutorial_CurrentEnemyCount = 0
-- Control variables for the burning ped section
mmAuraTutorial_BurnAllTargetsSuccessful = false
mmAuraTutorial_BurnAllTargetsResetting = false
SUPERPOWER_BUFF = 2
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ 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 mmAuraTutorial_start(start_checkpoint_name, is_restart)
mission_start_fade_out(0.0)
disable_diversions(true)
ui_hud_set_current_challenge(-1)
set_ped_override_density(.1)
set_traffic_density(.1)
parking_spot_disable_all(true)
--hvUnlockLoadout("mmAuraTutorial")
trigger_setup( mmAuraTutorial_trigger.lava_trigger )
-- 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 )
-- initialize systems
mission_startup(mmAuraTutorial_trigger, mmAuraTutorial_convo) -- mmAuraTutorial_checkpoint
local start_cp = get_table_by_name(mmAuraTutorial_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 mmAuraTutorial_scene.intro ~= "") then
-- First time playing mission
local fade_in_after = false
cutscene_play(mmAuraTutorial_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
mmAuraTutorial_initialize(start_checkpoint_name)
-- Run the mission from the current checkpoint
checkpoint_run_mission(mmAuraTutorial_checkpoint, start_checkpoint_name)
mission_end_success("mmAuraTutorial", nil, { "player_end_nav_client", "player_end_nav_host" } ) --, mmAuraTutorial_scene.outro, {, })
end
-- This is the primary function responsible for cleaning up the entire mission
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++)
--
function mmAuraTutorial_cleanup()
--[[ INSERT ANY MISSION SPECIFIC CLEAN-UP ]]--
city_zone_swap( "u_train", false, true )
-- Clean up lava trigger
trigger_cb( "", mmAuraTutorial_trigger.lava_trigger )
disable_diversions(false)
ui_hud_set_current_challenge(-2)
-- Enable all weapon slots
inv_weapon_disable_all_slots(false)
set_ped_override_density(-1)
set_traffic_density(1)
parking_spot_disable_all(false)
-- 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
local enable = true
player_super_attacks_enable( enable, "Stomp" )
player_super_attacks_enable( enable, "Freeze" )
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)
hud_prompt_clear()
npc_respawn_dist_reset()
-- 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
-- cleanup all threads
cleanup_threads(mmAuraTutorial_thread)
cleanup_threads( mmAuraTutorial_thread.burn_all_peds_thread )
-- run checkpoint cleanups (move into mission_shutdown?)
checkpoint_cleanup_mission(mmAuraTutorial_checkpoint)
-- cleanup triggers, convos, kill_list and interrogations
mission_shutdown()
-- cleanup all groups
cleanup_groups(mmAuraTutorial_group)
--fade_out_block()
-- delay(1.0)
-- -- teleport the player
-- teleport_coop("player_end_nav_host", "player_end_nav_client", true)
-- delay(2.0)
--fade_in( 1.0 )
--fade_in_block()
end
-- Called when the mission has ended with success
-- CALLED FROM CODE (+++MUST RETURN IMMEDIATELY+++)
--
function mmAuraTutorial_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 mmAuraTutorial_initialize(checkpoint_name)
-- Common initialization
mmAuraTutorial_initialize_common()
-- Checkpoint specific initialization
checkpoint_init(mmAuraTutorial_checkpoint, checkpoint_name)
-- Remove any present subtitles
message_remove_all()
-- Start fading in
mission_start_fade_in()
audio_object_post_event( "Play_AuraTutorial" )
end
-- Handle any common initialization
--
function mmAuraTutorial_initialize_common()
--[[ INSERT ANY COMMON INITIALIZATION CODE HERE ]]--
waypoint_remove()
mission_set_cancel_warp_location("player_end_nav_host", "player_end_nav_client")
-- Disable all superpowers and weapon radial
local enable = false
player_super_attacks_enable( enable, "Freeze" )
player_super_attacks_enable( enable, "Stomp" )
player_super_attacks_enable( enable, "Summon" )
player_super_power_lock_to_tutorial_element( true, "aura_coldfire", SYNC_ALL )
player_super_power_select( "Aura", SYNC_ALL, "aura_coldfire" )
hud_inventory_disable( true )
if mmAura_runtime.bPersonaLoaded == false then
load_persona(mmAura_persona.Vlad)
mmAura_runtime.bPersonaLoaded = true
end
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 mmAuraTutorial_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
player_unlock_super_power( SUPERPOWER_BUFF, LOCAL_PLAYER, true )
if coop_is_active() then
player_unlock_super_power( SUPERPOWER_BUFF, REMOTE_PLAYER, true )
end
--Remove all summons
player_super_power_clear_summons(LOCAL_PLAYER)
-- Enable superpower stuffs
player_super_movement_enable( true )
player_super_attacks_enable( true )
-- 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 mmAuraTutorial_fcp_run()
-- 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 )
-- Do not allow access to the hub menu
cellphone_lock(true)
-- set charge
player_super_power_set_regen_scalar_buff(8.0)
convo_start(mmAuraTutorial_convo.intro)
convo_wait_for_end()
convo_start(mmAuraTutorial_convo.wave)
-- SRG_MM_AURATUT_TIMER
mmAuraTutorial_wave_setup( mmAuraTutorial_group.wave_1 )
objective_text( 0, "SRG_MMAURA_OBJECTIVE_ENEMIES", "", "", SYNC_ALL, OI_ASSET_POWER_BUFF )
hud_prompt(LOCAL_PLAYER, "SRG_MMAURA_USE_NAG", "", true)
-- Play the tutorial text
local tutorial_name = "aura_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)
-- Wait until we successfully complete the activity
mmAuraTutorial_BurnAllTargetsSuccessful = false
mmAuraTutorial_BurnAllTargetsResetting = false
mmAuraTutorial_thread.burn_all_peds_thread = thread_new( "mmAuraTutorial_burn_all_targets_thread_func" )
while not mmAuraTutorial_BurnAllTargetsSuccessful do
thread_yield()
end
hud_prompt_clear()
mmAuraTutorial_wave_setup( mmAuraTutorial_group.wave_2 )
-- Wait until we successfully complete the activity
mmAuraTutorial_BurnAllTargetsSuccessful = false
mmAuraTutorial_BurnAllTargetsResetting = false
mmAuraTutorial_thread.burn_all_peds_thread = thread_new( "mmAuraTutorial_burn_all_targets_thread_func" )
while not mmAuraTutorial_BurnAllTargetsSuccessful do
thread_yield()
end
--convo_start(mmAuraTutorial_convo.inciter_intro)
mmAuraTutorial_wave_setup( mmAuraTutorial_group.wave_3)
-- Wait until we successfully complete the activity
mmAuraTutorial_BurnAllTargetsSuccessful = false
mmAuraTutorial_BurnAllTargetsResetting = false
mmAuraTutorial_thread.burn_all_peds_thread = thread_new( "mmAuraTutorial_burn_all_targets_thread_func" )
while not mmAuraTutorial_BurnAllTargetsSuccessful do
thread_yield()
end
convo_end_all()
convo_start(mmAuraTutorial_convo.intro_success)
convo_wait_for_end()
objective_text_clear(0)
-- Play the tutorial text
tutorial_stop_current()
tutorial_name = "aura_inciter"
tutorial_start(tutorial_name, delay_ms, auto_unlock, allow_redisplay, infinite_display)
dark_inciter_ultra_shield_only_vulnerable_to_superpowers( true )
mmAuraTutorial_final_wave_setup( mmAuraTutorial_group.wave_4 )
dark_inciter_disable_summon( mmAuraTutorial_group.wave_4.members[1], true)
npc_leash_to_nav(mmAuraTutorial_group.wave_4.members[1], mmAuraTutorial_get_npc_leash_navpoint(mmAuraTutorial_group.wave_4.members[1]), 4.0)
objective_text( 0, "SRG_MMAURA_OBJECTIVE_INCITER", "", "", SYNC_ALL, OI_ASSET_POWER_BUFF )
convo_start(mmAuraTutorial_convo.inciter_intro)
mmAuraTutorial_BurnAllTargetsSuccessful = false
mmAuraTutorial_BurnAllTargetsResetting = false
mmAuraTutorial_thread.burn_all_peds_thread = thread_new( "mmAuraTutorial_burn_all_targets_thread_func" )
while not mmAuraTutorial_BurnAllTargetsSuccessful do
thread_yield()
end
dark_inciter_ultra_shield_only_vulnerable_to_superpowers( false )
objective_text_clear(0)
convo_end_all()
convo_start(mmAuraTutorial_convo.complete)
convo_wait_for_end()
tutorial_stop_current()
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 mmAuraTutorial_fcp_cleanup(mission_exit)
-- turn back on all pickup drops
health_pickups_enable(true)
human_all_stop_dropping_weapons(false)
human_all_stop_dropping_cash(false)
-- 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
npc_respawn_dist_reset()
dark_inciter_ultra_shield_only_vulnerable_to_superpowers( false )
-- 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 )
mmAuraTutorial_cleanup_wave( mmAuraTutorial_group.wave_1 )
mmAuraTutorial_cleanup_wave( mmAuraTutorial_group.wave_2 )
mmAuraTutorial_cleanup_wave( mmAuraTutorial_group.wave_3 )
mmAuraTutorial_cleanup_wave( mmAuraTutorial_group.wave_4 )
end
------------------------------------
--
-- Checkpoint helper functions
--
------------------------------------
function mmAuraTutorial_wave_setup( wave_group )
-- Reset our enemy counter
mmAuraTutorial_CurrentEnemyCount = 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
--character_set_animation_overrides(wave_member, "cop_ps_cvch_lft" )--"crv crouch left")
on_death( "mmAuraTutorial_on_death_cb", wave_member )
wave_group.damage_threads[ wave_member ] = thread_new("mmAuraTutorial_lava_kill_thread", wave_member )
on_take_damage( "mmAuraTutorial_npc_damaged_cb", wave_member )
--character_set_animation_overrides(wave_member,"crv crouch left")
marker_add( wave_member, MINIMAP_ICON_BUFF, OI_ASSET_POWER_BUFF, OI_FLAGS_DEFAULT, SYNC_ALL )
mmAuraTutorial_CurrentEnemyCount = mmAuraTutorial_CurrentEnemyCount + 1
--Set ultra shields to be invulnerable to non-superpowers
tutorial_ultra_shield_only_vulnerable_to_superpowers( wave_member, true)
-- Play the fire effect
effect_play_on_human( mmAuraTutorial_effects.respawn_effect, wave_member )
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 )
--turn_invulnerable( wave_member )
--npc_respawn_after_death( wave_member, true )
--npc_respawn_after_death_time_override( wave_member, 10, true )
on_death( "mmAuraTutorial_on_death_cb", wave_member )
on_take_damage( "mmAuraTutorial_npc_damaged_cb", wave_member )
wave_group.damage_threads[ wave_member ] = thread_new("mmAuraTutorial_lava_kill_thread", wave_member )
tutorial_ultra_shield_only_vulnerable_to_superpowers( wave_member, true)
marker_add( wave_member, MINIMAP_ICON_BUFF, OI_ASSET_POWER_BUFF, OI_FLAGS_DEFAULT, SYNC_ALL )
mmAuraTutorial_CurrentEnemyCount = mmAuraTutorial_CurrentEnemyCount + 1
-- Play the fire effect
effect_play_on_human( mmAuraTutorial_effects.respawn_effect, wave_member )
end
end
end
function mmAuraTutorial_final_wave_setup( wave_group )
-- Reset our enemy counter
mmAuraTutorial_CurrentEnemyCount = 0
-- Create the wave
group_create( wave_group.name )
-- Set special tutorial wave properties.
for i, wave_member in pairs( wave_group.members ) do
on_death( "mmAuraTutorial_final_wave_on_death_cb", wave_member )
-- Do not allow them to catch fire.
character_set_never_catch_fire( wave_member )
marker_add( wave_member, MINIMAP_ICON_BUFF, OI_ASSET_POWER_BUFF, OI_FLAGS_DEFAULT, SYNC_ALL )
mmAuraTutorial_CurrentEnemyCount = mmAuraTutorial_CurrentEnemyCount + 1
-- Play the fire effect
effect_play_on_human( mmAuraTutorial_effects.respawn_effect, wave_member )
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
on_death( "mmAuraTutorial_final_wave_on_death_cb", wave_member )
-- Do not allow them to catch fire.
character_set_never_catch_fire( wave_member )
marker_add( wave_member, MINIMAP_ICON_BUFF, OI_ASSET_POWER_BUFF, OI_FLAGS_DEFAULT, SYNC_ALL )
mmAuraTutorial_CurrentEnemyCount = mmAuraTutorial_CurrentEnemyCount + 1
-- Play the fire effect
effect_play_on_human( mmAuraTutorial_effects.respawn_effect, wave_member )
end
end
end
function mmAuraTutorial_clear_wave( wave_group )
-- Reset our enemy counter
mmAuraTutorial_CurrentEnemyCount = 0
-- Set special tutorial wave properties.
for i, wave_member in pairs( wave_group.members ) do
-- Clear out the callbacks
on_death( "", wave_member )
on_take_damage( "", wave_member )
-- Remove the marker
marker_remove( wave_member, SYNC_ALL )
-- Hide the character
npc_fade_out( wave_member, 0.1, true, 0 )
-- Play the fire effect
effect_play_on_human( mmAuraTutorial_effects.respawn_effect, wave_member )
end
if coop_is_active() then
-- Set special tutorial wave properties.
for i, wave_member in pairs( wave_group.coop_only_members ) do
on_death( "", wave_member )
on_take_damage( "", wave_member )
-- Remove the marker
marker_remove( wave_member, SYNC_ALL )
-- Hide the character
npc_fade_out( wave_member, 0.1, true, 0 )
-- Play the fire effect
effect_play_on_human( mmAuraTutorial_effects.respawn_effect, wave_member )
end
end
-- Destroy the groupnnnnn
group_destroy( mmAuraTutorial_group.wave_1.name )
if coop_is_active() then
group_destroy( mmAuraTutorial_group.wave_1.coop_name )
end
end
-- Gets the name of the respawn navpoint associated with the npc
function mmAuraTutorial_get_npc_respawn_navpoint( npc_name )
return mmAuraTutorial_respawn_points[ npc_name ]
end
function mmAuraTutorial_get_npc_leash_navpoint( npc_name )
return mmAuraTutorial_leash_points[ npc_name ]
end
------------------------------------
--
-- Checkpoint callback functions
--
------------------------------------
function mmAuraTutorial_on_death_cb( npc )
if character_is_on_fire( npc ) then
mmAuraTutorial_CurrentEnemyCount = mmAuraTutorial_CurrentEnemyCount - 1
on_death( "", npc )
on_take_damage( "", npc )
marker_remove( npc )
else
-- Fade the character out.
npc_fade_out( npc, 1.0, false, 0 )
delay( 1.0 )
-- TODO: Play the VO for an unsuccessful kill.
if(convo_is_playing() == false) then
convo_start(mmAuraTutorial_convo.scold)
end
-- Teleport them to their respawn navpoint
teleport( npc, mmAuraTutorial_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( mmAuraTutorial_effects.respawn_effect, npc )
tutorial_ultra_shield_only_vulnerable_to_superpowers( npc, true)
-- Show the character and mark them as a target
character_show( npc )
marker_add( npc, MINIMAP_ICON_BUFF, OI_ASSET_POWER_BUFF, OI_FLAGS_DEFAULT, SYNC_ALL )
end
end
function mmAuraTutorial_npc_damaged_cb(npc, attacker, dam_pct, explosion, melee, vomit, dam, tk, dfa, energy, stomp, headshot, sidescroller, buff)
if not buff then
turn_invulnerable(npc, true)
else
turn_vulnerable( npc, true )
end
end
function mmAuraTutorial_final_wave_on_death_cb( npc )
mmAuraTutorial_CurrentEnemyCount = mmAuraTutorial_CurrentEnemyCount - 1
on_death( "", npc )
marker_remove( npc )
end
------------------------------------
--
-- Checkpoint thread functions
--
------------------------------------
--HVS_MO kills enemies if they fall into the lava and get stuck
function mmAuraTutorial_lava_kill_thread( npc )
while( true )do
-- Catches npcs which fall into the lava
-- To make extra sure we catch them, also process enemies near the lava (the lava is at about y: 882)
if character_is_in_lava( npc ) or (human_get_pos_y(npc) < 883.0) then
turn_vulnerable( npc )
character_kill( npc )
end
thread_yield()
end
end
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Common functions ]]--
--[[ ]]--
--[[**********************]]--
function mmAuraTutorial_cleanup_wave( wave_group )
cleanup_threads( wave_group.damage_threads )
-- Clean up the sp waves
for i, wave_member in pairs( wave_group.members ) do
on_death( "", wave_member )
on_take_damage( "", wave_member )
end
if coop_is_active() then
-- Clean up the coop waves
for i, wave_member in pairs( wave_group.coop_only_members ) do
on_death( "", wave_member )
on_take_damage( "", wave_member )
end
end
end
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Callback 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
--------------------------------------------------------------------------------------------------
--[[**********************]]--
--[[ ]]--
--[[ Thread functions ]]--
--[[ ]]--
--[[**********************]]--
function mmAuraTutorial_burn_all_targets_thread_func()
while true do
if mmAuraTutorial_CurrentEnemyCount == 0 and mmAuraTutorial_BurnAllTargetsResetting == false then
mmAuraTutorial_BurnAllTargetsSuccessful = true
break
end
thread_yield()
end
end