• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Reminder: AI-generated content is not allowed on the forums per the Rules and Regulations. Please contact us if you have any questions!
Pokémon Factory

v21.1 Pokémon Factory 1.1.0

This resource pertains to version 21.1 of Pokémon Essentials.
This update adds a new feature: variants:.
Its purpose is to provide an easy way to create variations when generating Pokémon, giving each its own weight to be delivered randomly. It can also accept switches and variables as activation conditions. As long as these conditions are not met, the variant will not be considered during creation.

Giving Various Pokémon:
Ruby:
Expand Collapse Copy
bird_data = {
  level: 15,
  variants: [
    {
      weight: 40,
      config: { species: :PIDGEY, nature: :JOLLY }
    },
    {
      weight: 50,           
      condition: proc { $game_variables[40] >= 1 },
      config: {
        species: :TAILLOW,
        ability_index: 1,
        moves: [:WINGATTACK, :QUICKATTACK, :FOCUSENERGY, :AERIALACE]
      }
    },
    {
      weight: 50,
      condition: proc { $game_variables[40] == 2 },
      config: {
        species: :STARLY,
        ability_index: 1,
        moves: [:WINGATTACK, :QUICKATTACK, :ENDEAVOR, :AERIALACE]
      }
    },
    {
      weight: 20,
      condition: proc { $game_switches[12] },
      config: {
        species: :FLETCHLING,
        shiny: true,
        ability_index: 1,
        moves: [:PECK, :QUICKATTACK, :FLAIL, :ACROBATICS]
      }
    }
  ]
}
    
pkmn = PokemonFactory.create(bird_data)
pbAddPokemon(pkmn)

Giving the Same Pokémon with Different Sets:
Ruby:
Expand Collapse Copy
arcanine_data = {
  species: :ARCANINE,
  level: 50,
  shiny: true,
  poke_ball: :FASTBALL,
  ivs: :perfect,
      
  variants: [
    {
      weight: 40,
      config: {
        nickname: "Blaze",
        nature: :ADAMANT,
        ability: :INTIMIDATE,
        item: :LIFEORB,
        evs: :sweeper_physical,
        moves: [:FLAREBLITZ, :EXTREMESPEED, :WILDCHARGE, :CLOSECOMBAT]
      }
    },
    {
      weight: 40,
      config: {
        nickname: "Inferno",
        nature: :TIMID,
        ability: :FLASHFIRE,
        item: :CHOICESPECS,
        evs: :sweeper_special,
        moves: [:FLAMETHROWER, :DRAGONPULSE, :SCORCHINGSANDS, :EXTREMESPEED]
      }
    },
    {
      weight: 20,
      config: {
        nickname: "Guardian",
        nature: :IMPISH,
        ability: :INTIMIDATE,
        item: :HEAVYDUTYBOOTS,
        evs: :tank_physical,
        moves: [:FLAREBLITZ, :WILLOWISP, :MORNINGSUN, :TELEPORT]
      }
    }
  ]
}
    
pkmn = PokemonFactory.create(arcanine_data)
pbAddPokemonWithNickname(pkmn)

It is not necessary for the weight: values to sum up to 100. The script is responsible for assigning the probability based on the total sum of all weights.

It is worth mentioning that this also works for generating eggs, although due to this addition, the way they are created changes slightly:

Ruby:
Expand Collapse Copy
eevee_egg_config = {
  species: :EEVEE, # Now you must add the species:
  steps_to_hatch: 1, 
  shiny: true,
  nature: :TIMID,
  ability_index: 2,
  ivs: :perfect,
  obtain_text: "Day-Care Couple"
}
    
# if EggFactory.create(:EEVEE, eevee_egg_config) # Before
if EggFactory.create(eevee_egg_config) # Now
  pbMessage(_INTL("Take good care of it!"))
else
  pbMessage(_INTL("Oh, you don't have any room in your party!"))
end

You can also find the examples with explanations in the 002_Events file.
Back
Top