Changing Z level for certain animations in battle?

Simply put, I'm looking for a way to display specific animations (such as magic circles) below battlers. I'm already using Galv's Map Animation Effects but as stated in the thread, it currently doesn't work for animations in battle. I've seen this feature implemented in this video, possibly through a different plugin that I couldn't find from my searches.

Whether it'd be a plugin edit to Galv's, a short plugin, or even a script call to alter the z values, anything would be appreciated
Someone posted on the support forum a long time ago, and shared with me the following code, which allows you to set the z layer of an animation based on it's name in the database.
Code:
var animation_position = Sprite_Animation.prototype.updatePosition;
Sprite_Animation.prototype.updatePosition = function() {
    animation_position.call(this)
    if (this._animation.name.contains("TPZH")) {
        this.z = -1;
    } else {
        this.z = 8;
    }
};
This should do it for you. Just ad TPZH to the end of any animation name you want this to apply to.
Someone posted on the support forum a long time ago, and shared with me the following code, which allows you to set the z layer of an animation based on it's name in the database.

This should do it for you. Just ad TPZH to the end of any animation name you want this to apply to.

Thank you very much, it works like a charm!
This is super helpful. I was just wondering however, if there was a way to set it up so if you have a group of enemies that are relatively close together, the animation will play above the targeted enemy, but below an enemy that is positioned in front (ie. closer to the camera) of the targeted enemy.
Can someone tell me where I'm supposed to put this code? I made a script call within the battle but its still not working.
Can someone tell me where I'm supposed to put this code? I made a script call within the battle but its still not working.
Open notepad and paste the text in there, then save as -> something.js

Import it into your plugin manager like any other plugin.
Hmm.....I did that and its not working. The animation in question is still appearing over the characters....hmmm....................................
Hmm.....I did that and its not working. The animation in question is still appearing over the characters....hmmm....................................
You have to add TPZH to the animation names in the database, not the sprites themselves.
Ok done m'such a noob. But its still not working properly the animation appears below the actors but flickers in and out.......
Two points:

1. Take out the part that says:

} else {
this.z = 8;

Otherwise, it will completely mess up GALV's plugin and put the animations above all of the events.

2. It doesn't work in SV_Battle. I named an animation Hit Fire TPZH. It still appears above the enemy.

Two points:

1. Take out the part that says:

} else {
this.z = 8;

Otherwise, it will completely mess up GALV's plugin and put the animations above all of the events.

2. It doesn't work in SV_Battle. I named an animation Hit Fire TPZH. It still appears above the enemy.

Strike that second point! For some reason, it only fails when I try putting the plugin into GALV's demo game. It works perfectly well for my own!

Original thread: https://forums.rpgmakerweb.com/threads/changing-z-level-for-certain-animations-in-battle.105489/