Like the pbHasSpecies?(:BULBASAUR), I wanted to make a function that checks the team for a certain type.
I added this in PokemonUtilities:
I made a test event. it's page has this in it:
But whatever pokémon I have in the party, it always says "No BUG type in team." I'm pretty sure the Utitlities code is incorrect but i'm not very experienced with Ruby. Any help?
I added this in PokemonUtilities:
def pbHasType?(types) # Searches team for certain type
if types.is_a?(String)
types=getID(PBTypes,types)
end
for pokemon in $Trainer.party
next if pokemon.egg?
return true if pokemon.getID(PBTypes,types)==types
end
return false
end
I made a test event. it's page has this in it:
Conditional Branch: Script: pbHasType?(:BUG)
Text: BUG type in team.
else
Text: No BUG type in team.
Branch End
But whatever pokémon I have in the party, it always says "No BUG type in team." I'm pretty sure the Utitlities code is incorrect but i'm not very experienced with Ruby. Any help?