Perk Functions Explained
This script adds custom abilities to four base BO2 Zombies perks.
Here is what each perk function does:
- Speed Cola β Power-Up Magnet + Hidden Perks
When the player has Speed Cola (specialty_fastreload), the script grants two extra hidden perks:
- Fast Weapon Switch(
specialty_fastweaponswitch)
- Fast Grenade Toss (
specialty_fasttoss)
Additionally, the player can pull power-ups toward themselves by pressing the melee button.
How it works:
- Every time the player presses melee, the script checks for nearby power-ups.
- Any power-up within 1500 units moves toward the player over 0.3 seconds.
- There's a 1-second cooldown between pulls.
- PhD Flopper β Automatic Grenade Regeneration
When the player has PhD Flopper (specialty_flakjacket), they receive:
- A guaranteed frag grenade loadout
- Automatic regeneration of grenades over time
How it works:
- The script keeps track of the lethal grenade type the player has.
- Every 30 seconds, if the player has less than 4 grenades, they gain +1 grenade.
- Works with both frag and semtex (sticky).
- Quick Revive β Double Jump / Multi-Jump
When the player has Quick Revive (specialty_quickrevive), they gain the ability to double jump.
How it works:
-
The script listens for the jump button press.
-
The player has 2 extra jumps stored.
-
Each jump adds upward velocity:
self SetVelocity(self GetVelocity() + (0,0,300));
-
The jump charges reset automatically every 1.8 seconds.
This creates smooth, BO3-style multi-jump movement.
- Double Tap β Cashback (Bonus Points System)
After the player has had Double Tap active for a few seconds, they enable the Cash Back effect.
How it works:
- The script monitors the playerβs score in real time.
- Whenever the player earns points, they get 50% extra points on top.
- Example: earning 100 points gives +50 bonus points.
- Only works while the player has Double Tap (
specialty_rof).
:
#include maps\mp\_utility;
#include maps\mp\zombies\_zm_utility;
#include common_scripts\utility;
#include maps\mp\gametypes_zm\_hud_util;
#include maps\mp\gametypes_zm\_hud_message;
#include maps\mp\gametypes_zm\_zm_powerups;
#include maps\mp\zombies\_zm_weapons;
init()
{
level thread onPlayerConnect();
level thread monitorPoints();
}
onPlayerConnect()
{
for (;;)
{
level waittill("connected", player);
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self endon("disconnect");
level endon("game_ended");
for (;;)
{
self waittill("spawned_player");
wait 2;
self thread speedcola();
self thread phdflopper();
self thread quickrevive();
self thread doubletap();
}
}
// -----------------------------
// 1. SPEED COLA - Magnetic Powerup
// -----------------------------
speedcola()
{
self endon("disconnect");
self.lastPullTime = 0;
for (;;)
{
if (self HasPerk("specialty_fastreload"))
{
if (!(self HasPerk("specialty_fastweaponswitch")))
{
self SetPerk("specialty_fastweaponswitch");
self notify("perk_acquired", "specialty_fastweaponswitch");
}
if (!(self HasPerk("specialty_fasttoss")))
{
self SetPerk("specialty_fasttoss");
self notify("perk_acquired", "specialty_fasttoss");
}
}
else
{
if (self HasPerk("specialty_fastweaponswitch"))
self UnsetPerk("specialty_fastweaponswitch");
if (self HasPerk("specialty_fasttoss"))
self UnsetPerk("specialty_fasttoss");
}
if (getTime() - self.lastPullTime > 1000)
{
if (self meleeButtonPressed())
{
if (!self HasPerk("specialty_fastreload"))
{
wait 0.3;
continue;
}
hasPulled = false;
foreach (powerup in level.active_powerups)
{
if (!isdefined(powerup)) continue;
if (distance(self.origin, powerup.origin) <= 1500)
{
powerup moveto(self.origin, 0.3);
hasPulled = true;
}
}
if (hasPulled)
{
self.lastPullTime = getTime();
}
}
}
wait 0.05;
}
}
// -----------------------------
// 2. PHD FLOPPER - Regen de Granadas
// -----------------------------
phdflopper()
{
self endon("disconnect");
self takeweapon("frag_grenade_zm");
self takeweapon("sticky_grenade_zm");
self giveweapon("frag_grenade_zm");
self set_player_lethal_grenade("frag_grenade_zm");
self setweaponammoclip("frag_grenade_zm", 4);
if (!isdefined(self.lethal_loop_started))
{
self.lethal_loop_started = true;
self thread lethal_grenade_loop();
}
}
lethal_grenade_loop()
{
self endon("disconnect");
for (;;)
{
wait(1);
if (!self hasperk("specialty_flakjacket"))
continue;
if (self hasweapon("sticky_grenade_zm"))
self.lethal_type = "sticky_grenade_zm";
else if (self hasweapon("frag_grenade_zm"))
self.lethal_type = "frag_grenade_zm";
else
continue;
wait(30);
if (self hasweapon(self.lethal_type))
{
ammo = self getweaponammoclip(self.lethal_type);
if (ammo < 4)
{
self setweaponammoclip(self.lethal_type, ammo + 1);
}
}
}
}
// -----------------------------
// 3. QUICK REVIVE - Multiple jumps
// -----------------------------
quickrevive()
{
self endon("disconnect");
self notifyOnPlayerCommand("jump_button_pressed", "+gostand");
self.jumps_left = 2;
self thread reset_pulo_timer();
for(;;)
{
self waittill("jump_button_pressed");
if(self HasPerk("specialty_quickrevive"))
{
if(self.jumps_left > 0)
{
self SetVelocity(self GetVelocity() + (0, 0, 300));
self.jumps_left--;
}
}
}
}
reset_pulo_timer()
{
self endon("disconnect");
for(;;)
{
wait 1.8; // time to reset
self.jumps_left = 2;
}
}
// -----------------------------
// 4. DOUBLE TAP - Cash Back
// -----------------------------
doubletap()
{
{
self endon("disconnect");
wait 7.5;
self.hasHalfDouble = true;
}
}
monitorPoints()
{
for(;;)
{
foreach(player in level.players)
{
if (!isDefined(player.old_score))
player.old_score = player.score;
if (isDefined(player.hasHalfDouble) && player.hasHalfDouble && player HasPerk("specialty_rof"))
{
diff = player.score - player.old_score;
if (diff > 0)
{
bonus = int(diff * 0.5);
player.score += bonus;
}
}
player.old_score = player.score;
}
wait 0.2;
}
}