• 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 Trading Card Game 2 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.

[Eventing Question] Shiny Locking and given pokemon shiny chance

DarrylBD99

Content Creator and Game Developer
  • 321
    Posts
    4
    Years
    Hey, this might seem like something I should know, but how do you shiny lock an event encounter. Not only that, how do you make it so that way there is a chance to obtain a shiny pokemon by chance from the pbAddPokemon function (if by default it can be shiny by chance, maybe teach me how to shiny lock that as well.) And btw, I am using essentials v18
     
    This code should help with your first problem, it is part of the base essentials version and you'll find it in "PField_EncounterModifiers".
    Code:
    # Make all wild Pokémon shiny while a certain Switch is ON (see Settings).
    Events.onWildPokemonCreate += proc { |sender,e|
      pokemon = e[0]
      if $game_switches[SHINY_WILD_POKEMON_SWITCH]
        pokemon.makeShiny
      end
    }
    For the second question you can add any modifications to new Pokemon inside "pbAddPokemon", making it shiny is also possible. :)
    Code:
    def pbAddPokemon(pokemon,level=nil,seeform=true)
      return if !pokemon
      if pbBoxesFull?
        pbMessage(_INTL("There's no more room for Pokémon!\1"))
        pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
        return false
      end
      pokemon = getID(PBSpecies,pokemon)
      if pokemon.is_a?(Integer) && level.is_a?(Integer)
        pokemon = pbNewPkmn(pokemon,level)
      end
    [COLOR="Red"]  pokemon.makeShiny if $game_switches[XXX][/COLOR]
      speciesname = PBSpecies.getName(pokemon.species)
      pbMessage(_INTL("\\me[Pkmn get]{1} obtained {2}!\1",$Trainer.name,speciesname))
      pbNicknameAndStore(pokemon)
      pbSeenForm(pokemon) if seeform
      return true
    end
     
    This code should help with your first problem, it is part of the base essentials version and you'll find it in "PField_EncounterModifiers".
    Code:
    # Make all wild Pokémon shiny while a certain Switch is ON (see Settings).
    Events.onWildPokemonCreate += proc { |sender,e|
      pokemon = e[0]
      if $game_switches[SHINY_WILD_POKEMON_SWITCH]
        pokemon.makeShiny
      end
    }
    For the second question you can add any modifications to new Pokemon inside "pbAddPokemon", making it shiny is also possible. :)
    Code:
    def pbAddPokemon(pokemon,level=nil,seeform=true)
      return if !pokemon
      if pbBoxesFull?
        pbMessage(_INTL("There's no more room for Pokémon!\1"))
        pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
        return false
      end
      pokemon = getID(PBSpecies,pokemon)
      if pokemon.is_a?(Integer) && level.is_a?(Integer)
        pokemon = pbNewPkmn(pokemon,level)
      end
    [COLOR="Red"]  pokemon.makeShiny if $game_switches[XXX][/COLOR]
      speciesname = PBSpecies.getName(pokemon.species)
      pbMessage(_INTL("\\me[Pkmn get]{1} obtained {2}!\1",$Trainer.name,speciesname))
      pbNicknameAndStore(pokemon)
      pbSeenForm(pokemon) if seeform
      return true
    end

    I appreciate it. However, I think you misunderstood what I meant for the second statement. What I meant to say is that I want it so that way there is a CHANCE of a shiny pokemon from the pbAddPokemon function, not forcing the pokemon to be shiny if a game switch is on.
     
    Mb, here you go for 50% chance:
    Code:
    pokemon.makeShiny if rand(2)==0
    And her for 0.1% chance:
    Code:
    pokemon.makeShiny if rand(1000)==0
     
    Back
    Top