• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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?

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