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

Randomized Pokemon Script

  • 1,748
    Posts
    15
    Years
    Just as the title states, it randomizes any and all pokemon you encounter. Whether it's a gift, a wild pokemon, or a trainer battle it'll all be random.

    Although, you must activate a switch (see the comments on how to edit the switch number) for it to become active.

    Code:
    ################################################################################
    # Randomized Pokemon Script
    # By Umbreon
    ################################################################################
    # Used for a randomized pokemon challenge mainly.
    # 
    # By randomized, I mean EVERY pokemon will be random, even interacted pokemon
    #   like legendaries. (You may easily disable the randomizer for certain
    #    situations like legendary battles and starter selecting.)
    #
    # To use: simply activate Switch Number X
    #  (X = the number listed After "Switch = ", default is switch number 36.)
    #
    # If you want certain pokemon to NEVER appear, add them inside the black list.
    #  (This does not take into effect if the switch stated above is off.)
    #
    # If you want ONLY certain pokemon to appear, add them to the whitelist. This
    #   is only recommended when the amount of random pokemon available is around
    #   32 or less.(This does not take into effect if the switch stated above is off.)
    #
    ################################################################################
    
    ########################## You may edit any settings below this freely.
    module RandomizedChallenge
      Switch = 36 # switch ID to randomize a pokemon, if it's on then ALL
                  # pokemon will be randomized. No exceptions.
                            
      BlackListedPokemon = [PBSpecies::MEW, PBSpecies::ARCEUS]
      # Pokemon to Black List. Any pokemon in here will NEVER appear.
      
      WhiteListedPokemon = []
      # Leave this empty if all pokemon are allowed, otherwise only pokemon listed
      # above will be selected.
    end
    
    ######################### Do not edit anything below here.
    class PokeBattle_Pokemon
      
      alias randomized_init initialize
      
      def initialize(species,level,player=nil,withMoves=true)
    
        species = RandomizedChallenge::WhiteListedPokemon.shuffle[0]
        
        if $game_switches && $game_switches[RandomizedChallenge::Switch]
          if RandomizedChallenge::WhiteListedPokemon.length == 0
            species = rand(PBSpecies.maxValue - 1) + 1
            while RandomizedChallenge::BlackListedPokemon.include?(species)
              species = rand(PBSpecies.maxValue - 1) + 1
            end
          end
        end
        
        randomized_init(species, level, player, withMoves)
      end
    end
     
    Last edited:
    This is amazing and works perfectly. Thanks! How would you like me to credit you?
     
    Wow I've seen only now this great code, you just made my day!! =)
     
    Can you help me is a simpe dude if i wanted this to be activate by a option in the intro how could i do it so it activates when you select randomized and desactivate when you pick a nuzlocke or history sorry for borhering also great job with this scripts
     
    Can you help me is a simpe dude if i wanted this to be activate by a option in the intro how could i do it so it activates when you select randomized and desactivate when you pick a nuzlocke or history sorry for borhering also great job with this scripts

    There is a line that looks like this in the script:

    Code:
    Switch = 36 # switch ID to randomize a pokemon, if it's on then ALL

    Change "36" to the switch ID of what switch you want for this script to be activated.

    Now in the intro say something like "Enable Random Pokemon? [Yes/No]"

    Under Yes enable the switch mentioned above.
     
    Hi Umbreon,

    I activated the switch, but now, no Pokemon appear at all. I'm not sure what I did wrong...
     
    Hey Umbreon

    Quick question: is there a way to make this script just change wild encounter and not all Pokemon encounter such as gifts and trainer stay the same. But wilds are random.
     
    Hi Umbreon,

    I activated the switch, but now, no Pokemon appear at all. I'm not sure what I did wrong...

    Sorry for the late reply, but it should be fixed now.

    Hey Umbreon

    Quick question: is there a way to make this script just change wild encounter and not all Pokemon encounter such as gifts and trainer stay the same. But wilds are random.

    ^ See above, temporarily disable the switch and then re-enable.
     
    Sorry for the necropost, but I'm getting this error:


    [PokeCommunity.com] Randomized Pokemon Script
     
    ¡Hello! I got an error trying to use the Script, it is only WHEN SWITCH IS OFF.
    when its On all random pokemon and trainer works well! but i need to turn it off sometimes to give a starter pokemon or legendaries, ¿Can anyone helps me? its so much important to me...

    CODE ERROR-----------------------------------------------------

    ---------------------------
    Pokemon Essentials
    ---------------------------
    Exception: ArgumentError

    Message: The species number (no. of 721) is invalid.

    PokeBattle_Pokemon:891:in `__mf_initialize'

    Pokemon_MultipleForms:133:in `randomized_init'

    Randomlocke:54:in `initialize'

    PField_Field:833:in `new'

    PField_Field:833:in `pbGenerateWildPokemon'

    PField_Field:895:in `pbWildBattle'

    PField_Field:1374:in `pbBattleOnStepTaken'

    PField_Field:1398:in `pbOnStepTaken'

    Game_Player:484:in `update_old'

    Walk_Run:76:in `follow_update'



    This exception was logged in

    C:\Users\Victor\Saved Games/Pokemon Essentials/errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    Aceptar
    ---------------------------
     
    ¡Hello! I got an error trying to use the Script, it is only WHEN SWITCH IS OFF.
    when its On all random pokemon and trainer works well! but i need to turn it off sometimes to give a starter pokemon or legendaries, ¿Can anyone helps me? its so much important to me...

    CODE ERROR-----------------------------------------------------

    ---------------------------
    Pokemon Essentials
    ---------------------------
    Exception: ArgumentError

    Message: The species number (no. of 721) is invalid.

    PokeBattle_Pokemon:891:in `__mf_initialize'

    Pokemon_MultipleForms:133:in `randomized_init'

    Randomlocke:54:in `initialize'

    PField_Field:833:in `new'

    PField_Field:833:in `pbGenerateWildPokemon'

    PField_Field:895:in `pbWildBattle'

    PField_Field:1374:in `pbBattleOnStepTaken'

    PField_Field:1398:in `pbOnStepTaken'

    Game_Player:484:in `update_old'

    Walk_Run:76:in `follow_update'



    This exception was logged in

    C:\Users\Victor\Saved Games/Pokemon Essentials/errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    Aceptar
    ---------------------------
    Yupp the exact same thing happened to me
     
    Just as the title states, it randomizes any and all pokemon you encounter. Whether it's a gift, a wild pokemon, or a trainer battle it'll all be random.

    Although, you must activate a switch (see the comments on how to edit the switch number) for it to become active.

    Umbra, your code is slightly broken. It gives an error when it's off if there are no whitelisted Pokemon, because it changes the species to nil first.

    Code:
    class PokeBattle_Pokemon
      
      alias randomized_init initialize
      
      def initialize(species,level,player=nil,withMoves=true)
        
        if $game_switches && $game_switches[RandomizedChallenge::Switch]
          [COLOR="Red"]species = RandomizedChallenge::WhiteListedPokemon.shuffle[0][/COLOR]
          if RandomizedChallenge::WhiteListedPokemon.length == 0
            species = rand(PBSpecies.maxValue - 1) + 1
            while RandomizedChallenge::BlackListedPokemon.include?(species)
              species = rand(PBSpecies.maxValue - 1) + 1
            end
          end
        end
        
        randomized_init(species, level, player, withMoves)
      end
    end

    This fixes the error. I don't need credit. Please update the first post though.
     
    Out of curiosity and desire to create a more customizable experience for players, is there any way to separate the randomization of Trainers' Pokemon and Wild Pokemon into two different switches? How complicated would it be to create something like that?
     
    Out of curiosity and desire to create a more customizable experience for players, is there any way to separate the randomization of Trainers' Pokemon and Wild Pokemon into two different switches? How complicated would it be to create something like that?

    yes there is a way

    Code:
    ################################################################################
    # Pokemon Level Balancing / Pokemon Randomizer 
    # By Umbreon
    ################################################################################
    # Balances any and all pokemon's levels towards the player's party level.
    #
    # NOTE: This won't affect any pokemon the player owns.
    #
    # To use: simply activate Switch Number X
    #  (X = the number listed After "Switch = ", default is switch number 37.)
    #
    #
    ################################################################################
    
    
    module LevelBalance
      Switch = 37 # The switch used to activate/deactivate the level balancing
    end
    
    module Random
      Switch = 36 # The switch used to activate/deactivate the level balancing
    end
    
    class PokeBattle_Pokemon
      
      alias balanced_level_init initialize
      
      def initialize(species,level,player=nil,withMoves=true)
        
        if $game_switches && $game_switches[LevelBalance::Switch] && $Trainer && $Trainer.party.length > 0
          level = pbBalancedLevel($Trainer.party)
        end
        
        if  $game_switches &&  $game_switches[Random::Switch]
          level = pbBalancedLevel($Trainer.party)
          species = rand(PBSpecies.maxValue)- 1
        end
        
          if $game_switches &&  PBTrainers::TEAMROCKET_M  && $game_switches[Random::Switch]
          level = pbBalancedLevel($Trainer.party)
          species = rand(PBSpecies.maxValue)- 1
        end
        
          if $game_switches && PBTrainers::TEAMROCKET_F  && $game_switches[Random::Switch]
          level = pbBalancedLevel($Trainer.party)
          species = rand(PBSpecies.maxValue)- 1
        end
        
        balanced_level_init(species, level, player, withMoves)
      end
    end
     
    Back
    Top