A Pokemon's Tera Type determines the type it will change into when it Terastallizes. By default, the Tera Type of all Pokemon match their base typing. If the Pokemon has multiple types, then its Tera Type is randomly decided among one of its base types.
This subsection will go over all features and mechanics related to a Pokemon's Tera Type.
Setting Tera Types
A Pokemon is assigned a Tera Type upon creation. However, for most Pokemon, this Tera Type isn't fixed and can be freely changed. This plugin allows you to set and edit a Pokemon's Tera Type in a variety of ways, though the particular way in which you may do this depends on whether the Pokemon is owned by the player or not.
Below, I'll go over all mechanics related to checking, setting or changing a Pokemon's Tera Type.
General
If you ever need to check the Tera Type of any defined Pokemon object through a script, you may do so by using the script Pokemon.tera_type, where Pokemon is the specific Pokemon object you are checking.
This will return the type ID of that Pokemon's Tera Type. You may also manually set a Tera Type for this Pokemon object by using the script Pokemon.tera_type = TYPE, where TYPE is the ID of the specific type you want to set as that Pokemon object's Tera Type. You can use this to set specific Tera Types for wild or gifted Pokemon by creating the Pokemon objects first, and then editing their attributes in this way before initiating a wild battle with them or giving them to the player.
Player's Pokemon
The player can change the Tera Type of their Pokemon at any time by the use of Tera Shards. Tera Shards are items introduced in Pokemon Scarlet & Violet that could be given to an NPC in order for them to change a Pokemon's Tera Type into one that matched the type of that particular Tera Shard.
To simplify this, I removed the need for an NPC and simply made it so that using the Tera Shard items directly on your Pokemon will allow them to change Tera Types. However, I did retain the steep cost that Scarlet & Violet imposes, meaning that you'll need 50 of a particular type of shard in order to change a Pokemon's Tera Type.
However, there is a setting provided by the plugin that allows you to change this if you're unhappy with the amount of Tera Shards required. In the settings file, you may set TERA_SHARDS_REQUIRED to whatever amount you want if you'd like to customize the number of shards required to change Tera Types.
In addition to Tera Shards, two additional custom items are added by this plugin to give you alternative ways of changing a Pokemon's Tera Type.
Mystery Tera Jewel
When used on a Pokemon, this will change its Tera Type to a completely random type.
Master Tera Jewel
When used on a Pokemon, this will allow you to manually select the exact Tera Type you wish to give it.
When playing in debug mode, you can manually adjust a Pokemon's Tera Type at any time. This can be done by going into that Pokemon's debug menu in the party screen and selecting "Plugin attributes..." at the bottom of the list. From here, select "Terastal..." and then "Set Tera type" to set a new Tera Type.
Checking for Tera Type
If you need to check whether or not the player has a Pokemon in their party that has a particular Tera Type, you may do so by using the script:
$player.has_pokemon_tera_type?(type)
This will return true if the player has any Pokemon in their party with a Tera Type that matches the type ID entered in the type argument.
Viewing Tera Types
The player can view their Pokemon's Tera Type at any time by viewing the Summary page of that Pokemon. In here, you'll see the Pokemon's Tera Type displayed next to their base typing. If you would like to hide this display for some reason, you may do so within the plugin settings by setting SUMMARY_TERA_TYPES to false.
Additionally, a Pokemon's Tera Type will also be displayed in the PC while viewing your Pokemon in storage. If you would like to hide this display, you may do so as well by setting STORAGE_TERA_TYPES to false in the plugin settings.
If you have the Enhanced Battle UI plugin installed, you will also be able to see each battler's Tera Type in battle by viewing a battler's info page.
NPC Trainer's Pokemon
The Tera Types of NPC trainer's Pokemon will naturally generate in the same way it does for any other Pokemon. However, you may set specific Tera Types for these Pokemon if you wish in that trainer's PBS data.
This can be done by setting TeraType = TYPE for the desired Pokemon, where TYPE is the ID for the specific type you want that Pokemon's Tera Type to be. This may also be done within the in-game trainer editor while playing in debug mode.
Wild Pokemon
Wild Pokemon can have their Tera Types edited in the same way any other Pokemon can have its attributes edited, which is described in the "General" section above.
However, you may also set a specific Tera Type for wild Pokemon by utilizing the "editWildPokemon" Battle Rule along with all of its variants introduced by the Deluxe Battle Kit. This can be done by setting up this rule as a hash, and entering :tera_type => TYPE within this hash for the desired Pokemon where TYPE is the ID of the specific type you want to set as that wild Pokemon's Tera Type.
For example, if you want to set a wild Flygon's Tera Type to Bug, you could implement it as such:
For more information on this Battle Rule, refer to the "Deluxe Battle Rules" section of the tutorial.
Unchangeable Tera Types
While a Pokemon's Tera Type can be changed in most scenarious, there are certain species that may have a set Tera Type that cannot be changed or randomized at all. In Pokemon Scarlet & Violet, there are only two Pokemon which behave in this way. One is Ogerpon, which was introduced in the Teal Mask DLC, and the other is Terapagos, which was introduced in the Indigo Disk DLC. Neither of these species appear in Essentials by default, but if you have the Generation 9 Pack installed, then both species will be present with this functionality already built in.
If you would like to customize your own species with a set Tera Type which may not be changed, you may do so be giving that species the flag TeraType_TYPE in its PBS data, where TYPE is the ID of the specific type you want that species' Tera Type to be.
For example, Teal Mask Ogerpon has the TeraType_GRASS flag set in its PBS data. This means that in this form, Ogerpon's Tera Type will always be Grass, and it may never be changed. However, Hearthflame Mask Ogerpon has the flag TeraType_FIRE, which means that in this form its Tera Type will always be Fire, and may never be changed.
You can use this flag if you want to lock certain species into specific Tera Types for some reason that cannot be altered in-game in any way.
Randomized Tera Types
If you would like Pokemon to generate with a random Tera Type instead of one that is always inherited from their base typing, there are some settings you may utilize to accomplish this. Note that when randomizing a Pokemon's Tera Type through any of the below methods, the Stellar type may never be randomly chosen.
Randomizing Tera Types for Specific Pokemon
If you only want to randomize the Tera Type of a particular Pokemon, you may do so by editing that Pokemon's Tera Type as you normally would, and setting it to :Random instead of a type ID.
For example, if you were to manually set a Tera Type on a particular Pokemon object through a script in the way outlined in the "General" section above, then you would set Pokemon.tera_type = :Random. If you'd like to set a random Tera Type on a wild Pokemon through the use of the "editWildPokemon" Battle Rule, then that may look something like this:
If you want all members of a particular species or form to always generate with a random Tera Type, then you may do so by utilizing the TeraType_TYPE flag, as described in the "Unchangeable Tera Types" section above. Except, instead of TYPE being a type ID, you would simply set it to Random instead.
For example, if you gave a species or form the flag TeraType_Random, then all Pokemon of that species or form would always generate with a randomized Tera Type. Note however that once this randomized Tera Type is set upon creation, it may never be changed.
Randomizing Tera Types for All Possible Species
If you want all possible Pokemon to spawn with a random Tera Type, this may also be done by turning on a specific switch. In the plugin settings, there is a setting named RANDOMIZED_TERA_TYPES which stores the switch number used for randomizing all Tera Types. This is saved as switch number 71 by default, but please renumber this if this conflicts with an existing game switch that you use.
If this switch is turned on, than all new Pokemon generated once that switch is activated will spawn with entirely random Tera Types. While playing in debug mode, you may quickly toggle this setting by going into the "Deluxe plugin settings..." of the debug menu and selecting "Terastal settings..." option. In here, you'll find on option called "Randomize Pokemon Tera types", which will allow you to toggle this feature.
Stellar Tera Type
In the Indigo Disk DLC for Pokemon Scarlet & Violet, a brand new 19th type was introduced called the Stellar type. This is a highly unique type in that no Pokemon has this type naturally, it may only be set as a Tera Type that Pokemon can Terastallize into. However, while a Pokemon is Terastallized into this type, they retain the defensive capabilities of their typing prior to Terastallizing, and only gain the offensive bonuses of this type.
The Stellar type has no weaknesses, resistances, or immunities, and it doesn't deal Super Effective damage against any other type. It is perfectly neutral in that regard. However, Stellar-type moves will deal Super Effective damage on Terastallized targets, regardless of their typing. However, the only Stellar-type moves available are the moves Tera Blast and Tera Starstorm, but only when the user is Terastallized into the Stellar-type.
This plugin adds this new Stellar type to Essentials, with all of its mechanics in tact. The PBS data and graphics for this type are automatically included upon installation. However, keep in mind that this new type assumes you don't have any custom types implemented in your game. So if you do, you will likely have to edit the type numbering in their PBS data, as well as editing the types graphic located in Graphics/UI, and the icon_types graphic found in Graphics/UI/Pokedex.
Note that even though this plugin doesn't utilize the Stellar type for anything beyond its Terastallization mechanics, you're free to use this type however you please. So it's totally possible to create your own custom Stellar-type Pokemon or Stellar-type moves. However, this plugin does exclude Stellar from being a viable Hidden Power type.
Adding Support For New Types
If your game includes custom types that aren't included in Essentials by default, you may need to edit some things in order for this plugin to work correctly. In Graphics/Plugins/Terastallization, you will find two images. One is labeled cursor_tera, and another labeled tera_types. The former is used for displaying the specific button used to Terastallize into that type, while the latter is used for displaying the actual icon for that Tera Type in various UI's.
For each custom type in your game, you must add a button and type icon to these images. Even if the custom type is flagged as IsPseudoType = true in its PBS data (like the :QMARKS type is), it requires its own button/icon added in the correct order to ensure the count is correct and the image won't be cut improperly when displaying these sprites.
As a quick reference, the dimensions for each button in cursor_tera must be 150x46. The dimensions for each Tera Type icon in tera_types must be 32x32.
Moves That Utilize Tera Type
Tera Blast
The move Tera Blast is implemented by this plugin. This move's type changes to match whatever the user's Tera Type is while the user is Terastallized. This move is near-universal, and can be learned by mostly every Pokemon in the game.
Because of this, manually adding the move to each species' learnset in their PBS data would be far too tedious. So instead, this plugin just assumes all Pokemon can learn the move via TM or Tutor. However, there are a few exceptions. The following species cannot be taught Tera Blast via TM or Tutor:
Magikarp
Ditto
Smeagle
Unown
Wobbuffet
Wynaut
These species are all blacklisted from being taught the move. Note that Smeargle can still learn the move through Sketch, it simply cannot be taught the move as a traditional tutor move. If you would like to add more species to this blacklist, you may do so in the plugin settings by adding the ID of the species you want to blacklist to the TERABLAST_BANLIST array.
Tera Starstorm
Note that this plugin does add all the necessary functionality for the move Tera Starstorm, but the move itself is not provided in this plugin. This is due to the move only being learnable by Terapagos, which isn't found in Essentials by default.
However, if you have the Generation 9 Pack installed, both Terapagos and Tera Starstorm will be added to your game, and will use this plugin to function as intended.