• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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.

Weighted Egg Generator

G-Master

Lead of Pokémon Roll
  • 61
    Posts
    11
    Years
    • AZ
    • Seen May 10, 2022
    In this tutorial you will learn how to make an egg generator that can give the player a egg. There are two major differences between this generator and FL's Random Egg Generator:

    1. In FL's generator, a random egg is selected from all possible Pokémon species and the user defines exceptions. In this generator, the user just picks what species they want available, so it works better when there are only a few choices for what can hatch from the egg.
    2. This generator uses a tier system, meaning that the user can make certain Pokémon have a lesser chance of generating.

    As usual, put this script somewhere above "Main." To call it, use "weightedEggGenerator"

    Spoiler:


    After you have pasted the above code into a blank script, the first thing you will want to do is change what species can hatch from the egg, and how likely it is for the player to get a specific species.

    At the top of the script, you'll see:

    TIER1=[PBSpecies::BULBASAUR,PBSpecies::CHARMANDER,PBSpecies::SQUIRTLE]
    TIER2=[PBSpecies::CHIKORITA,PBSpecies::CYNDAQUIL,PBSpecies::TOTODILE]
    TIER3=[PBSpecies::PHIONE]

    These are the three tiers of Pokémon, with Tier 1 being the most common and Tier 3 being the rarest. Just add/remove any Pokémon you want keeping the format "PBSpecies::XXX" with XXX being the Pokémon's name in all caps. Separate each Pokémon entry with a comma.

    The next thing you will want to do is customize how rare each tier is. This is what you want to edit:

    CHANCES=[90,9,1]

    These are the probabilities that a certain tier of Pokémon will be selected. The first number (90) implies that there is a 90% chance that Tier 1 will be chosen. The second number (9) implies that there is a 9% chance that Tier 2 is chosen. Tier 3 has only a 1% chance. You can change these three numbers to whatever you want, but make sure they add up to 100!

    That's all you need to do! The script will randomly choose one of the three tiers and then randomly select one of the Pokémon in that tier to put in the egg. I will eventually be improving this tutorial by explaining how you can add more tiers (and fix the indents in the code for readability).
     
    This is pretty sweet. Thanks for sharing :D
     
    Back
    Top