• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Shiny Starter Preview

v21.1 Shiny Starter Preview 2022-11-23

This resource pertains to version 21.1 of Pokémon Essentials.
Pokémon Essentials Version
v21.1 ✅
1669168491953.png
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
(Creating an object from a class is a fundamental part of coding with Ruby. If you're interesting in learning more - and I highly recommend you do, even if you're not going to do big scripts - Marin has some great tutorials to get you started.)

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)
or
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 with pbGet.

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 -
1669174011454.png


Your event might now look something like this -
1669174629624.png

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.
Author
TechSkylander1518
Views
2,701
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from TechSkylander1518

Back
Top