Advertisement
TechSkylander1518

Random Egg Generator

Sep 22nd, 2021
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.59 KB | None | 0 0
  1. #Code is adapted from Luka SJ's Randomizer, so credit goes to him!
  2.  
  3. RANDOMSTEPS = 10000
  4.  
  5. def pbGenerateRandEgg(text = "")
  6.   return false if $Trainer.party_full?
  7.   pool = []
  8.   GameData::Species.each { |species| pool.push(species.id) if species.form == 0 }
  9.   pkmn = pool[rand(0,pool.length)]
  10.   pkmn = Pokemon.new(pkmn, Settings::EGG_LEVEL) if !pkmn.is_a?(Pokemon)
  11.   # Set egg's details
  12.   pkmn.name           = _INTL("Egg")
  13.   pkmn.steps_to_hatch = RANDOMSTEPS
  14.   pkmn.obtain_text    = text
  15.   pkmn.calc_stats
  16.   # Add egg to party
  17.   $Trainer.party[$Trainer.party.length] = pkmn
  18.   return true
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement