Script for change the "self.z" of specific events.

Hello, I want an script that allow to, like, have a way to have specific events not affected by a change screen tone, or some others to stay above a picture.. i saw a post of a script like this, but it's for vx ace, can someone like, made something like this for me? I really need it. https://www.rpgmakercentral.com/topic/14467-request-script-for-change-the-selfz-of-specific-events/
re-up
Heretic's NPCs on Event Tiles script has that feature 🙂
You can try $game_map.events[id].z = value

but afaik, the event viewport itself is below the image viewport so it might not work. And this is for Ace..

Also what RM are you using? You posted on RGSS script support so it could be XP, VX or VX Ace..
Also what RM are you using? You posted on RGSS script support so it could be XP, VX or VX Ace..
It's posted in RGSS Script Requests, so that's XP.
I misread.. I thought it was RGSSX xD
It's posted in RGSS Script Requests, so that's XP.

Exactly

Heretic's NPCs on Event Tiles script has that feature 🙂

Really? I'll try then.
Heretic's NPCs on Event Tiles script has that feature 🙂
It don't affect pictures, it affect tiles. I need an event to stay above a picture.
I'm 90% sure you asked this a few weeks ago, and you could accomplish this, in turn you'd break half of the other systems in place.
Are you asking someone to rewrite half the standard scripts to move an even above a picture...?
It's not pretty. I literally just slapped this together:

Almost nothing is impossible. Just sometimes... plain freakin' stubborn.
Code:
#==============================================================================
# ** Sprites in the Sky
#    by DerVVulfman (May 16, 2019)
#    for Andrea87Sky (hence the name)
#------------------------------------------------------------------------------
#  This script takes the 'pictures' out of the 2nd viewport (Viewport2) and
#  reintroduces them into Viewport 1 at a projected z-Depth of 3001-3050, so
#  they are above the fog effect.

#  It also adds a new value to the Game and Sprite Character system so the
#  z-Depth of any sprite can be altered.
#
#  You can use a command of $game_player.z_adjustment = 3000
#  or make a call like $game_map.events[3].z_adjustment = 4000
#  A z_adjustment setting of 0 is considered normal
#==============================================================================


#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :z_adjustment             # Change to Z-Depth
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias change_pics_sprites_initialize initialize
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  def initialize
    # The original call
    change_pics_sprites_initialize
    # Set our default
    @z_adjustment = 0
  end
end



#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
#  switching via condition determinants, and running parallel process events.
#  It's used within the Game_Map class.
#==============================================================================

class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :z_adjustment             # Change to Z-Depth
  #--------------------------------------------------------------------------
  # * Clear Starting Flag
  #--------------------------------------------------------------------------
  def z_adjustment
    @z_adjustment
  end
end



#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Character < RPG::Sprite
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :character                # character
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias change_pics_sprites_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    change_pics_sprites_update
    self.z += @character.z_adjustment
  end
end



#==============================================================================
# ** Sprite_Picture
#------------------------------------------------------------------------------
#  This sprite is used to display the picture.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Picture < Sprite
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias change_sprite_pictures_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Original call
    change_sprite_pictures_update
    # Increase Z to make it above fogs
    self.z += 3000
  end
end



#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc.
#  It's used within the Scene_Map class.
#==============================================================================

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias change_pics_spriteset_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    change_pics_spriteset_initialize
    # Re-Make picture sprites
    @picture_sprites = []
    for i in 1..50
      @picture_sprites.push(Sprite_Picture.new(@viewport1,
        $game_screen.pictures[i]))
    end
  end
end
It's not pretty. I literally just slapped this together:

Almost nothing is impossible. Just sometimes... plain freakin' stubborn.
Code:
#==============================================================================
# ** Sprites in the Sky
#    by DerVVulfman (May 16, 2019)
#    for Andrea87Sky (hence the name)
#------------------------------------------------------------------------------
#  This script takes the 'pictures' out of the 2nd viewport (Viewport2) and
#  reintroduces them into Viewport 1 at a projected z-Depth of 3001-3050, so
#  they are above the fog effect.

#  It also adds a new value to the Game and Sprite Character system so the
#  z-Depth of any sprite can be altered.
#
#  You can use a command of $game_player.z_adjustment = 3000
#  or make a call like $game_map.events[3].z_adjustment = 4000
#  A z_adjustment setting of 0 is considered normal
#==============================================================================


