- 96
- Posts
- 6
- Years
- Seen Nov 17, 2024
This is an example of a black market type functionality for stolen eggs. Now, obviously it's not difficult to add an egg for a particular species. But if these are stolen eggs, the seller may not know which species is contained within a particular egg. In my example, I am using theft as the plot explanation, but it can obviously be adapted for other plot scenarios in which it makes sense for the species to be unknown.
In my example, I chose only the 18 species of baby pokemon, but again, you can choose whatever you like. I also weighted them to account for rarity, so a Pichu is six times as likely to be picked as a Happiny.
The script is basically like so:
As you can see, you can set the rarity by multiplying by a number of your choosing. No need to multiply by one for obvious reasons.
You can then create an event that looks like this:
And that's all there is to it. I recommend putting the method in your own script section to make it easier to update Essentials in the future.
In my example, I chose only the 18 species of baby pokemon, but again, you can choose whatever you like. I also weighted them to account for rarity, so a Pichu is six times as likely to be picked as a Happiny.
The script is basically like so:
Code:
def pbGenerateRandomBabyEgg
babySpecies = Array.new
babySpecies.concat([:PICHU]*6)
babySpecies.concat([:AZURILL]*6)
babySpecies.concat([:BUDEW]*6)
babySpecies.concat([:WYNAUT]*6)
babySpecies.concat([:TYROGUE]*4)
babySpecies.concat([:SMOOCHUM]*4)
babySpecies.concat([:MIMEJR]*4)
babySpecies.concat([:BONSLY]*4)
babySpecies.concat([:MANTYKE]*4)
babySpecies.concat([:CHINGLING]*4)
babySpecies.concat([:MAGBY]*3)
babySpecies.concat([:ELEKID]*3)
babySpecies.concat([:RIOLU]*3)
babySpecies.concat([:MUNCHLAX]*3)
babySpecies.concat([:CLEFFA]*2)
babySpecies.concat([:IGGLYBUFF]*2)
babySpecies.concat([:TOGEPI])
babySpecies.concat([:HAPPINY])
speciesIndex = rand(babySpecies.length)
speciesSelection = babySpecies[speciesIndex]
return pbGenerateEgg(speciesSelection)
end
As you can see, you can set the rarity by multiplying by a number of your choosing. No need to multiply by one for obvious reasons.
You can then create an event that looks like this:
![[PokeCommunity.com] Random Egg species [PokeCommunity.com] Random Egg species](https://i.redd.it/bko6a338ii031.png)
And that's all there is to it. I recommend putting the method in your own script section to make it easier to update Essentials in the future.