The PokéCommunity Forums Fan Games Game Development Scripts & Tutorials
Essentials Script Randomized Pokemon Script

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Reply
 
Thread Tools
  #1    
Old June 8th, 2014 (3:24 PM). Edited September 27th, 2015 by ☆Rei☆.
☆Rei☆'s Avatar
☆Rei☆ ☆Rei☆ is offline
 
Join Date: Aug 2009
Location: Nearby my feet.
Age: 21
Gender: Female
Nature: Calm
Posts: 1,746
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
Reply With Quote
  #2    
Old June 9th, 2014 (10:20 AM).
bbwong91900 bbwong91900 is offline
     
    Join Date: Dec 2013
    Gender: Male
    Posts: 15
    This is amazing and works perfectly. Thanks! How would you like me to credit you?
    Reply With Quote
      #3    
    Old June 9th, 2014 (12:00 PM).
    ☆Rei☆'s Avatar
    ☆Rei☆ ☆Rei☆ is offline
     
    Join Date: Aug 2009
    Location: Nearby my feet.
    Age: 21
    Gender: Female
    Nature: Calm
    Posts: 1,746
    I don't really require any credits but if you want just add "Umbreon" in your credits
    Reply With Quote
      #4    
    Old January 20th, 2015 (11:43 AM).
    Pumone Pumone is offline
       
      Join Date: Oct 2013
      Gender: Female
      Posts: 47
      Wow I've seen only now this great code, you just made my day!! =)
      Reply With Quote
        #5    
      Old July 11th, 2015 (11:49 AM).
      Schrroms's Avatar
      Schrroms Schrroms is offline
      Pokémon Infinite Fusion dev
         
        Join Date: Apr 2015
        Location: Canada
        Gender: Male
        Posts: 258
        Awesome, this is exactly what I needed for my game!
        Thanks, I'll credit you of course!
        __________________
        Reply With Quote
          #6    
        Old July 24th, 2015 (6:03 PM).
        Pokemoner1 Pokemoner1 is offline
           
          Join Date: Jul 2015
          Posts: 11
          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
          Reply With Quote
            #7    
          Old July 25th, 2015 (6:01 AM).
          ☆Rei☆'s Avatar
          ☆Rei☆ ☆Rei☆ is offline
           
          Join Date: Aug 2009
          Location: Nearby my feet.
          Age: 21
          Gender: Female
          Nature: Calm
          Posts: 1,746
          Quote:
          Originally Posted by Pokemoner1 View Post
          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.
          Reply With Quote
            #8    
          Old August 3rd, 2015 (10:37 AM).
          phantomness phantomness is offline
             
            Join Date: Jun 2006
            Gender:
            Nature: Adamant
            Posts: 220
            Hi Umbreon,

            I activated the switch, but now, no Pokemon appear at all. I'm not sure what I did wrong...
            __________________
            Watashi wa Phantomness desu. Hajimemamuke. Douzo yoroshiku. I created Championshipping (Lance x Ash/Red). My webpage is www.geocities.com/shadowphantomness. Fanfics galore + Lance shrine!
            Reply With Quote
              #9    
            Old September 24th, 2015 (1:11 PM).
            ReVaN777's Avatar
            ReVaN777 ReVaN777 is offline
            Creator of Pokemon Titanium
               
              Join Date: Feb 2012
              Location: Moreno Valley, CA
              Gender: Male
              Nature: Calm
              Posts: 108
              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.
              __________________
              Khaos Projects
              Reply With Quote
                #10    
              Old September 27th, 2015 (10:13 AM).
              ☆Rei☆'s Avatar
              ☆Rei☆ ☆Rei☆ is offline
               
              Join Date: Aug 2009
              Location: Nearby my feet.
              Age: 21
              Gender: Female
              Nature: Calm
              Posts: 1,746
              Quote:
              Originally Posted by phantomness View Post
              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.

              Quote:
              Originally Posted by ReVaN777 View Post
              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.
              Reply With Quote
                #11    
              Old March 29th, 2016 (2:42 AM).
              Helric's Avatar
              Helric Helric is offline
              Legendary Batcher
                 
                Join Date: Aug 2015
                Posts: 6
                Sorry for the necropost, but I'm getting this error:


                Reply With Quote
                  #12    
                Old April 1st, 2016 (8:36 AM).
                Leon Draceus's Avatar
                Leon Draceus Leon Draceus is offline
                Palette Works Leader
                   
                  Join Date: Nov 2015
                  Location: Ho Chi Minh City, Vietnam
                  Gender: Male
                  Nature: Lonely
                  Posts: 140
                  Well, I have problem saving the game while playing Randomized Mode
                  https://www.youtube.com/watch?v=trAT5NhV4bY
                  __________________
                  Reply With Quote
                    #13    
                  Old April 8th, 2016 (7:23 PM).
                  Emotionless living thing's Avatar
                  Emotionless living thing Emotionless living thing is offline
                     
                    Join Date: Jan 2016
                    Gender: Male
                    Posts: 47
                    I'm new to essentials and I am very confused. Can you show me an exact image/screenshot of how you input the code?
                    __________________
                    Reply With Quote
                      #14    
                    Old September 10th, 2016 (4:08 AM).
                    zenel zenel is offline
                       
                      Join Date: Aug 2016
                      Posts: 8
                      ¡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
                      ---------------------------
                      Reply With Quote
                        #15    
                      Old October 8th, 2016 (4:21 PM).
                      Horosaki's Avatar
                      Horosaki Horosaki is offline
                         
                        Join Date: Aug 2016
                        Gender: Male
                        Posts: 7
                        Can this work only in an specific map?
                        Reply With Quote
                          #16    
                        Old October 8th, 2016 (4:59 PM).
                        Zeak6464's Avatar
                        Zeak6464 Zeak6464 is online now
                        Zeak #3205 - Discord
                           
                          Join Date: Mar 2013
                          Location: USA
                          Age: 25
                          Gender: Male
                          Nature: Calm
                          Posts: 550
                          Quote:
                          Originally Posted by Horosaki View Post
                          Can this work only in an specific map?
                          yes just make a event that turns on "Switch = 36" and then make sure it's off when someone leaves the map
                          __________________
                          Looking for a team to help me finish Pokemon Green Remix

                          DM please
                          Reply With Quote
                            #17    
                          Old January 7th, 2017 (10:40 AM).
                          icsir3's Avatar
                          icsir3 icsir3 is offline
                             
                            Join Date: Aug 2016
                            Location: Hungary
                            Gender: Male
                            Nature: Relaxed
                            Posts: 30
                            Quote:
                            Originally Posted by zenel View Post
                            ¡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
                            Reply With Quote
                              #18    
                            Old January 7th, 2017 (7:41 PM).
                            Vendily's Avatar
                            Vendily Vendily is online now
                               
                              Join Date: Aug 2015
                              Gender: Female
                              Nature: Calm
                              Posts: 771
                              Quote:
                              Originally Posted by Umbra View Post
                              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]
                                    species = RandomizedChallenge::WhiteListedPokemon.shuffle[0]
                                    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.
                              __________________
                              Resources for ROM hackers has moved.

                              Reply With Quote
                                #19    
                              Old January 10th, 2017 (3:21 PM).
                              n8opot8oW n8opot8oW is offline
                                 
                                Join Date: Jun 2010
                                Gender: Male
                                Posts: 5
                                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?
                                Reply With Quote
                                  #20    
                                Old February 3rd, 2017 (10:53 AM).
                                Zeak6464's Avatar
                                Zeak6464 Zeak6464 is online now
                                Zeak #3205 - Discord
                                   
                                  Join Date: Mar 2013
                                  Location: USA
                                  Age: 25
                                  Gender: Male
                                  Nature: Calm
                                  Posts: 550
                                  Quote:
                                  Originally Posted by n8opot8oW View Post
                                  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
                                  __________________
                                  Looking for a team to help me finish Pokemon Green Remix

                                  DM please
                                  Reply With Quote
                                    #21    
                                  Old June 21st, 2017 (11:32 AM).
                                  zenel zenel is offline
                                     
                                    Join Date: Aug 2016
                                    Posts: 8
                                    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.
                                    Reply With Quote
                                      #22    
                                    Old November 30th, 2017 (10:52 AM).
                                    SylveonMakesGames SylveonMakesGames is offline
                                       
                                      Join Date: Nov 2017
                                      Posts: 3
                                      It will not change the Pokemon. Can someone show me where to put the script?
                                      Reply With Quote
                                        #23    
                                      Old 2 Weeks Ago (5:41 PM).
                                      WolfPP's Avatar
                                      WolfPP WolfPP is offline
                                         
                                        Join Date: Aug 2018
                                        Location: Brazil
                                        Gender: Male
                                        Nature: Jolly
                                        Posts: 124
                                        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:

                                        Code:
                                          BlackListedPokemon = [
                                            PBSpecies::MOLTRES,
                                            PBSpecies::ARTICUNO,
                                            PBSpecies::ZAPDOS,
                                            PBSpecies::MEWTWO,
                                            PBSpecies::MEW,
                                            PBSpecies::RAIKOU,
                                            PBSpecies::ENTEI,
                                            PBSpecies::SUICUNE,
                                            PBSpecies::LUGIA,
                                            PBSpecies::HOOH,
                                            PBSpecies::CELEBI,
                                            PBSpecies::REGIROCK,
                                            PBSpecies::REGICE,
                                            PBSpecies::REGISTEEL,
                                            PBSpecies::LATIOS,
                                            PBSpecies::LATIAS,
                                            PBSpecies::KYOGRE,
                                            PBSpecies::GROUDON,
                                            PBSpecies::RAYQUAZA,
                                            PBSpecies::JIRACHI,
                                            PBSpecies::DEOXYS,
                                            PBSpecies::UXIE,
                                            PBSpecies::MESPRIT,
                                            PBSpecies::AZELF,
                                            PBSpecies::DIALGA,
                                            PBSpecies::PALKIA,
                                            PBSpecies::GIRATINA,
                                            PBSpecies::REGIGIGAS,
                                            PBSpecies::HEATRAN,
                                            PBSpecies::CRESSELIA,
                                            PBSpecies::DARKRAI,
                                            PBSpecies::GENESECT,
                                            PBSpecies::VOLCANION,
                                            PBSpecies::HOOPA,
                                            PBSpecies::COBALION,
                                            PBSpecies::TERRAKION,
                                            PBSpecies::VIRIZION,
                                            PBSpecies::TORNADUS,
                                            PBSpecies::THUNDURUS,
                                            PBSpecies::RESHIRAM,
                                            PBSpecies::ZEKROM,
                                            PBSpecies::LANDORUS,
                                            PBSpecies::KYUREM,
                                            PBSpecies::XERNEAS,
                                            PBSpecies::YVELTAL,
                                            PBSpecies::ZYGARDE,
                                            PBSpecies::TYPENULL,
                                            PBSpecies::SILVALLY,
                                            PBSpecies::TAPUKOKO,
                                            PBSpecies::TAPULELE,
                                            PBSpecies::TAPUBULU,
                                            PBSpecies::TAPUFINI,
                                            PBSpecies::COSMOG,
                                            PBSpecies::COSMOEM,
                                            PBSpecies::SOLGALEO,
                                            PBSpecies::LUNALA,
                                            PBSpecies::NECROZMA,
                                            PBSpecies::POIPOLE,
                                            PBSpecies::NAGANADEL,
                                            PBSpecies::STAKATAKA,
                                            PBSpecies::BLACEPHALON,
                                            PBSpecies::GUZZLORD,
                                            PBSpecies::KARTANA,
                                            PBSpecies::CELESTEELA,
                                            PBSpecies::XURKITREE,
                                            PBSpecies::PHEROMOSA,
                                            PBSpecies::BUZZWOLE,
                                            PBSpecies::NIHILEGO,
                                            PBSpecies::PHIONE,
                                            PBSpecies::MANAPHY,
                                            PBSpecies::SHAYMIN,
                                            PBSpecies::VICTINI,
                                            PBSpecies::KELDEO,
                                            PBSpecies::MELOETTA,
                                            PBSpecies::DIANCIE,
                                            PBSpecies::MARSHADOW,
                                            PBSpecies::MAGEARNA,
                                            PBSpecies::ZERAORA,
                                            PBSpecies::MELTAN,
                                            PBSpecies::ARCEUS,
                                            PBSpecies::BULBASAUR,
                                            PBSpecies::CHARMANDER,
                                            PBSpecies::SQUIRTLE,
                                            PBSpecies::CYNDAQUIL,
                                            PBSpecies::CHIKORITA,
                                            PBSpecies::TOTODILE,
                                            PBSpecies::TREECKO,
                                            PBSpecies::TORCHIC,
                                            PBSpecies::MUDKIP,
                                            PBSpecies::TURTWIG,
                                            PBSpecies::CHIMCHAR,
                                            PBSpecies::PIPLUP,
                                            PBSpecies::SNIVY,
                                            PBSpecies::TEPIG,
                                            PBSpecies::OSHAWOTT,
                                            PBSpecies::CHESPIN,
                                            PBSpecies::FENNEKIN,
                                            PBSpecies::FROAKIE,
                                            PBSpecies::ROWLET,
                                            PBSpecies::LITTEN,
                                            PBSpecies::POPPLIO,
                                          ] 
                                          # 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)
                                            
                                            if $game_switches && $game_switches[RandomizedChallenge::Switch]
                                              species = RandomizedChallenge::WhiteListedPokemon.shuffle[0]
                                              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
                                        Reply With Quote
                                          #24    
                                        Old 1 Week Ago (7:57 AM). Edited 1 Week Ago by mgriffin.
                                        mgriffin's Avatar
                                        mgriffin mgriffin is offline
                                           
                                          Join Date: Apr 2014
                                          Posts: 117
                                          @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 }
                                          Reply With Quote
                                            #25    
                                          Old 1 Week Ago (10:46 AM).
                                          WolfPP's Avatar
                                          WolfPP WolfPP is offline
                                             
                                            Join Date: Aug 2018
                                            Location: Brazil
                                            Gender: Male
                                            Nature: Jolly
                                            Posts: 124
                                            Quote:
                                            Originally Posted by mgriffin View Post
                                            @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?
                                            Reply With Quote
                                            Reply

                                            Quick Reply

                                            Join the conversation!

                                            Create an account to post a reply in this thread, participate in other discussions, and more!

                                            Create a PokéCommunity Account
                                            Thread Tools

                                            Posting Rules
                                            You may not post new threads
                                            You may not post replies
                                            You may not post attachments
                                            You may not edit your posts

                                            BB code is On
                                            Smilies are On
                                            [IMG] code is On
                                            HTML code is Off

                                            Forum Jump


                                            All times are GMT -8. The time now is 5:18 PM.