#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :z_adjustment             # Change to Z-Depth
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias change_pics_sprites_initialize initialize
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  def initialize
    # The original call
    change_pics_sprites_initialize
    # Set our default
    @z_adjustment = 0
  end
end



#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
#  switching via condition determinants, and running parallel process events.
#  It's used within the Game_Map class.
#==============================================================================

class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :z_adjustment             # Change to Z-Depth
  #--------------------------------------------------------------------------
  # * Clear Starting Flag
  #--------------------------------------------------------------------------
  def z_adjustment
    @z_adjustment
  end
end



#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Character < RPG::Sprite
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :character                # character
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias change_pics_sprites_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    change_pics_sprites_update
    self.z += @character.z_adjustment
  end
end



#==============================================================================
# ** Sprite_Picture
#------------------------------------------------------------------------------
#  This sprite is used to display the picture.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Picture < Sprite
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias change_sprite_pictures_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Original call
    change_sprite_pictures_update
    # Increase Z to make it above fogs
    self.z += 3000
  end
end



#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc.
#  It's used within the Scene_Map class.
#==============================================================================

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias change_pics_spriteset_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    change_pics_spriteset_initialize
    # Re-Make picture sprites
    @picture_sprites = []
    for i in 1..50
      @picture_sprites.push(Sprite_Picture.new(@viewport1,
        $game_screen.pictures[i]))
    end
  end
end

OH MY GOD, THANK YOU! THAT'S WHAT I WAS SEARCHING!

But sadly it gives me this error: https://cdn.discordapp.com/attachme...05355264/bandicam_2019-05-29_21-09-49-707.png
Heh... you don't need to quote the WHOLE post... just a little bit to get my attention. 😉 If it's a big post, you certainly wouldn't wanna. 😀

So what I'm thinking, is that you have something that 'stalls' the creation of the character, so it's trying to make the sprite before the game character is readied.... so.....................

I added some tests so it won't try to alter the sprite if..
1) Self (the sprite itself) is nil .... the sprite hasn't been generated
2) @character is nil ....the character data hasn't been generated
--or--
3) @character.z_adjustment is nil .... nothing set.

So here goes:
Code:
#==============================================================================
# ** Sprites in the Sky
#    by DerVVulfman (May 29, 2019)
#    for Andrea87Sky (hence the name)
#    Version 1.1
#------------------------------------------------------------------------------
#  This script takes the 'pictures' out of the 2nd viewport (Viewport2) and
#  reintroduces them into Viewport 1 at a projected z-Depth of 3001-3050, so
#  they are above the fog effect.
#
#  It also adds a new value to the Game and Sprite Character system so the
#  z-Depth of any sprite can be altered.
#
#  You can use a command of $game_player.z_adjustment = 3000
#  or make a call like $game_map.events[3].z_adjustment = 4000
#  A z_adjustment setting of 0 is considered normal
#==============================================================================


#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :z_adjustment             # Change to Z-Depth
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias change_pics_sprites_initialize initialize
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  def initialize
    # The original call
    change_pics_sprites_initialize
    # Set our default
    @z_adjustment = 0
  end
end



#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
#  switching via condition determinants, and running parallel process events.
#  It's used within the Game_Map class.
#==============================================================================

class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :z_adjustment             # Change to Z-Depth
  #--------------------------------------------------------------------------
  # * Clear Starting Flag
  #--------------------------------------------------------------------------
  def z_adjustment
    @z_adjustment
  end
end



#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Character < RPG::Sprite
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :character                # character
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias change_pics_sprites_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Original call
    change_pics_sprites_update
    # Ensure that neither self nor @character is nil...
    return if self.nil?
    return if @character.nil?
    return if @character.z_adjustment.nil?
    # Adjust
    self.z += @character.z_adjustment
  end
end



#==============================================================================
# ** Sprite_Picture
#------------------------------------------------------------------------------
#  This sprite is used to display the picture.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Picture < Sprite
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias change_sprite_pictures_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Original call
    change_sprite_pictures_update
    # Increase Z to make it above fogs
    self.z += 3000
  end
end



#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc.
#  It's used within the Scene_Map class.
#==============================================================================

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias change_pics_spriteset_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    change_pics_spriteset_initialize
    # Re-Make picture sprites
    @picture_sprites = []
    for i in 1..50
      @picture_sprites.push(Sprite_Picture.new(@viewport1,
        $game_screen.pictures[i]))
    end
  end
