• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Scottie, Todd, Serena, Kris - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

Undefined method length error?

  • 59
    Posts
    9
    Years
    • Seen Aug 9, 2020
    This happens when a field encounter is generated:
    Code:
    Exception: NoMethodError
    
    Message: undefined method `length' for nil:NilClass
    
    PokemonBag:421:in `pbQuantity'
    
    PokemonField:977:in `pbGenerateWildPokemon'
    
    PokemonField:1009:in `pbWildBattle'
    
    PokemonField:1473:in `pbBattleOnStepTaken'
    
    PokemonField:1497:in `pbOnStepTaken'
    
    Game_Player_:449:in `update_old'
    
    Walk_Run:75:in `update'
    
    Scene_Map:104:in `update'
    
    Scene_Map:101:in `loop'
    
    Scene_Map:114:in `update'

    And this happens when the encounter is generated through Debug mode:

    Code:
    Exception: NoMethodError
    
    Message: undefined method `length' for nil:NilClass
    
    PokemonBag:421:in `pbQuantity'
    
    PokemonField:977:in `pbGenerateWildPokemon'
    
    PokemonField:1009:in `pbWildBattle'
    
    PokemonDebug:753:in `pbDebugMenu'
    
    PokemonDebug:297:in `loop'
    
    PokemonDebug:823:in `pbDebugMenu'
    
    PokemonPauseMenu:242:in `pbStartPokemonMenu'
    
    PokemonPauseMenu:241:in `pbFadeOutIn'
    
    PokemonPauseMenu:241:in `pbStartPokemonMenu'
    
    PokemonPauseMenu:142:in `loop'

    I haven't modified any of the scripts the error log lists. It started happening simply when I deleted some maps and started a new game. Trainer battles function perfectly. I started using a text comparer with my -small- edits and the stock Essentials and there is no difference in those scripts. Where should I keep looking?
     
    Did you change how many Bag pockets you have? And did you start a new game after doing so, or did you assume that using an old save was okay?
     
    hey maruno
    im not the op but as this is such a recent topic ill quickly ask my own similar problem here

    i edited the amount of bag slots and then (obviously) got the same error.
    i immediatly knew that it had something to do with it because that was the only thing i changed.
    i started a new game (i have never saved while debugging to begin with) and still got the error.

    i have changed the bag slot for potential items so they dont appear in bag slots that dont exist at the start.
    then i then wanted to test something else and then got the error from an encounter.

    so as u already had a suspicion:
    what more do i have to change to make a changed number of bag slots work?

    if i should make a new post or post my modifications let me know.

    thx for your time in advance :)

    EDIT: ok got it working. i had a single **** typo in the reworked items file that assigned an item to a pocket that didnt exist.
     
    Last edited:
    Back
    Top