• 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!
  • Cyndy, May, Hero (Conquest), or Wes - 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.

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

  • 224
    Posts
    9
    Years
    • Seen Feb 20, 2025
    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:
    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.
     
    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.
     
    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.
     
    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