From 619282e2523561deb1b73edf0440e33aef098b3d Mon Sep 17 00:00:00 2001 From: JezuzLizard Date: Fri, 1 Mar 2024 13:26:46 -0800 Subject: [PATCH] Refine mixed wave preset. --- zm_ai_pack/maps/mp/zombies/_zm_ai_brutus.gsc | 47 +++++----- .../scripts/zm/zm_ai_pack/_round_manager.gsc | 89 ++++++++++++++----- zm_ai_pack/scripts/zm/zm_ai_pack/_utility.gsc | 14 +++ .../zm/zm_ai_pack/mixed_presets/_wave.gsc | 45 ++++++++++ .../zm_ai_pack/mixed_variants/_dog_wave.gsc | 69 +++++++------- .../zm_ai_pack/mixed_variants/_mechz_wave.gsc | 72 +++++++++++++++ .../mixed_variants/_normal_wave.gsc | 33 +++++++ .../zm/zm_ai_pack/mixed_variants/_random.gsc | 8 +- .../scripts/zm/zm_ai_pack/rounds/_mechz.gsc | 7 +- .../scripts/zm/zm_ai_pack/rounds/_mixed.gsc | 27 +++--- .../scripts/zm/zm_ai_pack/rounds/_normal.gsc | 24 ++--- .../zm/zm_ai_pack/rounds/_zombie_dog.gsc | 7 +- zm_ai_pack/zone_source/mod.zone | 8 +- 13 files changed, 319 insertions(+), 131 deletions(-) create mode 100644 zm_ai_pack/scripts/zm/zm_ai_pack/mixed_presets/_wave.gsc create mode 100644 zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_mechz_wave.gsc create mode 100644 zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_normal_wave.gsc diff --git a/zm_ai_pack/maps/mp/zombies/_zm_ai_brutus.gsc b/zm_ai_pack/maps/mp/zombies/_zm_ai_brutus.gsc index 76d6944..e0d7307 100644 --- a/zm_ai_pack/maps/mp/zombies/_zm_ai_brutus.gsc +++ b/zm_ai_pack/maps/mp/zombies/_zm_ai_brutus.gsc @@ -233,19 +233,6 @@ init() setup_interaction_matrix() { level.interaction_types = []; - level.interaction_types["magic_box"] = sys::spawnstruct(); - level.interaction_types["magic_box"].priority = 0; - level.interaction_types["magic_box"].animstate = "zm_lock_magicbox"; - level.interaction_types["magic_box"].notify_name = "box_lock_anim"; - level.interaction_types["magic_box"].action_notetrack = "locked"; - level.interaction_types["magic_box"].end_notetrack = "lock_done"; - level.interaction_types["magic_box"].validity_func = ::is_magic_box_valid; - level.interaction_types["magic_box"].get_func = ::get_magic_boxes; - level.interaction_types["magic_box"].value_func = ::get_dist_score; - level.interaction_types["magic_box"].interact_func = ::magic_box_lock; - level.interaction_types["magic_box"].spawn_bias = 1000; - level.interaction_types["magic_box"].num_times_to_scale = 1; - level.interaction_types["magic_box"].unlock_cost = 2000; level.interaction_types["perk_machine"] = sys::spawnstruct(); level.interaction_types["perk_machine"].priority = 1; level.interaction_types["perk_machine"].animstate = "zm_lock_perk_machine"; @@ -260,6 +247,19 @@ setup_interaction_matrix() level.interaction_types["perk_machine"].unlock_cost = 2000; if ( getDvar( "mapname" ) == "zm_prison" ) { + level.interaction_types["magic_box"] = sys::spawnstruct(); + level.interaction_types["magic_box"].priority = 0; + level.interaction_types["magic_box"].animstate = "zm_lock_magicbox"; + level.interaction_types["magic_box"].notify_name = "box_lock_anim"; + level.interaction_types["magic_box"].action_notetrack = "locked"; + level.interaction_types["magic_box"].end_notetrack = "lock_done"; + level.interaction_types["magic_box"].validity_func = ::is_magic_box_valid; + level.interaction_types["magic_box"].get_func = ::get_magic_boxes; + level.interaction_types["magic_box"].value_func = ::get_dist_score; + level.interaction_types["magic_box"].interact_func = ::magic_box_lock; + level.interaction_types["magic_box"].spawn_bias = 1000; + level.interaction_types["magic_box"].num_times_to_scale = 1; + level.interaction_types["magic_box"].unlock_cost = 2000; level.interaction_types["craftable_table"] = sys::spawnstruct(); level.interaction_types["craftable_table"].priority = 2; level.interaction_types["craftable_table"].animstate = "zm_smash_craftable_table"; @@ -877,6 +877,7 @@ brutus_round_tracker() old_spawn_func = level.round_spawn_func; old_wait_func = level.round_wait_func; + is_team_on_golden_gate_bridge_func = pluto_sys::getfunction( "maps/mp/zm_alcatraz_utility", "is_team_on_golden_gate_bridge" ); while ( true ) { level waittill( "between_round_over" ); @@ -886,13 +887,11 @@ brutus_round_tracker() continue; else if ( level.next_brutus_round <= level.round_number ) { - /* - if ( maps\mp\zm_alcatraz_utility::is_team_on_golden_gate_bridge() ) + if ( isdefined( is_team_on_golden_gate_bridge_func ) && [[ is_team_on_golden_gate_bridge_func ]]() ) { level.next_brutus_round = level.round_number + 1; continue; } - */ wait( randomfloatrange( level.brutus_min_spawn_delay, level.brutus_max_spawn_delay ) ); @@ -2220,17 +2219,19 @@ brutus_damage_override( inflictor, attacker, damage, flags, meansofdeath, weapon return damage; } - /* + player_damage_shield_func = pluto_sys::getfunction( "maps/mp/zombies/_zm_weap_riotshield_prison", "player_damage_shield" ); if ( isdefined( meansofdeath ) && ( meansofdeath == "MOD_MELEE" || meansofdeath == "MOD_IMPACT" ) ) { if ( weapon == "alcatraz_shield_zm" ) { shield_damage = level.zombie_vars["riotshield_fling_damage_shield"]; - inflictor maps\mp\zombies\_zm_weap_riotshield_prison::player_damage_shield( shield_damage, 0 ); + if ( isdefined( player_damage_shield_func ) ) + { + inflictor [[ player_damage_shield_func ]]( shield_damage, 0 ); + } return 0; } } - */ if ( isdefined( level.zombiemode_using_afterlife ) && level.zombiemode_using_afterlife && weapon == "lightning_hands_zm" ) { @@ -2751,7 +2752,8 @@ check_craftable_table_valid( player ) self.stub.is_locked = 0; self.stub.locked_cost = undefined; self.stub.lock_fx delete(); - //self.stub thread maps\mp\zombies\_zm_craftables::craftablestub_update_prompt( player ); + craftablestub_update_prompt_func = pluto_sys::getfunction( "maps/mp/zombies/_zm_craftables", "craftablestub_update_prompt" ); + self.stub thread [[ craftablestub_update_prompt_func ]]( player ); self sethintstring( self.stub.hint_string ); } @@ -2777,7 +2779,10 @@ check_plane_valid( player ) plane_struct.locked_cost = undefined; plane_struct.lock_fx delete(); func = pluto_sys::getfunction( "maps/mp/zm_alcatraz_sq", "reset_plane_hint_string" ); - plane_struct [[ func ]]( player ); + if ( isdefined( func ) ) + { + plane_struct [[ func ]]( player ); + } } return false; diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/_round_manager.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/_round_manager.gsc index 0505163..3522462 100644 --- a/zm_ai_pack/scripts/zm/zm_ai_pack/_round_manager.gsc +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/_round_manager.gsc @@ -13,15 +13,19 @@ main() set_dvar_if_unset( "rm_special_round_chance", 33 ); set_dvar_if_unset( "rm_allow_same_round_as_last_round", 1 ); - set_dvar_if_unset( "rm_allowed_special_rounds", "normal zombie_dog mechz mixed" ); + set_dvar_if_unset( "rm_allowed_special_rounds", "normal zombie_dog mechz" ); set_dvar_if_unset( "rm_allowed_special_round_variants", "default" ); set_dvar_if_unset( "rm_forced_special_round", "" ); 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_round_variants", "random" ); + set_dvar_if_unset( "rm_allowed_mixed_rounds_presets", "default wave" ); + set_dvar_if_unset( "rm_allowed_mixed_round_variants_for_default_preset", "random" ); + set_dvar_if_unset( "rm_allowed_mixed_round_variants_for_wave_preset", "normal_wave dog_wave mechz_wave" ); set_dvar_if_unset( "rm_forced_mixed_rounds_preset", "" ); set_dvar_if_unset( "rm_forced_mixed_rounds_variant", "" ); + set_dvar_if_unset( "rm_mixed_round_chance_base", 20 ); + set_dvar_if_unset( "rm_mixed_round_chance_round_scalar", 5 ); + set_dvar_if_unset( "rm_mixed_round_min_start_round", 18 ); level.special_round = sys::spawnstruct(); level.special_round.current_data = sys::spawnstruct(); @@ -109,14 +113,37 @@ main() 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, + register_mixed_round_preset( "wave", + 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( "wave", "normal_wave", + scripts\zm\zm_ai_pack\mixed_variants\_normal_wave::spawning_wave, + scripts\zm\zm_ai_pack\mixed_variants\_normal_wave::spawning_chance, + scripts\zm\zm_ai_pack\mixed_variants\_normal_wave::spawning_limit, + scripts\zm\zm_ai_pack\mixed_variants\_normal_wave::spawning_cooldown, + scripts\zm\zm_ai_pack\mixed_variants\_normal_wave::spawning_round_start ); + + register_mixed_round_preset_variant( "wave", "dog_wave", + scripts\zm\zm_ai_pack\mixed_variants\_dog_wave::spawning_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); + + register_mixed_round_preset_variant( "wave", "mechz_wave", + scripts\zm\zm_ai_pack\mixed_variants\_mechz_wave::spawning_wave, + scripts\zm\zm_ai_pack\mixed_variants\_mechz_wave::spawning_chance, + scripts\zm\zm_ai_pack\mixed_variants\_mechz_wave::spawning_limit, + scripts\zm\zm_ai_pack\mixed_variants\_mechz_wave::spawning_cooldown, + scripts\zm\zm_ai_pack\mixed_variants\_mechz_wave::spawning_round_start); - scripts\zm\zm_ai_pack\mixed_variants\_random::main(); + scripts\zm\zm_ai_pack\mixed_presets\_default::main(); + + scripts\zm\zm_ai_pack\mixed_variants\_random::main(); + scripts\zm\zm_ai_pack\mixed_variants\_dog_wave::main(); + scripts\zm\zm_ai_pack\mixed_variants\_mechz_wave::main(); + scripts\zm\zm_ai_pack\mixed_variants\_normal_wave::main(); //Future variants // random - random ais, true_random - random ais + random behavior and stats // elemental? @@ -127,7 +154,8 @@ main() should_do_special_round() { - if ( getDvar( "rm_forced_special_round" ) != "" && getdvar( "rm_forced_special_variant" ) ) + forced_special_round_string = getDvar( "rm_forced_special_round" ); + if ( forced_special_round_string != "" && forced_special_round_string != "mixed" && getdvar( "rm_forced_special_variant" ) ) { return true; } @@ -174,6 +202,24 @@ should_do_special_round() return false; } +should_do_mixed_round() +{ + if ( getdvar( "rm_allowed_mixed_rounds_presets" ) == "" ) + { + return false; + } + min_round = getDvarInt( "rm_mixed_round_min_start_round" ); + + chance_base = getdvarint( "rm_mixed_round_chance_base" ); + + if ( level.round_number >= min_round ) + { + return randomInt( 100 ) <= ( chance_base + int( level.round_number * getdvarint( "rm_mixed_round_chance_round_scalar" ) ) ); + } + + return false; +} + determine_current_round_type() { return_value = sys::spawnstruct(); @@ -200,7 +246,9 @@ determine_current_round_type() should_do_special_round = should_do_special_round(); - if ( !should_do_special_round || !isDefined( level.round_manager_special_rounds ) || level.round_manager_special_rounds.size <= 0 ) + should_do_mixed_round = should_do_mixed_round(); + + if ( ( !should_do_special_round && !should_do_mixed_round ) || !isDefined( level.round_manager_special_rounds ) || level.round_manager_special_rounds.size <= 0 ) { return_value.round_type = "normal"; return_value.variant = "default"; @@ -208,6 +256,14 @@ determine_current_round_type() return level.normal_round.current_data; } + if ( !should_do_special_round && should_do_mixed_round ) + { + return_value.round_type = "mixed"; + return_value.variant = "default"; + level.normal_round.current_data = return_value; + return level.normal_round.current_data; + } + allowed_round_string = getDvar( "rm_allowed_special_rounds" ); variant_string = getdvar( "rm_allowed_special_round_variants" ); @@ -501,7 +557,7 @@ pick_mixed_round_preset_variant( variants ) } } - allowed_variants_string = getdvar( "rm_allowed_mixed_round_variants" ); + allowed_variants_string = getdvar( "rm_allowed_mixed_round_variants_for_" + level.round_manager_spawning_preset.preset_type + "_preset" ); pick_from_allowed_variants_pool = allowed_variants_string != ""; @@ -525,7 +581,7 @@ 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 ]]() && possible_variants[ i ] [[ variants[ possible_variants[ i ] ].cooldown_func ]]() ) + if ( [[ variants[ possible_variants[ i ] ].chance_func ]]() && variants[ possible_variants[ i ] ] [[ variants[ possible_variants[ i ] ].cooldown_func ]]() ) { variants[ possible_variants[ i ] ].last_time = gettime(); return variants[ possible_variants[ i ] ]; @@ -540,17 +596,4 @@ pick_mixed_round_preset_variant( variants ) 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; - } } \ No newline at end of file diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/_utility.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/_utility.gsc index 937e86e..c21d595 100644 --- a/zm_ai_pack/scripts/zm/zm_ai_pack/_utility.gsc +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/_utility.gsc @@ -41,6 +41,7 @@ register_mixed_round_preset( preset_type, preset_chance_func, preset_round_start 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; + level.round_manager_mixed_round_presets[ preset_type ].preset_type = preset_type; } register_mixed_round_preset_variant( preset_type, variant_type, spawning_func, spawning_chance_func, spawning_limit, spawning_cooldown_func, spawning_round_start_func ) @@ -120,3 +121,16 @@ wait_for_free_ai_slot( func ) wait 0.1; } } + +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; + } +} \ No newline at end of file diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_presets/_wave.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_presets/_wave.gsc new file mode 100644 index 0000000..74e8632 --- /dev/null +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_presets/_wave.gsc @@ -0,0 +1,45 @@ +#include maps\mp\zombies\_zm_utility; +#include common_scripts\utility; +#include maps\mp\_utility; + +#include scripts\zm\zm_ai_pack\_utility; + +main() +{ + +} + +preset_chance() +{ + return true; +} + +round_start() +{ + level.round_manager_spawn_count = 0; +} + +spawn_wave( type ) +{ + max_in_wave = [[ level.round_manager_spawning_preset_current_variant.limit ]](); + + while ( get_all_ai_count() > ( level.zombie_ai_limit - max_in_wave ) && level.zombie_total > 0 ) + { + wait 0.5; + } + + count = 0; + max_in_wave = min( level.zombie_total, max_in_wave ); + while ( ( count < max_in_wave ) && level.zombie_total > 0 ) + { + wait_for_free_ai_slot( ::get_all_ai_count ); + ai = level [[ level.round_manager_aitype_spawning_funcs[ type ] ]](); + if ( isdefined( ai ) ) + { + count++; + level.round_manager_spawn_count++; + } + wait( level.zombie_vars["zombie_spawn_delay"] ); + } + wait( level.zombie_vars["zombie_spawn_delay"] ); +} \ No newline at end of file diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_dog_wave.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_dog_wave.gsc index 208d565..e550147 100644 --- a/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_dog_wave.gsc +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_dog_wave.gsc @@ -6,60 +6,54 @@ 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 ); + set_dvar_if_unset( "rm_mixed_preset_wave_dog_wave_variant_spawn_limit_min", 6 ); + set_dvar_if_unset( "rm_mixed_preset_wave_dog_wave_variant_spawn_limit_max", 12 ); + set_dvar_if_unset( "rm_mixed_preset_wave_dog_wave_variant_min_round", 15 ); + set_dvar_if_unset( "rm_mixed_preset_wave_dog_wave_variant_min_cooldown", 80.0 ); + set_dvar_if_unset( "rm_mixed_preset_wave_dog_wave_variant_max_cooldown", 240.0 ); + set_dvar_if_unset( "rm_mixed_preset_wave_dog_wave_variant_chance_threshold", 1000 ); + set_dvar_if_unset( "rm_mixed_preset_wave_dog_wave_variant_chance_per_spawn_min", 5 ); + set_dvar_if_unset( "rm_mixed_preset_wave_dog_wave_variant_chance_per_spawn_max", 10 ); } -spawning_dog_wave() +spawning_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"] ); + scripts\zm\zm_ai_pack\mixed_presets\_wave::spawn_wave( "zombie_dog" ); + time = randomfloatrange( getdvarfloat( "rm_mixed_preset_wave_dog_wave_variant_min_cooldown" ), getdvarfloat( "rm_mixed_preset_wave_dog_wave_variant_max_cooldown" ) ); + level.round_manager_guaranteed_dog_wave_time = gettime() + ( time * level.round_manager_dog_wave_count ); } spawning_chance() { + if ( level.round_number < getdvarint( "rm_mixed_preset_wave_dog_wave_variant_min_round" ) ) + { + return false; + } chance_of_dog_wave = 0; - chance_of_dog_wave -= ( level.round_manager_dog_wave_count * 1000 ); + chance_of_dog_wave -= ( level.round_manager_dog_wave_count * getdvarint( "rm_mixed_preset_wave_dog_wave_variant_chance_threshold" ) ); - chance_of_dog_wave += ( level.round_manager_spawn_count * randomintrange( 5, 10 ) ); + min = getdvarint( "rm_mixed_preset_wave_dog_wave_variant_chance_per_spawn_min" ); + max = getdvarint( "rm_mixed_preset_wave_dog_wave_variant_chance_per_spawn_max" ); + chance_of_dog_wave += ( level.round_manager_spawn_count * randomintrange( min, max ) ); - should_spawn_dog_wave_random = chance_of_dog_wave >= 1000; - should_spawn_guaranteed_dog_wave = ( ( level.round_manager_guaranteed_dog_wave_time + 80000 ) <= getTime() ); + should_spawn_dog_wave_random = chance_of_dog_wave >= getdvarint( "rm_mixed_preset_wave_dog_wave_variant_chance_threshold" ); + time = randomfloatrange( getdvarfloat( "rm_mixed_preset_wave_dog_wave_variant_min_cooldown" ), getdvarfloat( "rm_mixed_preset_wave_dog_wave_variant_max_cooldown" ) ); + should_spawn_guaranteed_dog_wave = ( ( level.round_manager_guaranteed_dog_wave_time + ( time * 1000 ) ) <= 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" ); + if ( level.players.size <= 1 ) + { + return getdvarint( "rm_mixed_preset_wave_dog_wave_variant_spawn_limit_min" ); + } + else + { + return getdvarint( "rm_mixed_preset_wave_dog_wave_variant_spawn_limit_max" ); + } } spawning_cooldown() @@ -71,5 +65,4 @@ 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; } \ No newline at end of file diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_mechz_wave.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_mechz_wave.gsc new file mode 100644 index 0000000..9c382a9 --- /dev/null +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_mechz_wave.gsc @@ -0,0 +1,72 @@ +#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_wave_mechz_wave_variant_spawn_limit_min", 1 ); + set_dvar_if_unset( "rm_mixed_preset_wave_mechz_wave_variant_spawn_limit_max", 8 ); + set_dvar_if_unset( "rm_mixed_preset_wave_mechz_wave_variant_min_round", 25 ); + set_dvar_if_unset( "rm_mixed_preset_wave_mechz_wave_variant_min_cooldown", 120.0 ); + set_dvar_if_unset( "rm_mixed_preset_wave_mechz_wave_variant_max_cooldown", 240.0 ); + set_dvar_if_unset( "rm_mixed_preset_wave_mechz_wave_variant_chance_threshold", 2000 ); + set_dvar_if_unset( "rm_mixed_preset_wave_mechz_wave_variant_chance_per_spawn_min", 5 ); + set_dvar_if_unset( "rm_mixed_preset_wave_mechz_wave_variant_chance_per_spawn_max", 10 ); +} + +spawning_wave() +{ + level.round_manager_mechz_wave_count++; + scripts\zm\zm_ai_pack\mixed_presets\_wave::spawn_wave( "mechz" ); + time = randomfloatrange( getdvarfloat( "rm_mixed_preset_wave_mechz_wave_variant_min_cooldown" ), getdvarfloat( "rm_mixed_preset_wave_mechz_wave_variant_max_cooldown" ) ); + level.round_manager_guaranteed_mechz_wave_time = gettime() + ( time * level.round_manager_mechz_wave_count ); +} + +spawning_chance() +{ + if ( level.round_number < getdvarint( "rm_mixed_preset_wave_mechz_wave_variant_min_round" ) ) + { + return false; + } + chance_of_wave = 0; + chance_of_wave -= ( level.round_manager_mechz_wave_count * getdvarint( "rm_mixed_preset_wave_mechz_wave_variant_chance_threshold" ) ); + + min = getdvarint( "rm_mixed_preset_wave_mechz_wave_variant_chance_per_spawn_min" ); + max = getdvarint( "rm_mixed_preset_wave_mechz_wave_variant_chance_per_spawn_max" ); + chance_of_wave += ( level.round_manager_spawn_count * randomintrange( min , max ) ); + + should_spawn_wave_random = chance_of_wave >= getdvarint( "rm_mixed_preset_wave_mechz_wave_variant_chance_threshold" ); + time = randomfloatrange( getdvarfloat( "rm_mixed_preset_wave_mechz_wave_variant_min_cooldown" ), getdvarfloat( "rm_mixed_preset_wave_mechz_wave_variant_max_cooldown" ) ); + should_spawn_guaranteed_wave = ( ( level.round_manager_guaranteed_mechz_wave_time + ( time * 1000 ) ) <= getTime() ); + + return should_spawn_wave_random || should_spawn_guaranteed_wave; +} + +spawning_limit() +{ + if ( level.players.size <= 1 ) + { + return getdvarint( "rm_mixed_preset_wave_mechz_wave_variant_spawn_limit_min" ); + } + + spawn_amount = int( level.players.size * 0.5 ) + 1; + max = getdvarint( "rm_mixed_preset_wave_mechz_wave_variant_spawn_limit_max" ); + if ( spawn_amount > max ) + { + spawn_amount = max; + } + return spawn_amount; +} + +spawning_cooldown() +{ + return true; +} + +spawning_round_start() +{ + level.round_manager_guaranteed_mechz_wave_time = level.round_start_time; + level.round_manager_mechz_wave_count = 0; +} \ No newline at end of file diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_normal_wave.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_normal_wave.gsc new file mode 100644 index 0000000..23dbd69 --- /dev/null +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_normal_wave.gsc @@ -0,0 +1,33 @@ +#include maps\mp\zombies\_zm_utility; +#include common_scripts\utility; +#include maps\mp\_utility; + +#include scripts\zm\zm_ai_pack\_utility; + +main() +{ +} + +spawning_wave() +{ + scripts\zm\zm_ai_pack\mixed_presets\_wave::spawn_wave( "normal" ); +} + +spawning_chance() +{ + return true; +} + +spawning_limit() +{ + return int( level.zombie_total * 0.1 ) + 6; +} + +spawning_cooldown() +{ + return true; +} + +spawning_round_start() +{ +} \ No newline at end of file diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_random.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_random.gsc index 8d64598..b3fb5de 100644 --- a/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_random.gsc +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/mixed_variants/_random.gsc @@ -10,18 +10,12 @@ main() 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_mechz_spawn_chance_1000", 10 ); 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" ); diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_mechz.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_mechz.gsc index f8f3208..c186a98 100644 --- a/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_mechz.gsc +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_mechz.gsc @@ -25,7 +25,6 @@ main() round_spawning_common() { - while ( !isdefined( level.zombie_mechz_locations ) ) wait 0.05; @@ -236,13 +235,13 @@ spawn_single_mechz( starting_properties ) { ai = spawn_zombie( level.mechz_spawners[0] ); - 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 ) ) { level.mechz_left_to_spawn--; level.zombie_total--; + ai set_starting_properties_for_ai( starting_properties ); + + ai thread maps\mp\zombies\_zm_ai_mechz::mechz_spawn(); } return ai; diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_mixed.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_mixed.gsc index d7d3446..871631e 100644 --- a/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_mixed.gsc +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_mixed.gsc @@ -14,27 +14,17 @@ round_spawning() /# level endon( "kill_round" ); #/ - - if ( level.intermission ) - 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." ); -#/ - return; - } - - ai_calculate_health( level.round_number ); - - if ( level.round_number < 10 || level.speed_change_max > 0 ) - level thread zombie_speed_up(); while ( true ) { + while ( level.intermission ) + { + wait 1; + } + wait_for_free_ai_slot( ::get_all_ai_count ); spawning_variant = scripts\zm\zm_ai_pack\_round_manager::pick_mixed_round_preset_variant( level.round_manager_spawning_preset.variants ); + level.round_manager_spawning_preset_current_variant = spawning_variant; if ( isdefined( spawning_variant ) ) { if ( getdvarint( "zm_ai_pack_debug" ) > 0 ) @@ -115,6 +105,11 @@ round_max() round_start() { + ai_calculate_health( level.round_number ); + + if ( level.round_number < 10 || level.speed_change_max > 0 ) + level thread zombie_speed_up(); + level.round_manager_spawning_preset = scripts\zm\zm_ai_pack\_round_manager::determine_mixed_round_preset(); level [[ level.round_manager_spawning_preset.start_func ]](); diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_normal.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_normal.gsc index da42545..85e9413 100644 --- a/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_normal.gsc +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_normal.gsc @@ -15,22 +15,6 @@ round_spawning() level endon( "kill_round" ); #/ - if ( level.zombie_spawn_locations.size < 1 ) - { -/# - assertmsg( "No active spawn locations in the zone. Check to see if the zone is active and if it's pointing to spawners." ); -#/ - return; - } - - ai_calculate_health( level.round_number ); - - if ( level.round_number < 10 || level.speed_change_max > 0 ) - level thread zombie_speed_up(); - - mixed_spawns = 0; - old_spawn = undefined; - while ( true ) { while ( get_current_zombie_count() >= level.zombie_ai_limit || level.zombie_total <= 0 || level.intermission ) @@ -123,7 +107,10 @@ round_max() round_start() { - + ai_calculate_health( level.round_number ); + + if ( level.round_number < 10 || level.speed_change_max > 0 ) + level thread zombie_speed_up(); } round_over() @@ -211,9 +198,8 @@ spawn_single_normal_zombie( starting_properties_struct ) { level.zombie_total--; ai thread round_spawn_failsafe(); + ai set_starting_properties_for_ai( starting_properties_struct ); } - - ai scripts\zm\zm_ai_pack\_round_manager::set_starting_properties_for_ai( starting_properties_struct ); return ai; } \ No newline at end of file diff --git a/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_zombie_dog.gsc b/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_zombie_dog.gsc index 45db3ab..ec7dd91 100644 --- a/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_zombie_dog.gsc +++ b/zm_ai_pack/scripts/zm/zm_ai_pack/rounds/_zombie_dog.gsc @@ -165,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 ) @@ -279,7 +279,10 @@ spawn_single_zombie_dog( starting_properties_struct ) } } - ai scripts\zm\zm_ai_pack\_round_manager::set_starting_properties_for_ai( starting_properties_struct ); + if ( isdefined( ai ) ) + { + ai set_starting_properties_for_ai( starting_properties_struct ); + } return ai; } diff --git a/zm_ai_pack/zone_source/mod.zone b/zm_ai_pack/zone_source/mod.zone index 9d82a60..ca47a74 100644 --- a/zm_ai_pack/zone_source/mod.zone +++ b/zm_ai_pack/zone_source/mod.zone @@ -81,11 +81,17 @@ script,scripts/zm/zm_ai_pack/rounds/_timed.gsc script,scripts/zm/zm_ai_pack/rounds/_zombie_dog.gsc script,scripts/zm/zm_ai_pack/mixed_presets/_default.gsc +script,scripts/zm/zm_ai_pack/mixed_presets/_wave.gsc script,scripts/zm/zm_ai_pack/mixed_variants/_dog_wave.gsc +script,scripts/zm/zm_ai_pack/mixed_variants/_mechz_wave.gsc +script,scripts/zm/zm_ai_pack/mixed_variants/_normal_wave.gsc script,scripts/zm/zm_ai_pack/mixed_variants/_random.gsc script,sys.gsc script,pluto_sys.gsc // Map specific scripts -script,scripts/zm/zm_prison/zm_ai_pack_mod_zm_prison_main.gsc \ No newline at end of file +script,scripts/zm/zm_prison/zm_ai_pack_mod_zm_prison_main.gsc +script,scripts/zm/zm_buried/zm_ai_pack_mod_zm_buried_main.gsc +script,scripts/zm/zm_highrise/zm_ai_pack_mod_zm_highrise_main.gsc +script,scripts/zm/zm_transit/zm_ai_pack_mod_zm_transit_main.gsc \ No newline at end of file