VXAce Is there a way to change Z coordinates / layers of specific battle animations ?

So i'm actually using Yanfly's battle engine and i've put my cast animation at the feet of my ennemies and battlers. But, the sprites of battlers and foes are actually behind the animations and i'd like it to pass behind the sprite when they overlap. I looked for some scripts that permits to change Z coordinates of my animations, but didn't find anything usefull, i also looked inside the scripts i already have if i could change something but i never really programmed something and i don't know how to script from scratch. Here's a screenshot of the problem :

Spoiler: Screenshot
1780675307821.png

(the seal on the floor has a highest display priority than the ennemy sprite and i'd like to invert this so we see the ennemy above it)

I tried to make it less visual with opacity and blending but i'm not really satisfied with the results.

Scripts installed :

Yanfly's Ace core
Yanfly's Battle Engine
YEA's Battle System FTB
Yanfly's Cast Animation
Yanfly's State Animation
Yanfly's Visual Battler



Is there an option in the software, or a script i missed that could help me to have some control on this ?

Thanks a lot for taking time to help me guys =)
Hello!

Here is a tiny script, you can set which animation ids are displayed below the sprite by adding them to the list in the module:
Ruby:
#==============================================================================
# Under Animations
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 06/06/2026
#==============================================================================

$imported ||= {}
$imported["TIM-UnderAnims"] = true

#==============================================================================
# Description: You cna set some animations to be under the sprites of battlers
# or events, just fill the LIST in the module with the animation ids.
#==============================================================================
# Term of Use: Free for any project, credit is not required
#==============================================================================

#==============================================================================
# module
#==============================================================================
module TIM
  module UnderAnims
    #Any animation id in this list will be displayed under the sprite
    #instead of on top of
    LIST = [43,44,45,46]
  end #UnderAnims
end #TIM

#==============================================================================
# Sprite_Base
#==============================================================================
class Sprite_Base < Sprite
  #--------------------------------------------------------------------------
  # alias method: animation_set_sprites
  #--------------------------------------------------------------------------
  alias tim_ua_animation_set_sprites animation_set_sprites
  def animation_set_sprites(frame)
    tim_ua_animation_set_sprites(frame)
    z = anim_z(@animation.id)
    @ani_sprites.each_with_index{|sprite, i| sprite.z = z + i if sprite}
  end
 
  #--------------------------------------------------------------------------
  # new method: anim_z
  #--------------------------------------------------------------------------
  def anim_z(anim_id)
    self.z + (anim_under?(anim_id) ? -16 : 300)
  end
 
  #--------------------------------------------------------------------------
  # new method: anim_under?
  #--------------------------------------------------------------------------
  def anim_under?(anim_id)
    TIM::UnderAnims::LIST.include?(anim_id)
  end
end #Sprite_Base

I only tested it with Yanfly Battle Engine, please tell if something is wrong.
At first sight it seems to work like a charm ! I'll tell you if anything goes wrong later.
Spoiler: Screenshot
1780760288206.png

Anyway you're fantastic, thank you so much !! How do i credit you for this ?
You are welcome, as I said in the script header, you don't have to credit me for this script, but if you do, I guess you can display my username (Timtrack) in your game credits along other contributors to your game.

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-change-z-coordinates-layers-of-specific-battle-animations.183926/