@colorz808 and Ox_ I'll gladly share my code, to be totally honest it wan't that hard to make the pack a punch perk I used code from Rezhified credit to him for the pap code here is the code:
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\gametypes_zm\_hud_util;
#include maps\mp\gametypes_zm\_hud_message;
//important include
#include maps\mp\zombies\_zm_powerups;
#include maps\mp\zombies\_zm_weapons;
//making the code seperate for the Pack-A-Punch Power-Up to make it less confusing.
//but they could be merged as I've done before.
//Credits
// to _Ox for the original code, also thanks for the notes it was really helpful.
// and to Rezhified for the pack-a-punch code.
init()
{
level thread onPlayerConnect();
include_zombie_powerup("upgrade_weapon");
add_zombie_powerup("upgrade_weapon", "zombie_teddybear", &"ZOMBIE_POWERUP_UPGRADE_WEAPON", ::func_should_always_drop, 0, 0, 0);
powerup_set_can_pick_up_in_last_stand("upgrade_weapon", 1);
}
/*func_should_drop_past_level()
{
if ( level.round_number < 5 )
{
return 0;
}
return 1;
}*/
onplayerconnect()
{
for(;;)
{
level waittill("connected", player);
player thread onPlayerSpawned();
}
}
onplayerspawned()
{
self endon("disconnect");
level endon("game_ended");
for(;;)
{
self waittill("spawned_player");
if(self isHost() && !isDefined(level.custom_powerup_first_spawn))
{
wait 2;
//store the original custom powerup grab function,
//if one exists (Origins, Buried, Grief & Turned)
//note that this is not intended for Grief or Turned
//I have no idea what will happen, probably pretty broken
if(isDefined(level._zombiemode_powerup_grab))
level.original_zombiemode_powerup_grab = level._zombiemode_powerup_grab;
//delayed defining of the custom function so we're sure to
//override the function Origins and Buried defines for this
level._zombiemode_powerup_grab = ::custom_powerup_grab;
//message for the host to indicate that it should be all good
wait 2;
self iprintlnbold("^7Custom Powerup Loaded!");
//gives host the ability to test the powerup at the start of the game
//can be used to make sure it's actually working and all good
//remove the line directly below to disable
self thread test_the_powerup();
//whatever so this variable isn't undefined anymore
level.custom_powerup_first_spawn = "fortnite!fortnite!!";
}
}
}
test_the_powerup()
{
self endon("death");
self endon("disconnected");
self endon("testing_chance_ended");
level endon("game_ended");
wait 3;
self iprintlnbold("^7Press ^1[{+smoke}] ^7to test, you have ^15 seconds^7.");
self thread testing_duration_timeout();
for(;;)
{
if(self secondaryoffhandbuttonpressed())
{
level specific_powerup_drop("upgrade_weapon", self.origin + VectorScale(AnglesToForward(self.angles), 70));
return;
}
wait .05;
}
}
testing_duration_timeout()
{
self endon("death");
self endon("disconnected");
wait 5;
self notify("testing_chance_ended");
}
//fires when we grab any custom powerup
custom_powerup_grab(s_powerup, e_player)
{
if (s_powerup.powerup_name == "upgrade_weapon")
level thread upgrade_weapon_powerup();
//pass args onto the original custom powerup grab function
else if (isDefined(level.original_zombiemode_powerup_grab))
level thread [[level.original_zombiemode_powerup_grab]](s_powerup, e_player);
}
upgrade_weapon_powerup()
{
foreach(player in level.players)
{
//if powerup is already on, turn it off
//player notify("end_unlimited_ammo");
//small cha ching sound for each player when someone picks up the powerup
//cba'd to come up with anything better and don't have a list of sounds,
//change to w/e if you want.
player playsound("zmb_cha_ching");
player thread upgrade_players_weapon();
//player thread turn_on_unlimited_ammo();
//player thread unlimited_ammo_on_hud();
//player thread notify_unlimited_ammo_end();
}
}
//Rezhified pack-a-punch code. Rezhified.#3039 on discord. [Link To His Source](https://cabconmodding.com/threads/black-ops-2-gsc-managed-code-list.158/post-43365)
upgrade_players_weapon()
{
level endon("game_ended");
self endon("disonnect");
baseweapon = get_base_name(self getcurrentweapon());
weapon = get_upgrade(baseweapon);
if(IsDefined(weapon))
{
self takeweapon(baseweapon);
self giveweapon(weapon, 0, self get_pack_a_punch_weapon_options(weapon));
self switchtoweapon(weapon);
self givemaxammo(weapon);
}
}
get_upgrade(weapon)
{
if(IsDefined(level.zombie_weapons[weapon].upgrade_name) && IsDefined(level.zombie_weapons[weapon]))
return get_upgrade_weapon(weapon, 0 );
else
return get_upgrade_weapon(weapon, 1 );
}
/*Un-Pack-a-Punches current weapon
DowngradeWeapon()
{
baseweapon = self getcurrentweapon();
weapon = get_base_weapon_name(baseweapon, 1);
if( IsDefined(weapon))
{
self takeweapon(baseweapon);
self giveweapon(weapon, 0, self get_pack_a_punch_weapon_options(weapon));
self switchtoweapon(weapon);
self givemaxammo(weapon);
}
}*/
I was trying to figure out how to put something in to stop the perk from being spawned in at low rounds but couldn't figure it out. Maybe someone could figure it out. Thanks again Ox_ for making your code public, your an amazing coder. Would love to see this being used in servers especially if a round limiter is implemented.
Well looks like I left the func_should_drop_past_level() function in by mistake it should work now, but will always drop sorry about that.