Fix round manager and add more presets.

Add more spawns for mechz. Add spawns for zombie_dog. Add zombie counter for debugging.
This commit is contained in:
JezuzLizard
2024-02-28 23:18:41 -08:00
parent 0f53f2beed
commit 71b6671cd4
17 changed files with 1323 additions and 282 deletions

View File

@ -4,6 +4,8 @@
#include maps\mp\zombies\_zm;
#include scripts\zm\zm_ai_pack\_utility;
main()
{
set_dvar_if_unset( "rm_min_rounds_before_special_round", 3 );
@ -17,7 +19,7 @@ main()
set_dvar_if_unset( "rm_forced_special_variant", "" );
set_dvar_if_unset( "rm_allowed_mixed_rounds_presets", "default" );
set_dvar_if_unset( "rm_allowed_mixed_rounds_variants", "random" );
set_dvar_if_unset( "rm_allowed_mixed_round_variants", "random" );
set_dvar_if_unset( "rm_forced_mixed_rounds_preset", "" );
set_dvar_if_unset( "rm_forced_mixed_rounds_variant", "" );
@ -35,6 +37,10 @@ main()
level.normal_round.current_data.round_type = "";
level.normal_round.current_data.variant = "";
register_ai_spawning_func( "normal", scripts\zm\zm_ai_pack\rounds\_normal::spawn_single_normal_zombie );
register_ai_spawning_func( "zombie_dog", scripts\zm\zm_ai_pack\rounds\_zombie_dog::spawn_single_zombie_dog );
register_ai_spawning_func( "mechz", scripts\zm\zm_ai_pack\rounds\_mechz::spawn_single_mechz );
scripts\zm\zm_ai_pack\rounds\_zombie_dog::main();
scripts\zm\zm_ai_pack\rounds\_mechz::main();
@ -93,13 +99,24 @@ main()
scripts\zm\zm_ai_pack\rounds\_mixed::round_next );
register_mixed_round_preset( "default",
scripts\zm\zm_ai_pack\rounds\mixed_presets\_default::preset_chance );
scripts\zm\zm_ai_pack\mixed_presets\_default::preset_chance,
scripts\zm\zm_ai_pack\mixed_presets\_default::round_start );
register_mixed_round_preset_variant( "default", "random",
scripts\zm\zm_ai_pack\rounds\mixed_variants\_random::spawning_random,
scripts\zm\zm_ai_pack\rounds\mixed_variants\_random::spawning_chance,
scripts\zm\zm_ai_pack\rounds\mixed_variants\_random::spawning_limit,
scripts\zm\zm_ai_pack\rounds\mixed_variants\_random::spawning_cooldown );
scripts\zm\zm_ai_pack\mixed_variants\_random::spawning_random,
scripts\zm\zm_ai_pack\mixed_variants\_random::spawning_chance,
scripts\zm\zm_ai_pack\mixed_variants\_random::spawning_limit,
scripts\zm\zm_ai_pack\mixed_variants\_random::spawning_cooldown,
scripts\zm\zm_ai_pack\mixed_variants\_random::spawning_round_start );
register_mixed_round_preset_variant( "default", "dog_wave",
scripts\zm\zm_ai_pack\mixed_variants\_dog_wave::spawning_dog_wave,
scripts\zm\zm_ai_pack\mixed_variants\_dog_wave::spawning_chance,
scripts\zm\zm_ai_pack\mixed_variants\_dog_wave::spawning_limit,
scripts\zm\zm_ai_pack\mixed_variants\_dog_wave::spawning_cooldown,
scripts\zm\zm_ai_pack\mixed_variants\_dog_wave::spawning_round_start);
scripts\zm\zm_ai_pack\mixed_variants\_random::main();
//Future variants
// random - random ais, true_random - random ais + random behavior and stats
// elemental?
@ -108,58 +125,6 @@ main()
// several default presets to cycle through
}
register_special_round( round_type, variant_type, round_spawning_func, round_wait_func, round_max_func, round_start_func, between_round_over_func, round_chance_func, next_instance_func )
{
if ( !isDefined( level.round_manager_special_rounds ) )
{
level.round_manager_special_rounds = [];
}
if ( !isDefined( level.round_manager_special_rounds[ round_type ] ) )
{
level.round_manager_special_rounds[ round_type ] = [];
}
s = sys::spawnstruct();
s.spawning_func = round_spawning_func;
s.wait_func = round_wait_func;
s.max_func = round_max_func;
s.start_func = round_start_func;
s.between_round_over_func = between_round_over_func;
s.chance_func = round_chance_func;
s.next_instance_func = next_instance_func;
s.active = false;
level.round_manager_special_rounds[ round_type ][ variant_type ] = s;
}
register_mixed_round_preset( preset_type, preset_chance_func )
{
if ( !isDefined( level.round_manager_mixed_round_presets ) )
{
level.round_manager_mixed_round_presets = [];
}
if ( !isDefined( level.round_manager_mixed_round_presets[ preset_type ] ) )
{
level.round_manager_mixed_round_presets[ preset_type ] = sys::spawnstruct();
level.round_manager_mixed_round_presets[ preset_type ].variants = [];
}
level.round_manager_mixed_round_presets[ preset_type ].chance_func = preset_chance_func;
}
register_mixed_round_preset_variant( preset_type, variant_type, spawning_func, spawning_chance_func, spawning_limit_per_round_func, spawning_cooldown_func )
{
assert( isdefined( level.round_manager_mixed_round_presets[ preset_type ] ) );
s = sys::spawnstruct();
s.spawning_func = spawning_func;
s.chance_func = spawning_chance_func;
s.limit_per_round_func = spawning_limit_per_round_func;
s.cooldown_func = spawning_cooldown_func;
level.round_manager_mixed_round_presets[ preset_type ].variants[ variant_type ] = s;
}
should_do_special_round()
{
if ( getDvar( "rm_forced_special_round" ) != "" && getdvar( "rm_forced_special_variant" ) )
@ -222,8 +187,7 @@ determine_current_round_type()
{
if ( !isDefined( level.round_manager_special_rounds[ forced_special_round ] ) || !isDefined( level.round_manager_special_rounds[ forced_special_round ][ forced_variant ] ) )
{
print( "Round Manager ERROR: Can't set special round and variant to " + forced_special_round + " and " + forced_variant + " because it wasn't registered" );
assert( false );
assertmsg( "Round Manager ERROR: Can't set special round and variant to " + forced_special_round + " and " + forced_variant + " because it wasn't registered" );
}
else
{
@ -315,36 +279,6 @@ determine_current_round_type()
}
}
get_zombie_dog_array()
{
return getaispeciesarray( level.zombie_team, "zombie_dog" );
}
get_zombie_dog_count()
{
return get_zombie_dog_array().size;
}
get_mechz_array()
{
zombies = getaiarray( level.zombie_team );
mechz = [];
for ( i = 0; i < zombies.size; i++ )
{
if ( isdefined( zombies[ i ].animname ) && zombies[ i ].animname == "mechz_zombie" )
{
mechz[ mechz.size ] = zombies[ i ];
}
}
return mechz;
}
get_mechz_count()
{
return get_mechz_array().size;
}
round_think_override( restart )
{
if ( !isdefined( restart ) )
@ -421,6 +355,10 @@ round_think_override( restart )
while ( level.zombie_spawn_locations.size <= 0 )
wait 0.1;
/#
while ( getdvarint( #"zombie_cheat" ) == 2 || getdvarint( #"zombie_cheat" ) >= 4 )
wait 1;
#/
level.round_manager_special_rounds[ current_round_data.round_type ][ current_round_data.variant ].active = true;
level [[ round_manager_inst.max_func ]]();
@ -510,8 +448,7 @@ determine_mixed_round_preset()
{
if ( !isDefined( level.round_manager_mixed_round_presets[ forced_preset ] ) )
{
print( "Round Manager ERROR: Can't set preset to " + forced_preset + " because it wasn't registered" );
assert( false );
assertmsg( "Round Manager ERROR: Can't set preset to " + forced_preset + " because it wasn't registered" );
}
else
{
@ -521,7 +458,7 @@ determine_mixed_round_preset()
allowed_presets_string = getDvar( "rm_allowed_mixed_rounds_presets" );
allowed_presets_keys = strok( allowed_presets_string, " " );
allowed_presets_keys = strtok( allowed_presets_string, " " );
max_iterations = 50;
current_iterations = 0;
@ -552,12 +489,11 @@ pick_mixed_round_preset_variant( variants )
{
forced_variant = getdvar( "rm_forced_mixed_rounds_variant" );
if ( forced_preset != "" )
if ( forced_variant != "" )
{
if ( !isDefined( variants[ forced_variant ] ) )
{
print( "Round Manager ERROR: Can't set preset to " + forced_preset + " because it wasn't registered" );
assert( false );
assertmsg( "Round Manager ERROR: Can't set preset to " + forced_variant + " because it wasn't registered" );
}
else
{
@ -565,7 +501,7 @@ pick_mixed_round_preset_variant( variants )
}
}
allowed_variants_string = getdvar( "rm_allowed_mixed_rounds_variants" );
allowed_variants_string = getdvar( "rm_allowed_mixed_round_variants" );
pick_from_allowed_variants_pool = allowed_variants_string != "";
@ -589,8 +525,9 @@ pick_mixed_round_preset_variant( variants )
possible_variants = array_randomize( allowed_variants_keys );
for ( i = 0; i < possible_variants.size; i++ )
{
if ( [[ variants[ possible_variants[ i ] ].chance_func ]]() )
if ( [[ variants[ possible_variants[ i ] ].chance_func ]]() && possible_variants[ i ] [[ variants[ possible_variants[ i ] ].cooldown_func ]]() )
{
variants[ possible_variants[ i ] ].last_time = gettime();
return variants[ possible_variants[ i ] ];
}
}
@ -599,7 +536,21 @@ pick_mixed_round_preset_variant( variants )
if ( current_iterations >= max_iterations )
{
variants[ possible_variants[ 0 ] ].last_time = gettime();
return variants[ possible_variants[ 0 ] ];
}
}
}
set_starting_properties_for_ai( starting_properties_struct )
{
if ( !isdefined( starting_properties_struct ) )
{
return;
}
if ( isdefined( starting_properties_struct.health ) )
{
self.custom_starting_health = starting_properties_struct.health;
}
}

View File

@ -0,0 +1,122 @@
#include maps\mp\zombies\_zm_utility;
#include common_scripts\utility;
#include maps\mp\_utility;
register_special_round( round_type, variant_type, round_spawning_func, round_wait_func, round_max_func, round_start_func, between_round_over_func, round_chance_func, next_instance_func )
{
if ( !isDefined( level.round_manager_special_rounds ) )
{
level.round_manager_special_rounds = [];
}
if ( !isDefined( level.round_manager_special_rounds[ round_type ] ) )
{
level.round_manager_special_rounds[ round_type ] = [];
}
s = sys::spawnstruct();
s.spawning_func = round_spawning_func;
s.wait_func = round_wait_func;
s.max_func = round_max_func;
s.start_func = round_start_func;
s.between_round_over_func = between_round_over_func;
s.chance_func = round_chance_func;
s.next_instance_func = next_instance_func;
s.active = false;
level.round_manager_special_rounds[ round_type ][ variant_type ] = s;
}
register_mixed_round_preset( preset_type, preset_chance_func, preset_round_start_func )
{
if ( !isDefined( level.round_manager_mixed_round_presets ) )
{
level.round_manager_mixed_round_presets = [];
}
if ( !isDefined( level.round_manager_mixed_round_presets[ preset_type ] ) )
{
level.round_manager_mixed_round_presets[ preset_type ] = sys::spawnstruct();
level.round_manager_mixed_round_presets[ preset_type ].variants = [];
}
level.round_manager_mixed_round_presets[ preset_type ].chance_func = preset_chance_func;
level.round_manager_mixed_round_presets[ preset_type ].start_func = preset_round_start_func;
}
register_mixed_round_preset_variant( preset_type, variant_type, spawning_func, spawning_chance_func, spawning_limit, spawning_cooldown_func, spawning_round_start_func )
{
assert( isdefined( level.round_manager_mixed_round_presets[ preset_type ] ) );
s = sys::spawnstruct();
s.spawning_func = spawning_func;
s.chance_func = spawning_chance_func;
s.limit = spawning_limit;
s.cooldown_func = spawning_cooldown_func;
s.start_func = spawning_round_start_func;
s.last_time = 0;
s.preset_type = preset_type;
s.variant_type = variant_type;
level.round_manager_mixed_round_presets[ preset_type ].variants[ variant_type ] = s;
}
register_ai_spawning_func( aitype, spawning_func )
{
if ( !isdefined( level.round_manager_aitype_spawning_funcs ) )
{
level.round_manager_aitype_spawning_funcs = [];
}
level.round_manager_aitype_spawning_funcs[ aitype ] = spawning_func;
}
get_zombie_dog_array()
{
return getaispeciesarray( level.zombie_team, "zombie_dog" );
}
get_zombie_dog_count()
{
return get_zombie_dog_array().size;
}
get_mechz_array()
{
zombies = getaiarray( level.zombie_team );
mechz = [];
for ( i = 0; i < zombies.size; i++ )
{
if ( isdefined( zombies[ i ].animname ) && zombies[ i ].animname == "mechz_zombie" )
{
mechz[ mechz.size ] = zombies[ i ];
}
}
return mechz;
}
get_mechz_count()
{
return get_mechz_array().size;
}
get_all_ai_array()
{
return getaispeciesarray( level.zombie_team, "all" );
}
get_all_ai_count()
{
return get_all_ai_array().size;
}
wait_for_free_ai_slot( func )
{
while ( level.zombie_total <= 0 || isdefined( func ) && [[ func ]]() >= level.zombie_ai_limit )
wait 0.1;
while ( get_current_actor_count() >= level.zombie_actor_limit )
{
clear_all_corpses();
wait 0.1;
}
}

View File

@ -0,0 +1,14 @@
main()
{
}
preset_chance()
{
return true;
}
round_start()
{
level.round_manager_spawn_count = 0;
}

View File

@ -0,0 +1,75 @@
#include maps\mp\zombies\_zm_utility;
#include common_scripts\utility;
#include maps\mp\_utility;
#include scripts\zm\zm_ai_pack\_utility;
main()
{
set_dvar_if_unset( "rm_mixed_preset_default_dog_wave_variant_spawn_limit_min", 6 );
set_dvar_if_unset( "rm_mixed_preset_default_dog_wave_variant_spawn_limit_max", 12 );
}
spawning_dog_wave()
{
level.round_manager_dog_wave_count++;
players = sys::getplayers();
max_dogs_in_wave = 12;
if ( players.size == 1 )
{
max_dogs_in_wave = 6;
}
while ( get_all_ai_count() > ( level.zombie_ai_limit - max_dogs_in_wave ) && level.zombie_total > 0 )
{
wait 0.5;
}
spawned_dog_count = 0;
max_dogs_in_wave = min( level.zombie_total, max_dogs_in_wave );
while ( ( spawned_dog_count < max_dogs_in_wave ) && level.zombie_total > 0 )
{
wait_for_free_ai_slot( ::get_all_ai_count );
ai = level [[ level.round_manager_aitype_spawning_funcs[ "zombie_dog" ] ]]();
if ( ai )
{
spawned_dog_count++;
level.round_manager_spawn_count++;
}
wait( level.zombie_vars["zombie_spawn_delay"] );
}
level.round_manager_dog_wave_count++;
level.round_manager_guaranteed_dog_wave_time = getTime() + ( 80000 * level.round_manager_dog_wave_count );
wait( level.zombie_vars["zombie_spawn_delay"] );
}
spawning_chance()
{
chance_of_dog_wave = 0;
chance_of_dog_wave -= ( level.round_manager_dog_wave_count * 1000 );
chance_of_dog_wave += ( level.round_manager_spawn_count * randomintrange( 5, 10 ) );
should_spawn_dog_wave_random = chance_of_dog_wave >= 1000;
should_spawn_guaranteed_dog_wave = ( ( level.round_manager_guaranteed_dog_wave_time + 80000 ) <= getTime() );
return should_spawn_dog_wave_random || should_spawn_guaranteed_dog_wave;
}
spawning_limit()
{
return level.players.size <= 1 ? getdvarint( "rm_mixed_preset_default_dog_wave_variant_spawn_limit_min" ) : getdvarint( "rm_mixed_preset_default_dog_wave_variant_spawn_limit_max" );
}
spawning_cooldown()
{
return true;
}
spawning_round_start()
{
level.round_manager_guaranteed_dog_wave_time = level.round_start_time;
level.round_manager_dog_wave_count = 0;
level.round_manager_chance_of_dog_wave = 0;
}

View File

@ -0,0 +1,80 @@
#include maps\mp\zombies\_zm_utility;
#include common_scripts\utility;
#include maps\mp\_utility;
#include scripts\zm\zm_ai_pack\_utility;
main()
{
set_dvar_if_unset( "rm_mixed_preset_default_random_variant_allowed_aitypes", "normal zombie_dog mechz" );
set_dvar_if_unset( "rm_mixed_preset_default_random_variant_wave_spawn_limit", 24 );
set_dvar_if_unset( "rm_mixed_preset_default_random_variant_wave_spawn_cooldown", 1 );
set_dvar_if_unset( "rm_mixed_preset_default_random_variant_mechz_spawn_chance_1000", 5 );
set_dvar_if_unset( "rm_mixed_preset_default_random_variant_zombie_dog_spawn_chance_1000", 200 );
}
spawning_random()
{
level endon( "intermission" );
level endon( "end_of_round" );
level endon( "restart_round" );
/#
level endon( "kill_round" );
#/
mechz_spawn_chance = getdvarint( "rm_mixed_preset_default_random_variant_mechz_spawn_chance_1000" );
zombie_dog_chance = getdvarint( "rm_mixed_preset_default_random_variant_zombie_dog_spawn_chance_1000" );
count = 0;
for (;;)
{
wait_for_free_ai_slot( ::get_all_ai_count );
ai = undefined;
random_number = randomint( 1000 );
if ( random_number < mechz_spawn_chance )
{
ai = [[ level.round_manager_aitype_spawning_funcs[ "mechz" ] ]]();
}
else if ( random_number < zombie_dog_chance )
{
ai = [[ level.round_manager_aitype_spawning_funcs[ "zombie_dog" ] ]]();
}
else
{
ai = [[ level.round_manager_aitype_spawning_funcs[ "normal" ] ]]();
}
if ( isdefined( ai ) )
{
count++;
level.round_manager_spawn_count++;
}
if ( count >= spawning_limit() )
{
return;
}
wait( level.zombie_vars["zombie_spawn_delay"] );
}
}
spawning_chance()
{
return true;
}
spawning_limit()
{
return getdvarint( "rm_mixed_preset_default_random_variant_wave_spawn_limit" );
}
spawning_cooldown()
{
return ( self.last_time + ( getdvarint( "rm_mixed_preset_default_random_variant_wave_spawn_cooldown" ) * 1000 ) ) <= gettime();
}
spawning_round_start()
{
}

View File

@ -5,6 +5,7 @@
#include maps\mp\zombies\_zm_ai_mechz;
#include scripts\zm\zm_ai_pack\_round_manager;
#include scripts\zm\zm_ai_pack\_utility;
main()
{
@ -17,8 +18,8 @@ main()
set_dvar_if_unset( "rm_mechz_rush_min_round", 45 );
set_dvar_if_unset( "rm_mechz_rush_min_spawn_wait", 1.5 );
set_dvar_if_unset( "rm_mechz_rush_max_spawn_wait", 2.5 );
set_dvar_if_unset( "rm_mechz_rush_max_mechz_alive", 24 );
set_dvar_if_unset( "rm_mechz_rush_max_mechz_round", 24 );
set_dvar_if_unset( "rm_mechz_rush_max_mechz_alive", 12 );
set_dvar_if_unset( "rm_mechz_rush_max_mechz_round", 12 );
set_dvar_if_unset( "rm_mechz_rush_max_health_multiplier", 0.5 );
}
@ -45,11 +46,7 @@ round_spawning()
if ( level.intermission )
return;
/#
if ( getdvarint( #"zombie_cheat" ) == 2 || getdvarint( #"zombie_cheat" ) >= 4 )
return;
#/
round_spawning_common();
for (;;)
@ -188,7 +185,9 @@ round_spawning_rush()
while ( level.zombie_mechz_locations.size < 1 )
wait( randomfloatrange( 5.0, 10.0 ) );
ai = spawn_single_mechz( int( level.mechz_health * getdvarfloat( "rm_mechz_rush_max_health_multiplier" ) ) );
starting_properties = sys::spawnstruct();
starting_properties.health = int( level.mechz_health * getdvarfloat( "rm_mechz_rush_max_health_multiplier" ) );
ai = spawn_single_mechz( starting_properties );
if ( level.mechz_left_to_spawn == 0 )
level thread maps\mp\zombies\_zm_ai_mechz::response_to_air_raid_siren_vo();
@ -233,13 +232,11 @@ round_next_rush()
}
}
spawn_single_mechz( starting_health )
spawn_single_mechz( starting_properties )
{
ai = spawn_zombie( level.mechz_spawners[0] );
if ( isdefined( starting_health ) )
{
ai.custom_starting_health = starting_health;
}
ai scripts\zm\zm_ai_pack\_round_manager::set_starting_properties_for_ai( starting_properties );
ai thread maps\mp\zombies\_zm_ai_mechz::mechz_spawn();
if ( isdefined( ai ) )

View File

@ -4,6 +4,8 @@
#include maps\mp\zombies\_zm;
#include scripts\zm\zm_ai_pack\_utility;
round_spawning()
{
level endon( "intermission" );
@ -16,11 +18,6 @@ round_spawning()
if ( level.intermission )
return;
/#
if ( getdvarint( #"zombie_cheat" ) == 2 || getdvarint( #"zombie_cheat" ) >= 4 )
return;
#/
if ( level.zombie_spawn_locations.size < 1 )
{
/#
@ -33,33 +30,20 @@ round_spawning()
if ( level.round_number < 10 || level.speed_change_max > 0 )
level thread zombie_speed_up();
mixed_spawns = 0;
old_spawn = undefined;
spawning_preset = scripts\zm\zm_ai_pack\_round_manager::determine_mixed_round_preset();
while ( true )
{
while ( get_current_zombie_count() >= level.zombie_ai_limit || level.zombie_total <= 0 )
wait 0.1;
spawning_variant = scripts\zm\zm_ai_pack\_round_manager::pick_mixed_round_preset_variant( level.round_manager_spawning_preset.variants );
while ( get_current_actor_count() >= level.zombie_actor_limit )
if ( isdefined( spawning_variant ) )
{
clear_all_corpses();
wait 0.1;
if ( getdvarint( "zm_ai_pack_debug" ) > 0 )
{
print( "Round Manager: Running mixed preset <" + spawning_variant.preset_type + "> variant <" + spawning_variant.variant_type + ">" );
}
level [[ spawning_variant.spawning_func ]]();
}
flag_wait( "spawn_zombies" );
while ( level.zombie_spawn_locations.size <= 0 )
wait 0.1;
run_custom_ai_spawn_checks();
ai = scripts\zm\zm_ai_pack\rounds\_normal::spawn_single_normal_zombie();
wait( level.zombie_vars["zombie_spawn_delay"] );
wait_network_frame();
}
}
@ -84,7 +68,7 @@ round_wait()
if ( isdefined( level.is_ghost_round_started ) && [[ level.is_ghost_round_started ]]() )
should_wait = 1;
else
should_wait = get_current_zombie_count() > 0 || level.zombie_total > 0 || level.intermission;
should_wait = get_all_ai_count() > 0 || level.zombie_total > 0 || level.intermission;
if ( !should_wait )
return;
@ -131,7 +115,16 @@ round_max()
round_start()
{
level.round_manager_spawning_preset = scripts\zm\zm_ai_pack\_round_manager::determine_mixed_round_preset();
level [[ level.round_manager_spawning_preset.start_func ]]();
variants = level.round_manager_spawning_preset.variants;
variant_keys = getarraykeys( level.round_manager_spawning_preset.variants );
for ( i = 0; i < variant_keys.size; i++ )
{
level [[ variants[ variant_keys[ i ] ].start_func ]]();
}
}
round_over()
@ -147,68 +140,4 @@ round_chance()
round_next()
{
return level.round_number + 1;
}
special_dog_spawn( spawners, num_to_spawn )
{
dogs = getaispeciesarray( "all", "zombie_dog" );
if ( isdefined( dogs ) && dogs.size >= 9 )
return false;
if ( !isdefined( num_to_spawn ) )
num_to_spawn = 1;
spawn_point = undefined;
count = 0;
while ( count < num_to_spawn )
{
players = sys::getplayers();
favorite_enemy = get_favorite_enemy();
if ( isdefined( spawners ) )
{
spawn_point = spawners[randomint( spawners.size )];
ai = spawn_zombie( spawn_point );
if ( isdefined( ai ) )
{
ai.favoriteenemy = favorite_enemy;
spawn_point thread dog_spawn_fx( ai );
count++;
flag_set( "dog_clips" );
}
}
else if ( isdefined( level.dog_spawn_func ) )
{
spawn_loc = [[ level.dog_spawn_func ]]( level.dog_spawners, favorite_enemy );
ai = spawn_zombie( level.dog_spawners[0] );
if ( isdefined( ai ) )
{
ai.favoriteenemy = favorite_enemy;
spawn_loc thread dog_spawn_fx( ai, spawn_loc );
count++;
flag_set( "dog_clips" );
}
}
else
{
spawn_point = dog_spawn_factory_logic( level.enemy_dog_spawns, favorite_enemy );
ai = spawn_zombie( level.dog_spawners[0] );
if ( isdefined( ai ) )
{
ai.favoriteenemy = favorite_enemy;
spawn_point thread dog_spawn_fx( ai, spawn_point );
count++;
flag_set( "dog_clips" );
}
}
waiting_for_next_dog_spawn( count, num_to_spawn );
}
return true;
}

View File

@ -4,6 +4,8 @@
#include maps\mp\zombies\_zm;
#include scripts\zm\zm_ai_pack\_utility;
round_spawning()
{
level endon( "intermission" );
@ -13,18 +15,10 @@ round_spawning()
level endon( "kill_round" );
#/
if ( level.intermission )
return;
/#
if ( getdvarint( #"zombie_cheat" ) == 2 || getdvarint( #"zombie_cheat" ) >= 4 )
return;
#/
if ( level.zombie_spawn_locations.size < 1 )
{
/#
assertmsg( "No active spawners in the map. Check to see if the zone is active and if it's pointing to spawners." );
assertmsg( "No active spawn locations in the zone. Check to see if the zone is active and if it's pointing to spawners." );
#/
return;
}
@ -39,7 +33,7 @@ round_spawning()
while ( true )
{
while ( get_current_zombie_count() >= level.zombie_ai_limit || level.zombie_total <= 0 )
while ( get_current_zombie_count() >= level.zombie_ai_limit || level.zombie_total <= 0 || level.intermission )
wait 0.1;
while ( get_current_actor_count() >= level.zombie_actor_limit )
@ -57,7 +51,7 @@ round_spawning()
ai = spawn_single_normal_zombie();
wait( level.zombie_vars["zombie_spawn_delay"] );
wait( level.zombie_vars[ "zombie_spawn_delay" ] );
wait_network_frame();
}
}
@ -171,9 +165,10 @@ default_max_zombie_func( max_num )
return max;
}
spawn_single_normal_zombie()
spawn_single_normal_zombie( starting_properties_struct )
{
ai = undefined;
old_spawn = undefined;
spawn_point = level.zombie_spawn_locations[randomint( level.zombie_spawn_locations.size )];
@ -217,6 +212,8 @@ spawn_single_normal_zombie()
level.zombie_total--;
ai thread round_spawn_failsafe();
}
ai scripts\zm\zm_ai_pack\_round_manager::set_starting_properties_for_ai( starting_properties_struct );
return ai;
}

View File

@ -5,6 +5,7 @@
#include maps\mp\zombies\_zm_ai_dogs;
#include scripts\zm\zm_ai_pack\_round_manager;
#include scripts\zm\zm_ai_pack\_utility;
main()
{
@ -12,9 +13,9 @@ main()
set_dvar_if_unset( "rm_dog_rush_min_round", 20 );
set_dvar_if_unset( "rm_dog_rush_round_chance", 10 );
set_dvar_if_unset( "rm_dog_rush_max_dogs_alive", 24 );
set_dvar_if_unset( "rm_dog_rush_max_dogs_round", 128 );
set_dvar_if_unset( "rm_dog_rush_max_dogs_round_per_player", 8 );
set_dvar_if_unset( "rm_dog_rush_max_dogs_alive_per_player", 6 );
set_dvar_if_unset( "rm_dog_rush_max_dogs_round", 64 );
set_dvar_if_unset( "rm_dog_rush_max_dogs_round_per_player", 4 );
set_dvar_if_unset( "rm_dog_rush_max_dogs_round_base", 24 );
set_dvar_if_unset( "rm_dog_rush_max_dogs_round_number_multiplier", 0.1 );
set_dvar_if_unset( "rm_dog_rush_max_spawn_wait", 0.5 );
@ -23,28 +24,18 @@ main()
round_spawning()
{
level endon( "end_of_round" );
level endon( "intermission" );
level.dog_targets = sys::getplayers();
for ( i = 0; i < level.dog_targets.size; i++ )
level.dog_targets[i].hunted_by = 0;
level endon( "end_of_round" );
level endon( "restart_round" );
/#
level endon( "kill_round" );
if ( getdvarint( #"zombie_cheat" ) == 2 || getdvarint( #"zombie_cheat" ) >= 4 )
return;
#/
if ( level.intermission )
return;
count = 0;
max = level.zombie_total;
while ( true )
{
while ( get_zombie_dog_count() >= level.zombie_ai_limit || level.zombie_total <= 0 )
while ( get_zombie_dog_count() >= level.zombie_ai_limit || level.zombie_total <= 0 || level.intermission )
wait 0.1;
for ( num_player_valid = get_number_of_valid_players(); get_zombie_dog_count() >= num_player_valid * 2; num_player_valid = get_number_of_valid_players() )
@ -86,6 +77,10 @@ round_max()
round_start()
{
level.dog_targets = sys::getplayers();
for ( i = 0; i < level.dog_targets.size; i++ )
level.dog_targets[i].hunted_by = false;
level.music_round_override = 1;
maps\mp\zombies\_zm_ai_dogs::dog_round_start();
@ -94,7 +89,12 @@ round_start()
players = sys::getplayers();
array_thread( players, maps\mp\zombies\_zm_ai_dogs::play_dog_round );
wait 1;
playsoundatposition( game["zmbdialog"]["prefix"] + "_event_dogstart_0", ( 0, 0, 0 ) );
prefix = "vox_zmba";
if ( !level.sndannouncerisrich || level.script == "zm_prison" || level.script == "zm_tomb" )
{
prefix = "vox_zmba_sam";
}
playsoundatposition( prefix + "_event_dogstart_0", ( 0, 0, 0 ) );
wait 6;
}
@ -139,26 +139,16 @@ round_spawning_rush()
{
level endon( "end_of_round" );
level endon( "intermission" );
level.dog_targets = sys::getplayers();
for ( i = 0; i < level.dog_targets.size; i++ )
level.dog_targets[i].hunted_by = 0;
/#
level endon( "kill_round" );
if ( getdvarint( #"zombie_cheat" ) == 2 || getdvarint( #"zombie_cheat" ) >= 4 )
return;
#/
if ( level.intermission )
return;
count = 0;
max = level.zombie_total;
while ( true )
{
while ( get_zombie_dog_count() >= level.zombie_ai_limit || get_zombie_dog_count() >= getdvarint( "rm_dog_rush_max_dogs_alive" ) || level.zombie_total <= 0 )
while ( get_zombie_dog_count() >= level.zombie_ai_limit || get_zombie_dog_count() >= ( getdvarint( "rm_dog_rush_max_dogs_alive_per_player" ) * level.players.size )
|| level.zombie_total <= 0 || level.intermission )
wait 0.1;
count = spawn_zombie_dog( count );
@ -175,7 +165,7 @@ round_max_rush()
dog_max += players.size * getdvarint( "rm_dog_rush_max_dogs_round_per_player" );
dog_max *= int( level.round_number * getdvarfloat( "rm_dog_rush_max_dogs_round_number_multiplier" ) );
//dog_max *= int( level.round_number * getdvarfloat( "rm_dog_rush_max_dogs_round_number_multiplier" ) );
max = getdvarint( "rm_dog_rush_max_dogs_round" );
if ( dog_max > max )
@ -247,9 +237,22 @@ waiting_for_next_dog_spawn_rush( count, max )
spawn_zombie_dog( count )
{
players = sys::getplayers();
ai = spawn_single_zombie_dog();
if ( isdefined( ai ) )
{
count++;
}
return count;
}
spawn_single_zombie_dog( starting_properties_struct )
{
favorite_enemy = maps\mp\zombies\_zm_ai_dogs::get_favorite_enemy();
ai = undefined;
if ( isdefined( level.dog_spawn_func ) )
{
spawn_loc = [[ level.dog_spawn_func ]]( level.dog_spawners, favorite_enemy );
@ -260,7 +263,6 @@ spawn_zombie_dog( count )
ai.favoriteenemy = favorite_enemy;
spawn_loc thread maps\mp\zombies\_zm_ai_dogs::dog_spawn_fx( ai, spawn_loc );
level.zombie_total--;
count++;
}
}
else
@ -273,12 +275,13 @@ spawn_zombie_dog( count )
ai.favoriteenemy = favorite_enemy;
spawn_point thread maps\mp\zombies\_zm_ai_dogs::dog_spawn_fx( ai, spawn_point );
level.zombie_total--;
count++;
flag_set( "dog_clips" );
}
}
return count;
ai scripts\zm\zm_ai_pack\_round_manager::set_starting_properties_for_ai( starting_properties_struct );
return ai;
}
dog_spawn_sumpf_logic( dog_array, favorite_enemy )

View File

@ -1,9 +0,0 @@
main()
{
}
preset_chance()
{
return true;
}

View File

@ -1,19 +0,0 @@
spawning_random()
{
}
spawning_chance()
{
}
spawning_limit()
{
}
spawning_cooldown()
{
}

View File

@ -20,6 +20,8 @@ init()
}
level.zone_hud_y_offset = y;
level.location_hud_y_offset = y - 20;
level thread command_thread();
level thread on_player_connect();
level thread draw_zombie_spawn_locations();
@ -101,6 +103,11 @@ on_player_connect()
level waittill( "connected", player );
player thread zone_hud();
player thread location_hud();
player thread zombie_counter_hud();
if ( getdvarint( "zm_ai_pack_debug" ) > 0 )
{
level.zombie_vars[ "zombie_intermission_time" ] = 0.05;
}
}
}
@ -230,6 +237,52 @@ location_hud()
}
}
zombie_counter_hud()
{
self endon( "disconnect" );
x = 5;
y = level.location_hud_y_offset - 20;
text_hud = self new_debug_hud( x, y );
text_hud settext( "Zombies Left: " );
x += 75;
current_hud = self new_debug_hud( x, y );
x += 20;
plus_hud = self new_debug_hud( x, y );
plus_hud settext( " + " );
x += 20;
total_hud = self new_debug_hud( x, y );
flag_wait( "initial_blackscreen_passed" );
while ( !isdefined( level.zombie_total ) )
{
wait 1;
}
for (;;)
{
while ( getDvarInt( "zm_ai_pack_debug" ) <= 0 )
{
text_hud.alpha = 0;
current_hud.alpha = 0;
plus_hud.alpha = 0;
total_hud.alpha = 0;
wait 1;
}
text_hud.alpha = 1;
current_hud.alpha = 1;
plus_hud.alpha = 1;
total_hud.alpha = 1;
current_hud setvalue( get_current_zombie_count() );
total_hud setvalue( level.zombie_total );
wait 0.05;
}
}
draw_zombie_spawn_location_box( origin, color, vec = ( 20, 20, 40 ) )
{
box( origin + ( 0, 0, 20 ), vec * -1, vec, 0, color, 1.0 );
@ -457,6 +510,8 @@ draw_nodes()
draw_node_data( node, color, type );
throttle_count++;
}
nodes = undefined;
wait 0.05;
}
}
@ -495,4 +550,5 @@ print_entities()
print( "**************" );
}
print( "Listed " + ents.size + " entities" );
}
}

View File

@ -51,7 +51,7 @@ main()
level.ai_data[ "mechz" ].init = maps\mp\zombies\_zm_ai_mechz::init;
level.ai_data[ "mechz" ].should_execute = level.script != "zm_tomb";
level.ai_data[ "zombie_dog" ] = sys::spawnstruct();
level.ai_data[ "zombie_dog" ].main = maps\mp\zombies\_zm_ai_dogs::init;
level.ai_data[ "zombie_dog" ].init = maps\mp\zombies\_zm_ai_dogs::init;
level.ai_data[ "zombie_dog" ].should_execute = level.gametype != "zstandard" ;
keys = getArrayKeys( level.ai_data );
@ -183,7 +183,7 @@ dotraverse_teleport( no_powerups )
startnode = self getnegotiationstartnode();
if ( !isdefined( endnode ) || !isdefined( startnode ) )
{
print( "dotraverse_teleport() missing endnode or startnode" );
assertmsg( "dotraverse_teleport() missing endnode or startnode" );
return;
}