- Pokémon Essentials Version
- v21.1 ✅
Pokémon Infinity
A step-by-step guide on displaying a Pokémon's shininess when the player inspects a Poké Ball in the starter selection cutscene.
Note: This tutorial is for starter selection done purely through eventing, not through a script. (DiegoWT's, Voltseon's Emerald Style, Modular Selection Screen, etc.) It's still possible to do so, but that would involve manipulating the script itself, and so that won't be covered in this tutorial.
Generate and Store
Hopefully you're already familiar with basic commands like
pbAddPokemon
and WildBattle.start
, which create new Pokémon as part of their function. You might also be familiar with creating a Pokémon directly and editing it, like with the Pokémon ball - Advanced event in the default maps' Pokémon Fan Club.
Ruby:
pkmn = Pokemon.new(:PICHU, 30)
pkmn.item = :ZAPPLATE
pkmn.form = 2 # Spiky-eared
pkmn.makeFemale
pkmn.shiny = false
pkmn.learn_move(:VOLTTACKLE)
pkmn.learn_move(:HELPINGHAND)
pkmn.learn_move(:SWAGGER)
pkmn.learn_move(:PAINSPLIT)
pkmn.calc_stats
We'll be doing something similar here, with one key difference: Rather than save the Pokemon to a local variable, we're going to be saving it to a game variable instead. Game variables can store any object, not just numbers! The only difference is that other objects have to use script commands rather than the standard event commands for game variables.
You can refer to a game variable in a script with
[imath]game_variables[x]
, with x being the number of your game variable. (No 0s in front - for example, Game Variable 1 should just be [/imath]game_variables[1]
, not $game_variables[001]
) Essentials also has the commands pbSet(x,value)
and pbGet(x)
, which set/return the value of a game variable, respectively.What all that means is that when we create our Pokémon, we're going to be doing something like this instead -
Ruby:
$game_variables[10] = Pokemon.new(:BULBASAUR, 5)
Ruby:
pbSet(10,Pokemon.new(:BULBASAUR, 5))
You'll want to do this for each starter, storing them each in their own variable. (If you're familiar enough with Ruby, you could also just make an array of starters and store that in one variable, but I'm going to keep it simple here and stick with one variable per starter)
You can do this at any point prior to the player receiving their starter - anywhere from the game first starting to the moment the player first interacts with the Poké Ball. (although soft-resetters will definitely prefer it to be as close to receiving your Pokémon as possible) You'll want to clearly document this - believe me, people will be asking about it a lot.
Check and Retrieve
Now that the Pokémon have been saved to game variables, we can reference them in other events withpbGet
.The method
.shiny?
will return true if a Pokémon is shiny, and false if it isn't. So, combining these, you would make a conditional branch with the script pbGet(x).shiny?
, and use that to have the event run different commands if the Pokémon was shiny.For example, if you were using a Show Picture command to display an image -
Your event might now look something like this -
You'll still use pbAddPokemon to give the player the starter if they select it, you'll just put the Pokémon object instead of the species -
pbAddPokemon(pbGet(x))
.
In Summary
- Generate and store the Pokémon with
pbSet(variable,Pokemon.new(:SPECIES,level))
- Check if the Pokémon is shiny in a conditional branch with
pbGet(variable).shiny?
- Give the player the Pokémon with
pbAddPokemon(pbGet(x))
And this isn't just limited to starters and shininess! You could store any Pokémon for any reason, and check any property about them! Check out Editing a Pokémon for more - any trait that can be changed can also be checked!
- Credits
- None needed.