• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Akari, Selene, Mint, Solana - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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

  • 224
    Posts
    9
    Years
    • Seen Feb 20, 2025
    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!
     
    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