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

[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?

429
Posts
4
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.
     
    143
    Posts
    4
    Years
    • Seen Mar 26, 2024
    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