Animated: Dynamic Sprite Effects
Section 7.I.2
Last updated
Section 7.I.2
Last updated
There are a variety of conditions that may alter how a sprite appears or animates both in and out of battle. In this subsection, I'll go over various conditions that may affect your sprites.
Battle Animations
In base Essentials, Pokemon that change forms in battle will do so abruptly by instantly changing sprites without any sort of visual effect. This plugin implements a new sprite feature that adds a bit more visual flair to these instances by utilizing a mosaic effect.
This is the same effect used in the PC Storage UI when viewing Pokemon. When navigating through a PC box, the displayed sprite of the selected Pokemon will briefly pixelate before loading in the sprite of the new Pokemon your cursor is over. This plugin borrows this code and reapplies it to battler sprites so that the same effect occurs when a Pokemon changes form.
In addition, this effect will also apply to Pokemon who change into a different species through the use of Transform or Imposter, or Pokemon under the effects of Illusion who are revealed when the effect ends.
When using a move that puts the user in a semi-invulnerable state for one turn, such as Fly, Dig, Dive, and others; the user's sprite will now vanish off screen for the duration of this semi-invulnerable state.
Note that while the user is in this state and its sprite is hidden from view, animations that would normally apply to the user's sprite will be skipped and not display. This includes things like indirect damage from things like Poison or Burn, or animations for moves that can bypass this state.
For the moves that send the user high in the air during their semi-invulnerable turn, their shadow sprite will not disappear. Instead, it will shrink during this turn to imply that the user is casting a shadow from way up in the sky. This effect will occur specifically for the moves Fly, Bounce and Sky Drop. Note that in Sky Drop's case in particular, this effect applies to both the Sky Drop user and the target that the user is lifting.
By default, Essentials doesn't include any graphics or animations related to the move Substitute. This means that whenever a Pokemon is under the effects of this move, they will still appear on screen normally, and there won't be any visual indication that the Pokemon is under its effects.
This plugin addresses this issue by including its own graphics and animations related to displaying the Substitute doll. Now, when the move Substitute is used (and Shed Tail, if the Gen 9 Pack is installed), the user will summon a Substitute doll that will take their place in battle for the duration of the effect.
Whenever the Pokemon uses a move, changes form, or transforms, it will briefly swap back into the battlefield and then swap back out with the Substitute doll upon completing that action. If the Substitute is broken, it will animate differently and simply fade away before the original Pokemon swaps back in.
Implementing Substitute Doll Animations
If you have any new moves or custom effects that apply the Substitute effect on a battler, or should show/hide the Substitute doll if one is displayed, you will have to manually include the code that triggers these animations.
To do this, you may use the following Battle::Scene
script:
pbAnimateSubstitute(idxBattler, mode, delay = false)
This will automatically animate the Substitute doll for the index of the battler that is set with idxBattler
. The type of animation that plays depends on what you set with mode
. There four possible settings you can enter here:
:create
Calls the animation related to the initial creation of the Substitute doll.
:show
Calls the animation where the Substitute doll swaps in and the battler swaps out.
:hide
Calls the animation where the battler swaps in and the Substitute doll swaps out.
:broken
Calls the animation where the Substitute doll breaks and fades away.
Lastly, if the delay
argument is set to true
, the game will delay calling the animation for 1 second before it starts. This isn't necessary however, and you can simply omit this in most cases.
Substitute Doll Metrics
Just like with any ordinary Pokemon sprite, the Substitute doll sprite appears on screen based on the metrics set for that sprite. However, unlike actual Pokemon species, there is no entry for these metrics in the traditional metrics PBS files.
Instead, these are stored in the array SUBSTITUTE_DOLL_METRICS
in the plugin Settings. The first number entered in this array corresponds to the Y-axis coordinates of the Substitute doll's back sprite, while the second number corresponds to the Y-axis coordinates of the front sprite.
Note that X-axis coordinates aren't included. This is because the Substitute doll will just always appear in the center of the battle base, so there's no need to customize this metric.
Certain species have uniquely implemented animations that trigger under specific circumstances. These are implemented using a global midbattle script so that they can apply at all times in every battle.
Sudowoodo
Sudowoodo's entire gimmick is that it's pretending to imitate a tree. Because of this, it doesn't make much sense that it should be constantly moving about with an animation. So in order for it to fit more with its character, I decided to give this species an AnimationSpeed
metric of zero, which means it will remain completely still and not animate at all in battle.
However, you can still see Sudowoodo animate under specific conditions. If a Sudowoodo is struck by a Water-type move that deals super effective damage, the targeted Sudowoodo will briefly drop the act and wiggle around for a second, as if it's reacting negatively to the water and trying to shake it off. This is meant as a fun little easter egg reminiscent of how it reacts when sprinkled with watering can when encountered in the Johto games.
Klink Family
The entire Klink family line (Klink, Klang, and Klinklang) have a small animation quirk related to the move Shift Gear. After any member of this family uses this move in battle, their animations will begin playing in reverse. This is a fun little easter egg meant to indicate that these Pokemon are literally "shifting gears" by rotating in the opposite direction after this move is used. If the move is used a second time, their animation will reverse once again, meaning that their animation will return to spinning in their original direction.
This subtle animation effect will only occur when Shift Gear is used by one of these species, and will not occur if used by any other species.
Conditional Animation Effects
This plugin implements a new visual feature that applies an overlay pattern on the sprites of Pokemon who are under the effect of certain status conditions. This will apply a coloration effect on the sprite related to the status effect it's suffering from that will repeatedly fade in and out. This will be displayed both in and out of battle.
Note that the Sleep status is the exception here, and will not apply and colorization effect to sprites. The same is true for the Drowsy status, if you have that installed. If you have the Frostbite status installed, this status will use the same colored overlay as the Frozen status.
While the animation speed of a Pokemon's sprite is based on its AnimationSpeed
metrics by default, it is possible for this speed to be altered both in and out of battle by various conditions.
Low HP
If the Pokemon's total remaining HP is less than or equal to 25% of its max HP, the rate at which its sprite animate will be slowed down by 2x.
This effect will not stack with other effects that may alter animation speeds.
Status Conditions
Certain status conditions may alter the rate at which a Pokemon's sprites animate.
Paralysis: Slows animation speed down by 2x. (Same for Drowsy status if installed)
Sleep: Slows animation speed down by 3x.
Frozen: Completely stops the Pokemon from animating at all.
This effect will not stack with other effects that may alter animation speeds.
Speed Stages
In battle, the number of stages a Pokemon's Speed has been altered by may affect the animation speed of its sprites. For every stage of speed increased, its sprites will animate roughly 5% faster, up to a rough total of a 30% increase at +6 stages. This works the same in reverse for lowered Speed stages, which will slow down the animation speed of its sprites by roughly 5% per lowered stage.
This effect will not stack with other effects that may alter animation speeds.
Mid-Battle Scripting
You may forcibly set the animation speed of a Pokemon's sprite utilizing the "spriteSpeed" midbattle command. More information on this is covered in the "Mid-Battle Scripting" subsection for this plugin.
This effect will not stack with other effects that may alter animation speeds.
If a Pokemon becomes confused or infatuated during battle, its sprites will begin animating in reverse for the duration of these effects to indicate the Pokemon's disorientation. This is a very subtle effect and is something you probably wouldn't even notice unless you're specifically looking for it. However, it's more noticeable on some species than others.
For example it's easier to tell that a Pokemon like Klink is animating in reverse, since its gears will begin spinning in the opposite direction.
By default, Essentials includes the ability to find Super Shiny Pokemon. Super Shinies are just rarer variants of shiny Pokemon that utilize different sparkle animations starting in Pokemon Sword & Shield. However, there is no inherent visual difference between shiny and Super Shiny Pokemon in Essentials, so it's impossible for the player to ever tell the difference between them.
This plugin implements a new feature however that allows shiny and Super Shiny Pokemon to have visual differences by applying different hues to the sprites of Super Shiny Pokemon. This effectively gives every species an additional possible color variant that may be obtained.
By default, this Super Shiny hue is completely randomized for every species and form, and will re-randomize every time you recompile the game. However, if you wish to set specific hues for certain species or forms, you may do so by adding a new parameter to that Pokemon's metrics in the various pokemon_metrics.txt
PBS files.
These files now accept a brand new optional metric parameter called SuperShinyHue
. This can be set to a number ranging from -255 to 255, and that number will correspond to the hue that is used to recolor the Super Shiny sprites of that species. This will override whatever randomized hue would be normally generated, allowing you to customize and set exactly how you'd like specific Super Shiny Pokemon to look like.
Also note that this Super Shiny hue may also be applied via the debug mode Sprite Editor, the same way all metrics data can be edited. But I'll go over more on that in its own subsection.
Spinda is a unique case, since its sprite is able to have randomly generated spots. This causes a lot of problems with animating Spinda, since its spots will always be in a different place, and thus impossible to know how to animate.
Because of this, this plugin dedicates a ton of complex coding and work-arounds just to get Spinda to work. However, a few liberties have been taken that stray from the main series a bit to accomplish this.
The only way to have Spinda's spots to animate properly is to "track" Spinda's movement during its animation and draw the spots on every frame of the sprite that match up with how much Spinda has moved from one frame to the next. This is extremely tricky to do, since it's so sprite-specific. How I've managed to implement this is to simply track Spinda's mouth during its animation. Its mouth is a unique color on Spinda's sprite that is the same color in its shiny version too. This makes it easy to track by simply checking the color of each pixel within a certain bounds of the sprite. If the color of that pixel does not match Spinda's mouth color, then we know the sprite must have moved. If so, the code calculates how many pixels Spinda's mouth has moved since the last frame of its animation, and then shifts where the spots should be drawn based on the difference in movement.
This works all well and good...for Spinda's face. Spinda's ears however, animate completely independently from its face, so the same logic can't be used to place spots on its ears like they can be on its face. There's simply no way to do this, so I've decided to just change how Spinda's spot patterns generate so that they just no longer appear on its ears. Because of this, Spinda will have completely different looking spot patterns on its animated sprite than it would otherwise normally have prior to installing this plugin. So any Spinda purists out there should keep that in mind.
In addition, I've also decided to just turn off displaying spots on Spinda's back sprite altogether. The new sprite patterns just simply do not display well on the back sprite and are much harder to match up with the animation. So all Spinda will unfortunately look identical when viewed from behind.