From f62e0b0645066a7ddeb40a34ddc3380b623f7b66 Mon Sep 17 00:00:00 2001 From: Jbleezy Date: Tue, 2 May 2023 13:59:42 -0700 Subject: [PATCH] Buried: ghosts no longer spawn and go after players not in the Mansion during a ghost round --- README.md | 1 + scripts/zm/replaced/_zm_ai_ghost.gsc | 79 +++++++++++++++++++ scripts/zm/zm_buried/zm_buried_reimagined.gsc | 1 + 3 files changed, 81 insertions(+) diff --git a/README.md b/README.md index 1150fb49..b39b3564 100644 --- a/README.md +++ b/README.md @@ -673,6 +673,7 @@ * Drawing weapons no longer gives points * Arthur barricades are buyable debris * Arthur can be purchased to feed him candy and make him run around and kill zombies for 30 seconds +* Ghosts no longer spawn and go after players not in the Mansion during a ghost round * Ghosts no longer drop free perk powerup if any player gets damaged by the ghosts * Fountain portal automatically active * Players no longer take fall damage after using the fountain teleporter diff --git a/scripts/zm/replaced/_zm_ai_ghost.gsc b/scripts/zm/replaced/_zm_ai_ghost.gsc index c60e04ef..6967aee0 100644 --- a/scripts/zm/replaced/_zm_ai_ghost.gsc +++ b/scripts/zm/replaced/_zm_ai_ghost.gsc @@ -14,6 +14,85 @@ #include maps\mp\zombies\_zm_powerups; #include maps\mp\zombies\_zm_ai_basic; +ghost_zone_spawning_think() +{ + level endon( "intermission" ); + + if ( isdefined( level.intermission ) && level.intermission ) + return; + + if ( !isdefined( level.female_ghost_spawner ) ) + { + return; + } + + while ( true ) + { + if ( level.zombie_ghost_count >= level.zombie_ai_limit_ghost ) + { + wait 0.1; + continue; + } + + valid_player_count = 0; + valid_players = []; + + while ( valid_player_count < 1 ) + { + players = getplayers(); + valid_player_count = 0; + + foreach ( player in players ) + { + if ( is_player_valid( player ) && !is_player_fully_claimed( player ) ) + { + if ( isdefined( player.is_in_ghost_zone ) && player.is_in_ghost_zone ) + { + valid_player_count++; + valid_players[valid_players.size] = player; + } + } + } + + wait 0.1; + } + + valid_players = array_randomize( valid_players ); + spawn_point = get_best_spawn_point( valid_players[0] ); + + if ( !isdefined( spawn_point ) ) + { + wait 0.1; + continue; + } + + ghost_ai = undefined; + + if ( isdefined( level.female_ghost_spawner ) ) + ghost_ai = spawn_zombie( level.female_ghost_spawner, level.female_ghost_spawner.targetname, spawn_point ); + else + { + return; + } + + if ( isdefined( ghost_ai ) ) + { + ghost_ai setclientfield( "ghost_fx", 3 ); + ghost_ai.spawn_point = spawn_point; + ghost_ai.is_ghost = 1; + ghost_ai.is_spawned_in_ghost_zone = 1; + ghost_ai.find_target = 1; + level.zombie_ghost_count++; + } + else + { + return; + } + + wait 0.1; + } +} + should_last_ghost_drop_powerup() { if ( flag( "time_bomb_restore_active" ) ) diff --git a/scripts/zm/zm_buried/zm_buried_reimagined.gsc b/scripts/zm/zm_buried/zm_buried_reimagined.gsc index cc32259b..e921bc07 100644 --- a/scripts/zm/zm_buried/zm_buried_reimagined.gsc +++ b/scripts/zm/zm_buried/zm_buried_reimagined.gsc @@ -46,6 +46,7 @@ main() replaceFunc(maps\mp\zm_buried_sq_ip::init, scripts\zm\replaced\zm_buried_sq_ip::init); replaceFunc(maps\mp\zm_buried_sq_ows::ows_targets_start, scripts\zm\replaced\zm_buried_sq_ows::ows_targets_start); replaceFunc(maps\mp\zm_buried_distance_tracking::delete_zombie_noone_looking, scripts\zm\replaced\zm_buried_distance_tracking::delete_zombie_noone_looking); + replaceFunc(maps\mp\zombies\_zm_ai_ghost::ghost_zone_spawning_think, scripts\zm\replaced\_zm_ai_ghost::ghost_zone_spawning_think); replaceFunc(maps\mp\zombies\_zm_ai_ghost::should_last_ghost_drop_powerup, scripts\zm\replaced\_zm_ai_ghost::should_last_ghost_drop_powerup); replaceFunc(maps\mp\zombies\_zm_ai_sloth::sloth_init_start_funcs, scripts\zm\replaced\_zm_ai_sloth::sloth_init_start_funcs); replaceFunc(maps\mp\zombies\_zm_ai_sloth::sloth_init_update_funcs, scripts\zm\replaced\_zm_ai_sloth::sloth_init_update_funcs);