Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Releases & Resources
  3. [Release] [GSC] Zombies Custom Powerup | Unlimited Ammo

[Release] [GSC] Zombies Custom Powerup | Unlimited Ammo

Scheduled Pinned Locked Moved BO2 Modding Releases & Resources
44 Posts 18 Posters 11.9k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Ox_undefined Ox_

    JezuzLizard said in [GSC] Zombies Custom Powerup | Unlimited Ammo:

    Ox_ Plutonium is a custom bo2 client that supports 8 player dedicated zombie servers on all maps. It doesn't support GSC injection and instead uses its own modloader similar to Redacted so dedicated servers can load custom GSC mods. The GSC modloader feature is relatively new so it seems to have some interesting behavior sometimes. Eg. your old code not working but your new code does for some reason that I'll look into at some point.

    I recommend you try Plutonium sometime since it has a more active playerbase than steam bo2, you can actually find games for all maps usually.

    Also, I used your mod as a base to add a few extra powerups in the game files as drops like, the bonus team points, perk bottle, and random weapon. So thanks for the new version again.

    Last thing, is it possible for a world at war nacht der untoten style powerup display for the infinite ammo powerup? I think it would it say Infinite Ammo: 20 and tick down from 20 at the bottom of the screen.

    Yeah I know what Plutonium is/does, just didn't know what quirks are related to hosting a server and loading custom gsc, thanks.
    And about the old code not working, which map did you try? the old code didn't work in Buried & Origins, as described in the Original post. The delayed registering of the custom powerup pickup function fixed that.

    And cool that you added some stuff, maybe post it here if you want to share. Some other people might want to use them as well. Maybe I would use it as well next time I play zombies with my friends.

    And about having a countdown or whatever to indicate when the powerup ends.
    It most certainly is possible, but really cba right now at least. Already spend a few hrs trying to get the native style powerup hud to work via clientfields (as is done in the original game gsc), but every time I just errored out with client field mismatch error, and I have no idea why. So I lost motivation.

    The reason why I didn't at the very first go for drawing text on the screen, is because I don't remember from on top of my head how to draw 100% safe text. Been years and years since I properly did gsc (good old Xbox 360 RGH days). Would be super pissed if the game crashed due to an overflow on like round 40 or whatever.
    I guess like an iprintln would be safe to use. Looks maybe quite stupid though.
    If you want an iprintln solution, and don't know how to make it yourself, I can make it for you.

    JezuzLizardundefined Offline
    JezuzLizardundefined Offline
    JezuzLizard
    Plutonium Staff
    wrote on last edited by JezuzLizard
    #23

    Ox_ I got around to making a simple waw style timer:

    #include maps\mp\_utility;
    #include common_scripts\utility;
    #include maps\mp\gametypes_zm\_hud_util;
    #include maps\mp\gametypes_zm\_hud_message;
    #include maps\mp\zombies\_zm_powerups;
    #include maps\mp\zombies\_zm_utility;
    
    //credit goes to _Ox for the original code
    init()
    {
    	level thread onPlayerConnect();
    	//include and init the powerup
    	include_zombie_powerup("unlimited_ammo");
    	add_zombie_powerup("unlimited_ammo", "T6_WPN_AR_GALIL_WORLD", &"ZOMBIE_POWERUP_UNLIMITED_AMMO", ::func_should_always_drop, 0, 0, 0);
    	powerup_set_can_pick_up_in_last_stand("unlimited_ammo", 1);
            initializeUnlimitedAmmo();
    }
    
    onPlayerConnect()
    {
    	for(;;)
    	{
    		level waittill("connected", player);
    		player thread onPlayerSpawned();
    	}
    }
    
    onPlayerSpawned()
    {
    	self endon("disconnect");
    	level endon("game_ended");
    	for(;;)
    	{
    		self waittill("spawned_player");
    		
    		if(!isDefined(level.unlimited_ammo_first_spawn))
    		{
    			wait 2;
    			//delayed defining of the custom function so we're sure to
    			//override the function Origins defines for this
    			level._zombiemode_powerup_grab = ::custom_powerup_grab;
    				
    			//message for the host to indicate that it should be all good
    			self iprintln("^6Unlimited Ammo Custom Powerup Loaded"); 
    				
    			//spawns the unlimited ammo powerup in front of the host at the very start of the game
    			//can be used to make sure it's actually working and all good
    			//remove the line directly below to disable
    			//level specific_powerup_drop("unlimited_ammo", self.origin + VectorScale(AnglesToForward(self.angles), 70));
    			level.unlimited_ammo_first_spawn = "fortnite!fortnite!!";
    		}	
    	}
    }
    
    initializeUnlimitedAmmo()
    {
          level.unlimited_ammo_active = false; //initializes that the powerup is off for the timer
          level.unlimited_ammo_duration = 20; //initializes the timer duration var change this to affect the duration
    }
    
    //fires when we grab any custom powerup
    custom_powerup_grab(s_powerup, e_player)
    {
    	if (s_powerup.powerup_name == "unlimited_ammo")
    		level thread unlimited_ammo_powerup(s_powerup, e_player);
    }
    
    unlimited_ammo_powerup(m_powerup, e_player)
    {
    	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 notify_unlimited_ammo_end();
    		player thread turn_on_unlimited_ammo();
    		player thread unlimited_ammo_timer();
    	}
    }
    
    turn_on_unlimited_ammo()
    {
    	level endon("game_ended");
    	self endon("disconnect");
    	self endon("end_unlimited_ammo");
    	for(;;)
    	{
    		//simply set the current mag to be full on a loop
    		self setWeaponAmmoClip(self GetCurrentWeapon(), 150);
    		wait .02;
    	}
    }
    
    notify_unlimited_ammo_end()
    {
    	level endon("game_ended");
    	self endon("disconnect");
    	self endon("end_unlimited_ammo");
    	level.unlimited_ammo_duration = 20; //this sets the duration for the unlimited_ammo_timer() modify this when modifying the wait
    	wait 20; //directly changes the duration of the powerup
    	self notify("end_unlimited_ammo");
    }
    
    unlimited_ammo_timer()
    {   
    	level endon("game_ended");
    	self endon("disconnect");
    	if ( level.unlimited_ammo_active == true )//checks whether the powerup is already active and returns so no dupe countdown
    	{
    		return;
    	}
    	level.unlimited_ammo_active = true; //sets that the powerup is active
    	
    	Remaining = create_simple_hud();
      	Remaining.horzAlign = "center";
      	Remaining.vertAlign = "middle";
       	Remaining.alignX = "Left";
       	Remaining.alignY = "middle";
       	Remaining.y = 180; //- is top 0 is middle + is bottom
       	Remaining.x = 85; //- is left 0 is middle + is right
       	Remaining.foreground = 1;
       	Remaining.fontscale = 3.0;
       	Remaining.alpha = 1;
       	Remaining.color = ( 0.423, 0.004, 0 );
    
    
       	UnlimitedAmmo = create_simple_hud();
       	UnlimitedAmmo.horzAlign = "center"; //valid inputs: center, top, bottom, left, right, top_right, top_left, topcenter, bottom_right, bottom_left
       	UnlimitedAmmo.vertAlign = "middle";
       	UnlimitedAmmo.alignX = "center";
       	UnlimitedAmmo.alignY = "middle";
       	UnlimitedAmmo.y = 180; //- is top 0 is middle + is bottom
       	UnlimitedAmmo.x = -1; //- is left 0 is middle + is right
       	UnlimitedAmmo.foreground = 1;
       	UnlimitedAmmo.fontscale = 3.0;
       	UnlimitedAmmo.alpha = 1; //transparency
       	UnlimitedAmmo.color = ( 0.423, 0.004, 0 );
       	UnlimitedAmmo SetText("Unlimited Ammo: ");
      
    	while( 1 )
    	{
    		Remaining SetValue( level.unlimited_ammo_duration ); //this is necessary so the timer will reset on the chance that 2 unlimited ammo drops drop at once
    		wait 1;
    		level.unlimited_ammo_duration--;
    		if ( level.unlimited_ammo_duration <= 0 )
    		{
    			UnlimitedAmmo.alpha = 0; //these 2 variables make the text invisible instead of destroying it to avoid the string overflow
    			Remaining.alpha = 0;
    			level.unlimited_ammo_active = false; //sets this to false in order to allow the timer to start again
    			break;
    		}
    	}
    }
    

    Basically instead of destroy() I just turn it transparent so it avoids creating too many strings over time or any for that matter beyond one. Obviously this isn't future proofed so if more custom powerups are added it will be awkward to have them all stack using this method.

    edit: I will post the other powerups I teased in a previous post in its own topic when I get them working correctly on all maps.

    Ox_undefined 2 Replies Last reply
    0
    • JezuzLizardundefined JezuzLizard

      Ox_ I got around to making a simple waw style timer:

      #include maps\mp\_utility;
      #include common_scripts\utility;
      #include maps\mp\gametypes_zm\_hud_util;
      #include maps\mp\gametypes_zm\_hud_message;
      #include maps\mp\zombies\_zm_powerups;
      #include maps\mp\zombies\_zm_utility;
      
      //credit goes to _Ox for the original code
      init()
      {
      	level thread onPlayerConnect();
      	//include and init the powerup
      	include_zombie_powerup("unlimited_ammo");
      	add_zombie_powerup("unlimited_ammo", "T6_WPN_AR_GALIL_WORLD", &"ZOMBIE_POWERUP_UNLIMITED_AMMO", ::func_should_always_drop, 0, 0, 0);
      	powerup_set_can_pick_up_in_last_stand("unlimited_ammo", 1);
              initializeUnlimitedAmmo();
      }
      
      onPlayerConnect()
      {
      	for(;;)
      	{
      		level waittill("connected", player);
      		player thread onPlayerSpawned();
      	}
      }
      
      onPlayerSpawned()
      {
      	self endon("disconnect");
      	level endon("game_ended");
      	for(;;)
      	{
      		self waittill("spawned_player");
      		
      		if(!isDefined(level.unlimited_ammo_first_spawn))
      		{
      			wait 2;
      			//delayed defining of the custom function so we're sure to
      			//override the function Origins defines for this
      			level._zombiemode_powerup_grab = ::custom_powerup_grab;
      				
      			//message for the host to indicate that it should be all good
      			self iprintln("^6Unlimited Ammo Custom Powerup Loaded"); 
      				
      			//spawns the unlimited ammo powerup in front of the host at the very start of the game
      			//can be used to make sure it's actually working and all good
      			//remove the line directly below to disable
      			//level specific_powerup_drop("unlimited_ammo", self.origin + VectorScale(AnglesToForward(self.angles), 70));
      			level.unlimited_ammo_first_spawn = "fortnite!fortnite!!";
      		}	
      	}
      }
      
      initializeUnlimitedAmmo()
      {
            level.unlimited_ammo_active = false; //initializes that the powerup is off for the timer
            level.unlimited_ammo_duration = 20; //initializes the timer duration var change this to affect the duration
      }
      
      //fires when we grab any custom powerup
      custom_powerup_grab(s_powerup, e_player)
      {
      	if (s_powerup.powerup_name == "unlimited_ammo")
      		level thread unlimited_ammo_powerup(s_powerup, e_player);
      }
      
      unlimited_ammo_powerup(m_powerup, e_player)
      {
      	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 notify_unlimited_ammo_end();
      		player thread turn_on_unlimited_ammo();
      		player thread unlimited_ammo_timer();
      	}
      }
      
      turn_on_unlimited_ammo()
      {
      	level endon("game_ended");
      	self endon("disconnect");
      	self endon("end_unlimited_ammo");
      	for(;;)
      	{
      		//simply set the current mag to be full on a loop
      		self setWeaponAmmoClip(self GetCurrentWeapon(), 150);
      		wait .02;
      	}
      }
      
      notify_unlimited_ammo_end()
      {
      	level endon("game_ended");
      	self endon("disconnect");
      	self endon("end_unlimited_ammo");
      	level.unlimited_ammo_duration = 20; //this sets the duration for the unlimited_ammo_timer() modify this when modifying the wait
      	wait 20; //directly changes the duration of the powerup
      	self notify("end_unlimited_ammo");
      }
      
      unlimited_ammo_timer()
      {   
      	level endon("game_ended");
      	self endon("disconnect");
      	if ( level.unlimited_ammo_active == true )//checks whether the powerup is already active and returns so no dupe countdown
      	{
      		return;
      	}
      	level.unlimited_ammo_active = true; //sets that the powerup is active
      	
      	Remaining = create_simple_hud();
        	Remaining.horzAlign = "center";
        	Remaining.vertAlign = "middle";
         	Remaining.alignX = "Left";
         	Remaining.alignY = "middle";
         	Remaining.y = 180; //- is top 0 is middle + is bottom
         	Remaining.x = 85; //- is left 0 is middle + is right
         	Remaining.foreground = 1;
         	Remaining.fontscale = 3.0;
         	Remaining.alpha = 1;
         	Remaining.color = ( 0.423, 0.004, 0 );
      
      
         	UnlimitedAmmo = create_simple_hud();
         	UnlimitedAmmo.horzAlign = "center"; //valid inputs: center, top, bottom, left, right, top_right, top_left, topcenter, bottom_right, bottom_left
         	UnlimitedAmmo.vertAlign = "middle";
         	UnlimitedAmmo.alignX = "center";
         	UnlimitedAmmo.alignY = "middle";
         	UnlimitedAmmo.y = 180; //- is top 0 is middle + is bottom
         	UnlimitedAmmo.x = -1; //- is left 0 is middle + is right
         	UnlimitedAmmo.foreground = 1;
         	UnlimitedAmmo.fontscale = 3.0;
         	UnlimitedAmmo.alpha = 1; //transparency
         	UnlimitedAmmo.color = ( 0.423, 0.004, 0 );
         	UnlimitedAmmo SetText("Unlimited Ammo: ");
        
      	while( 1 )
      	{
      		Remaining SetValue( level.unlimited_ammo_duration ); //this is necessary so the timer will reset on the chance that 2 unlimited ammo drops drop at once
      		wait 1;
      		level.unlimited_ammo_duration--;
      		if ( level.unlimited_ammo_duration <= 0 )
      		{
      			UnlimitedAmmo.alpha = 0; //these 2 variables make the text invisible instead of destroying it to avoid the string overflow
      			Remaining.alpha = 0;
      			level.unlimited_ammo_active = false; //sets this to false in order to allow the timer to start again
      			break;
      		}
      	}
      }
      

      Basically instead of destroy() I just turn it transparent so it avoids creating too many strings over time or any for that matter beyond one. Obviously this isn't future proofed so if more custom powerups are added it will be awkward to have them all stack using this method.

      edit: I will post the other powerups I teased in a previous post in its own topic when I get them working correctly on all maps.

      Ox_undefined Offline
      Ox_undefined Offline
      Ox_
      wrote on last edited by
      #24

      JezuzLizard said in [GSC] Zombies Custom Powerup | Unlimited Ammo:

      Ox_ I got around to making a simple waw style timer:

      #include maps\mp\_utility;
      #include common_scripts\utility;
      #include maps\mp\gametypes_zm\_hud_util;
      #include maps\mp\gametypes_zm\_hud_message;
      #include maps\mp\zombies\_zm_powerups;
      #include maps\mp\zombies\_zm_utility;
      
      //credit goes to _Ox for the original code
      init()
      {
      	level thread onPlayerConnect();
      	//include and init the powerup
      	include_zombie_powerup("unlimited_ammo");
      	add_zombie_powerup("unlimited_ammo", "T6_WPN_AR_GALIL_WORLD", &"ZOMBIE_POWERUP_UNLIMITED_AMMO", ::func_should_always_drop, 0, 0, 0);
      	powerup_set_can_pick_up_in_last_stand("unlimited_ammo", 1);
              initializeUnlimitedAmmo();
      }
      
      onPlayerConnect()
      {
      	for(;;)
      	{
      		level waittill("connected", player);
      		player thread onPlayerSpawned();
      	}
      }
      
      onPlayerSpawned()
      {
      	self endon("disconnect");
      	level endon("game_ended");
      	for(;;)
      	{
      		self waittill("spawned_player");
      		
      		if(!isDefined(level.unlimited_ammo_first_spawn))
      		{
      			wait 2;
      			//delayed defining of the custom function so we're sure to
      			//override the function Origins defines for this
      			level._zombiemode_powerup_grab = ::custom_powerup_grab;
      				
      			//message for the host to indicate that it should be all good
      			self iprintln("^6Unlimited Ammo Custom Powerup Loaded"); 
      				
      			//spawns the unlimited ammo powerup in front of the host at the very start of the game
      			//can be used to make sure it's actually working and all good
      			//remove the line directly below to disable
      			//level specific_powerup_drop("unlimited_ammo", self.origin + VectorScale(AnglesToForward(self.angles), 70));
      			level.unlimited_ammo_first_spawn = "fortnite!fortnite!!";
      		}	
      	}
      }
      
      initializeUnlimitedAmmo()
      {
            level.unlimited_ammo_active = false; //initializes that the powerup is off for the timer
            level.unlimited_ammo_duration = 20; //initializes the timer duration var change this to affect the duration
      }
      
      //fires when we grab any custom powerup
      custom_powerup_grab(s_powerup, e_player)
      {
      	if (s_powerup.powerup_name == "unlimited_ammo")
      		level thread unlimited_ammo_powerup(s_powerup, e_player);
      }
      
      unlimited_ammo_powerup(m_powerup, e_player)
      {
      	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 notify_unlimited_ammo_end();
      		player thread turn_on_unlimited_ammo();
      		player thread unlimited_ammo_timer();
      	}
      }
      
      turn_on_unlimited_ammo()
      {
      	level endon("game_ended");
      	self endon("disconnect");
      	self endon("end_unlimited_ammo");
      	for(;;)
      	{
      		//simply set the current mag to be full on a loop
      		self setWeaponAmmoClip(self GetCurrentWeapon(), 150);
      		wait .02;
      	}
      }
      
      notify_unlimited_ammo_end()
      {
      	level endon("game_ended");
      	self endon("disconnect");
      	self endon("end_unlimited_ammo");
      	level.unlimited_ammo_duration = 20; //this sets the duration for the unlimited_ammo_timer() modify this when modifying the wait
      	wait 20; //directly changes the duration of the powerup
      	self notify("end_unlimited_ammo");
      }
      
      unlimited_ammo_timer()
      {   
      	level endon("game_ended");
      	self endon("disconnect");
      	if ( level.unlimited_ammo_active == true )//checks whether the powerup is already active and returns so no dupe countdown
      	{
      		return;
      	}
      	level.unlimited_ammo_active = true; //sets that the powerup is active
      	
      	Remaining = create_simple_hud();
        	Remaining.horzAlign = "center";
        	Remaining.vertAlign = "middle";
         	Remaining.alignX = "Left";
         	Remaining.alignY = "middle";
         	Remaining.y = 180; //- is top 0 is middle + is bottom
         	Remaining.x = 85; //- is left 0 is middle + is right
         	Remaining.foreground = 1;
         	Remaining.fontscale = 3.0;
         	Remaining.alpha = 1;
         	Remaining.color = ( 0.423, 0.004, 0 );
      
      
         	UnlimitedAmmo = create_simple_hud();
         	UnlimitedAmmo.horzAlign = "center"; //valid inputs: center, top, bottom, left, right, top_right, top_left, topcenter, bottom_right, bottom_left
         	UnlimitedAmmo.vertAlign = "middle";
         	UnlimitedAmmo.alignX = "center";
         	UnlimitedAmmo.alignY = "middle";
         	UnlimitedAmmo.y = 180; //- is top 0 is middle + is bottom
         	UnlimitedAmmo.x = -1; //- is left 0 is middle + is right
         	UnlimitedAmmo.foreground = 1;
         	UnlimitedAmmo.fontscale = 3.0;
         	UnlimitedAmmo.alpha = 1; //transparency
         	UnlimitedAmmo.color = ( 0.423, 0.004, 0 );
         	UnlimitedAmmo SetText("Unlimited Ammo: ");
        
      	while( 1 )
      	{
      		Remaining SetValue( level.unlimited_ammo_duration ); //this is necessary so the timer will reset on the chance that 2 unlimited ammo drops drop at once
      		wait 1;
      		level.unlimited_ammo_duration--;
      		if ( level.unlimited_ammo_duration <= 0 )
      		{
      			UnlimitedAmmo.alpha = 0; //these 2 variables make the text invisible instead of destroying it to avoid the string overflow
      			Remaining.alpha = 0;
      			level.unlimited_ammo_active = false; //sets this to false in order to allow the timer to start again
      			break;
      		}
      	}
      }
      

      Basically instead of destroy() I just turn it transparent so it avoids creating too many strings over time or any for that matter beyond one. Obviously this isn't future proofed so if more custom powerups are added it will be awkward to have them all stack using this method.

      edit: I will post the other powerups I teased in a previous post in its own topic when I get them working correctly on all maps.

      Oh man, I actually just got around making some improvements myself. Made my own hud and made it act pretty much like a normal powerup's hud does. So it shows an icon and starts blinking at 10sec and faster at 5sec.
      Gonna finish it up and record a vid about it and then post it here, stay tuned haha.

      I'll check your version out later as well and can probably put it to the OP.

      Also, going to test if my thing is safe by spawning in like 1000 of these powerups on me and seeing what happens :'-D

      1 Reply Last reply
      0
      • Fryundefined Fry

        OP is your code on the main post the latest changes of the GSC? I have been thinking about merging this to RG server along with unlimited perks etc. I just wanted to make sure before I push it live.

        Ox_undefined Offline
        Ox_undefined Offline
        Ox_
        wrote on last edited by
        #25

        Fry said in [GSC] Zombies Custom Powerup | Unlimited Ammo:

        OP is your code on the main post the latest changes of the GSC? I have been thinking about merging this to RG server along with unlimited perks etc. I just wanted to make sure before I push it live.

        Yes it was, and will always be. Also just pushed a big update.

        banni said in [GSC] Zombies Custom Powerup | Unlimited Ammo:

        Tried improving the code, added ambient sound when powerup is active, and iprintin message about powerup being picked up and being ended. I also tried drawing a hud powerup icon but it doesn't work.
        I also removed zombie blood code because it wasn't working.

        #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;
        
        init()
        {
        	level thread onPlayerConnect();
            precacheshader( "zom_icon_minigun" ); // tried precaching death machine icon for hud, didn't work for some reason
        	include_zombie_powerup("unlimited_ammo");
        	add_zombie_powerup("unlimited_ammo", "T6_WPN_AR_GALIL_WORLD", &"ZOMBIE_POWERUP_UNLIMITED_AMMO", ::func_should_always_drop, 0, 0, 0);
        	powerup_set_can_pick_up_in_last_stand("unlimited_ammo", 1);
        }
        
        onPlayerConnect()
        {
        	for(;;)
        	{
        		level waittill("connected", player);
        		player thread onPlayerSpawned();
        	}
        }
        
        onPlayerSpawned()
        {
        	self endon("disconnect");
        	level endon("game_ended");
        	for(;;)
        	{
        		self waittill("spawned_player");
        			//only run this when the host spawns in for the very first time
        			if(!isDefined(level.unlimited_ammo_first_spawn))
        			{
        				wait 2;
        				level._zombiemode_powerup_grab = ::custom_powerup_grab;
        				level.unlimited_ammo_first_spawn = "fortnite!fortnite!!";
        			}
        			
        	}
        }
        
        //fires when we grab any custom powerup
        custom_powerup_grab(s_powerup, e_player)
        {
        	if (s_powerup.powerup_name == "unlimited_ammo")
        		level thread unlimited_ammo_powerup(s_powerup, e_player);
        	    
        }
        
        unlimited_ammo_powerup(m_powerup, e_player)
        {
        	foreach(player in level.players)
        	{
        		//if powerup is already on, turn it off
        		player notify("end_unlimited_ammo");
                //decided to use stinger from when you get ray gun from box
        		player playsound("mus_raygun_stinger");
        		player thread turn_on_unlimited_ammo();
        		player thread notify_unlimited_ammo_end();
        		player thread sfx_inf_ammo();
                        player thread ammo_hud_create();
        		player iprintln("^2Bottomless Clip!");  
        		wait 30;
        		player iprintln("^1Bottomless Clip has ended!");
        		player playsound("zmb_insta_kill_loop_off");
        
        	}
        	
        }
        
        sfx_inf_ammo()
        {
            level endon("game_ended");
        	self endon("disconnect");
        	self endon("end_unlimited_ammo");
        	inf_ammo_ent = spawn( "script_origin", ( 0, 0, 0 ) ); 
        	inf_ammo_ent playloopsound( "zmb_insta_kill_loop" );
        	wait 30;
        	inf_ammo_ent stoploopsound();
        	inf_ammo_ent destroy();
        
        }
        //my attempt at making a hud icon for it, as expected, it didn't work
        ammo_hud_create()
        {
        	self.ammo_icon = newclienthudelem( self );
        	self.ammo_icon.horzalign = "center";
        	self.ammo_icon.vertalign = "middle";
        	self.ammo_icon.x = -16;
        	self.ammo_icon.y = 16;
        	self.ammo_icon.alpha = 0;
        	width = 64;
        	height = 64;
        	self.ammo_icon setshader( "zom_icon_minigun", width, height );	
                wait 30;
                self.ammo_icon destroy();
        }
        
        turn_on_unlimited_ammo()
        {
        	level endon("game_ended");
        	self endon("disconnect");
        	self endon("end_unlimited_ammo");	
        
            self setWeaponAmmoClip(self GetCurrentWeapon(), 150);
        	
        	for(;;)
        	{
        	    self waittill ("weapon_fired");
        		//simply set the current mag to be full on a loop
        		self setWeaponAmmoClip(self GetCurrentWeapon(), 150);
        		wait .02;
        	}
        }
        
        notify_unlimited_ammo_end()
        {
        	level endon("game_ended");
        	self endon("disconnect");
        	self endon("end_unlimited_ammo");
        	//changed duration to 30 because why not 
        	wait 30;
        	self notify("end_unlimited_ammo");
        
        }
        
        
        

        The zombie blood was working as intended. Did you read the comments about it?
        It wasn't supposed to add the zombie blood powerup to all maps, just make it functional in Origins. Your current code overwrites the custom powerup pickup function and it doesn't include zombie blood so the powerup is broken in your code.
        My latest version right now uses a better way of not breaking zombie blood though, check the edit in OP.

        And not bad with the raygun sound. I would probably use it if I wasn't too used to knowing that sound means someone got it from the random box. Do you have a list of sounds? All I have nowadays is what I find from Google, and wasn't able to find anything good.

        Also I decided not to add that ambient sound to my latest version. I tried your stuff and literally could not hear a thing. So I don't see the point. Maybe if there was some good sound, but well, don't know of one.

        And about your hud, the biggest problem with it is that you set it to be fully transparent alpha = 0. So yeah, can't really see it haha.
        See my latest version in OP though, I added a hud.

        And you can't wait inside the unlimited_ammo_powerup() function. Right now in your code the first player gets the powerup and then 30seconds later the second player gets the powerup, etc.

        Also I decided not to take the waittill("weapon_fired") approach, since it's no good if you swap to a weapon that would have to reloaded, or if you're out of ammo. And also, setting the current clip to be full every .05sec is literally nothing in gsc. So I don't see any point bothering to implement proper logic for handling it with waittills.

        And yeah, I guess 30sec duration is good. First I thought it's a bit too much, but meh, whatever, I'll make it be that.

        Btw, "Bottomless Clip", love the name haha.
        I added that in, thanks.

        1 Reply Last reply
        0
        • JezuzLizardundefined JezuzLizard

          Ox_ I got around to making a simple waw style timer:

          #include maps\mp\_utility;
          #include common_scripts\utility;
          #include maps\mp\gametypes_zm\_hud_util;
          #include maps\mp\gametypes_zm\_hud_message;
          #include maps\mp\zombies\_zm_powerups;
          #include maps\mp\zombies\_zm_utility;
          
          //credit goes to _Ox for the original code
          init()
          {
          	level thread onPlayerConnect();
          	//include and init the powerup
          	include_zombie_powerup("unlimited_ammo");
          	add_zombie_powerup("unlimited_ammo", "T6_WPN_AR_GALIL_WORLD", &"ZOMBIE_POWERUP_UNLIMITED_AMMO", ::func_should_always_drop, 0, 0, 0);
          	powerup_set_can_pick_up_in_last_stand("unlimited_ammo", 1);
                  initializeUnlimitedAmmo();
          }
          
          onPlayerConnect()
          {
          	for(;;)
          	{
          		level waittill("connected", player);
          		player thread onPlayerSpawned();
          	}
          }
          
          onPlayerSpawned()
          {
          	self endon("disconnect");
          	level endon("game_ended");
          	for(;;)
          	{
          		self waittill("spawned_player");
          		
          		if(!isDefined(level.unlimited_ammo_first_spawn))
          		{
          			wait 2;
          			//delayed defining of the custom function so we're sure to
          			//override the function Origins defines for this
          			level._zombiemode_powerup_grab = ::custom_powerup_grab;
          				
          			//message for the host to indicate that it should be all good
          			self iprintln("^6Unlimited Ammo Custom Powerup Loaded"); 
          				
          			//spawns the unlimited ammo powerup in front of the host at the very start of the game
          			//can be used to make sure it's actually working and all good
          			//remove the line directly below to disable
          			//level specific_powerup_drop("unlimited_ammo", self.origin + VectorScale(AnglesToForward(self.angles), 70));
          			level.unlimited_ammo_first_spawn = "fortnite!fortnite!!";
          		}	
          	}
          }
          
          initializeUnlimitedAmmo()
          {
                level.unlimited_ammo_active = false; //initializes that the powerup is off for the timer
                level.unlimited_ammo_duration = 20; //initializes the timer duration var change this to affect the duration
          }
          
          //fires when we grab any custom powerup
          custom_powerup_grab(s_powerup, e_player)
          {
          	if (s_powerup.powerup_name == "unlimited_ammo")
          		level thread unlimited_ammo_powerup(s_powerup, e_player);
          }
          
          unlimited_ammo_powerup(m_powerup, e_player)
          {
          	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 notify_unlimited_ammo_end();
          		player thread turn_on_unlimited_ammo();
          		player thread unlimited_ammo_timer();
          	}
          }
          
          turn_on_unlimited_ammo()
          {
          	level endon("game_ended");
          	self endon("disconnect");
          	self endon("end_unlimited_ammo");
          	for(;;)
          	{
          		//simply set the current mag to be full on a loop
          		self setWeaponAmmoClip(self GetCurrentWeapon(), 150);
          		wait .02;
          	}
          }
          
          notify_unlimited_ammo_end()
          {
          	level endon("game_ended");
          	self endon("disconnect");
          	self endon("end_unlimited_ammo");
          	level.unlimited_ammo_duration = 20; //this sets the duration for the unlimited_ammo_timer() modify this when modifying the wait
          	wait 20; //directly changes the duration of the powerup
          	self notify("end_unlimited_ammo");
          }
          
          unlimited_ammo_timer()
          {   
          	level endon("game_ended");
          	self endon("disconnect");
          	if ( level.unlimited_ammo_active == true )//checks whether the powerup is already active and returns so no dupe countdown
          	{
          		return;
          	}
          	level.unlimited_ammo_active = true; //sets that the powerup is active
          	
          	Remaining = create_simple_hud();
            	Remaining.horzAlign = "center";
            	Remaining.vertAlign = "middle";
             	Remaining.alignX = "Left";
             	Remaining.alignY = "middle";
             	Remaining.y = 180; //- is top 0 is middle + is bottom
             	Remaining.x = 85; //- is left 0 is middle + is right
             	Remaining.foreground = 1;
             	Remaining.fontscale = 3.0;
             	Remaining.alpha = 1;
             	Remaining.color = ( 0.423, 0.004, 0 );
          
          
             	UnlimitedAmmo = create_simple_hud();
             	UnlimitedAmmo.horzAlign = "center"; //valid inputs: center, top, bottom, left, right, top_right, top_left, topcenter, bottom_right, bottom_left
             	UnlimitedAmmo.vertAlign = "middle";
             	UnlimitedAmmo.alignX = "center";
             	UnlimitedAmmo.alignY = "middle";
             	UnlimitedAmmo.y = 180; //- is top 0 is middle + is bottom
             	UnlimitedAmmo.x = -1; //- is left 0 is middle + is right
             	UnlimitedAmmo.foreground = 1;
             	UnlimitedAmmo.fontscale = 3.0;
             	UnlimitedAmmo.alpha = 1; //transparency
             	UnlimitedAmmo.color = ( 0.423, 0.004, 0 );
             	UnlimitedAmmo SetText("Unlimited Ammo: ");
            
          	while( 1 )
          	{
          		Remaining SetValue( level.unlimited_ammo_duration ); //this is necessary so the timer will reset on the chance that 2 unlimited ammo drops drop at once
          		wait 1;
          		level.unlimited_ammo_duration--;
          		if ( level.unlimited_ammo_duration <= 0 )
          		{
          			UnlimitedAmmo.alpha = 0; //these 2 variables make the text invisible instead of destroying it to avoid the string overflow
          			Remaining.alpha = 0;
          			level.unlimited_ammo_active = false; //sets this to false in order to allow the timer to start again
          			break;
          		}
          	}
          }
          

          Basically instead of destroy() I just turn it transparent so it avoids creating too many strings over time or any for that matter beyond one. Obviously this isn't future proofed so if more custom powerups are added it will be awkward to have them all stack using this method.

          edit: I will post the other powerups I teased in a previous post in its own topic when I get them working correctly on all maps.

          Ox_undefined Offline
          Ox_undefined Offline
          Ox_
          wrote on last edited by
          #26

          JezuzLizard latest version is up now.
          I'll check out your version tomorrow probably and see about adding it to the OP as well.

          1 Reply Last reply
          0
          • Knightundefined Offline
            Knightundefined Offline
            Knight
            wrote on last edited by Knight
            #27

            Ox_ 🤦 I literally was just gonna post my source of my new power-up I cobbled together and I noticed you updated your source 🤣 guess I'll have to go through it. but ill still post an images of the power-up next to yours.

            Pictures (sorry for the gigantic pics before lol)
            https://imgur.com/gallery/BH4k3C7

            I think you get the idea, it's the Pack-A-Punch power up!
            It paps your gun! Oh and I used the teddy bear model because I couldn't find a pap.

            Ox_undefined 1 Reply Last reply
            0
            • Knightundefined Knight

              Ox_ 🤦 I literally was just gonna post my source of my new power-up I cobbled together and I noticed you updated your source 🤣 guess I'll have to go through it. but ill still post an images of the power-up next to yours.

              Pictures (sorry for the gigantic pics before lol)
              https://imgur.com/gallery/BH4k3C7

              I think you get the idea, it's the Pack-A-Punch power up!
              It paps your gun! Oh and I used the teddy bear model because I couldn't find a pap.

              Ox_undefined Offline
              Ox_undefined Offline
              Ox_
              wrote on last edited by
              #28

              Knight said in [GSC] Zombies Custom Powerup | Unlimited Ammo:

              Ox_ 🤦 I literally was just gonna post my source of my new power-up I cobbled together and I noticed you updated your source 🤣 guess I'll have to go through it. but ill still post an images of the power-up next to yours.

              Pictures (sorry for the gigantic pics before lol)
              https://imgur.com/gallery/BH4k3C7

              I think you get the idea, it's the Pack-A-Punch power up!
              It paps your gun! Oh and I used the teddy bear model because I couldn't find a pap.

              Good stuff. Would like to see your implementation of the countdown, always interesting to see what sort of approaches other people have taken.
              About the powerup itself, sounds quite overpowered to me haha. Would need some balancing done to it for sure.

              If you're up for a challenge, try to balance the powerup.
              What I'd look into myself, is changing its spawning chance based on in what stage of the game players are.
              E.g. really rare to spawn in unless pap is legitmately accessible as well. Also based on how much money the player has.
              And if players are really late game, could spawn it in quite commonly just for fun. In such a case I wouldn't use the normal way of spawning them in though. You wouldn't want to consume the limit of powerups per round and push chances of max ammo off powerup array.
              I guess same could be said about adding any custom powerup, it always makes max ammo more rare. I didn't see this is a problem with unlimited ammo though, since it should be quite good at high rounds and you also fill up your current clip at least.

              1 Reply Last reply
              0
              • GroverFoxundefined Offline
                GroverFoxundefined Offline
                GroverFox
                wrote on last edited by
                #29

                Really like this and hope someday to learn how to do it.

                Ox_undefined 1 Reply Last reply
                0
                • GroverFoxundefined GroverFox

                  Really like this and hope someday to learn how to do it.

                  Ox_undefined Offline
                  Ox_undefined Offline
                  Ox_
                  wrote on last edited by
                  #30

                  GroverFox said in [GSC] Zombies Custom Powerup | Unlimited Ammo:

                  Really like this and hope someday to learn how to do it.

                  If you're just looking to use it, there's a download the precompiled .gsc you can use.
                  How you use this .gsc depends a bit. If you're looking to use it on a Plutionum server, they have a tutorial stickied in here.
                  If not on a Plutonium server, you can Google for a tutorial on how to inject it to Steam/Redacted.

                  1 Reply Last reply
                  0
                  • GroverFoxundefined Offline
                    GroverFoxundefined Offline
                    GroverFox
                    wrote on last edited by
                    #31

                    No, I'm taking about the coding part 🙂

                    Ox_undefined 1 Reply Last reply
                    0
                    • GroverFoxundefined GroverFox

                      No, I'm taking about the coding part 🙂

                      Ox_undefined Offline
                      Ox_undefined Offline
                      Ox_
                      wrote on last edited by
                      #32

                      GroverFox said in [GSC] Zombies Custom Powerup | Unlimited Ammo:

                      No, I'm taking about the coding part 🙂

                      I see.
                      Well good luck with with the learning 🙂

                      1 Reply Last reply
                      0
                      • Ox_undefined Ox_

                        So I was playing some zombies with a friend and wanted to do something with gsc. Just to remember the good old golden days. Thought of making a custom powerup and unlimited ammo seemed like a pretty cool one.

                        So it'll drop on the ground randomly just like any powerup, and when someone picks it up, every player gets unlimited ammo for 30secs. Duration can be easily changed, of course.

                        This is not intended for Turned or Grief. I have no idea what happens if you try to use them there. Nothing good I'd assume.
                        Cba'd to make it work with them because who needs unlimited ammo in Turned, and who tf plays Grief.
                        Other than that, should be all good. Managed to even spam myself with the powerup over 2000 times in a row with no issues.

                        EDIT: Seems the shader I'm using for the icon wont load in all maps KMS KMS KMS KMS KMS KMS. I fucking cba trying to find one that works. Shit's fucking impossible. I can deal with a checkerboard icon in some maps.

                        Video
                        https://www.youtube.com/watch?v=M5qXeJAmdZ8
                        Picture
                        https://i.imgur.com/Amllzkw.jpg

                        Full source for a minimal example script. Be sure to read the comments in there if you'll be doing any changes yourself.

                        #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;
                        
                        init()
                        {
                           	level thread onPlayerConnect();
                        
                        	//include and init the powerup
                           	include_zombie_powerup("unlimited_ammo");
                           	//change the powerup duration if you want
                           	level.unlimited_ammo_duration = 30;
                           	//shitty model, cant find a good model list so cba
                           	//change to w/e if you have some nice model
                           	//galil works in all maps though, so be decent in that regard ig
                           	add_zombie_powerup("unlimited_ammo", "T6_WPN_AR_GALIL_WORLD", &"ZOMBIE_POWERUP_UNLIMITED_AMMO", ::func_should_always_drop, 0, 0, 0);
                        	powerup_set_can_pick_up_in_last_stand("unlimited_ammo", 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.unlimited_ammo_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("^7Unlimited Ammo Custom 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.unlimited_ammo_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("unlimited_ammo", 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 == "unlimited_ammo")
                        		level thread unlimited_ammo_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);
                        }
                        
                        unlimited_ammo_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 turn_on_unlimited_ammo();
                        		player thread unlimited_ammo_on_hud();
                        		player thread notify_unlimited_ammo_end();
                        	}
                        }
                        
                        unlimited_ammo_on_hud()
                        {
                        	self endon("disconnect");
                        	//hud elems for text & icon
                        	unlimited_ammo_hud_string = newclienthudelem(self);
                        	unlimited_ammo_hud_string.elemtype = "font";
                        	unlimited_ammo_hud_string.font = "objective";
                        	unlimited_ammo_hud_string.fontscale = 2;
                        	unlimited_ammo_hud_string.x = 0;
                        	unlimited_ammo_hud_string.y = 0;
                        	unlimited_ammo_hud_string.width = 0;
                        	unlimited_ammo_hud_string.height = int( level.fontheight * 2 );
                        	unlimited_ammo_hud_string.xoffset = 0;
                        	unlimited_ammo_hud_string.yoffset = 0;
                        	unlimited_ammo_hud_string.children = [];
                        	unlimited_ammo_hud_string setparent(level.uiparent);
                        	unlimited_ammo_hud_string.hidden = 0;
                        	unlimited_ammo_hud_string maps/mp/gametypes_zm/_hud_util::setpoint("TOP", undefined, 0, level.zombie_vars["zombie_timer_offset"] - (level.zombie_vars["zombie_timer_offset_interval"] * 2));
                        	unlimited_ammo_hud_string.sort = .5;
                        	unlimited_ammo_hud_string.alpha = 0;
                        	unlimited_ammo_hud_string fadeovertime(.5);
                        	unlimited_ammo_hud_string.alpha = 1;
                        	//cool powerup name, sounds like something that could actually be in the game
                        	//credits to "Banni" for it
                        	unlimited_ammo_hud_string setText("Bottomless Clip!");
                        	unlimited_ammo_hud_string thread unlimited_ammo_hud_string_move();
                        	
                        	unlimited_ammo_hud_icon = newclienthudelem(self);
                        	unlimited_ammo_hud_icon.horzalign = "center";
                        	unlimited_ammo_hud_icon.vertalign = "bottom";
                        	unlimited_ammo_hud_icon.x = -75;
                        	unlimited_ammo_hud_icon.y = 0;
                        	unlimited_ammo_hud_icon.alpha = 1;
                        	unlimited_ammo_hud_icon.hidewheninmenu = true;   
                        	unlimited_ammo_hud_icon setshader("hud_icon_minigun", 40, 40);
                        	self thread unlimited_ammo_hud_icon_blink(unlimited_ammo_hud_icon);
                        	self thread destroy_unlimited_ammo_icon_hud(unlimited_ammo_hud_icon);
                        }
                        
                        unlimited_ammo_hud_string_move()
                        {
                        	wait .5;
                        	self fadeovertime(1.5);
                        	self moveovertime(1.5);
                        	self.y = 270;
                        	self.alpha = 0;
                        	wait 1.5;
                        	self destroy();
                        }
                        
                        //blinking times match the normal powerup hud blinking times
                        unlimited_ammo_hud_icon_blink(elem)
                        {
                        	level endon("disconnect");
                        	self endon("disconnect");
                        	self endon("end_unlimited_ammo");
                        	time_left = level.unlimited_ammo_duration;
                        	for(;;)
                        	{
                        		//less than 5sec left on powerup, blink fast
                        		if(time_left <= 5)
                        			time = .1;
                        		//less than 10sec left on powerup, blink
                        		else if(time_left <= 10)
                        			time = .2;
                        		//over 20sec left, dont blink
                        		else
                        		{
                        			wait .05;
                        			time_left -= .05;
                        			continue;
                        		}
                        		elem fadeovertime(time);
                        		elem.alpha = 0;
                        		wait time;
                        		elem fadeovertime(time);
                        		elem.alpha = 1;
                        		wait time;
                        		time_left -= time * 2;
                        	}
                        }
                        
                        destroy_unlimited_ammo_icon_hud(elem)
                        {
                        	level endon("game_ended");
                        	//timeout just in case aswell, shouldnt ever get used, but who knows if I missed something
                        	self waittill_any_timeout(level.unlimited_ammo_duration+1, "disconnect", "end_unlimited_ammo");
                        	elem destroy();
                        }
                        
                        turn_on_unlimited_ammo()
                        {
                        	level endon("game_ended");
                        	self endon("disonnect");
                        	self endon("end_unlimited_ammo");
                        	for(;;)
                        	{
                        		//simply set the current mag to be full on a loop
                        		self setWeaponAmmoClip(self GetCurrentWeapon(), 150);
                        		wait .05;
                        	}
                        }
                        
                        notify_unlimited_ammo_end()
                        {
                        	level endon("game_ended");
                        	self endon("disonnect");
                        	self endon("end_unlimited_ammo");
                        	wait level.unlimited_ammo_duration;
                        	//the same sound that plays when instakill powerup ends
                        	self playsound("zmb_insta_kill");
                        	self notify("end_unlimited_ammo");
                        }
                        

                        Download to a precompiled .gsc you can use:
                        https://www.mediafire.com/file/h501pdsime694jx/BO2-Zombies-Custom-Powerup-Unlimited-Ammo.zip/file
                        https://www.virustotal.com/gui/file/e7efd7e643d5f5e2a4aa29c32af186b13d314b0915687f13724b88ec890bd604/detection

                        Hope someone finds some use, or maybe figures out how to add their own custom powerups, post them down below if you do.
                        And if you have any ideas for improvement, or other custom powerups, or any other custom stuff, post them down below. I might make them if I find them cool.

                        ~Ox

                        Optimus Xundefined Offline
                        Optimus Xundefined Offline
                        Optimus X
                        Contributor
                        wrote on last edited by
                        #33
                        This post is deleted!
                        Ox_undefined 1 Reply Last reply
                        0
                        • Optimus Xundefined Optimus X

                          This post is deleted!

                          Ox_undefined Offline
                          Ox_undefined Offline
                          Ox_
                          wrote on last edited by
                          #34

                          @colorz808 said in [Release] [GSC] Zombies Custom Powerup | Unlimited Ammo:

                          Ox_ Are you going to make more custom power ups? I would like to see a perk bottle powerup that gives a perk to all players that leads to gaining all 7 perks on any map or perhaps a pack o punch powerup to upgrade your gun for maps like bus depo or farm that don't have a pack o punch machine. I've used your Unlimited Ammo Powerup and I enjoy it alot when I host my server. Great Work

                          Guess I could make more. Just seriously lost motivation when I made the nice shader at the bottom of the screen for the powerup timer and all, just to notice it doesn't work for all maps.

                          Ideas are appreciated though, the more complex, the more interesting it is (but that could also result in cba, haha)
                          And I don't think I quite understand what your first idea is. Just normal perk bottle powerup, but it also increases the perk cap? Or?
                          And for pack-a-punch, seems like Knight made it already, here's his post. Maybe he could share it.

                          1 Reply Last reply
                          0
                          • Optimus Xundefined Offline
                            Optimus Xundefined Offline
                            Optimus X
                            Contributor
                            wrote on last edited by
                            #35

                            Thanks for the info on Knight already making the pap powerup i'll see if he can share but for the perk powerup I was thinking can give perks like flopper etc that are not originally in the map like town or farm. Everytime they grab the perk bottle it gives everyone one random free perk but it's random between 8 perks like the wunderfizz machine on origins

                            JezuzLizardundefined 1 Reply Last reply
                            0
                            • Optimus Xundefined Optimus X

                              Thanks for the info on Knight already making the pap powerup i'll see if he can share but for the perk powerup I was thinking can give perks like flopper etc that are not originally in the map like town or farm. Everytime they grab the perk bottle it gives everyone one random free perk but it's random between 8 perks like the wunderfizz machine on origins

                              JezuzLizardundefined Offline
                              JezuzLizardundefined Offline
                              JezuzLizard
                              Plutonium Staff
                              wrote on last edited by
                              #36

                              @colorz808 This isn't possible yet not without mod tools. The actual perks aren't on the fast file the map loads so if you do try to give say "specialty_flakjacket" which is flopper the game will crash.

                              Modding is currently limited to whatever is actually on the fast file, if its not on the fast file already and its not a script its not possible. It is possible to bring over scripts from other maps and use their functions in any map but with varying results.

                              1 Reply Last reply
                              0
                              • Optimus Xundefined Offline
                                Optimus Xundefined Offline
                                Optimus X
                                Contributor
                                wrote on last edited by
                                #37

                                Thanks for the information. Hopefully in the future it's possible.

                                1 Reply Last reply
                                0
                                • Knightundefined Offline
                                  Knightundefined Offline
                                  Knight
                                  wrote on last edited by Knight
                                  #38

                                  @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. 😅

                                  Optimus Xundefined JezuzLizardundefined 2 Replies Last reply
                                  1
                                  • Knightundefined Knight

                                    @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. 😅

                                    Optimus Xundefined Offline
                                    Optimus Xundefined Offline
                                    Optimus X
                                    Contributor
                                    wrote on last edited by
                                    #39

                                    Knight Thank You, Knight. I will use this when I host my server. Be perfect for farm and bus depot. Wish I knew how to get those map working correctly on my server. Any help you can give would be greatly appreciated

                                    1 Reply Last reply
                                    0
                                    • Knightundefined Knight

                                      @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. 😅

                                      JezuzLizardundefined Offline
                                      JezuzLizardundefined Offline
                                      JezuzLizard
                                      Plutonium Staff
                                      wrote on last edited by
                                      #40

                                      Knight I believe you'll have to modify _zm_powerups.gsc itself to manually set conditions for drops. Its possible since fire sale is an example of one such powerup. I have a _zm_powerups.gsc that compiles but will have errors with custom powerups you'll have to fix it if you want it to work with your powerup but it shouldn't be that difficult.

                                      https://github.com/JezuzLizard/Recompilable-gscs-for-BO2-zombies/tree/master/patch_zm
                                      If you do manage to figure out why the function custom_powerup_grab doesn't run make a pull request, otherwise I'll probably fix it later today after I finish working on _zm.gsc.

                                      Oh yeah I guess I should also explain how you make use of recompileable .gscs. Just compile it as _zm_powerups.gsc and place it maps/mp/zombies. The game will run this version of _zm_powerups.gsc instead of the base version allowing for total customization of the base powerups.

                                      1 Reply Last reply
                                      0
                                      • Ox_undefined Ox_

                                        So I was playing some zombies with a friend and wanted to do something with gsc. Just to remember the good old golden days. Thought of making a custom powerup and unlimited ammo seemed like a pretty cool one.

                                        So it'll drop on the ground randomly just like any powerup, and when someone picks it up, every player gets unlimited ammo for 30secs. Duration can be easily changed, of course.

                                        This is not intended for Turned or Grief. I have no idea what happens if you try to use them there. Nothing good I'd assume.
                                        Cba'd to make it work with them because who needs unlimited ammo in Turned, and who tf plays Grief.
                                        Other than that, should be all good. Managed to even spam myself with the powerup over 2000 times in a row with no issues.

                                        EDIT: Seems the shader I'm using for the icon wont load in all maps KMS KMS KMS KMS KMS KMS. I fucking cba trying to find one that works. Shit's fucking impossible. I can deal with a checkerboard icon in some maps.

                                        Video
                                        https://www.youtube.com/watch?v=M5qXeJAmdZ8
                                        Picture
                                        https://i.imgur.com/Amllzkw.jpg

                                        Full source for a minimal example script. Be sure to read the comments in there if you'll be doing any changes yourself.

                                        #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;
                                        
                                        init()
                                        {
                                           	level thread onPlayerConnect();
                                        
                                        	//include and init the powerup
                                           	include_zombie_powerup("unlimited_ammo");
                                           	//change the powerup duration if you want
                                           	level.unlimited_ammo_duration = 30;
                                           	//shitty model, cant find a good model list so cba
                                           	//change to w/e if you have some nice model
                                           	//galil works in all maps though, so be decent in that regard ig
                                           	add_zombie_powerup("unlimited_ammo", "T6_WPN_AR_GALIL_WORLD", &"ZOMBIE_POWERUP_UNLIMITED_AMMO", ::func_should_always_drop, 0, 0, 0);
                                        	powerup_set_can_pick_up_in_last_stand("unlimited_ammo", 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.unlimited_ammo_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("^7Unlimited Ammo Custom 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.unlimited_ammo_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("unlimited_ammo", 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 == "unlimited_ammo")
                                        		level thread unlimited_ammo_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);
                                        }
                                        
                                        unlimited_ammo_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 turn_on_unlimited_ammo();
                                        		player thread unlimited_ammo_on_hud();
                                        		player thread notify_unlimited_ammo_end();
                                        	}
                                        }
                                        
                                        unlimited_ammo_on_hud()
                                        {
                                        	self endon("disconnect");
                                        	//hud elems for text & icon
                                        	unlimited_ammo_hud_string = newclienthudelem(self);
                                        	unlimited_ammo_hud_string.elemtype = "font";
                                        	unlimited_ammo_hud_string.font = "objective";
                                        	unlimited_ammo_hud_string.fontscale = 2;
                                        	unlimited_ammo_hud_string.x = 0;
                                        	unlimited_ammo_hud_string.y = 0;
                                        	unlimited_ammo_hud_string.width = 0;
                                        	unlimited_ammo_hud_string.height = int( level.fontheight * 2 );
                                        	unlimited_ammo_hud_string.xoffset = 0;
                                        	unlimited_ammo_hud_string.yoffset = 0;
                                        	unlimited_ammo_hud_string.children = [];
                                        	unlimited_ammo_hud_string setparent(level.uiparent);
                                        	unlimited_ammo_hud_string.hidden = 0;
                                        	unlimited_ammo_hud_string maps/mp/gametypes_zm/_hud_util::setpoint("TOP", undefined, 0, level.zombie_vars["zombie_timer_offset"] - (level.zombie_vars["zombie_timer_offset_interval"] * 2));
                                        	unlimited_ammo_hud_string.sort = .5;
                                        	unlimited_ammo_hud_string.alpha = 0;
                                        	unlimited_ammo_hud_string fadeovertime(.5);
                                        	unlimited_ammo_hud_string.alpha = 1;
                                        	//cool powerup name, sounds like something that could actually be in the game
                                        	//credits to "Banni" for it
                                        	unlimited_ammo_hud_string setText("Bottomless Clip!");
                                        	unlimited_ammo_hud_string thread unlimited_ammo_hud_string_move();
                                        	
                                        	unlimited_ammo_hud_icon = newclienthudelem(self);
                                        	unlimited_ammo_hud_icon.horzalign = "center";
                                        	unlimited_ammo_hud_icon.vertalign = "bottom";
                                        	unlimited_ammo_hud_icon.x = -75;
                                        	unlimited_ammo_hud_icon.y = 0;
                                        	unlimited_ammo_hud_icon.alpha = 1;
                                        	unlimited_ammo_hud_icon.hidewheninmenu = true;   
                                        	unlimited_ammo_hud_icon setshader("hud_icon_minigun", 40, 40);
                                        	self thread unlimited_ammo_hud_icon_blink(unlimited_ammo_hud_icon);
                                        	self thread destroy_unlimited_ammo_icon_hud(unlimited_ammo_hud_icon);
                                        }
                                        
                                        unlimited_ammo_hud_string_move()
                                        {
                                        	wait .5;
                                        	self fadeovertime(1.5);
                                        	self moveovertime(1.5);
                                        	self.y = 270;
                                        	self.alpha = 0;
                                        	wait 1.5;
                                        	self destroy();
                                        }
                                        
                                        //blinking times match the normal powerup hud blinking times
                                        unlimited_ammo_hud_icon_blink(elem)
                                        {
                                        	level endon("disconnect");
                                        	self endon("disconnect");
                                        	self endon("end_unlimited_ammo");
                                        	time_left = level.unlimited_ammo_duration;
                                        	for(;;)
                                        	{
                                        		//less than 5sec left on powerup, blink fast
                                        		if(time_left <= 5)
                                        			time = .1;
                                        		//less than 10sec left on powerup, blink
                                        		else if(time_left <= 10)
                                        			time = .2;
                                        		//over 20sec left, dont blink
                                        		else
                                        		{
                                        			wait .05;
                                        			time_left -= .05;
                                        			continue;
                                        		}
                                        		elem fadeovertime(time);
                                        		elem.alpha = 0;
                                        		wait time;
                                        		elem fadeovertime(time);
                                        		elem.alpha = 1;
                                        		wait time;
                                        		time_left -= time * 2;
                                        	}
                                        }
                                        
                                        destroy_unlimited_ammo_icon_hud(elem)
                                        {
                                        	level endon("game_ended");
                                        	//timeout just in case aswell, shouldnt ever get used, but who knows if I missed something
                                        	self waittill_any_timeout(level.unlimited_ammo_duration+1, "disconnect", "end_unlimited_ammo");
                                        	elem destroy();
                                        }
                                        
                                        turn_on_unlimited_ammo()
                                        {
                                        	level endon("game_ended");
                                        	self endon("disonnect");
                                        	self endon("end_unlimited_ammo");
                                        	for(;;)
                                        	{
                                        		//simply set the current mag to be full on a loop
                                        		self setWeaponAmmoClip(self GetCurrentWeapon(), 150);
                                        		wait .05;
                                        	}
                                        }
                                        
                                        notify_unlimited_ammo_end()
                                        {
                                        	level endon("game_ended");
                                        	self endon("disonnect");
                                        	self endon("end_unlimited_ammo");
                                        	wait level.unlimited_ammo_duration;
                                        	//the same sound that plays when instakill powerup ends
                                        	self playsound("zmb_insta_kill");
                                        	self notify("end_unlimited_ammo");
                                        }
                                        

                                        Download to a precompiled .gsc you can use:
                                        https://www.mediafire.com/file/h501pdsime694jx/BO2-Zombies-Custom-Powerup-Unlimited-Ammo.zip/file
                                        https://www.virustotal.com/gui/file/e7efd7e643d5f5e2a4aa29c32af186b13d314b0915687f13724b88ec890bd604/detection

                                        Hope someone finds some use, or maybe figures out how to add their own custom powerups, post them down below if you do.
                                        And if you have any ideas for improvement, or other custom powerups, or any other custom stuff, post them down below. I might make them if I find them cool.

                                        ~Ox

                                        ElotitoGameplayundefined Offline
                                        ElotitoGameplayundefined Offline
                                        ElotitoGameplay
                                        wrote on last edited by ElotitoGameplay
                                        #41
                                        This post is deleted!
                                        1 Reply Last reply
                                        0
                                        • MisterX2003undefined Offline
                                          MisterX2003undefined Offline
                                          MisterX2003
                                          wrote on last edited by
                                          #42
                                          This post is deleted!
                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • 1
                                          • 2
                                          • 3
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Donate