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

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. My Give All Perks Script Isn't Working

My Give All Perks Script Isn't Working

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
14 Posts 9 Posters 7.5k Views 1 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.
  • Doob Offline
    Doob Offline
    Doob
    wrote on last edited by
    #1

    So I made a simple script that should give all players all perks on the map. The issues I am having are, you get juggernog but, you don't get the health boost. The script also doesn't run again once the game resets, only once. My code for the script is below, please help in anyway possible.

    init()
    {
    
        for(;;)
        {
            level waittill("connected", player);
    		player thread onPlayerConnect();
    }
    }
    
    PerkTest()
    {
    	self give_perk("specialty_armorvest");
    	self give_perk("specialty_quickrevive");
    	self give_perk("specialty_fastreload");
    	self give_perk("specialty_rof");
    	self give_perk("specialty_longersprint");
    }
    
    onPlayerConnect()
    {
    	self thread PerkTest();
    }
    
    1 Reply Last reply
    0
    • Sorex Offline
      Sorex Offline
      Sorex
      Contributor
      wrote on last edited by Sorex
      #2

      Doob its simple you give perk when player connect. Thats mean he can't get it because he is not in the game he is just connecting to the server. You have to give him perks when player spawn

      1 Reply Last reply
      0
      • Doob Offline
        Doob Offline
        Doob
        wrote on last edited by
        #3

        How would I give players the perk once they spawn in? What function would I use?

        birchy GerardS0406 2 Replies Last reply
        0
        • Doob Doob

          How would I give players the perk once they spawn in? What function would I use?

          birchy Offline
          birchy Offline
          birchy
          wrote on last edited by
          #4

          Doob

          perkTest(){
              for(;;){
          	self waittill("spawned_player");
                  self give_perk("specialty_armorvest");
          	self give_perk("specialty_quickrevive");
          	self give_perk("specialty_fastreload");
          	self give_perk("specialty_rof");
          	self give_perk("specialty_longersprint");
              }
          }
          
          1 Reply Last reply
          1
          • Doob Offline
            Doob Offline
            Doob
            wrote on last edited by
            #5

            Thanks for the fix it worked 🙂
            Now my perk icons won't show once I've given the perks. Is there anyway to fix that?

            JezuzLizard 1 Reply Last reply
            0
            • Sorex Offline
              Sorex Offline
              Sorex
              Contributor
              wrote on last edited by
              #6

              Doob
              With give_perk("specialty_armorvest"); will give just the perk ability. You can use this function to give the perk ability and show the icon. This funcion will show also the drink animations when you give the perk.

              doGivePerk(perk)
              {
                  self endon("disconnect");
                  self endon("death");
                  level endon("game_ended");
                  self endon("perk_abort_drinking");
                  if (!(self hasperk(perk) || (self maps/mp/zombies/_zm_perks::has_perk_paused(perk))))
                  {
                      gun = self maps/mp/zombies/_zm_perks::perk_give_bottle_begin(perk);
                      evt = self waittill_any_return("fake_death", "death", "player_downed", "weapon_change_complete");
                      if (evt == "weapon_change_complete")
                          self thread maps/mp/zombies/_zm_perks::wait_give_perk(perk, 1);
                      self maps/mp/zombies/_zm_perks::perk_give_bottle_end(gun, perk);
                      if (self maps/mp/zombies/_zm_laststand::player_is_in_laststand() || isDefined(self.intermission) && self.intermission)
                          return;
                      self notify("burp");
                  }
              }
              
              Vin Soren 1 Reply Last reply
              1
              • Doob Doob

                Thanks for the fix it worked 🙂
                Now my perk icons won't show once I've given the perks. Is there anyway to fix that?

                JezuzLizard Offline
                JezuzLizard Offline
                JezuzLizard
                Plutonium Staff
                wrote on last edited by JezuzLizard
                #7

                Doob I figured I'd make a simple script that would work for all maps giving all perks.
                It uses some of Treyarch's code from buried to work but slightly modified:

                #include maps/mp/zombies/_zm_utility;
                #include maps/mp/_utility;
                #include common_scripts/utility;
                #include maps/mp/zombies/_zm_perks;
                
                init()
                {
                    level thread on_player_connect();
                }
                
                on_player_connect()
                {
                    level endon( "end_game" );
                    while ( true )
                    {
                        level waittill( "connected", player );
                        player thread on_player_spawned();
                        player thread sq_give_player_all_perks();
                    }
                }
                
                on_player_spawned()
                {
                    level endon( "end_game" );
                    self endon( "disconnect" );
                    while ( true )
                    {
                        self waittill( "spawned_player" );
                    }
                }
                
                sq_give_player_all_perks()
                {
                    flag_wait( "initial_blackscreen_passed" );
                    if ( level.script != "zm_tomb" )
                    {
                        machines = getentarray( "zombie_vending", "targetname" );
                        perks = [];
                        i = 0;
                        while ( i < machines.size )
                        {
                            if ( machines[ i ].script_noteworthy == "specialty_weapupgrade" )
                            {
                                i++;
                                continue;
                            }
                            perks[ perks.size ] = machines[ i ].script_noteworthy;
                            i++;
                        }
                    }
                    else 
                    {
                        perks = level._random_perk_machine_perk_list;
                    }
                	foreach ( perk in perks )
                	{
                		if ( isDefined( self.perk_purchased ) && self.perk_purchased == perk )
                		{
                		}
                		else
                		{
                			if ( self hasperk( perk ) || self maps/mp/zombies/_zm_perks::has_perk_paused( perk ) )
                			{
                			}
                			else
                			{
                				self maps/mp/zombies/_zm_perks::give_perk( perk, 0 );
                				wait 0.25;
                			}
                		}
                	}
                    if ( getDvarInt( "players_keep_perks_permanently" ) == 1 )
                    {
                        if ( !is_true( self._retain_perks ) )
                        {
                            self thread watch_for_respawn();
                            self._retain_perks = 1;
                        }
                    }
                }
                
                watch_for_respawn()
                {
                    level endon( "end_game" );
                    self endon( "disconnect" );
                    while ( true )
                    {
                        self waittill_either( "spawned_player", "player_revived" );
                        wait_network_frame();
                        self thread sq_give_player_all_perks();
                        self setmaxhealth( level.zombie_vars[ "zombie_perk_juggernaut_health" ] );
                    }
                }
                

                You can set this dvar: players_keep_perks_permanently to 1 in your server config for players to never lose perks even if they down, or bleedout. If you play solo with this mod with the dvar set you'll also have infinite quick revives.

                Doob RuinasYm0_0 JuiceTrailer62 3 Replies Last reply
                4
                • JezuzLizard JezuzLizard

                  Doob I figured I'd make a simple script that would work for all maps giving all perks.
                  It uses some of Treyarch's code from buried to work but slightly modified:

                  #include maps/mp/zombies/_zm_utility;
                  #include maps/mp/_utility;
                  #include common_scripts/utility;
                  #include maps/mp/zombies/_zm_perks;
                  
                  init()
                  {
                      level thread on_player_connect();
                  }
                  
                  on_player_connect()
                  {
                      level endon( "end_game" );
                      while ( true )
                      {
                          level waittill( "connected", player );
                          player thread on_player_spawned();
                          player thread sq_give_player_all_perks();
                      }
                  }
                  
                  on_player_spawned()
                  {
                      level endon( "end_game" );
                      self endon( "disconnect" );
                      while ( true )
                      {
                          self waittill( "spawned_player" );
                      }
                  }
                  
                  sq_give_player_all_perks()
                  {
                      flag_wait( "initial_blackscreen_passed" );
                      if ( level.script != "zm_tomb" )
                      {
                          machines = getentarray( "zombie_vending", "targetname" );
                          perks = [];
                          i = 0;
                          while ( i < machines.size )
                          {
                              if ( machines[ i ].script_noteworthy == "specialty_weapupgrade" )
                              {
                                  i++;
                                  continue;
                              }
                              perks[ perks.size ] = machines[ i ].script_noteworthy;
                              i++;
                          }
                      }
                      else 
                      {
                          perks = level._random_perk_machine_perk_list;
                      }
                  	foreach ( perk in perks )
                  	{
                  		if ( isDefined( self.perk_purchased ) && self.perk_purchased == perk )
                  		{
                  		}
                  		else
                  		{
                  			if ( self hasperk( perk ) || self maps/mp/zombies/_zm_perks::has_perk_paused( perk ) )
                  			{
                  			}
                  			else
                  			{
                  				self maps/mp/zombies/_zm_perks::give_perk( perk, 0 );
                  				wait 0.25;
                  			}
                  		}
                  	}
                      if ( getDvarInt( "players_keep_perks_permanently" ) == 1 )
                      {
                          if ( !is_true( self._retain_perks ) )
                          {
                              self thread watch_for_respawn();
                              self._retain_perks = 1;
                          }
                      }
                  }
                  
                  watch_for_respawn()
                  {
                      level endon( "end_game" );
                      self endon( "disconnect" );
                      while ( true )
                      {
                          self waittill_either( "spawned_player", "player_revived" );
                          wait_network_frame();
                          self thread sq_give_player_all_perks();
                          self setmaxhealth( level.zombie_vars[ "zombie_perk_juggernaut_health" ] );
                      }
                  }
                  

                  You can set this dvar: players_keep_perks_permanently to 1 in your server config for players to never lose perks even if they down, or bleedout. If you play solo with this mod with the dvar set you'll also have infinite quick revives.

                  Doob Offline
                  Doob Offline
                  Doob
                  wrote on last edited by
                  #8

                  JezuzLizard Wow, big thanks dude! Fantastic script : )
                  I do have two questions though, by server config for the perma perk value do you mean like in the dedicated_zm.cfg? Also are there any work arounds for mob of the dead? You do get the perks at the start but since you down at the beginning you loose them.

                  JezuzLizard 1 Reply Last reply
                  0
                  • Doob Doob

                    JezuzLizard Wow, big thanks dude! Fantastic script : )
                    I do have two questions though, by server config for the perma perk value do you mean like in the dedicated_zm.cfg? Also are there any work arounds for mob of the dead? You do get the perks at the start but since you down at the beginning you loose them.

                    JezuzLizard Offline
                    JezuzLizard Offline
                    JezuzLizard
                    Plutonium Staff
                    wrote on last edited by
                    #9

                    Doob Its difficult to make it work on mob since mob has its own system with how perks work when you down. What you could do is make the script give the perks every time a player respawns or is revived.

                    1 Reply Last reply
                    1
                    • David23 Offline
                      David23 Offline
                      David23
                      wrote on last edited by David23
                      #10

                      how to give perk on zm_tomb ? i've tried many but dont work.

                      1 Reply Last reply
                      0
                      • Doob Doob

                        How would I give players the perk once they spawn in? What function would I use?

                        GerardS0406 Offline
                        GerardS0406 Offline
                        GerardS0406
                        VIP
                        wrote on last edited by
                        #11
                        This post is deleted!
                        1 Reply Last reply
                        0
                        • JezuzLizard JezuzLizard

                          Doob I figured I'd make a simple script that would work for all maps giving all perks.
                          It uses some of Treyarch's code from buried to work but slightly modified:

                          #include maps/mp/zombies/_zm_utility;
                          #include maps/mp/_utility;
                          #include common_scripts/utility;
                          #include maps/mp/zombies/_zm_perks;
                          
                          init()
                          {
                              level thread on_player_connect();
                          }
                          
                          on_player_connect()
                          {
                              level endon( "end_game" );
                              while ( true )
                              {
                                  level waittill( "connected", player );
                                  player thread on_player_spawned();
                                  player thread sq_give_player_all_perks();
                              }
                          }
                          
                          on_player_spawned()
                          {
                              level endon( "end_game" );
                              self endon( "disconnect" );
                              while ( true )
                              {
                                  self waittill( "spawned_player" );
                              }
                          }
                          
                          sq_give_player_all_perks()
                          {
                              flag_wait( "initial_blackscreen_passed" );
                              if ( level.script != "zm_tomb" )
                              {
                                  machines = getentarray( "zombie_vending", "targetname" );
                                  perks = [];
                                  i = 0;
                                  while ( i < machines.size )
                                  {
                                      if ( machines[ i ].script_noteworthy == "specialty_weapupgrade" )
                                      {
                                          i++;
                                          continue;
                                      }
                                      perks[ perks.size ] = machines[ i ].script_noteworthy;
                                      i++;
                                  }
                              }
                              else 
                              {
                                  perks = level._random_perk_machine_perk_list;
                              }
                          	foreach ( perk in perks )
                          	{
                          		if ( isDefined( self.perk_purchased ) && self.perk_purchased == perk )
                          		{
                          		}
                          		else
                          		{
                          			if ( self hasperk( perk ) || self maps/mp/zombies/_zm_perks::has_perk_paused( perk ) )
                          			{
                          			}
                          			else
                          			{
                          				self maps/mp/zombies/_zm_perks::give_perk( perk, 0 );
                          				wait 0.25;
                          			}
                          		}
                          	}
                              if ( getDvarInt( "players_keep_perks_permanently" ) == 1 )
                              {
                                  if ( !is_true( self._retain_perks ) )
                                  {
                                      self thread watch_for_respawn();
                                      self._retain_perks = 1;
                                  }
                              }
                          }
                          
                          watch_for_respawn()
                          {
                              level endon( "end_game" );
                              self endon( "disconnect" );
                              while ( true )
                              {
                                  self waittill_either( "spawned_player", "player_revived" );
                                  wait_network_frame();
                                  self thread sq_give_player_all_perks();
                                  self setmaxhealth( level.zombie_vars[ "zombie_perk_juggernaut_health" ] );
                              }
                          }
                          

                          You can set this dvar: players_keep_perks_permanently to 1 in your server config for players to never lose perks even if they down, or bleedout. If you play solo with this mod with the dvar set you'll also have infinite quick revives.

                          RuinasYm0_0 Offline
                          RuinasYm0_0 Offline
                          RuinasYm0_0
                          wrote on last edited by
                          #12
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • Sorex Sorex

                            Doob
                            With give_perk("specialty_armorvest"); will give just the perk ability. You can use this function to give the perk ability and show the icon. This funcion will show also the drink animations when you give the perk.

                            doGivePerk(perk)
                            {
                                self endon("disconnect");
                                self endon("death");
                                level endon("game_ended");
                                self endon("perk_abort_drinking");
                                if (!(self hasperk(perk) || (self maps/mp/zombies/_zm_perks::has_perk_paused(perk))))
                                {
                                    gun = self maps/mp/zombies/_zm_perks::perk_give_bottle_begin(perk);
                                    evt = self waittill_any_return("fake_death", "death", "player_downed", "weapon_change_complete");
                                    if (evt == "weapon_change_complete")
                                        self thread maps/mp/zombies/_zm_perks::wait_give_perk(perk, 1);
                                    self maps/mp/zombies/_zm_perks::perk_give_bottle_end(gun, perk);
                                    if (self maps/mp/zombies/_zm_laststand::player_is_in_laststand() || isDefined(self.intermission) && self.intermission)
                                        return;
                                    self notify("burp");
                                }
                            }
                            
                            Vin Soren Offline
                            Vin Soren Offline
                            Vin Soren
                            wrote on last edited by
                            #13

                            Sorex lo estoy probando y seme congela el juego cuando me da las bebidas. alguna solución?

                            1 Reply Last reply
                            0
                            • JezuzLizard JezuzLizard

                              Doob I figured I'd make a simple script that would work for all maps giving all perks.
                              It uses some of Treyarch's code from buried to work but slightly modified:

                              #include maps/mp/zombies/_zm_utility;
                              #include maps/mp/_utility;
                              #include common_scripts/utility;
                              #include maps/mp/zombies/_zm_perks;
                              
                              init()
                              {
                                  level thread on_player_connect();
                              }
                              
                              on_player_connect()
                              {
                                  level endon( "end_game" );
                                  while ( true )
                                  {
                                      level waittill( "connected", player );
                                      player thread on_player_spawned();
                                      player thread sq_give_player_all_perks();
                                  }
                              }
                              
                              on_player_spawned()
                              {
                                  level endon( "end_game" );
                                  self endon( "disconnect" );
                                  while ( true )
                                  {
                                      self waittill( "spawned_player" );
                                  }
                              }
                              
                              sq_give_player_all_perks()
                              {
                                  flag_wait( "initial_blackscreen_passed" );
                                  if ( level.script != "zm_tomb" )
                                  {
                                      machines = getentarray( "zombie_vending", "targetname" );
                                      perks = [];
                                      i = 0;
                                      while ( i < machines.size )
                                      {
                                          if ( machines[ i ].script_noteworthy == "specialty_weapupgrade" )
                                          {
                                              i++;
                                              continue;
                                          }
                                          perks[ perks.size ] = machines[ i ].script_noteworthy;
                                          i++;
                                      }
                                  }
                                  else 
                                  {
                                      perks = level._random_perk_machine_perk_list;
                                  }
                              	foreach ( perk in perks )
                              	{
                              		if ( isDefined( self.perk_purchased ) && self.perk_purchased == perk )
                              		{
                              		}
                              		else
                              		{
                              			if ( self hasperk( perk ) || self maps/mp/zombies/_zm_perks::has_perk_paused( perk ) )
                              			{
                              			}
                              			else
                              			{
                              				self maps/mp/zombies/_zm_perks::give_perk( perk, 0 );
                              				wait 0.25;
                              			}
                              		}
                              	}
                                  if ( getDvarInt( "players_keep_perks_permanently" ) == 1 )
                                  {
                                      if ( !is_true( self._retain_perks ) )
                                      {
                                          self thread watch_for_respawn();
                                          self._retain_perks = 1;
                                      }
                                  }
                              }
                              
                              watch_for_respawn()
                              {
                                  level endon( "end_game" );
                                  self endon( "disconnect" );
                                  while ( true )
                                  {
                                      self waittill_either( "spawned_player", "player_revived" );
                                      wait_network_frame();
                                      self thread sq_give_player_all_perks();
                                      self setmaxhealth( level.zombie_vars[ "zombie_perk_juggernaut_health" ] );
                                  }
                              }
                              

                              You can set this dvar: players_keep_perks_permanently to 1 in your server config for players to never lose perks even if they down, or bleedout. If you play solo with this mod with the dvar set you'll also have infinite quick revives.

                              JuiceTrailer62 Offline
                              JuiceTrailer62 Offline
                              JuiceTrailer62
                              wrote on last edited by
                              #14

                              JezuzLizard Im just now seeing this, pretty cool especially players_keep_perks_permanently couldn't you just use this to give all perks?

                              for( i = 0; i < level.perks.size; i++ ) {
                                  self give_perk( level.perks[ i ] );
                              }
                              
                              1 Reply Last reply
                              0

                              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                              With your input, this post could be even better 💗

                              Register Login
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

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