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

Checking the species of a Pok?mon chosen from the party

226
Posts
8
Years
    • Seen Jul 19, 2023
    Checking the species of a Pokémon chosen from the party

    Hello,

    I'm trying to make an event where the player is asked to choose a Pokemon. Depending on which one he chooses, the outcome of the event will be different.

    I got this:

    Code:
    pbChoosePokemon(1,2,
    proc {|poke|
     !poke.egg? &&
     !(poke.isShadow? rescue false)
    })
    
    pbSet(2,pbGetPokemon(1).species)
    
    Conditional Branch: Variable [0001] <0
    Text: Cancelled
    Exit Event Processing
    Branch End
    
    Conditional Branch: Script: [COLOR=Red]pbGetPokemon(1).species=PBSpecies::PIKACHU[/COLOR]
    Text: Blabla
    Exit Event Processing
    Branch End
    I can't find the right way to get the red part working. Right now it doesn't return any error but it doesn't work (if I choose a Pikachu it doesn't do anything).
     
    Last edited by a moderator:

    HackerTDog

    Hacker
    11
    Posts
    10
    Years
  • Hey there,

    I've solved your problem.

    What you're doing wrong is retrieving the pokemon in the game variable 1 which is redundant.

    What you're supposed to do is specify the pokemon in the first block of code so you change it to this instead
    pbChoosePokemon(1,2,
    proc {|poke|
    !poke.egg? &&
    !(poke.isShadow? rescue false) &&
    poke.species==PBSpecies::PIKACHU
    })
    Now it'll recognise that you specifically want a pikachu.

    Hope this helped.
     
    226
    Posts
    8
    Years
    • Seen Jul 19, 2023
    I thought about doing that, but it won't let me define more than 1 species.

    I need to set up my event so that depending on the Pokemon you choose, the following lines may differ. So I need to retrieve the Pokemon in a variable and question it several times:

    Conditional Branch: Script: pbGetPokemon(1).species=PBSpecies: PIKACHU
    Text: Oh! You found a Pikachu! Take this!
    Exit Event Processing
    Branch End

    Conditional Branch: Script: pbGetPokemon(1).species=PBSpecies: RATTATA
    Text: A Rattata, how cute!
    Exit Event Processing
    Branch End

    Conditional Branch: Script: pbGetPokemon(1).species=PBSpecies: CATERPIE
    Text: I hate Caterpie!
    Exit Event Processing
    Branch End

    Except the script I use isn't working.
     
    226
    Posts
    8
    Years
    • Seen Jul 19, 2023
    Okay I found a way:

    pbSet(2,pbGetPokemon(1).species)
    Conditional Branch: Variable [0002: Temp Move Choice] = = 25
    Text: Oh! You found a Pikachu! Take this!
    Exit Event Processing
    Branch End

    ".species" is storing the number of the Pokemon and not the species name... It makes sense.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Your original code looked fine. It's just that the bit in red needed to use == rather than =, because you're comparing two values to see if they're equal.

    Or you could use isConst?(pbGetPokemon(1).species,PBSpecies,:PIKACHU).
     
    Back
    Top