Black Eternity
Lord of Eternity
- 57
- Posts
- 11
- Years
- Seen Jun 30, 2016
Alright first thing first.... I did not create this script, I just altered it slightly for some different performances.
Credits to FL.
1. I changed the script to accept minimum/maximum values. This is so you can choose to limit the range of pokemon it can generate, EX: 1,151 will generate only Gen 1 pokemon.
152,251 will generate Gen 2 pokemon.
2. Made it easier to add exceptions/type limits. No longer have to type PBSpecies::POKENAME
Just type :POKENAME. Same for PBTypes::TYPE, just :TYPE.
The main reason I did this was because I needed fewer amount of pokemon to be generated, and needed more space in the event script.
Once again, no need to credit me for the script.
Just replace the old script with this new one, and call it like this:
randomEggGenerator(min,max,[exceptions],[types],incense)
Example for Generation 1 only, Fire type, and no incense:
randomEggGenerator(1,151,[],[:FIRE])
Example for Generation 2 only, No starter pokemon, incense set to true:
randomEggGenerator(152,251,[:CHIKORITA,:CYNDAQUIL,:TOTODILE],[],true)
To use it like the original script:
randomEggGenerator(1,649,[exceptions],[types],false/true)
Final time.... This is just a modified version of FL.'s script.
Credits to FL.
1. I changed the script to accept minimum/maximum values. This is so you can choose to limit the range of pokemon it can generate, EX: 1,151 will generate only Gen 1 pokemon.
152,251 will generate Gen 2 pokemon.
2. Made it easier to add exceptions/type limits. No longer have to type PBSpecies::POKENAME
Just type :POKENAME. Same for PBTypes::TYPE, just :TYPE.
The main reason I did this was because I needed fewer amount of pokemon to be generated, and needed more space in the event script.
Once again, no need to credit me for the script.
Just replace the old script with this new one, and call it like this:
randomEggGenerator(min,max,[exceptions],[types],incense)
Example for Generation 1 only, Fire type, and no incense:
randomEggGenerator(1,151,[],[:FIRE])
Example for Generation 2 only, No starter pokemon, incense set to true:
randomEggGenerator(152,251,[:CHIKORITA,:CYNDAQUIL,:TOTODILE],[],true)
To use it like the original script:
randomEggGenerator(1,649,[exceptions],[types],false/true)
Final time.... This is just a modified version of FL.'s script.
Code:
#===============================================================================
# * Random Egg Generator - by FL (Credits will be apreciated)
#===============================================================================
#
# This script is for Pokémon Essentials. It random generates an egg with all
# possible pokémon that can hatch from an eggs (excluding some species like
# Ditto, Mewtwo and Unown) with same probability. You can also filter by type.
#
#===============================================================================
#
# To this scripts works, put it above main and use in script command
# 'randomEggGenerator'. This only gives to player an egg if the player has
# a empty party slot. You can also calls the method with an array with the
# exceptions that cannot be random generated. Example:
# 'randomEggGenerator(1,649,[:DRATINI,:LARVITAR],[])' won't generates
# Dratini or Larvitar.
#
# You can also filter by types calling this method with a type array as
# second parameter. Example:
# 'randomEggGenerator(1,649[],[:ROCK,:GROUND,:STEEL])' only
# generates pokémon that have the Rock, Ground or Steel types. Please note
# that pokémon like Swablu doesn't count as a Dragon type.
#
# This script also doesn't generate eggs for pokémon than can incense breed
# like Wynaut, but generate for pokémon than are incense babies like Wobbuffet.
# If you wish to enable the both cases in eggs, both counting as different
# pokémon call the script using 'randomEggGenerator(1,649,[],[],true)'.
#
#===============================================================================
def randomEggGenerator(min,max,exceptions=[],type=[],enableIncenseEvos=false)
for i in 0...type.length
type[i]=getID(PBTypes,type[i]) if !type[i].is_a?(Integer)
end
for i in 0...exceptions.length
exceptions[i]=getID(PBSpecies,exceptions[i]) if !exceptions[i].is_a?(Integer)
end
# Phione and Manaphy are always exceptions
exceptions+=[PBSpecies::PHIONE,PBSpecies::MANAPHY]
if $Trainer.party.length>=6
Kernel.pbMessage(_INTL(
"I'm sorry, but it would seem that you can't carry any more Pokemon."))
else
species=0
dexdata=pbOpenDexData
while(species==0)
species=min+rand(max-min)
pbDexDataOffset(dexdata,species,8)
type1=dexdata.fgetb
type2=dexdata.fgetb
# Redo the loop if the species can't be in an egg, is an exceptions or
# is an evolution (only if enableIncenseEvos=false)
species=0 if (!pbHasEgg?(species) || exceptions.include?(species) ||
(!type.empty? && !type.include?(type1) && !type.include?(type2)) ||
(!enableIncenseEvos && pbGetPreviousForm(species)!=species))
end
dexdata.close
pbGenerateEgg(species)
Kernel.pbMessage(
_INTL("{1} received the Egg!\\se[itemlevel]\1",$Trainer.name))
end
end