• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Adding new bag pockets doesn't work?

Enigmatic Emolga

abandoned account, pls delete if seen
30
Posts
11
Years
  • Hi again. So I checked out the Wiki's page for the bag and noticed that the only thing you need to do to add more pockets is add their names and properties in the script "Settings". I added two pockets and their properties without modifying anything else, but I got this error:
    Spoiler:

    Does anyone know what went wrong here?
     
    1,224
    Posts
    10
    Years
  • Hi again. So I checked out the Wiki's page for the bag and noticed that the only thing you need to do to add more pockets is add their names and properties in the script "Settings". I added two pockets and their properties without modifying anything else, but I got this error:
    Spoiler:

    Does anyone know what went wrong here?

    Did you start a new game, or reinitialize your bag? If not, your new pockets were not created in your bag yet technically, and you need to do that.
     

    Enigmatic Emolga

    abandoned account, pls delete if seen
    30
    Posts
    11
    Years
  • Oh, haven't done either yet. As I don't really want to start a new game, how would I go about reinitializing my bag?
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Go into the scripts and find class PokemonBag. In there, find def rearrange. Replace it with this code:

    Code:
      def rearrange
        if (@pockets.length-1)!=PokemonBag.numPockets
          newpockets=[]
          for i in 0..PokemonBag.numPockets
            newpockets[i]=[]
            @choices[i]=0 if !@choices[i]
          end
          nump=PokemonBag.numPockets
          for i in [email protected]
            for item in @pockets[i]
              p=pbGetPocket(item[0])
              newpockets[p].push(item) if p<=nump
            end
          end
          @pockets=newpockets
        end
      end
    As I don't really want to start a new game
    By the way, this attitude really won't help you. If the number of pockets is changing, the game is still being made, so any save file you have is for debug purposes which, while useful, can easily be recreated by debug processes. There's no good reason you would want to keep your save file while changing the Bag pockets.
     
    Last edited:

    Enigmatic Emolga

    abandoned account, pls delete if seen
    30
    Posts
    11
    Years
  • Good point. I never really bothered to change the bag pockets around until now, and I was only really testing things like maps and Mega Evolutions, so I just kept the save file I had.
     
    1,224
    Posts
    10
    Years
  • Go into the scripts and find class PokemonBag. In there, find def rearrange. Replace it with this code:

    Code:
      def rearrange
        if @pockets.length!=PokemonBag.numPockets
          newpockets=[]
          for i in 0..PokemonBag.numPockets
            newpockets[i]=[]
            @choices[i]=0 if !@choices[i]
          end
          nump=PokemonBag.numPockets
          for i in [email protected]
            for item in @pockets[i]
              p=pbGetPocket(item[0])
              newpockets[p].push(item) if p<nump
            end
          end
          @pockets=newpockets
        end
      end


    By the way, this attitude really won't help you. If the number of pockets is changing, the game is still being made, so any save file you have is for debug purposes which, while useful, can easily be recreated by debug processes. There's no good reason you would want to keep your save file while changing the Bag pockets.

    Code:
      def rearrange
       [COLOR="Red"] if (@pockets.length-1)!=PokemonBag.numPockets[/COLOR]
          newpockets=[]
          for i in 0..PokemonBag.numPockets
            newpockets[i]=[]
            @choices[i]=0 if !@choices[i]
          end
          nump=PokemonBag.numPockets
          for i in [email protected]
            for item in @pockets[i]
              p=pbGetPocket(item[0])
              newpockets[p].push(item) if p<nump
            end
          end
          @pockets=newpockets
        end
      end

    This was slightly incorrect, and messed up pockets for existing games
     
    658
    Posts
    7
    Years
  • Is there any safer option without removing items in the player's bag?

    I don't think so. You need to create a new Bag Object to reinitialise the bag data. Or then you'd have to go about with some jank way to save each individual bag item and add them to the new bag silently. Honestly leave the Bag Pocket update for an update where you are gonna add new Pokemon or something, because then the players are gonna have to start a new save anyways.
     
    Back
    Top