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

Checking for shadow/shiny Pokemon

226
Posts
8
Years
  • Age 32
  • Seen Jul 19, 2023
I was interested in checking the player's party for a shadow Pokemon and I thought I could use this:

Conditional Branch: Script: pbCheckAble($Trainer.party[0])
Script: poke=$Trainer.pokemonParty[0]
Script: poke.isShadow?
...

However the last line will not work. Does anyone know how to write it properly?

Also, I check each Pokemon one by one, but if an easier way of doing things exists (scanning the whole party for a shadow Pokemon in a single command), it would be cleaner.

I guess it would work in a similar way for shinies.

Thanks in advance!
 
824
Posts
8
Years
Put these two functions in PSystem_Utilities:

Code:
def pbHasShiny?(species=nil)
  if species!=nil
    if species.is_a?(String) || species.is_a?(Symbol)
      species=getID(PBSpecies,species)
    end
    for pokemon in $Trainer.party
      next if pokemon.isEgg?
      return true if pokemon.species==species && pokemon.isShiny?
    end
  else
    for pokemon in $Trainer.party
      next if pokemon.isEgg?
      return true if pokemon.isShiny?
    end
  end
  return false
end

def pbHasShadow?(species=nil)
  if species!=nil
    if species.is_a?(String) || species.is_a?(Symbol)
      species=getID(PBSpecies,species)
    end
    for pokemon in $Trainer.party
      next if pokemon.isEgg?
      return true if pokemon.species==species && (pokemon.isShadow? rescue false)
    end
  else
    for pokemon in $Trainer.party
      next if pokemon.isEgg?
      return true if (pokemon.isShadow? rescue false)
    end
  end
  return false
end

now you can check for a Shadow Pokemon with Conditional Branch: Script: pbHasShadow?(), and can even specify a certain species of Shadow Pokemon if you want (either using the :BULBASAUR method or the "Bulbasaur" method. If no species is specified it goes for any Shadow Pokemon). pbHasShiny?() works similarly.
 
Back
Top