• 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!
  • Akari, Selene, Mint, Solana - 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.

Check the type

  • 69
    Posts
    15
    Years
    • Seen Sep 26, 2016
    Hey guys, I've a little question:

    How can I check the type of the first pokemon in the team and make conditions?

    I want to make a guy who checks the first pokemon and is giving an item.

    For example: If the first pokemon is a psychic type he will give you a twistedspoon.
    If the first pokemon is an electric type he will give you a magnet.

    Any idea how to set up such an event?

    Thanks a lot guys :-)
     
    Hey guys, I've a little question:

    How can I check the type of the first pokemon in the team and make conditions?

    I want to make a guy who checks the first pokemon and is giving an item.

    For example: If the first pokemon is a psychic type he will give you a twistedspoon.
    If the first pokemon is an electric type he will give you a magnet.

    Any idea how to set up such an event?

    Thanks a lot guys :-)

    Code:
    if $Trainer.party[0].hasType?(:PSYCHIC)
       $PokemonBag.pbStoreItem(:TWISTEDSPOON)
       Kernel.pbMessage("Here's a spoon")
    elsif $Trainer.party[0].hasType?(:ELECTRIC)
       $PokemonBag.pbStoreItem(:MAGNET)
       Kernel.pbMessage("Here's a magnet")
    #more conditions
    end
     
    Thanks a lot for your answer, mej71.
    Can I also check only the first type of the pokemon?
    When I have an Zapdos i will get a Magnet and also a Sharpbreak.
     
    Thanks a lot for your answer, mej71.
    Can I also check only the first type of the pokemon?
    When I have an Zapdos i will get a Magnet and also a Sharpbreak.

    If you're using "elsif" instead of "if" for each check (like mej71's example shows) you should only be getting the first one it comes to in the list of checks. (Only the first check is "if", the rest are "else if"'s which means "if the last if statement didn't come back true, check this one.)
     
    Yeah I see it is a good idea.
    But it would be better if the game is checking the first type of a pokemon.
    Is there no way doing so?
     
    When I put this in the Conditional Branch I get an error:

    $Trainer.party[0].type1==getConst(PBTypes,ELECTRIC)
     
    Back
    Top