• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • 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.

[Error] Pokemon Boxes Won't Hold 30 Pokemon

  • 6
    Posts
    5
    Years
    • Seen Jul 5, 2020
    For some odd reason when I fill boxes using debug there is this weird dead space in the box where it doesn't allow me to put any pokemon(as shown in thumbnail and attached file). Does anyone have any idea whats going on and how to fix it?
     

    Attachments

    • [PokeCommunity.com] Pokemon Boxes Won't Hold 30 Pokemon
      Pokemon Surreal Dream 12_23_2019 10_14_52 PM.png
      30.2 KB · Views: 25
    Have you changed any box scripts? If so, could you give us your storage system code that includes your changes so we can help you. Thanks!
     
    Have you changed any box scripts? If so, could you give us your storage system code that includes your changes so we can help you. Thanks!
    class PokemonBox
    attr_reader :pokemon
    attr_accessor :name
    attr_accessor :background

    def initialize(name,maxPokemon=30)
    @pokemon = []
    @name = name
    @background = 0
    for i in 0...maxPokemon
    @pokemon = nil
    end
    end

    def length
    return @pokemon.length
    end

    def nitems
    return @pokemon.nitems
    end

    def full?
    return (@pokemon.nitems==self.length)
    end

    def empty?
    return (@pokemon.nitems==0)
    end

    def [](i)
    return @pokemon
    end

    def []=(i,value)
    @pokemon = value
    end

    def each
    @pokemon.each{|item| yield item}
    end

    def clear
    @pokemon.clear
    end
    end



    class PokemonStorage
    attr_reader :boxes
    attr_accessor :currentBox
    attr_writer :unlockedWallpapers
    BASICWALLPAPERQTY = 16

    def initialize(maxBoxes=STORAGEBOXES,maxPokemon=20)
    @boxes = []
    for i in 0...maxBoxes
    @boxes = PokemonBox.new(_INTL("Box {1}",i+1),maxPokemon)
    @boxes.background = i%BASICWALLPAPERQTY
    end
    @currentBox = 0
    @boxmode = -1
    @unlockedWallpapers = []
    for i in 0...allWallpapers.length
    @unlockedWallpapers = false
    end
    end

    def allWallpapers
    return [
    # Basic wallpapers
    _INTL("Forest"),_INTL("City"),_INTL("Desert"),_INTL("Savanna"),
    _INTL("Crag"),_INTL("Volcano"),_INTL("Snow"),_INTL("Cave"),
    _INTL("Beach"),_INTL("Seafloor"),_INTL("River"),_INTL("Sky"),
    _INTL("Poké Center"),_INTL("Machine"),_INTL("Checks"),_INTL("Simple"),
    # Special wallpapers
    _INTL("Space"),_INTL("Backyard"),_INTL("Nostalgic 1"),_INTL("Torchic"),
    _INTL("Trio 1"),_INTL("PikaPika 1"),_INTL("Legend 1"),_INTL("Team Galactic 1"),
    _INTL("Distortion"),_INTL("Contest"),_INTL("Nostalgic 2"),_INTL("Croagunk"),
    _INTL("Trio 2"),_INTL("PikaPika 2"),_INTL("Legend 2"),_INTL("Team Galactic 2"),
    _INTL("Heart"),_INTL("Soul"),_INTL("Big Brother"),_INTL("Pokéathlon"),
    _INTL("Trio 3"),_INTL("Spiky Pika"),_INTL("Kimono Girl"),_INTL("Revival")
    ]
    end

    def unlockedWallpapers
    @unlockedWallpapers = [] if !@unlockedWallpapers
    return @unlockedWallpapers
    end

    def availableWallpapers
    ret = [[],[]] # Names, IDs
    papers = allWallpapers
    @unlockedWallpapers = [] if !@unlockedWallpapers
    for i in 0...papers.length
    next if !isAvailableWallpaper(i)
    ret[0].push(papers); ret[1].push(i)
    end
    return ret
    end

    def isAvailableWallpaper(i)
    @unlockedWallpapers = [] if !@unlockedWallpapers
    return true if i<BASICWALLPAPERQTY
    return true if @unlockedWallpapers
    return false
    end

    def party
    $Trainer.party
    end

    def party=(value)
    raise ArgumentError.new("Not supported")
    end

    def maxBoxes
    return @boxes.length
    end

    def maxPokemon(box)
    return 0 if box>=self.maxBoxes
    return (box<0) ? 6 : self[box].length
    end

    def full?
    for i in 0...self.maxBoxes
    return false if !@boxes.full?
    end
    return true
    end

    def pbFirstFreePos(box)
    if box==-1
    ret = self.party.nitems
    return (ret==6) ? -1 : ret
    else
    for i in 0...maxPokemon(box)
    return i if !self[box,i]
    end
    return -1
    end
    end

    def [](x,y=nil)
    if y==nil
    return (x==-1) ? self.party : @boxes[x]
    else
    for i in @boxes
    raise "Box is a Pokémon, not a box" if i.is_a?(PokeBattle_Pokemon)
    end
    return (x==-1) ? self.party[y] : @boxes[x][y]
    end
    end

    def []=(x,y,value)
    if x==-1
    self.party[y] = value
    else
    @boxes[x][y] = value
    end
    end

    def pbCopy(boxDst,indexDst,boxSrc,indexSrc)
    if indexDst<0 && boxDst<self.maxBoxes
    found = false
    for i in 0...maxPokemon(boxDst)
    if !self[boxDst,i]
    found = true
    indexDst = i
    break
    end
    end
    return false if !found
    end
    if boxDst==-1
    return false if self.party.nitems>=6
    self.party[self.party.length] = self[boxSrc,indexSrc]
    self.party.compact!
    else
    pkmn = self[boxSrc,indexSrc]
    if !pkmn
    raise "Trying to copy nil to storage"
    end
    pkmn.heal
    pkmn.formTime = nil if pkmn.respond_to?("formTime") && pkmn.formTime
    self[boxDst,indexDst] = pkmn
    end
    return true
    end

    def pbMove(boxDst,indexDst,boxSrc,indexSrc)
    return false if !pbCopy(boxDst,indexDst,boxSrc,indexSrc)
    pbDelete(boxSrc,indexSrc)
    return true
    end

    def pbMoveCaughtToParty(pkmn)
    return false if self.party.nitems>=6
    self.party[self.party.length] = pkmn
    end

    def pbMoveCaughtToBox(pkmn,box)
    for i in 0...maxPokemon(box)
    if self[box,i]==nil
    if box>=0
    pkmn.heal
    pkmn.formTime = nil if pkmn.respond_to?("formTime") && pkmn.formTime
    end
    self[box,i] = pkmn
    return true
    end
    end
    return false
    end

    def pbStoreCaught(pkmn)
    for i in 0...maxPokemon(@currentBox)
    if self[@currentBox,i]==nil
    self[@currentBox,i] = pkmn
    return @currentBox
    end
    end
    for j in 0...self.maxBoxes
    for i in 0...maxPokemon(j)
    if self[j,i]==nil
    self[j,i] = pkmn
    @currentBox = j
    return @currentBox
    end
    end
    end
    return -1
    end

    def pbDelete(box,index)
    if self[box,index]
    self[box,index] = nil
    self.party.compact! if box==-1
    end
    end

    def clear
    for i in 0...self.maxBoxes
    @boxes.clear
    end
    end
    end



    #===============================================================================
    # Regional Storage scripts
    #===============================================================================
    class RegionalStorage
    def initialize
    @storages = []
    @lastmap = -1
    @rgnmap = -1
    end

    def getCurrentStorage
    if !$game_map
    raise _INTL("The player is not on a map, so the region could not be determined.")
    end
    if @lastmap!=$game_map.map_id
    @rgnmap = pbGetCurrentRegion # may access file IO, so caching result
    @lastmap = $game_map.map_id
    end
    if @rgnmap<0
    raise _INTL("The current map has no region set. Please set the MapPosition metadata setting for this map.")
    end
    if !@storages[@rgnmap]
    @storages[@rgnmap] = PokemonStorage.new
    end
    return @storages[@rgnmap]
    end

    def allWallpapers
    return getCurrentStorage.allWallpapers
    end

    def availableWallpapers
    return getCurrentStorage.availableWallpapers
    end

    def unlockWallpaper(index)
    getCurrentStorage.unlockWallpaper(index)
    end

    def boxes
    return getCurrentStorage.boxes
    end

    def party
    return getCurrentStorage.party
    end

    def maxBoxes
    return getCurrentStorage.maxBoxes
    end

    def maxPokemon(box)
    return getCurrentStorage.maxPokemon(box)
    end

    def full?
    getCurrentStorage.full?
    end

    def currentBox
    return getCurrentStorage.currentBox
    end

    def currentBox=(value)
    getCurrentStorage.currentBox = value
    end

    def [](x,y=nil)
    getCurrentStorage[x,y]
    end

    def []=(x,y,value)
    getCurrentStorage[x,y] = value
    end

    def pbFirstFreePos(box)
    getCurrentStorage.pbFirstFreePos(box)
    end

    def pbCopy(boxDst,indexDst,boxSrc,indexSrc)
    getCurrentStorage.pbCopy(boxDst,indexDst,boxSrc,indexSrc)
    end

    def pbMove(boxDst,indexDst,boxSrc,indexSrc)
    getCurrentStorage.pbCopy(boxDst,indexDst,boxSrc,indexSrc)
    end

    def pbMoveCaughtToParty(pkmn)
    getCurrentStorage.pbMoveCaughtToParty(pkmn)
    end

    def pbMoveCaughtToBox(pkmn,box)
    getCurrentStorage.pbMoveCaughtToBox(pkmn,box)
    end

    def pbStoreCaught(pkmn)
    getCurrentStorage.pbStoreCaught(pkmn)
    end

    def pbDelete(box,index)
    getCurrentStorage.pbDelete(pkmn)
    end
    end



    #===============================================================================
    #
    #===============================================================================
    def pbUnlockWallpaper(index)
    $PokemonStorage.unlockedWallpapers[index] = true
    end

    def pbLockWallpaper(index) # Don't know why you'd want to do this
    $PokemonStorage.unlockedWallpapers[index] = false
    end
     
    Have you changed any box scripts? If so, could you give us your storage system code that includes your changes so we can help you. Thanks!

    I actually have one more problem. now that I fixed it I get

    [Pokémon Essentials version 17.2]

    Exception: NoMethodError

    Message: undefined method `length' for nil:NilClass

    Pokemon_Storage:119:in `maxBoxes'

    Pokemon_Storage:123:in `maxPokemon'

    Debug_Menu:456:in `pbDebugMenuActions'

    Debug_Menu:449:in `each'

    Debug_Menu:449:in `pbDebugMenuActions'

    Debug_Menu:744:in `pbDebugMenu'

    Debug_Menu:710:in `loop'

    Debug_Menu:746:in `pbDebugMenu'

    PScreen_PauseMenu:251:in `pbStartPokemonMenu'

    PScreen_PauseMenu:250:in `pbFadeOutIn'


    Do you have any idea how to fix this?
     
    Pokemon_Storage:119:in `maxBoxes'

    Pokemon_Storage:123:in `maxPokemon'

    Well, what's at lines 119 and 123 of Pokemon_Storage?

    Also you changed the max pokemon from 20 to something, what did you change it to?
    (Obviously you didn't just delete it, right? Since of course it wouldn't be able to find a length if you don't initialise one.)
     
    Have you started a new game and tried it? This should always be the first thing you try to solve a problem you can't immediately figure out.
     
    Back
    Top