Add support for leapers. Add mechz to zm_highrise.

Patch multiple level.zombie_total++ occurences to fix interactions with boss zombies not incrementing their zombie total.
This commit is contained in:
JezuzLizard
2024-02-20 22:14:48 -08:00
parent 963e62d02d
commit 3eff80fcf3
14 changed files with 1796 additions and 3 deletions

View File

@ -1,6 +1,7 @@
#include maps\mp\zombies\_zm_utility;
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\zombies\_zm_spawner;
#include maps\mp\zombies\_zm_ai_avogadro;
#include maps\mp\zombies\_zm_ai_screecher;
@ -18,7 +19,7 @@ main()
replace_single_function( "maps/mp/zombies/_zm_weap_slowgun", "can_be_paralyzed", ::can_be_paralyzed_override );
replace_single_function( "maps/mp/zombies/_zm_ai_sloth", "watch_crash_trigger", ::watch_crash_trigger_override );
level.script = toLower( getDvar( "mapname" ) );
level.gametype = toLower( getDvar( "g_gametype" ) );
@ -73,6 +74,45 @@ init()
level [[ level.ai_data[ keys[ i ] ].init ]]();
}
}
level thread add_spawn_functions_to_spawners();
}
watch_for_damage_from_players()
{
self endon( "death" );
for (;;)
{
self waittill( "damage", amount, attacker, direction_vec, point, type );
if ( !isdefined( amount ) )
continue;
if ( !isalive( self ) || self.delayeddeath )
return;
if ( !player_attacker( attacker ) )
continue;
self.has_been_damaged_by_player = true;
if ( is_true( self.is_ghost ) )
{
continue;
}
self player_attacks_enemy( attacker, amount, type, point );
}
}
add_spawn_functions_to_spawners()
{
flag_wait( "initial_blackscreen_passed" );
if ( isDefined( level.ghost_spawners ) )
{
array_thread( level.ghost_spawners, ::add_spawn_function, ::watch_for_damage_from_players );
}
}
add_visionset_callback( func )
@ -329,4 +369,30 @@ check_solo_status()
{
level.is_forever_solo_game = 0;
}
}
increment_enemy_count( who )
{
if ( !is_true( who.has_been_damaged_by_player ) )
{
return;
}
if ( is_true( who.is_leaper ) )
{
who thread [maps\mp\zombies\_zm_ai_leaper::leaper_cleanup]();
}
else if ( is_true( who.is_mechz ) )
{
level.mechz_left_to_spawn++;
}
else if ( is_true( who.is_brutus ) )
{
level.brutus_count++;
}
//Maybe add dog increment here when possible
else
{
level.zombie_total++;
}
}

View File

@ -0,0 +1,33 @@
#include maps\mp\zombies\_zm_utility;
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\zm_buried_classic;
#include scripts\zm\zm_ai_pack_mod_main;
main()
{
}
squashed_death_init( kill_if_falling )
{
while ( true )
{
self waittill( "trigger", who );
if ( !( isdefined( who.insta_killed ) && who.insta_killed ) )
{
if ( isplayer( who ) )
who thread insta_kill_player( 1, kill_if_falling );
else if ( isai( who ) )
{
who dodamage( who.health + 100, who.origin );
who.insta_killed = 1;
increment_enemy_count( who );
}
}
}
}

View File

@ -0,0 +1,85 @@
#include maps\mp\zombies\_zm_utility;
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\zm_highrise_classic;
#include scripts\zm\zm_ai_pack_mod_main;
main()
{
replaceFunc( maps\mp\zm_highrise_classic::squashed_death_init, ::squashed_death_init_override );
replaceFunc( maps\mp\zm_highrise::elevator_traverse_watcher, ::elevator_traverse_watcher_override );
}
squashed_death_init_override( kill_if_falling )
{
while ( true )
{
self waittill( "trigger", who );
if ( !is_true( who.insta_killed ) )
{
continue;
}
if ( isplayer( who ) )
{
who thread elevator_black_screen_squash_check();
who thread insta_kill_player( 1, kill_if_falling );
}
else if ( isai( who ) )
{
if ( is_true( who.in_the_ceiling ) )
{
continue;
}
if ( is_true( who.is_avogadro ) )
{
continue;
}
who dodamage( who.health + 100, who.origin );
who.insta_killed = 1;
increment_enemy_count( who );
}
}
}
elevator_traverse_watcher_override()
{
self endon( "death" );
while ( true )
{
wait 0.2;
if ( !is_true( self.is_traversing ) )
{
continue;
}
self.elevator_parent = undefined;
if ( !is_true( self maps\mp\zm_highrise_elevators::object_is_on_elevator() ) )
{
continue;
}
if ( !isdefined( self.elevator_parent ) )
{
continue;
}
if ( !is_true( self.elevator_parent.is_moving ) )
{
continue;
}
playfx( level._effect["zomb_gib"], self.origin );
increment_enemy_count( self );
self delete();
return;
}
}

View File

@ -0,0 +1,47 @@
#include maps\mp\zombies\_zm_utility;
#include common_scripts\utility;
#include maps\mp\_utility;
main()
{
replaceFunc( maps\mp\zm_transit_power::killzombiesinpowerstation, ::killzombiesinpowerstation_override );
}
killzombiesinpowerstation_override()
{
level endon( "power_on" );
radiussq = 122500;
while ( true )
{
zombies = getaiarray( level.zombie_team );
foreach ( zombie in zombies )
{
if ( !isdefined( zombie ) )
continue;
if ( isdefined( zombie.is_avogadro ) && zombie.is_avogadro )
continue;
if ( is_true( zombie.is_boss ) )
{
continue;
}
if ( distancesquared( ( 11344, 7590, -729 ), zombie.origin ) < radiussq )
continue;
if ( isdefined( zombie ) && zombie maps\mp\zombies\_zm_zonemgr::entity_in_zone( "zone_prr", 1 ) || isdefined( zombie.zone_name ) && zombie.zone_name == "zone_prr" )
{
if ( !( isdefined( zombie.has_been_damaged_by_player ) && zombie.has_been_damaged_by_player ) )
level.zombie_total++;
zombie dodamage( zombie.health + 100, zombie.origin );
wait( randomfloatrange( 0.05, 0.15 ) );
}
}
wait 1;
}
}