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

Randomized Pokemon Script

8
Posts
7
Years
    • Seen Jun 25, 2018
    Hello! i really love this Script and i was testing a lot.
    Something went wrong in the last script, (Separated balanced and random system)
    when you activat balanced switch alone, it works, but when you activate random switch, its turn both, random and balanced.
     

    esteban

    Pokémon Moon Version
    5
    Posts
    8
    Years
    • Seen Aug 7, 2017
    Hi Umbreon

    I'm having the same problem as a number of other people who replied to your thread seem to be having. It happens when an event Pokémon is given to the player, that being a starter or any other Pokémon given by commands.

    This is the error:

    Code:
     Exception: RuntimeError
      Message: Script error within event 2, map 3 (Luna's Room):
      Exception: ArgumentError
      Message: Section122:891:in `__mf_initialize'The species number (no.  of 802) is invalid.
      ***Full script:
      pbAddPokemon(PBSpecies::ARCANINE,5)
      $Trainer.pokedex=false
    
      Interpreter:243:in `pbExecuteScript'
      Pokemon_MultipleForms:133:in `initializeEvolutionMoves'
      Gen7 Evolution:227:in `randomized_init'
      Randomizer:56:in `initialize'
      PSystem_Utilities:1757:in `new'
      PSystem_Utilities:1757:in `pbAddPokemon'
      (eval):1in `pbExecuteScript'
      Interpreter:1606:in `eval'
      Interpreter:243:in `pbExecuteScript'
      Interpreter:1606:in `command_355'
    
      Interpreter:276:in `pbExecuteScript'
      Interpreter:1606:in `command_355'
      Interpreter:494:in `execute_command'
      Interpreter:193:in `update'
      Interpreter:106:in `loop'
      Interpreter:198:in `update'
    
      Scene_Map:103:in `updateOldFL'
      Scene_Map:101:in `loop'
      Scene_Map:114:in `updateOldFL'
      HUD:120:in `update'
     

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Sorry to necropost but i really want to use that scrip into my game.
    So, i try to put black list but always in sometimes appears. How can fix it?

    my script with black list:
    Spoiler:
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    @WolfPP

    This code:
    Code:
            while RandomizedChallenge::BlackListedPokemon.include?(species)
              species = rand(PBSpecies.maxValue - 1) + 1
            end
    makes it look like the black list would have to contain the species numbers not symbols, because rand returns a number.

    Maybe you could write yourself a function that gets the ID from a symbol, and use that on each element in your list? Possibly it would look a bit like this:

    Code:
      BlackListedPokemon = [
        PBSpecies::MOLTRES,
        ...
      ].map { |p| getConst(PBSpecies,p).id }
     
    Last edited:

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • @WolfPP


    This code:
    Code:
            while RandomizedChallenge::BlackListedPokemon.include?(species)
              species = rand(PBSpecies.maxValue - 1) + 1
            end
    makes it look like the black list would have to contain the species numbers not symbols, because rand returns a number.

    Maybe you could write yourself a function that gets the ID from a symbol, and use that on each element in your list? Possibly it would look a bit like this:

    Code:
      BlackListedPokemon = [
        PBSpecies::MOLTRES,
        ...
      ].map { |p| getConst(PBSpecies,p).id }

    OMG, ty ty!
    i change to this:
    Code:
      ].map {|species| getID(PBSpecies,species) }

    and works fine! until now, no one starter and legendary lol

    Now i want to know how to put a switch to make a encounter by type
    like, if i stay in volcano area, switch x will appears only fire type, or in a sky pillar will appears only fly type, you know?
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Now i want to know how to put a switch to make a encounter by type
    like, if i stay in volcano area, switch x will appears only fire type, or in a sky pillar will appears only fly type, you know?

    Maybe you can do something like:

    Code:
      BlackListedPokemonDefault = [...].map { ... }
      BlackListedPokemonGrass = [...].map { ... }
      BlackListedPokemonVolcano = [...].map { ... }
      ...
    
      def BlackListedPokemon
        case mySwitch
        when 0: return BlackListedPokemonGrass
        when 1: return BlackListedPokemonVolcano
        ...
        else: return BlackListedPokemonDefault
        end
      end

    I don't know about switches, but I guess you know how to set mySwitch when a player enters an area? Or maybe there is some way to find out what route the player is on, and switch on that instead?

    EDIT: Maybe it is easier to use whitelist for these kinds of things? Probably it will be less typing.
     
    Last edited:

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • EDIT: Maybe it is easier to use whitelist for these kinds of things? Probably it will be less typing.

    I agree, but how can i put Types? Like egg generator by FL:

    Code:
    def randomEggBasedOnTypeEntered(helptext)
      typeName = pbEnterText(helptext,0,8)
      typeValidNumber = nil 
      typeAvailable = [:NORMAL,:FIGHTING,:FLYING,:POISON,:GROUND,
          :ROCK,:BUG,:GHOST,:STEEL,:FIRE,:WATER,:GRASS,:ELECTRIC,:PSYCHIC,
          :ICE,:DRAGON,:DARK,:FAIRY]
      for typeSymbol in typeAvailable
        type = getID(PBTypes,typeSymbol)
        if PBTypes.getName(type).downcase == typeName.strip.downcase
          typeValidNumber = type 
          break
        end
      end
      if typeValidNumber
        randomEggGenerator([],false,typeValidNumber)
        return true
      end
      return false
    end

    about the switch, yes, i know how to put it. Player touch etc :D

    ty ty!
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    I agree, but how can i put Types?

    Oh right, I misunderstood.

    Maybe you can use select?

    e.g.

    Code:
    [1, 2, 3].select { |i| i < 3 }

    Returns [1, 2].

    So you could use a select that checks the type of the species?
     
    Last edited:

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Oh right, I misunderstood.

    Maybe you can use select?

    e.g.

    Code:
    [1, 2, 3].select { |i| i < 3 }

    Returns [1, 2].

    So you could use a select that checks the type of the species?

    I didnt :/

    And, unfortunately, i found a treecko in a wild encounter :///////// To sad...
     
    29
    Posts
    5
    Years
    • Seen Feb 27, 2023
    What about a Form Randomizer, which picks a random form of those that are available for each pokemon; or select a range of numbers to randomize, returning the number that will specify the pokemon's form? With that it would be possible to battle Megas and other forms of Arceus/Genesect/Silvally...and so on...

    Thanks for your time! :thumbsup:
     
    27
    Posts
    4
    Years
    • Seen Jul 19, 2023
    I'm using the script for my game and it works fine, but there is one thing that bothers me: If I define any moves for trainer pokemon, the randomized Pokémon will still have this attacks. For example, when I fighted against a randomizied version of my rock gym leader, his randomized pokemon (a Pigeon) still used the attacks of his normal pokemon (a onix). Was funny to see a Pigeon using rock tomb, but it's a little bit stupid. Is there a way to change that?
    Thanks for your time.^^
     
    18
    Posts
    6
    Years
    • Seen Sep 26, 2023
    I'm using this script, but i don't know how to put that the trainers that have pokemon with custom moves, get level moves if you turn on the switch of the script. Can some one help me? (sorry for my bad english)
     
    43
    Posts
    4
    Years
    • He/Him
    • Seen Nov 11, 2023
    If I'm reading this correctly, when the randomizer switch ## is on, when the randomizer affects a Pokemon with custom defined moves, you want the new randomly generated pokemon to have its default moveset instead of the custom defined ones in the PBS files, right?

    1) To do this, go to the PTrainer_NPCTrainers section in your scripts.

    2) You're going to add a "pokemon.resetMoves if $game_switches[##]==true" (where ## is the switch number that turns on the randomizer) in line 62

    Spoiler:


    This is from my old v17.2 file & it works for me.
     

    AskipLudo

    The Masked Guy
    159
    Posts
    7
    Years
  • Hello, I wanted to know if there is a way to change the name in a text when randomizing.

    Exemple; I'm choosing my starters so there is this message "So, you want Bulbasaur, the grass Pokémon?" but it's randomized so shouldn't be "bulbasaur"

    Thanks if someone can hele me ^^

    Also, is there a way to not randomize when reseting?

    EDIT:

    Got this error in non randomized
    Spoiler:
     
    Last edited:
    311
    Posts
    3
    Years
    • Seen Apr 27, 2024
    I got a similar error as the previous user I think... when I go to get my starter in a normal mode (i.e. when the randomizer) is not activated, I got the following error:

    Spoiler:


    I also am curious to know how to make sure that Trainer battles with Pokemon with defined items and move sets are reset to normal move sets when the randomizer does work.
     
    295
    Posts
    5
    Years
    • Seen Aug 15, 2022
    Maybe it's doesn't work in v18 sad I wanted to add a randomizer in my game

    In class PokeBattle_Pokemon
    In def initialize(species,level,player=nil,withMoves=true)

    change
    Code:
    species = getID(PBSpecies,species)
    into
    Code:
        if $game_switches[Randomized::Switch]
          species = Randomized::WhiteListedPokemon.shuffle
          if Randomized::WhiteListedPokemon.length == 0
            random = 1+rand(PBSpecies.maxValue)
            loop do
              if Randomized.isIDBlack(random)
                random = 1+rand(PBSpecies.maxValue)
              else
                break
              end
            end
            species = random
          end
        else
          species = getID(PBSpecies,species)
        end

    Above Main, add
    Code:
    module Randomized
      Switch = 1975 # switch ID to randomize a pokemon, if it's on then ALL
                  # pokemon will be randomized. No exceptions.
                            
      BlackListedPokemon = [:MEW,: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.
      
      def self.isIDBlack(id)
        (0...BlackListedPokemon.size).each{|i|
        if getID(PBSpecies,BlackListedPokemon[i])==id
          return true
          break
        end }
        return false
      end
      
    end

    Credit:
    Umbreon
    bo4p5687 (if you use this)
     
    Back
    Top