FL
Pokémon Island Creator
- 2,549
- Posts
- 14
- Years
- Seen May 5, 2025
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.
#
#===============================================================================
#
# 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(PBSpecies::DRATINI,PBSpecies::LARVITAR) won't generates
# Dratini or Larvitar.
#
# This script also doesn't generate eggs for pokémon than can incense breed
# like Marill, but generate for pokémon than are incense babies like Azurill.
# If you wish to enable the both cases in eggs, both counting as different
# pokémon call the script using 'randomEggGenerator([],true)'.
#
#===============================================================================
def randomEggGenerator(exceptions=[],enableIncenseEvos=false)
# 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
while(species==0)
species=rand(PBSpecies.maxValue)+1
# 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) ||
(!enableIncenseEvos && pbGetPreviousForm(species)!=species))
end
pbGenerateEgg(species)
Kernel.pbMessage(
_INTL("{1} received the Egg!\\se[itemlevel]\1",$Trainer.name))
end
end