From da1a729ecaba14d59483e99a2a30d920601d096a Mon Sep 17 00:00:00 2001 From: Jbleezy Date: Mon, 17 Apr 2023 19:58:39 -0700 Subject: [PATCH] EMP Grenade: zombies that are in the ground can no longer get EMP'd --- README.md | 1 + scripts/zm/replaced/_zm_weap_emp_bomb.gsc | 39 ++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f6b22ba..e6d1009d 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,7 @@ * Decreased zombie EMP radius by 30% (same radius as perk EMP) * Can destroy deployed Zombie Shields * Sprinting no longer wakes up EMP'd zombies +* Zombies that are in the ground can no longer get EMP'd ### Hell's Retriever * No longer ricochets to other zombies when not charged diff --git a/scripts/zm/replaced/_zm_weap_emp_bomb.gsc b/scripts/zm/replaced/_zm_weap_emp_bomb.gsc index 2be32648..23de34c0 100644 --- a/scripts/zm/replaced/_zm_weap_emp_bomb.gsc +++ b/scripts/zm/replaced/_zm_weap_emp_bomb.gsc @@ -24,7 +24,7 @@ emp_detonate(grenade) } level notify( "emp_detonate", origin, emp_radius ); - self thread maps\mp\zombies\_zm_weap_emp_bomb::emp_detonate_zombies( grenade_origin, grenade_owner ); + self thread emp_detonate_zombies( grenade_origin, grenade_owner ); if ( isDefined( level.custom_emp_detonate ) ) { @@ -44,6 +44,43 @@ emp_detonate(grenade) maps\mp\zombies\_zm_power::revert_power_to_list( 1, origin, emp_radius, disabled_list ); } +emp_detonate_zombies( grenade_origin, grenade_owner ) +{ + zombies = get_array_of_closest( grenade_origin, getaispeciesarray( level.zombie_team, "all" ), undefined, undefined, level.zombie_vars["emp_stun_range"] ); + + if ( !isdefined( zombies ) ) + return; + + for ( i = 0; i < zombies.size; i++ ) + { + if ( !isdefined( zombies[i] ) || isdefined( zombies[i].ignore_inert ) && zombies[i].ignore_inert ) + continue; + + if ( is_true( zombies[i].in_the_ground ) ) + continue; + + zombies[i].becoming_inert = 1; + } + + stunned = 0; + + for ( i = 0; i < zombies.size; i++ ) + { + if ( !isdefined( zombies[i] ) || isdefined( zombies[i].ignore_inert ) && zombies[i].ignore_inert ) + continue; + + if ( is_true( zombies[i].in_the_ground ) ) + continue; + + stunned++; + zombies[i] thread stun_zombie(); + wait 0.05; + } + + if ( stunned >= 10 && isdefined( grenade_owner ) ) + grenade_owner notify( "the_lights_of_their_eyes" ); +} + destroyequipment( origin, radius ) { grenades = getentarray( "grenade", "classname" );