• 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.

Editing the Pokédex

16
Posts
10
Years
    • Seen Dec 21, 2019
    Hi,
    I'm working on my first game and I'm trying to edit the pokedex in such a way so you can not only check if you own a pokemon, but also can check if you currently own a pokemon (so all the pokemon in your boxes and your party). All pokemon that you've traded, released or evolved are currently marked as "owned" even if you don't own one at the moment. For those who remember, this was in Stadium 2 also: htt p://imgu r.com/jddCPKN (remove spaces as I'm not allowed yet to post links)

    So I want
    -a normal red/white pokeball if you have that species in your boxes/party
    -a grey pokeball if you once have onwed that species
    -a white box if you only have seen that species

    I've edited this on the PokemonPokedex script:

    This:
    Spoiler:

    I've changed into this:

    Spoiler:

    (I know it only checks the boxes and not the party, but I'll do that later)

    and this:
    Spoiler:

    into this:
    Spoiler:

    Offcourse I've also placed the right images in the right folders.

    When I try to test it, it gives no error, but when I open the Pokédex the game crashes.
    No error or error log, just not responding.

    Any idea what I've done wrong?
    Any help is appriciated
    P.S. sorry if my English isn't good, it's not my first language.
     
    • Like
    Reactions: FL
    1,224
    Posts
    10
    Years
  • Code:
    while hasinbox==false
    for i in 0...$PokemonStorage.maxBoxes
    for j in 0...$PokemonStorage.maxPokemon(i)
    hasinbox=($PokemonStorage[i][j]==species)
    end
    end
    end

    This is creating an endless loop for you. You don't even need the while here.

    Code:
    for i in 0...$PokemonStorage.maxBoxes
    for j in 0...$PokemonStorage.maxPokemon(i)
    if $PokemonStorage[i][j]==species
    hasinbox=true
    end
    end
    end
     
    16
    Posts
    10
    Years
    • Seen Dec 21, 2019
    Thanks,
    I've changed my it and now it doesn't crash, but it only show's me a grey pokeball even when I've that species in my computer.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    $PokemonStorage[j] is a PokeBattle_Pokemon object. You're trying to compare it to a number, which is obviously never going to be the same. Use if $PokemonStorage[j] && $PokemonStorage[j]==species instead.
     
    16
    Posts
    10
    Years
    • Seen Dec 21, 2019
    To be honest, I don't really understand why $PokemonStorage[j]"has to be put infront, but it works now exactly as I'd like it.
    (I only had to change it into: $PokemonStorage[j] && $PokemonStorage[j].species==species)
    So thank you mej71 and Maruno, my problem is solved.
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen yesterday
    Code:
    for i in 0...$PokemonStorage.maxBoxes
      for j in 0...$PokemonStorage.maxPokemon(i)
        if $PokemonStorage[i][j]==species
          hasinbox=true
        end
      end
    end
    I really suggest you to use a 'break' line after 'hasinbox=true', since there's no meaning for continuing searching something that you already found. I also suggest for creating a boolean array with all species that you have in the box rather than checking the ENTIRE box storage for every single line. You earn a lot in performance.
     
    Back
    Top