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

FL Random Egg Gen Question

Harvey_Create

Pokemon Apex Team Member
187
Posts
11
Years
  • http://pokemonessentials.wikia.com/wiki/Tutorial:Random_Egg_Generator

    For the script by FL, I was wondering on how to make it so it only randomly generates a species ranging from 1-251 because those are the only Pokemon i'm using.

    Is this all i have to change? Or is this even possible.

    Code:
    species=0
        dexdata=pbOpenDexData
        while(species[COLOR="Blue"]<=251[/COLOR])

    Thanks

    I'm going to assume that(after reading the script) that it will only generate an egg based off of the Pokemon written into the game. So if you Pokemon.TXT only has Regional Des 1-251 in it, it will only generate out of them.
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    For starters, changing the (species==0) to (species<=251), will never, ever, ever, ever, ever, get what you are looking for.

    Quick explanation on FL .'s script.

    Code:
    [COLOR="Blue"]def randomEggGenerator(exceptions=[],type=[],enableIncenseEvos=false)
      # Phione and Manaphy are always exceptions 
      exceptions+=[PBSpecies::PHIONE,PBSpecies::MANAPHY] [/COLOR] Is Pokémon you won't get within an egg.
    Code:
    [COLOR="blue"]  if $Trainer.party.length>=6
        Kernel.pbMessage(_INTL(
            "I'm sorry, but it would seem that you can't carry any more Pokemon."))[/COLOR] Means if you own 6 or more Pokémon in your team, you will [B][U]NOT[/U][/B], get an egg.
    Code:
    [COLOR="blue"]  else   
        species=0[/COLOR] Will set species to equal 0, incase the script has run before I suppose.
        [COLOR="blue"]dexdata=pbOpenDexData[/COLOR] Gets Pokémon info from pokemon.txt.
        [COLOR="blue"]while(species==0)[/COLOR] ([I]your guessed part to edit[/I]) means, for as long as species = 0, keep doing the next part.
          [COLOR="blue"]species=rand(PBSpecies.maxValue)+1[/COLOR] randoms what species will equal within your pokemon.txt.
          [COLOR="blue"]pbDexDataOffset(dexdata,species,8)[/COLOR] will get the species name of the random'd Pokémon, i.e. Bulbasaur, Mew, Regirock, etc.
          [COLOR="blue"]type1=dexdata.fgetb[/COLOR] Will recall that Pokémons type1.
          [COLOR="blue"]type2=dexdata.fgetb[/COLOR] Will recall that Pokémons type2.
          # Redo the loop if the species can't be in an egg, is an exceptions or
          # is an evolution (only if enableIncenseEvos=false)
    [COLOR="blue"]      species=0 if (!pbHasEgg?(species) || exceptions.include?(species) || 
              (!type.empty? && !type.include?(type1) && !type.include?(type2)) ||
              (!enableIncenseEvos && pbGetPreviousForm(species)!=species))
        end[/COLOR] Will set species to 0, if the random'd Pokémon equals any of these things...  Remember the while you wanted to edit...  Well it will replay from there.
    Code:
        [COLOR="blue"]dexdata.close [/COLOR]   Closes the use of pokemon.txt.
        [COLOR="blue"]pbGenerateEgg(species)[/COLOR] Gives you your egg.
    [COLOR="blue"]    Kernel.pbMessage(
            _INTL("{1} received the Egg!\\se[itemlevel]\1",$Trainer.name))
      end
    end[/COLOR] Shows message and ends generator.
    So yes, Harvey is correct, if you only have 251 Pokémon in your pokemon.txt, it will work nonetheless, if you have 9340 Pokémon in the pokemon.txt, then it will random up to 9340.

    Bottom line, don't edit that part you wanted to.
     

    thor348

    That's Oak to You
    137
    Posts
    11
    Years
  • Thank you both for your input and explanation. Would you both like credit along with FL in my game if I decide to use this script?
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen today
    Changing 'species=rand(PBSpecies.maxValue)+1' to 'species=rand(251)+1' also do the job without changing pokemon.txt.

    An example: If you only wish to show the pokémon between 494-649 use 'species=rand(156)+494'.
     

    Harvey_Create

    Pokemon Apex Team Member
    187
    Posts
    11
    Years
  • Thank you both for your input and explanation. Would you both like credit along with FL in my game if I decide to use this script?

    THis is a simple question, No need for credit. Now, if a gave you something Drastic, That would be Different
     
    Back
    Top