Events Always Under - DerVVulfman -  02-26-2015
 
 
Events Always Under 
Version: 1.0 
 
 
Introduction 
This script is designed to add a new parameter to events that are drawn on the map, the ability to be drawn below the traditional ground level.  This "Always Under" flag,  the polar opposite of the "Always On Top" flag, will have the event drawn at a -1 z-depth,  which will force it  to be rendered under the base ground layer, but still above the panorama graphic. 
 
 
 
Script 
Code: #============================================================================== 
# ** Events Always Under 
#------------------------------------------------------------------------------ 
#    by DerVVulfman 
#    version 1.0 
#    02-22-2015 
#    RGSS & RGSS2 / RPGMaker XP & RPGMaker VX 
#============================================================================== 
#  
#  INTRODUCTION: 
# 
#  This script is designed to add a new parameter to events that are drawn on 
#  the map, the ability to be drawn below the traditional ground level.  This 
#  "Always Under" flag,  the polar opposite of the "Always On Top" flag, will 
#  have the event drawn at a -1 z-depth,  which will force it  to be rendered 
#  under the base ground layer, but still above the panorama graphic. 
# 
#------------------------------------------------------------------------------ 
# 
#  USAGE: 
# 
#  Simply put, add the word 'Under' (without the quotes) to your event's name 
#  (EX:  EV003 Under),  or create a comment  in your event's list of commands 
#  and have that comment  merely read 'Under'  (again, without quotes).  This 
#  will flag the event as an 'Always Under' event. 
# 
#  On personal preference, I would recommend using it within a comment as the 
#  event can have the 'Always Under' flag turned on/off  if the event erased,  
#  gone from one event page to another, or the like. 
#   
#============================================================================== 
# 
#  NOTE: 
# 
#  While one can apply a characterset graphic to an event, the 'through' flag 
#  in an event will not let the player step upon any such tile.   So if it is 
#  the intention  of the game/map designer  for the player  to walk upon such 
#  tiles, only use graphics from the tileset for these events.  Additionally, 
#  setting the 'through' flag on may actively hamper movement and disable the 
#  passages flags. 
#   
#============================================================================== 
# 
#  TERMS AND CONDITIONS: 
# 
#  Free for use, even in commercial games.  This script was inspired by JayRay 
#  who requested this feature, so due credit to both he and I is required. 
# 
#============================================================================== 
 
 
 
 
#============================================================================== 
# ** Game_Map 
#------------------------------------------------------------------------------ 
#  This class handles the map. It includes scrolling and passable determining 
#  functions. Refer to "$game_map" for the instance of this class. 
#============================================================================== 
 
class Game_Map 
  #-------------------------------------------------------------------------- 
  # * Alias Listings 
  #-------------------------------------------------------------------------- 
  alias always_under_setup setup 
  #-------------------------------------------------------------------------- 
  # * Setup 
  #     map_id : map ID 
  #-------------------------------------------------------------------------- 
  def setup(map_id) 
    always_under_setup(map_id) 
    for e in @events.values 
      next if e.nil? 
      e.always_under = true if e.name =~ "Under" 
      image_flag = false 
      if RUBY_VERSION.slice(0,3) == "1.6" 
        image_flag = true if e.character_name != "" 
      else 
        image_flag = true if e.character_name != "" or e.tile_id != 0 
      end 
      unless image_flag == false or e.list.nil? 
        for i in 0...e.list.size 
          next if e.list[i].code != 108 
          e.always_under = true  if e.list[i].parameters[0] =~ "Under" 
        end 
      end 
    end 
  end 
end 
 
 
 
#============================================================================== 
# ** 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 :always_under             # Always Under Flag 
  #-------------------------------------------------------------------------- 
  # * Alias Listings 
  #-------------------------------------------------------------------------- 
  alias always_under_initialize initialize 
  alias always_under_screen_z screen_z 
  #-------------------------------------------------------------------------- 
  # * Object Initialization 
  #-------------------------------------------------------------------------- 
  def initialize 
    always_under_initialize 
    @always_under = false 
  end 
  #-------------------------------------------------------------------------- 
  # * Get Screen Z-Coordinates 
  #     height : character height 
  #-------------------------------------------------------------------------- 
  def screen_z(height = 0) 
    return -1 if @always_under 
    if RUBY_VERSION.slice(0,3) == "1.6" 
      return always_under_screen_z(height) 
    else 
      return always_under_screen_z 
    end 
  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 
  #-------------------------------------------------------------------------- 
  # * Get Event Name 
  #-------------------------------------------------------------------------- 
  def name 
    return @event.name 
  end 
end
  
 
Instructions 
The instructions are pretty much in the script.  But it is MOSTLY Plug-n-play. :cheery: 
 
 
Compatibility 
This script works for both RPGMaker XP and RPGMaker VX.  I am unsure about it's compatibility with RPGMaker VXAce, but it MAY work. 
 
 
Terms and Conditions 
Free for use, even in commercial games.  This script was inspired by JayRay who requested this feature, so due credit to both he and I is required.
 
 
 
 |