end
Heh... you don't need to quote the WHOLE post... just a little bit to get my attention. 😉 If it's a big post, you certainly wouldn't wanna. 😀

So what I'm thinking, is that you have something that 'stalls' the creation of the character, so it's trying to make the sprite before the game character is readied.... so.....................

I added some tests so it won't try to alter the sprite if..
1) Self (the sprite itself) is nil .... the sprite hasn't been generated
2) @character is nil ....the character data hasn't been generated
--or--
3) @character.z_adjustment is nil .... nothing set.

So here goes:
Code:
#==============================================================================
# ** Sprites in the Sky
#    by DerVVulfman (May 29, 2019)
#    for Andrea87Sky (hence the name)
#    Version 1.1
#------------------------------------------------------------------------------
#  This script takes the 'pictures' out of the 2nd viewport (Viewport2) and
#  reintroduces them into Viewport 1 at a projected z-Depth of 3001-3050, so
#  they are above the fog effect.
#
#  It also adds a new value to the Game and Sprite Character system so the
#  z-Depth of any sprite can be altered.
#
#  You can use a command of $game_player.z_adjustment = 3000
#  or make a call like $game_map.events[3].z_adjustment = 4000
#  A z_adjustment setting of 0 is considered normal
#==============================================================================


#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :z_adjustment             # Change to Z-Depth
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias change_pics_sprites_initialize initialize
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  def initialize
    # The original call
    change_pics_sprites_initialize
    # Set our default
    @z_adjustment = 0
  end
end



#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
#  switching via condition determinants, and running parallel process events.
#  It's used within the Game_Map class.
#==============================================================================

class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :z_adjustment             # Change to Z-Depth
  #--------------------------------------------------------------------------
  # * Clear Starting Flag
  #--------------------------------------------------------------------------
  def z_adjustment
    @z_adjustment
  end
end



#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Character < RPG::Sprite
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :character                # character
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias change_pics_sprites_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Original call
    change_pics_sprites_update
    # Ensure that neither self nor @character is nil...
    return if self.nil?
    return if @character.nil?
    return if @character.z_adjustment.nil?
    # Adjust
    self.z += @character.z_adjustment
  end
end



#==============================================================================
# ** Sprite_Picture
#------------------------------------------------------------------------------
#  This sprite is used to display the picture.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Picture < Sprite
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias change_sprite_pictures_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Original call
    change_sprite_pictures_update
    # Increase Z to make it above fogs
    self.z += 3000
  end
end



#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc.
#  It's used within the Scene_Map class.
#==============================================================================

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias change_pics_spriteset_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    change_pics_spriteset_initialize
    # Re-Make picture sprites
    @picture_sprites = []
    for i in 1..50
      @picture_sprites.push(Sprite_Picture.new(@viewport1,
        $game_screen.pictures[i]))
    end
  end
end

Uh now it works, but without doing anything the color screen tone affects now the pictures, that wasn't the exactly thing i wanted to do, at least maybe made a specific picture to be affected to color screen tone.. Or maybe a switch for change the viewpoint of a picture

Anyway I've just clicked on "reply" on your comments, I didn't quoted it manually.
Code:
#  This script takes the 'pictures' out of the 2nd viewport (Viewport2) and
#  reintroduces them into Viewport 1 at a projected z-Depth of 3001-3050, so
#  they are above the fog effect.
Screen tone changes are applied to @viewport1 directly, so everything on it will be affected. As I said, characters are on @viewport1, so the only real fix would be to move them to a different viewport. But you can't--or rather, you shouldn't--do that since characters and the tilemap need to be on the same viewport (otherwise, z-order/tile priorities will no longer work). The best way to do it would be to use a script that changes the tone for the sprites individually rather than the viewport; and if you wanted to still affect the tilemap, you'd need a tilemap rewrite.
Daamn, ok then, so what about making like a new character type? For example the "player" is tecnically another type of character, idk if it's possible, but I'll ask anyway.

Maybe a new character type called "Bullets" that has like viewport 3, so I can make that daamn bullet hell system, and maybe to ensure that the game identifies it, make a comment on an events that says like "bullet" or something.
I think then it's impossible to do a thing like this. What a shame..

Original thread: https://forums.rpgmakerweb.com/threads/script-for-change-the-self-z-of-specific-events.108042/