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

check pokemon-type?

  • 8
    Posts
    9
    Years
    • Seen Sep 8, 2015
    Is there a Contitinal Branch or something, that can check if I have a curtain type of pokemon in my team?
     
    Add this in the scripts, in PSystem_Utilities. I have it right below the "pbHasSpecies?" function.

    Code:
    def pbHasPokemonType?(type)
      if type.is_a?(String) || type.is_a?(Symbol)
        type=getID(PBTypes,type)
      end
      for pokemon in $Trainer.party
        next if pokemon.isEgg?
        return true if pokemon.hasType?(type)
      end
      return false
    end

    you can then in the events, use, for example, "pbHasPokemonType?( :FIGHTING)" to test if the player has a Fighting type with them.
     
    I'm trying to use your script in my project but it's not working, dose it still work in v21.1 or am I doing something wrong?
     
    I'm trying to use your script in my project but it's not working, dose it still work in v21.1 or am I doing something wrong?

    Code:
    $player.has_pokemon_of_type?(:NORMAL)

    This returns true if there is a Pokémon in the player's party of the specified type, false if there is no such Pokémon in the party or if the specified type doesn't exist.
     
    Code:
    $player.has_pokemon_of_type?(:NORMAL)

    This returns true if there is a Pokémon in the player's party of the specified type, false if there is no such Pokémon in the party or if the specified type doesn't exist.
    Thank you! But what if I want to only read the first type of a Pokemon? e.g. Gloom = GRASS & POISON, so the NPC will only say or do the thing coz of the GRASS typing.
     
    Thank you! But what if I want to only read the first type of a Pokemon? e.g. Gloom = GRASS & POISON, so the NPC will only say or do the thing coz of the GRASS typing.

    I don't know of a ready-made method that checks the player's party for a specific primary type. But you could try inserting this custom script into the script editor:

    Ruby:
    # checks whether party contains at least one Pokémon of some specified primary type
    def checkPrimaryType(targettype)
      $player.party.each do |pkmn|
        primarytype = pkmn.types[0]
        return true if primarytype == targettype
      end
      return false
    end

    Example:
    checkPrimaryType(:NORMAL) would return true if there is at least one Pokémon in the party with a primary typing of NORMAL, and false in all other circumstances.
     
    I don't know of a ready-made method that checks the player's party for a specific primary type. But you could try inserting this custom script into the script editor:

    Ruby:
    # checks whether party contains at least one Pokémon of some specified primary type
    def checkPrimaryType(targettype)
      $player.party.each do |pkmn|
        primarytype = pkmn.types[0]
        return true if primarytype == targettype
      end
      return false
    end

    Example:
    checkPrimaryType(:NORMAL) would return true if there is at least one Pokémon in the party with a primary typing of NORMAL, and false in all other circumstances.
    OH WOW!! Thank you, I'll try it out and report back. You've very kind :)
     
    Back
    Top