• 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, Red, Kris, May - which Pokémon protagonist is your favorite? Let us know by voting in our semifinal favorite protagonist 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.

[Question] How to check the Type of the party's first Pokemon via script, so you need a Pokemon of the correct type to pass the check?

  • 413
    Posts
    5
    Years
    How to check the Type of the party's first Pokemon via script, so you need a Pokemon of the correct type to pass the check?

    For example, a NPC could check if there's a Water Pokemon in your party. If you have one, he says "Cool!" and does nothing else. If you don't have one, he says "You need a Water Pokemon in your party".

    The goal is to make a script with two different outcomes, and the type check determines that outcome.
     
    This function in "PSystem_PokemonUtilities" should help. :)
    Code:
    # Returns true if there is a Pokémon with the given type in the player's party.
    def pbHasType?(type)
      type = getID(PBTypes,type)
      for pokemon in $Trainer.pokemonParty
        return true if pokemon.hasType?(type)
      end
      return false
    end
    Example:
    Code:
    pbHasType?(:GRASS)
     
    Back
    Top