Skip to content
  • 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 2.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Doobundefined Offline
    Doobundefined 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
    • Sorexundefined Offline
      Sorexundefined 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
      • Doobundefined Offline
        Doobundefined Offline
        Doob
        wrote on last edited by
        #3

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

        birchyundefined GerardS0406undefined 2 Replies Last reply
        0
        • birchyundefined Offline
          birchyundefined Offline
          birchy
          replied to Doob 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
          • Doobundefined Offline
            Doobundefined 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?

            JezuzLizardundefined 1 Reply Last reply
            0
            • Sorexundefined Offline
              Sorexundefined 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 Sorenundefined 1 Reply Last reply
              1
              • JezuzLizardundefined Offline
                JezuzLizardundefined Offline
                JezuzLizard Plutonium Staff
                replied to Doob 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.

                Doobundefined RuinasYm0_0undefined JuiceTrailer62undefined 3 Replies Last reply
                4
                • Doobundefined Offline
                  Doobundefined Offline
                  Doob
                  replied to JezuzLizard 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.

                  JezuzLizardundefined 1 Reply Last reply
                  0
                  • JezuzLizardundefined Offline
                    JezuzLizardundefined Offline
                    JezuzLizard Plutonium Staff
                    replied to Doob 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
                    • David23undefined Offline
                      David23undefined 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
                      • GerardS0406undefined Offline
                        GerardS0406undefined Offline
                        GerardS0406 VIP
                        replied to Doob on last edited by
                        #11
                        This post is deleted!
                        1 Reply Last reply
                        0
                        • RuinasYm0_0undefined Offline
                          RuinasYm0_0undefined Offline
                          RuinasYm0_0
                          replied to JezuzLizard on last edited by
                          #12
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • Vin Sorenundefined Offline
                            Vin Sorenundefined Offline
                            Vin Soren
                            replied to Sorex 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
                            • JuiceTrailer62undefined Offline
                              JuiceTrailer62undefined Offline
                              JuiceTrailer62
                              replied to JezuzLizard 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

                              • Login

                              • Don't have an account? Register

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