RPG Maker Forums

I'm using Kha's awesome light effects and Falcao's Pearl ABS. But when I adjust the lighting with Kha's script, it draws the darkness over Falcao's HUD, so the HP bars, etc also get darkened.

Is there a way to make Falcao's ABS appear above the effect layer drawn by Khas light effects, or another way to stop the HUD darkening along with the rest of the screen?

Scripts are here:

Khas

#-------------------------------------------------------------------------------
# * [ACE] Khas Awesome Light Effects
#-------------------------------------------------------------------------------
# * By Khas Arcthunder - arcthunder.site40.net
# * Version: 1.0 EN
# * Released on: 17/01/2012
#
#-------------------------------------------------------------------------------
# * Terms of Use
#-------------------------------------------------------------------------------
# When using any Khas script, you agree with the following terms:
# 1. You must give credit to Khas;
# 2. All Khas scripts are licensed under a Creative Commons license;
# 3. All Khas scripts are for non-commercial projects. If you need some script
#    for your commercial project (I accept requests for this type of project),
#    send an email to nilokruch@live.com with your request;
# 4. All Khas scripts are for personal use, you can use or edit for your own
#    project, but you are not allowed to post any modified version;
# 5. You can’t give credit to yourself for posting any Khas script;
# 6. If you want to share a Khas script, don’t post the direct download link,
#    please redirect the user to arcthunder.site40.net
#
#-------------------------------------------------------------------------------
# * Features
#-------------------------------------------------------------------------------
# - Realistic Light
# - Light does not pass over walls, blocks and roofs
# - Static Light Sources
# - Dynamic Light Sources (like a player's lantern)
# - Multiple effects
# - Easy to use (comments)
#
#-------------------------------------------------------------------------------
# * WARNING - Performance
#-------------------------------------------------------------------------------
# This script may be too heavy to old processors! The Awesome Light Effects was
# tested on a Core 2 Duo E4500 and on a Core i5, without any lag. However,
# there's other factors that may influence the script performance:
#
# 1. Map size
# This script searches surfaces on the map, in order to cut the light pictures.
# In a huge map, the number of surfaces may increase a lot, affecting the
# DYNAMIC LIGHT SOURCE only. Map size does not influence the static sources.
#
# 2. Number of effects
# This script draws the effects on the screen, but before drawing, it checks
# if the effect is out of screen (in this case, the script will skip the
# light drawing). Too much effects may cause lag, but this is just a prevision.
#
# 3. Effect's picture size
# The picture size of the DYNAMIC LIGHT SOURCE influences directly on your
# game's performace. The bigger is the picture, the slower it will be to
# draw it dynamically. The recommended maximum size is 200x200 pixels
#
#-------------------------------------------------------------------------------
# * WARNING - Light pictures
#-------------------------------------------------------------------------------
# In order to run this script correctly, the light pictures MUST obey the
# following conditions:
# 1. The picture's size MUST be multiple of 2. Example: 150x150
# 2. The picture's width MUST be equal to it's height. Example: 156x156
# 3. The picture's colors MUST be inverted! This is necessary because
#    the script inverts the colors to draw the effect. The black color
#    will be transparent!
#
#-------------------------------------------------------------------------------
# * Instructions - 1. Setup your effects!
#-------------------------------------------------------------------------------
# In order to setup your static effects, go to the setup part and define your
# effects inside the Effects hash. Do as the following mode:
#
# X => [picture,opacity,variation,cut],   <= Remember to put a comma here!
#
# Where:
# picture => Picture's name, inside the Graphics/Lights folder;
# opacity => Effect's opacity;
# variation => Effect's opacity variation;
# cut => Put true to cut the effect or false to don't;
# X => The effect's ID, it will be used on events.
#
# Check the default effects to understand how they work.
#
#-------------------------------------------------------------------------------
# * Instructions - 2. Use your effects!
#-------------------------------------------------------------------------------
# In order to use a effect, put the following comment on a event:
#
# [light x]
#
# Where x must be the Effect's ID.
#
#-------------------------------------------------------------------------------
# * Instructions - 3. Use an awesome lantern!
#-------------------------------------------------------------------------------
# The dynamic light source (lantern) is initialized invisible by default.
# You may call the following commands:
#
# l = $game_map.lantern
# Gets the lantern into a variable

# l.set_graphic(i)
# Sets the lantern's graphic to i, where i must be the picture's file name on
# Graphics/Lights folder.
#
# l.set_multiple_graphics(h)
# Sets the lantern's graphics to h, where h must be a hash with the following
# structure:
#
# h = {2=>"ld",4=>"ll",6=>"lr",8=>"lu"}
#
# Where:
# "ld" is the name of the picture when the lantern's owner is looking down;
# "ll" is the name of the picture when the lantern's owner is looking left;
# "lr" is the name of the picture when the lantern's owner is looking right;
# "lu" is the name of the picture when the lantern's owner is looking up.
#
# l.change_owner(char)
# Sets the lantern's owner to char. Char must be ONE of the following commands:
# $game_player           <= The player itself;
# self_event             <= The event where the command was called;
# $game_map.events[x]    <= The event ID x.
#
# l.set_opacity(o,p)
# Sets the lantern's opacity, where:
# o is the opacity itself;
# p is the opacity variation.
#
# l.show
# After setting the lantern with the commands above, you may set it to visible
# using this command.
#
# l.hide
# Use this command to set the lantern as invisible.
#
#-------------------------------------------------------------------------------
# * Instructions - 4. Use the effect's surface!
#-------------------------------------------------------------------------------
# The Awesome Light Effects draws the effects on a surface. In order to make
# the effects visible, the effect's surface MUST be visible. The Effect's
# Surface is initialized with it's opacity set to zero. You can call the
# following commands:
#
# s = $game_map.effect_surface
# Gets the Effect's Surface into a variable
#
# s.set_color(r,g, B)
# Changes the Effect's Surface color instantly, where:
# r => red level;
# g => green level;
# b => blue level;
#
# s.set_alpha(a)
# Changes the Effect's Surface opacity instantly to a.
#
# s.change_color(time,r,g, B)
# Changes the Effect's Surface color ONLY in a certain time, where:
# time => The change's time (frames);
# r => red level;
# g => green level;
# b => blue level;
#
# s.change_color(time,r,g,b,a)
# Changes the Effect's Surface color and it's opacity in a certain time, where:
# time => The change's time (frames);
# r => red level;
# g => green level;
# b => blue level;
# a => opacity
#
# s.change_alpha(time,a)
# Changes the Effect's Surface opacity in a certain time, where:
# time => The change's time (frames);
# a => opacity
#
#-------------------------------------------------------------------------------
# * Instructions - 5. Use the effect's surface with Tone command!
#-------------------------------------------------------------------------------
# You can access the Effect's Surface with the "Screen Tone" command. In order
# to turn this feature on, set the "Surface_UE" constant to true.
#
# If you decided to use this feature, please note some details:
# 1. The colors values must be between 0 and 255;
# 2. The time is in frames;
# 3. The "gray" value will be sent as the opacity value
#
#-------------------------------------------------------------------------------
# * Instructions - 6. Setup your Tileset Tags!
#-------------------------------------------------------------------------------
# In order to cut the effect's picture correctly, there's 3 types of behavior
# for a tile: wall, block and roof. Walls will make shadows as real walls,
# blocks as blocks and roofs as roofs. So, the tileset tags MUST be configured.
# Check the demo to understand how this system works. If the tilesets aren't
# configured correctly, the script won't cut the effects correctly.
#
#-------------------------------------------------------------------------------
# * Setup Part
#-------------------------------------------------------------------------------
module Light_Core
  Effects = { #  <= DON'T change this!
#-------------------------------------------------------------------------------
# PUT YOUR EFFECTS HERE!
#-------------------------------------------------------------------------------
  0 => ["light",255,0,true],
  1 => ["torch",200,20,true],
  2 => ["torch_m",180,30,true],
  3 => ["light_s",255,0,true],
 
#-------------------------------------------------------------------------------
# End of effecs configuration
#-------------------------------------------------------------------------------
  } #  <= DON'T change this!
 
  # Z coordinate of the Effect's Surface
  Surface_Z = 180
 
  # Enable Effect's Surface control by "Screen Tone" command?
  Surface_UE = true
 
  # Roof behavior tag
  Roof_Tag = 5
  # Wall behavior tag
  Wall_Tag = 6
  # Block behavior tag
  Block_Tag = 7
 
  # Don't change this!
  ACC = Math.tan(Math::pI/26)
end
#-------------------------------------------------------------------------------
# Script
#-------------------------------------------------------------------------------
module Cache
  def self.light(filename)
    load_bitmap("Graphics/Lights/", filename)
  end
end
module Light_Bitcore
  include Light_Core
  def self.initialize
    @@buffer = {}
    Effects.values.each { |effect| Light_Bitcore.push(effect[0])}
  end
  def self::[](key)
    return @@buffer[key]
  end
  def self.push(key)
    return if @@buffer.keys.include?(key)
    @@buffer[key] = Cache.light(key)
  end
end
Light_Bitcore.initialize
class Light_SSource
  attr_reader :real_x
  attr_reader :real_y
  attr_reader :range
  attr_accessor :bitmap
  attr_reader :w
  attr_reader :h
  attr_reader :hs
  def initialize(char,bitmap,opacity,plus,hs)
    sync(char)
    @key = bitmap
    @bitmap = Light_Bitcore[@key].clone
    @range = @bitmap.width/2
    @w = @bitmap.width
    @h = @bitmap.height
    @mr = @range - 16
    @opacity = opacity
    @plus = plus
    @hs = hs
    render if @hs
  end
  def render
    tx = x
    ty = y
    tsx = x + @range
    tsy = y + @range
    dr = @range*2
    for s in $game_map.surfaces
      next if !s.visible?(tsx,tsy) || !s.within?(tx,tx+dr,ty,ty+dr)
      s.render_shadow(tx,ty,tsx,tsy,@range,@bitmap)
    end
  end
  def restore
    return unless @bitmap.nil?
    @bitmap = Light_Bitcore[@key].clone
    render if @hs
  end
  def opacity
    @plus == 0 ? @opacity : (@opacity + rand(@plus))
  end
  def sx
    return $game_map.adjust_x(@real_x)*32-@mr
  end
  def sy
    return $game_map.adjust_y(@real_y)*32-@mr
  end
  def sync(char)
    @real_x = char.real_x
    @real_y = char.real_y
  end
  def x
    return (@real_x*32 - @mr).to_f
  end
  def y
    return (@real_y*32 - @mr).to_f
  end
  def dispose
    return if @bitmap.nil?
    @bitmap.dispose
    @bitmap = nil
  end
end
class Light_DSource < Light_SSource
  attr_reader :bitmap
  attr_reader :visible
  def initialize
    @key = nil
    @bitmap = nil
    @opacity = 255
    @plus = 0
    @char = $game_player
    @visible = false
  end
  def set_opacity(o,p)
    @opacity = o
    @plus = p
  end
  def set_graphic(sb)
    dispose
    @key = {2=>sb,4=>sb,6=>sb,8=>sb}
    Light_Bitcore.push(sb)
    @bitmap = {2=>Light_Bitcore[@key[2]].clone,4=>Light_Bitcore[@key[4]].clone,6=>Light_Bitcore[@key[6]].clone,8=>Light_Bitcore[@key[8]].clone}
    @range = @bitmap[2].width/2
    @w = @bitmap[2].width
    @h = @bitmap[2].height
    @mr = @range - 16
  end
  def set_multiple_graphics(ba)
    dispose
    @key = ba
    @key.values.each {|key| Light_Bitcore.push(key)}
    @bitmap = {2=>Light_Bitcore[@key[2]].clone,4=>Light_Bitcore[@key[4]].clone,6=>Light_Bitcore[@key[6]].clone,8=>Light_Bitcore[@key[8]].clone}
    @range = @bitmap[2].width/2
    @w = @bitmap[2].width
    @h = @bitmap[2].height
    @mr = @range - 16
  end
  def get_graphic
    return @bitmap[@char.direction].clone
  end
  def show
    return if @bitmap.nil?
    @visible = true
  end
  def hide
    @visible = false
  end
  def restore
    return if @key.nil?
    @key.values.each {|key| Light_Bitcore.push(key)}
    @bitmap = {2=>Light_Bitcore[@key[2]].clone,4=>Light_Bitcore[@key[4]].clone,6=>Light_Bitcore[@key[6]].clone,8=>Light_Bitcore[@key[8]].clone}
  end
  def dispose
    return if @bitmap.nil?
    @bitmap.values.each { |b| b.dispose }
    @bitmap = nil
  end
  def change_owner(char)
    @char = char
  end
  def render
  end
  def sx
    return $game_map.adjust_x(@char.real_x)*32-@mr
  end
  def sy
    return $game_map.adjust_y(@char.real_y)*32-@mr
  end
  def x
    return (@char.real_x*32 - @mr).to_f
  end
  def y
    return (@char.real_y*32 - @mr).to_f
  end
end
class Light_Surface
  def initialize
    @ta = @a = 0
    @tr = @r = 255
    @tg = @g = 255
    @tb = @b = 255
    @va = @vr = @vg = @vb = 0.0
    @timer = 0
  end
  def refresh
    return if @timer == 0
    @a += @va
    @r += @vr
    @g += @vg
    @b += @vb
    $game_map.light_surface.opacity = @a
    @timer -= 1
  end
  def change_color(time,r,g,b,a=nil)
    r = 0 if r < 0; r = 255 if r > 255
    g = 0 if g < 0; g = 255 if g > 255
    b = 0 if b < 0; b = 255 if b > 255
    unless a.nil?
      a = 0 if a < 0; a = 255 if a > 255
    end
    @timer = time
    @tr = 255-r
    @tg = 255-g
    @tb = 255-b
    @va = (a.nil? ? 0 : (a-@a).to_f/@timer)
    @vr = (@tr - @r).to_f/@timer
    @vg = (@tg - @g).to_f/@timer
    @vb = (@tb - @ B) .to_f/@timer
  end
  def change_alpha(time,a)
    a = 0 if a < 0; a = 255 if a > 255
    @timer = time
    @ta = a
    @vr = @vg = @vb = 0.0
    @va = (a-@a).to_f/@timer
  end
  def set_color(r,g, B)
    r = 0 if r < 0; r = 255 if r > 255
    g = 0 if g < 0; g = 255 if g > 255
    b = 0 if b < 0; b = 255 if b > 255
    @tr = @r = 255-r
    @tg = @g = 255-g
    @tb = @b = 255-b
    @va = @vr = @vg = @vb = 0.0
    @timer = 0
  end
  def set_alpha(a)
    a = 0 if a < 0; a = 255 if a > 255
    @ta = @a = a
    $game_map.light_surface.opacity = @a
    @va = @vr = @vg = @vb = 0.0
    @timer = 0
  end
  def alpha
    return @a
  end
  def color
    return Color.new(@r,@g,@ B)
  end
end
class Game_Map
  include Light_Core
  attr_accessor :light_surface
  attr_accessor :light_sources
  attr_accessor :surfaces
  attr_accessor :effect_surface
  attr_accessor :lantern
  alias kbl_setup_events setup_events
  alias kbl_initialize initialize
  alias kbl_update update
  def initialize
    kbl_initialize
    @effect_surface = Light_Surface.new
    @lantern = Light_DSource.new
  end
  def update(arg)
    @effect_surface.refresh if arg
    kbl_update(arg)
  end
  def first_tag(x,y)
    tag = tileset.flags[tile_id(x,y,0)] >> 12
    return tag > 0 ? tag : 0
  end
  def setup_events
    @light_sources.nil? ? @light_sources = [] : @light_sources.clear
    setup_surfaces
    merge_surfaces
    kbl_setup_events
  end
  def setup_surfaces
    @surfaces = []
    for x in 0..(width-1)
      for y in 0..(height-1)
        tag = first_tag(x,y)
        if tag == Wall_Tag
          i = tile_id(x,y,0)
          if i & 0x02 == 0x02
            @surfaces << Block_SD.new(x*32,y*32,x*32+32,y*32)
          end
          if i & 0x04 == 0x04
            @surfaces << Block_WR.new(x*32+31,y*32,x*32+31,y*32+32)
            @surfaces << Block_IL.new(x*32+32,y*32,x*32+32,y*32+32)
          end
          if i & 0x01 == 0x01
            @surfaces << Block_IR.new(x*32-1,y*32,x*32-1,y*32+32)
            @surfaces << Block_WL.new(x*32,y*32,x*32,y*32+32)
          end
        elsif tag == Roof_Tag
          i = tile_id(x,y,0)
          @surfaces << Block_SU.new(x*32,y*32,x*32+32,y*32) if i & 0x02 == 0x02
          @surfaces << Block_SR.new(x*32+31,y*32,x*32+31,y*32+32) if i & 0x04 == 0x04
          @surfaces << Block_SL.new(x*32,y*32,x*32,y*32+32) if i & 0x01 == 0x01
        elsif tag == Block_Tag
          f = tileset.flags[tile_id(x,y,0)]
          @surfaces << Block_SL.new(x*32,y*32,x*32,y*32+32) if f & 0x02 == 0x02
          @surfaces << Block_SR.new(x*32+31,y*32,x*32+31,y*32+32) if f & 0x04 == 0x04
          @surfaces << Block_SU.new(x*32,y*32,x*32+32,y*32) if f & 0x08 == 0x08
        end
      end
    end
  end
  def merge_surfaces
    new_surfaces = []
    hs = []; vs = []
    ws = []; is = []
    for surface in @surfaces
      if surface.type & 0x05 == 0
        hs << surface
      else
        if surface.type & 0x010 == 0
          vs << surface
        else
          if surface.type & 0x08 == 0
            ws << surface
          else
            is << surface
          end
        end
      end
    end
    for surface in hs
      surface.ready ? next : surface.ready = true
      for s in hs
        next if s.ready || s.y1 != surface.y1 || surface.type != s.type
        if s.x2 == surface.x1
          surface.x1 = s.x1
          s.trash = true
          s.ready = true
          surface.ready = false
        elsif s.x1 == surface.x2
          surface.x2 = s.x2
          s.trash = true
          s.ready = true
          surface.ready = false
        end
      end
    end
    hs.each { |s| @surfaces.delete(s) if s.trash}
    for surface in vs
      surface.ready ? next : surface.ready
      for s in vs
        next if s.ready || s.x1 != surface.x1
        if s.y2 == surface.y1
          surface.y1 = s.y1
          s.trash = true
          s.ready = true
          surface.ready = false
        elsif s.y1 == surface.y2
          surface.y2 = s.y2
          s.trash = true
          s.ready = true
          surface.ready = false
        end
      end
    end
    vs.each { |s| @surfaces.delete(s) if s.trash}
    for surface in ws
      surface.ready ? next : surface.ready
      for s in ws
        next if s.ready || s.x1 != surface.x1
        if s.y2 == surface.y1
          surface.y1 = s.y1
          s.trash = true
          s.ready = true
          surface.ready = false
        elsif s.y1 == surface.y2
          surface.y2 = s.y2
          s.trash = true
          s.ready = true
          surface.ready = false
        end
      end
    end
    ws.each { |s| @surfaces.delete(s) if s.trash}
    for surface in is
      surface.ready ? next : surface.ready
      for s in is
        next if s.ready || s.x1 != surface.x1
        if s.y2 == surface.y1
          surface.y1 = s.y1
          s.trash = true
          s.ready = true
          surface.ready = false
        elsif s.y1 == surface.y2
          surface.y2 = s.y2
          s.trash = true
          s.ready = true
          surface.ready = false
        end
      end
    end
    is.each { |s| @surfaces.delete(s) if s.trash}
  end
end
class Game_Event < Game_Character
  alias kbl_initialize initialize
  alias kbl_setup_page setup_page
  def initialize(m,e)
    @light = nil
    kbl_initialize(m,e)
  end
  def setup_page(np)
    kbl_setup_page(np)
    setup_light(np.nil?)
  end
  def setup_light(dispose)
    unless @light.nil?
      $game_map.light_sources.delete(self)
      @light.dispose
      @light = nil
    end
    unless dispose && @list.nil?
      for command in @list
        if command.code == 108 && command.parameters[0].include?("[light")
          command.parameters[0].scan(/\[light ([0.0-9.9]+)\]/)
          effect = Light_Core::Effects[$1.to_i]
          @light = Light_SSource.new(self,effect[0],effect[1],effect[2],effect[3])
          $game_map.light_sources << self
          return
        end
      end
    end
  end
  def draw_light
    sx = @light.sx
    sy = @light.sy
    w = @light.w
    h = @light.h
    return if sx > 544 && sy > 416 && sx + w < 0 && sy + h < 0
    $game_map.light_surface.bitmap.blt(sx,sy,@light.bitmap,Rect.new(0,0,w,h),@light.opacity)
  end
  def dispose_light
    @light.dispose
  end
  def restore_light
    @light.restore
  end
end
if Light_Core::Surface_UE
  class Game_Interpreter
    def command_223
      $game_map.effect_surface.change_color(@params[1],@params[0].red,@params[0].green,@params[0].blue,@params[0].gray)
      wait(@params[1]) if @params[2]
    end
  end
end
class Game_Interpreter
  def self_event
    return $game_map.events[@event_id]
  end
end
class Block_Surface
  include Light_Core
  attr_accessor :x1
  attr_accessor :y1
  attr_accessor :x2
  attr_accessor :y2
  attr_accessor :ready
  attr_accessor :trash
  def initialize(x1,y1,x2,y2)
    @x1 = x1
    @y1 = y1
    @x2 = x2
    @y2 = y2
    @ready = false
    @trash = false
  end
  def within?(min_x,max_x,min_y,max_y)
    return @x2 > min_x && @x1 < max_x && @y2 > min_y && @y1 < max_y
  end
end
class Block_SL < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x01
  end
  def visible?(sx,sy)
    return sx < @x1
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    @m1 = (@y1-sy)/(@x1-sx)
    @n1 = sy - @m1*sx
    @m2 = (@y2-sy)/(@x2-sx)
    @n2 = sy - @m2*sx
    for x in @x1..(sx+range)
      init = shadow_iy(x)
      bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+3)
    end
  end
  def shadow_iy(x)
    return @m1*x+@n1
  end
  def shadow_fy(x)
    return @m2*x+@n2
  end
end
class Block_SR < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x04
  end
  def visible?(sx,sy)
    return sx > @x1
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    @m1 = (@y1-sy)/(@x1-sx)
    @n1 = sy - @m1*sx
    @m2 = (@y2-sy)/(@x2-sx)
    @n2 = sy - @m2*sx
    for x in (sx-range).to_i..@x1
      init = shadow_iy(x)
      bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+3)
    end
  end
  def shadow_iy(x)
    return @m1*x+@n1
  end
  def shadow_fy(x)
    return @m2*x+@n2
  end
end
class Block_IL < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x019
  end
  def visible?(sx,sy)
    return sx < @x1 && sy > @y1
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    @m1 = (@y1-sy)/(@x1-sx)
    @n1 = @y1 - @m1*@x1
    @m2 = (@y2-sy)/(@x2-sx)
    @m2 = 0 if @m2 > 0
    @n2 = @y2 - @m2*@x2
    for x in @x1..(sx+range)
      init = shadow_iy(x).floor
      bitmap.clear_rect(x-phx,init-3-phy,1,shadow_fy(x)-init+3)
    end
  end
  def shadow_iy(x)
    return @m1*x+@n1
  end
  def shadow_fy(x)
    return @m2*x+@n2
  end
end
class Block_IR < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x01c
  end
  def visible?(sx,sy)
    return sx > @x1 && sy > @y1
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    @m1 = (@y1-sy)/(@x1-sx)
    @n1 = @y1 - @m1*@x1
    @m2 = (@y2-sy)/(@x2-sx)
    @m2 = 0 if @m2 < 0
    @n2 = @y2 - @m2*@x2
    for x in (sx-range).to_i..@x1
      init = shadow_iy(x).floor
      bitmap.clear_rect(x-phx,init-3-phy,1,shadow_fy(x)-init+3)
    end
  end
  def shadow_iy(x)
    return @m1*x+@n1
  end
  def shadow_fy(x)
    return @m2*x+@n2
  end
end
class Block_WL < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x011
  end
  def visible?(sx,sy)
    return sx < @x1 && sy < @y2
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    @m1 = (@y1-sy)/(@x1-sx)
    @n1 = sy - @m1*sx
    @m2 = (@y2-sy)/(@x2-sx)
    @n2 = sy - @m2*sx
    for x in @x1..(sx+range)
      init = shadow_iy(x)
      bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+2)
    end
  end
  def shadow_iy(x)
    return @m1*x+@n1
  end
  def shadow_fy(x)
    return @m2*x+@n2
  end
end
class Block_WR < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x014
  end
  def visible?(sx,sy)
    return sx > @x1 && sy < @y2
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    @m1 = (@y1-sy)/(@x1-sx)
    @n1 = sy - @m1*sx
    @m2 = (@y2-sy)/(@x2-sx)
    @n2 = sy - @m2*sx
    for x in (sx-range).to_i..@x1
      init = shadow_iy(x)
      bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+2)
    end
  end
  def shadow_iy(x)
    return @m1*x+@n1
  end
  def shadow_fy(x)
    return @m2*x+@n2
  end
end
class Block_SU < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x02
  end
  def visible?(sx,sy)
    return sy < @y1
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    if @x1 == sx
      @m1 = nil
    else
      @m1 = (@y1-sy)/(@x1-sx)
      @m1 += ACC if @m1 < -ACC
      @n1 = @y1 - @m1*@x1
    end
    if @x2 == sx
      @m2 = nil
    else
      @m2 = (@y2-sy)/(@x2-sx)
      @n2 = sy - @m2*sx
    end
    for y in @y1..(sy+range)
      init = shadow_ix(y)
      bitmap.clear_rect(init-phx,y-phy,shadow_fx(y)-init+1,1)
    end
  end
  def shadow_ix(y)
    return @m1.nil? ? @x1 : (y-@n1)/@m1
  end
  def shadow_fx(y)
    return @m2.nil? ? @x2 : (y-@n2)/@m2
  end
end
class Block_SD < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x08
  end
  def visible?(sx,sy)
    return sy > @y1
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    if @x1 == sx
      @m1 = nil
    else
      @m1 = (@y1-sy)/(@x1-sx)
      @m1 -= ACC if @m1 > ACC
      @n1 = sy - @m1*sx
    end
    if x2 == sx
      @m2 = nil
    else
      @m2 = (@y2-sy)/(@x2-sx)
      @n2 = sy - @m2*sx
    end
    for y in (sy-range).to_i..@y1
      init = shadow_ix(y)
      bitmap.clear_rect(init-phx,y-phy,shadow_fx(y)-init+1,1)
    end
  end
  def shadow_ix(y)
    return @m1.nil? ? @x1 : (y-@n1)/@m1
  end
  def shadow_fx(y)
    return @m2.nil? ? @x2 : (y-@n2)/@m2
  end
end
class Spriteset_Map
  include Light_Core
  alias kbl_initialize initialize
  alias kbl_update update
  alias kbl_dispose dispose
  def initialize
    setup_lights
    kbl_initialize
  end
  def update
    kbl_update
    update_lights
  end
  def dispose
    kbl_dispose
    dispose_lights
  end
  def dispose_lights
    $game_map.lantern.dispose
    $game_map.light_sources.each { |source| source.dispose_light }
    $game_map.light_surface.bitmap.dispose
    $game_map.light_surface.dispose
    $game_map.light_surface = nil
  end
  def update_lights
    $game_map.light_surface.bitmap.clear
    $game_map.light_surface.bitmap.fill_rect(0,0,544,416,$game_map.effect_surface.color)
    $game_map.light_sources.each { |source| source.draw_light }
    return unless $game_map.lantern.visible
    @btr = $game_map.lantern.get_graphic
    x = $game_map.lantern.x
    y = $game_map.lantern.y
    r = $game_map.lantern.range
    sx = x + r
    sy = y + r
    dr = r*2
    $game_map.surfaces.each { |s| s.render_shadow(x,y,sx,sy,r,@btr) if s.visible?(sx,sy) && s.within?(x,x+dr,y,y+dr) }
    $game_map.light_surface.bitmap.blt($game_map.lantern.sx,$game_map.lantern.sy,@btr,Rect.new(0,0,dr,dr),$game_map.lantern.opacity)
  end
  def setup_lights
    @btr = nil
    $game_map.lantern.restore
    $game_map.light_sources.each { |source| source.restore_light }
    $game_map.light_surface = Sprite.new
    $game_map.light_surface.bitmap = Bitmap.new(544,416)
    $game_map.light_surface.bitmap.fill_rect(0,0,544,416,$game_map.effect_surface.color)
    $game_map.light_surface.blend_type = 2
    $game_map.light_surface.opacity = $game_map.effect_surface.alpha
    $game_map.light_surface.z = Surface_Z
  end
end
Falcao

http://www.rpgmakervxace.net/topic/8809-falcao-pearl-abs-liquid-update-v2/

(I think the part that handles HP bars is below)

#===============================================================================
# * Falcao Pearl ABS script shelf # 7
#
# Actor / Eenemies HP and MP bars display v 2.0
#
# This script acts like an Add-On, the main system can run without this piece
#
#-------------------------------------------------------------------------------

# * Features
# - Display HP, MP, experience and TP bars of the current player actor
# - Display the Enemy HP bar when was hit
# - Boss HP bar anabled
# - Display enemy states and buff / debuff icons
# - Non-graphical bars but hightly customizable
# - 2.0 now support images instead of script drawing bars

# * Usage and Installation
# Just copy and paste below the Pearl ABS System
#
# * Commands
# PearlBars.hide          - Hide the actor bars
# PearlBars.show          - Show the actor bars (by default)
#
# PearlBars.enemy_auto(id)- Show automatically the enemy HP bars without need
# to hit, this is mostly used for bosses, change id for the event id
# Tag any enemy with   Enemy Boss Bar = true   to eneble the boss bar mode
#------------------------------------------------------------------------------
module PearlBars
  #=============================================================================
  # * Actors bars configuration
  #
  # Bars x and y position on the screen
  ScreenPos_X = 10
  ScreenPos_Y = 10
  #
  # Dimentions of the bars you cant exceed 300 width x 100 height
  #                   x    y     width   height
  HP_BarDimentions = [8,   16,    118,    14]
  MP_BarDimentions = [8,   36,    118,    14]
  EX_BarDimentions = [8,   57,    118,    10]
 
  # Tp info     x   y
  TP_Info =    [8,  64]
  #
  # color definition
  #           color 1    R    G    B   Opa     color 2   R   G    B    Opa
  HP_Color = [Color.new(205, 255, 205, 200),   Color.new(10, 220, 45,  200)]
  MP_Color = [Color.new(180, 225, 245, 200),   Color.new(20, 160, 225, 200)]
  EX_Color = [Color.new(180, 225, 245, 200),   Color.new(20, 160, 225, 200)]
 
  # Do you want to display graphics instead of script drawing bars?
  # if so, fill this actors bars graphics requirements
 
  ActorsHp    = ""       # Actor Hp graphic bar name (inside quotation marks)
  ActorsMp    = ""       # Actor Mp graphic bar name
  ActorsExp   = ""       # Actor Experience, if you dont want it leave it ""
  ActorsBack  = ""       # Background semi-transparent bar
 
  #=============================================================================
  # * Normal Enemies bars
  #
  # Normal enemies Bars x and y position on the screen
  NeScreenPos_X = 390
  NeScreenPos_Y = 10
  #
  # Dimentions of the bars you cant exceed 300 width x 100 height
  #                    x    y     width   height
  EHP_BarDimentions = [8,   16,    126,    10]
  #
  # color definition
  #            color 1    R    G    B   Opa     color 2   R   G    B    Opa
  EHP_Color = [Color.new(205, 255, 205, 200),   Color.new(10, 220, 45,  200)]
 
  # if you want to display grahics bar pictures fill this
  NormalEne = ""           # normal enemy hp bar
  NormalBack = ""          # Background semi-transparent bar
 
  #=============================================================================
  # * Enemy Boss HP Bar
  #
  # Boss enemies Bar x and y position on the screen
  BeScreenPos_X = 100
  BeScreenPos_Y = 286
  #
  # Dimentions of the bars you cant exceed 640 width x 100 height
  #                    x    y     width   height
  BHP_BarDimentions = [8,   22,    330,    12]
  #
  #            color 1    R    G    B   Opa     color 2   R   G    B    Opa
  BHP_Color = [Color.new(205, 255, 205, 200),   Color.new(10, 220, 45,  200)]
 
  # if you want to display grahics bar pictures fill this
  BossEne = ""        # Boss enemy Hp bar
  BossBack = ""       # Background semi-transparent bar
  #=============================================================================
 
  def self.show() $game_system.pearlbars = nil  end
  def self.hide() $game_system.pearlbars = true end
   
  def self.enemy_auto(event_id)
    $game_system.enemy_lifeobject = $game_map.events[event_id]
  end

end

($imported ||= {})["Falcao Pearl ABS Life"] = true

class Spriteset_Map
 
  alias falcaopearl_lifebars_create create_pictures
  def create_pictures
    create_hud_lifebars
    falcaopearl_lifebars_create
  end
 
  def create_hud_lifebars
    @enemy_lifeobject = $game_system.enemy_lifeobject
    @enemyhpsp = Sprite_LifeBars.new(@viewport2, @enemy_lifeobject) if
    not @enemy_lifeobject.nil?
  end
 
  def create_actorlifebars
    return if !@actor_lifebar.nil?
    @actor_lifebar = Sprite_LifeBars.new(@viewport2, $game_player)
  end
 
  def dispose_actorlifebars
    return if @actor_lifebar.nil?
    @actor_lifebar.dispose
    @actor_lifebar = nil
  end
 
  alias falcaopearl_lifebars_update update
  def update
    update_lifebars_sprites
    falcaopearl_lifebars_update
  end
 
  def update_lifebars_sprites
    $game_system.pearlbars.nil? ? create_actorlifebars : dispose_actorlifebars
    @actor_lifebar.update unless @actor_lifebar.nil?
   
    # enemy
    if !@enemyhpsp.nil?
      unless @enemyhpsp.disposed?
        @enemyhpsp.update
      else
        @enemyhpsp.dispose
        @enemyhpsp = nil
        $game_system.enemy_lifeobject = nil
        @enemy_lifeobject = nil
      end
    end
   
    if @enemy_lifeobject != $game_system.enemy_lifeobject
      @enemyhpsp.dispose if !@enemyhpsp.nil?
      @enemyhpsp = nil
      @enemyhpsp = Sprite_LifeBars.new(@viewport2,$game_system.enemy_lifeobject)
      @enemy_lifeobject = $game_system.enemy_lifeobject
    end
  end

  alias falcaopearl_lifebars_dispose dispose
  def dispose
    dispose_actorlifebars
    @enemyhpsp.dispose unless @enemyhpsp.nil?
    falcaopearl_lifebars_dispose
  end
end

# Life bars sprite
class Sprite_LifeBars < Sprite
  include PearlBars
  def initialize(viewport, character)
    super(viewport)
    @character = character
    self.bitmap = Bitmap.new(boss? ? 640 : 300, 120)
    @old_hp = battler.hp
    @old_mp = battler.mp
    @erasetimer = 180
    @state_checker = []
    @buff_checker = []
    refresh_contents
    @view = viewport
    update
  end
 
  def boss?
    return true if battler.is_a?(Game_Enemy) && battler.boss_hud
    return false
  end
 
  def battler
    return @character.battler
  end
 
  def refresh_contents
    self.bitmap.clear
    self.bitmap.font.size = 19
    @erasetimer = 180
    self.opacity = 255
    if battler.is_a?(Game_Actor)
      @old_exp = battler.exp
      @old_tp = battler.tp
      self.x = ScreenPos_X
      self.y = ScreenPos_Y
      h  = HP_BarDimentions ; m = MP_BarDimentions ; e = EX_BarDimentions
      if PearlBars::ActorsHp != ""
        @pimg = Cache.picture(PearlBars::ActorsHp)  if @pimg.nil?
        @bimg = Cache.picture(PearlBars::ActorsBack) if @bimg.nil?
        @pimp = Cache.picture(PearlBars::ActorsMp)  if @pimp.nil?
        PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@bimg,
        @pimg, battler,true)
        PearlKernel.image_mp(self.bitmap, m[0] + 4, m[1], @bimg, @pimp, battler)
        if PearlBars::ActorsExp != ""
          @piexp = Cache.picture(PearlBars::ActorsExp)  if @piexp.nil?
          PearlKernel.image_exp(self.bitmap,e[0] + 4,e[1],@bimg,@piexp, battler)
        end
      else
        hc = HP_Color ; mc = MP_Color ; ec = EX_Color
        PearlKernel.draw_hp(self.bitmap,battler, h[0], h[1], h[2], h[3], hc)
        PearlKernel.draw_mp(self.bitmap,battler, m[0], m[1], m[2], m[3], mc)
        PearlKernel.draw_exp(self.bitmap,battler, e[0], e[1], e[2], e[3], ec)
      end
      PearlKernel.draw_tp(self.bitmap, TP_Info[0], TP_Info[1], battler)
    else battler.is_a?(Game_Enemy)
      if boss?
        self.x = BeScreenPos_X
        self.y = BeScreenPos_Y
        h  = BHP_BarDimentions ; hc = BHP_Color
        if PearlBars::BossEne != ""
          @n_img = Cache.picture(PearlBars::BossEne) if @n_img.nil?
          @n_back = Cache.picture(PearlBars::BossBack) if @n_back.nil?
          PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@n_back,
          @n_img, battler,true)
        else
          PearlKernel.draw_hp(self.bitmap,battler, h[0],h[1],h[2], h[3],hc,true)
        end
      else
        self.x = NeScreenPos_X
        self.y = NeScreenPos_Y
        h  = EHP_BarDimentions ; hc = EHP_Color
        if PearlBars::NormalEne != ""
          @n_img = Cache.picture(PearlBars::NormalEne) if @n_img.nil?
          @n_back = Cache.picture(PearlBars::NormalBack) if @n_back.nil?
          PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@n_back,
          @n_img, battler,true)
        else
          PearlKernel.draw_hp(self.bitmap,battler,h[0],h[1],h[2], h[3], hc,true)
        end
      end
    end
  end
 
  def update
    super
    if @old_hp != battler.hp
      refresh_contents
      @old_hp = battler.hp
    end
    if @old_mp != battler.mp
      refresh_contents
      @character.actor.apply_usability if @character.is_a?(Game_Player)
      @old_mp = battler.mp
    end
   
    if battler.is_a?(Game_Actor)
      if @old_exp != battler.exp
        @old_exp = battler.exp
        refresh_contents
      end
      if @old_tp != battler.tp
        @old_tp = battler.tp
        @character.actor.apply_usability if @character.is_a?(Game_Player)
        refresh_contents
      end
     
    elsif battler.is_a?(Game_Enemy)
      if boss?
        dispose if battler.dead?
      else
        if @erasetimer > 0
          @erasetimer -= 1
          self.opacity -= 10 if @erasetimer <= 25
          @states.opacity = self.opacity if !@states.nil?
          dispose if @erasetimer == 0
        end
      end
      update_enemy_status_icons
    end
  end
 
  # enemy status icons engine
  def update_enemy_status_icons
    display_status? ? create_states_icons : dispose_state_icons
    4.times.each {|i| refresh_states_icons if
    @state_checker != battler.state_icons}
    2.times.each {|i| refresh_states_icons if
    @buff_checker != battler.buff_icons}
  end
 
  def display_status?
    return true if !battler.state_icons.empty?
    return true if !battler.buff_icons.empty?
    return false
  end
 
  def create_states_icons
    return if disposed?
    return if !@states.nil?
    @states = ::Sprite.new(@view)
    @states.bitmap = Bitmap.new(144, 24)
    @n_back.nil? ? y_plus = BHP_BarDimentions[3] : y_plus = @n_back.height
    pos = [beScreenPos_X, BeScreenPos_Y, y_plus] if  boss?
    pos = [NeScreenPos_X, NeScreenPos_Y, y_plus] if !boss?
    @states.x = pos[0] + 10
    @states.y = pos[1] + pos[2] + 24
    @states.zoom_x = 0.8
    @states.zoom_y = 0.8
    refresh_states_icons
  end
 
  def dispose_state_icons
    return if @states.nil?
    @states.bitmap.dispose
    @states.dispose
    @states = nil
  end
 
  def refresh_states_icons
    4.times.each {|i| @state_checker = battler.state_icons}
    2.times.each {|i| @buff_checker = battler.buff_icons}
    return if @states.nil?
    @states.bitmap.clear
    x = 0
    battler.state_icons.each {|icon| draw_icon(icon, x, 0) ; x += 24
    break if x == 96}
    count = 0
    battler.buff_icons.each {|icon| draw_icon(icon, x, 0) ; x += 24 ; count += 1
    break if count == 2}
  end
 
  def draw_icon(icon_index, x, y, enabled = true)
    bit = Cache.system("Iconset")
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    @states.bitmap.blt(x, y, bit, rect, enabled ? 255 : 150)
  end
 
  def dispose
    self.bitmap.dispose
    dispose_state_icons
    super
  end
end

# Make the enemy bars to load when enemy is hited
class Projectile < Game_Character
  alias falcao_lifebars_execute execute_damageto_enemy
  def execute_damageto_enemy(event)
    $game_system.enemy_lifeobject = event if @user.is_a?(Game_Player) &&
    !event.battler.object
    falcao_lifebars_execute(event)
  end
end
(This is the part that handles the hotkeys section)

#===============================================================================
# * Falcao Pearl ABS script shelf # 4
#
# This script handles the Skillbar funtions
# it is designed to support the 'Mouse System Buttons script 1.6 and above too
# you can trigger tools by clicking the icons on the toolbar!
#===============================================================================

module PearlSkillBar
 
  # Skillbar X position in tiles
  Tile_X = 7
 
  # Skillbar Y position in tiles
  Tile_Y = 11
 
  # Layout graphic
  LayOutImage = "Pearl Skillbar"
 
  # Follower attack command icon index
  ToggleIcon = 116
 
  #    * Commands
  #
  # PearlSkillBar.hide        - hide the skillbar
  # PearlSkillBar.show        - show the skillbar
  #-----------------------------------------------------------------------------
 
  def self.hide
    $game_system.skillbar_enable = true
  end
 
  def self.show
    $game_system.skillbar_enable = nil
  end
 
  def self.hidden?
    !$game_system.skillbar_enable.nil?
  end
end

class Game_System
  attr_accessor :skillbar_enable, :pearlbars, :enemy_lifeobject
  alias falcaopearl_abs_hud initialize
  def initialize
    unless PearlKernel::StartWithHud
      @skillbar_enable = true
      @pearlbars = true
    end
    falcaopearl_abs_hud
  end
end

class Sprite_PearlTool < Sprite
  include PearlSkillBar
  attr_accessor :actor
  def initialize(view, custom_pos=nil)
    super(view)
    @layout = ::Sprite.new(view)
    @layout.bitmap = Cache.picture(LayOutImage)
    @icons = ::Sprite.new(view)
    @icons.bitmap = Bitmap.new(@layout.bitmap.width, @layout.bitmap.height)
    self.bitmap = Bitmap.new(@layout.bitmap.width+32, @layout.bitmap.height+32)
    if custom_pos.nil?
      @layout.x = Tile_X * 32
      @layout.y = Tile_Y * 32
    else
      @layout.x = custom_pos[0]
      @layout.y = custom_pos[1]
    end
    @icons.x = @layout.x
    @icons.y = @layout.y
    self.x = @layout.x - 16
    self.y = @layout.y - 12
    self.z = self.z + 1
    @actor = $game_player.actor
    @actor.apply_usability
    @old_usability = []
    8.times.each {|i| @old_usability = @actor.usability}
    @framer = 0
    @info_keys = ::Sprite.new(view)
    @info_keys.bitmap = Bitmap.new(self.bitmap.width, self.bitmap.height)
    @info_keys.x = self.x; @info_keys.y = self.y; @info_keys.z = self.z
    draw_key_info
    refresh_icons
    refresh_texts
    @view = view
    @on_map = SceneManager.scene_is?(Scene_Map)
    @mouse_exist = defined?(Map_Buttons).is_a?(String)
    @mouse_exist = false if @mouse_exist && !SceneManager.scene_is?(Scene_Map)
    update
  end
 
  def draw_key_info
    @info_keys.bitmap.font.size = 15
    letters = [Key::Weapon[1], Key::Armor[1], Key::Item[1], Key::Item2[1],
    Key::Skill[1],Key::Skill2[1],Key::Skill3[1],Key::Skill4[1],Key::Follower[1]]
    x = 28
    for i in letters
      @info_keys.bitmap.draw_text(x, -2, @info_keys.bitmap.width, 32, i)
      x += 32
    end
  end
 
  def refresh_texts
    self.bitmap.clear
    self.bitmap.font.size = 15
    refresh_cooldown
    refresh_ammo
  end
 
  def number(operand)
    return (operand / 60).to_i + 1
  end
 
  def flagged(item, type)
    return :false if !item.cool_enabled? and type == 1
    return item.itemcost if type == 2
  end
 
  # Refresh toolbar icons
  def refresh_icons
    @icons.bitmap.clear
    icon = [@actor.equips[0], @actor.equips[1], @actor.assigned_item,
    @actor.assigned_item2, @actor.assigned_skill, @actor.assigned_skill2,
    @actor.assigned_skill3, @actor.assigned_skill4, ToggleIcon]
    x = 4
    icon.each {|i|
    if !i.nil? and !i.is_a?(Fixnum)
      if i.is_a?(RPG::Item) || i.is_a?(RPG::Skill)
        draw_icon(i.icon_index, x, 6, @actor.usable?(i))
      else
        if i.is_a?(RPG::Weapon)
          enable = @actor.usability[0] ; enable = true if enable.nil?
          draw_icon(i.icon_index, x, 6, enable)
        elsif i.is_a?(RPG::Armor)
           enable = @actor.usability[1] ; enable = true if enable.nil?
           draw_icon(i.icon_index, x, 6, enable)
        end
      end
    end
    draw_icon(i, x, 6) if i.is_a?(Fixnum) ; x += 32}
    @now_equip = [@actor.equips[0], @actor.equips[1], @actor.assigned_item,
    @actor.assigned_item2, @actor.assigned_skill, @actor.assigned_skill2,
    @actor.assigned_skill3, @actor.assigned_skill4]
  end
 
  def update
    update_mouse_tiles if @mouse_exist
    update_cooldown
    update_ammo_tools
    update_usability_enable
    refresh_icons if @now_equip[0] != @actor.equips[0]
    refresh_icons if @now_equip[1] != @actor.equips[1]
    refresh_icons if @now_equip[2] != @actor.assigned_item
    refresh_icons if @now_equip[3] != @actor.assigned_item2
    refresh_icons if @now_equip[4] != @actor.assigned_skill
    refresh_icons if @now_equip[5] != @actor.assigned_skill2
    refresh_icons if @now_equip[6] != @actor.assigned_skill3
    refresh_icons if @now_equip[7] != @actor.assigned_skill4
    update_fade_effect
  end
 
  # fade effect when player is behind the toolbar
  def update_fade_effect
    if behind_toolbar?
      if self.opacity >= 60
        self.opacity -= 10
        @layout.opacity = @icons.opacity = @info_keys.opacity = self.opacity
      end
    elsif self.opacity != 255
      self.opacity += 10
      @layout.opacity = @icons.opacity = @info_keys.opacity = self.opacity
    end
  end
 
  def behind_toolbar?
    return false unless @on_map
    px = ($game_player.screen_x / 32).to_i
    py = ($game_player.screen_y / 32).to_i
    9.times.each {|x| return true if px == Tile_X + x and py == Tile_Y}
    return false
  end
 
  # refresh the icons when the usability change
  def update_usability_enable
    8.times.each {|i| refresh_icons if @old_usability != @actor.usability}
  end
 
  #-----------------------------------------------
  # ammunition engine
  def ammo_ready?(item)
    return false if item.nil?
    return true if item.has_data.nil? && item.is_a?(RPG::Item) &&
    item.consumable
    return false if flagged(item, 2).nil?
    return true  if flagged(item, 2) != 0
    return false
  end
 
  # get item cost
  def itemcost(item)
    return $game_party.item_number(item) if item.has_data.nil? &&
    item.is_a?(RPG::Item) && item.consumable
    if !flagged(item, 2).nil? and flagged(item, 2) != 0
      return $game_party.item_number($data_items[flagged(item, 2)])
    end
    return 0
  end
 
  # Ammo refresher
  def refresh_ammo
    if ammo_ready?(@actor.equips[0])
      @wnumber = itemcost(@actor.equips[0])
      self.bitmap.draw_text(18, 24, 32,32, @wnumber.to_s, 1)
    end
    if ammo_ready?(@actor.equips[1])
      @anumber = itemcost(@actor.equips[1])
      self.bitmap.draw_text(50, 24, 32,32, @anumber.to_s, 1)
    end
    if ammo_ready?(@actor.assigned_item)
      @inumber = itemcost(@actor.assigned_item)
      self.bitmap.draw_text(82, 24, 32,32, @inumber.to_s, 1)
    end
    if ammo_ready?(@actor.assigned_item2)
      @inumber2 = itemcost(@actor.assigned_item2)
      self.bitmap.draw_text(112, 24, 32,32, @inumber2.to_s, 1) # item 2
    end
    if ammo_ready?(@actor.assigned_skill)
      @snumber = itemcost(@actor.assigned_skill)
      self.bitmap.draw_text(144, 24, 32,32, @snumber.to_s, 1)
    end
    if ammo_ready?(@actor.assigned_skill2)
      @snumber2 = itemcost(@actor.assigned_skill2)
      self.bitmap.draw_text(176, 24, 32,32, @snumber2.to_s, 1) # skill 2
    end
    if ammo_ready?(@actor.assigned_skill3)
      @snumber3 = itemcost(@actor.assigned_skill3)
      self.bitmap.draw_text(208, 24, 32,32, @snumber3.to_s, 1) # skill 3
    end
    if ammo_ready?(@actor.assigned_skill4)
      @snumber4 = itemcost(@actor.assigned_skill4)
      self.bitmap.draw_text(240, 24, 32,32, @snumber4.to_s, 1) # skill 4
    end
 
  end
 
  def update_ammo_tools
    refresh_texts if ammo_ready?(@actor.equips[0]) &&
    @wnumber != itemcost(@actor.equips[0])
    refresh_texts if ammo_ready?(@actor.equips[1]) &&
    @anumber != itemcost(@actor.equips[1])
   
    if ammo_ready?(@actor.assigned_item) &&
      @inumber != itemcost(@actor.assigned_item)
      refresh_texts
    end
    refresh_texts if ammo_ready?(@actor.assigned_item2) && #@inumber2
    @inumber2 != itemcost(@actor.assigned_item2)
    refresh_texts if ammo_ready?(@actor.assigned_skill) &&
    @snumber != itemcost(@actor.assigned_skill)
    refresh_texts if ammo_ready?(@actor.assigned_skill2) && #@snumber2
    @snumber2 != itemcost(@actor.assigned_skill2)
    # new anmmo
    refresh_texts if ammo_ready?(@actor.assigned_skill3) && #@snumber3
    @snumber3 != itemcost(@actor.assigned_skill3)
    refresh_texts if ammo_ready?(@actor.assigned_skill4) && #@snumber4
    @snumber4 != itemcost(@actor.assigned_skill4)
  end
 
  #--------------------------------------
  # cooldown engine
  def cool_down_active?
    return true if skill_cooldown > 0 || weapon_cooldown > 0 ||
    armor_cooldown > 0 || item_cooldown > 0 || skill_cooldown2 > 0 ||
    item_cooldown2 > 0 || skill_cooldown3 > 0 || skill_cooldown4 > 0
    return false
  end
 
  def weapon_cooldown
    if !@actor.equips[0].nil?
      return 0 if flagged(@actor.equips[0], 1) == :false
      cd =  @actor.weapon_cooldown[@actor.equips[0].id]
      return cd unless cd.nil?
    end
    return 0
  end
 
  def armor_cooldown
   if !@actor.equips[1].nil?
      return 0 if flagged(@actor.equips[1], 1) == :false
      cd = @actor.armor_cooldown[@actor.equips[1].id]
      return cd unless cd.nil?
    end
    return 0
  end
 
  def item_cooldown
    if !@actor.assigned_item.nil?
      return 0 if flagged(@actor.assigned_item, 1) == :false
      cd = @actor.item_cooldown[@actor.assigned_item.id]
      return cd unless cd.nil?
    end
    return 0
  end
 
  def item_cooldown2
    if !@actor.assigned_item2.nil?
      return 0 if flagged(@actor.assigned_item2, 1) == :false
      cd = @actor.item_cooldown[@actor.assigned_item2.id]
      return cd unless cd.nil?
    end
    return 0
  end
 
  def skill_cooldown
    if !@actor.assigned_skill.nil?
      return 0 if flagged(@actor.assigned_skill, 1) == :false
      cd = @actor.skill_cooldown[@actor.assigned_skill.id]
      return cd unless cd.nil?
    end
    return 0
  end
 
  def skill_cooldown2
    if !@actor.assigned_skill2.nil?
      return 0 if flagged(@actor.assigned_skill2, 1) == :false
      cd = @actor.skill_cooldown[@actor.assigned_skill2.id]
      return cd unless cd.nil?
    end
    return 0
  end
 
  # two new skillls
  def skill_cooldown3
    if !@actor.assigned_skill3.nil?
      return 0 if flagged(@actor.assigned_skill3, 1) == :false
      cd = @actor.skill_cooldown[@actor.assigned_skill3.id]
      return cd unless cd.nil?
    end
    return 0
  end
 
  def skill_cooldown4 # 4
    if !@actor.assigned_skill4.nil?
      return 0 if flagged(@actor.assigned_skill4, 1) == :false
      cd = @actor.skill_cooldown[@actor.assigned_skill4.id]
      return cd unless cd.nil?
    end
    return 0
  end
 
 
  # Cooldown refresher
  def refresh_cooldown
    wcd = number(weapon_cooldown)
    self.bitmap.draw_text(18, 36,32,32, wcd.to_s, 1) if weapon_cooldown > 10
    acd = number(armor_cooldown)
    self.bitmap.draw_text(50, 36,32,32, acd.to_s, 1) if armor_cooldown > 10
    icd = number(item_cooldown)
    self.bitmap.draw_text(82, 36,32,32, icd.to_s, 1) if item_cooldown > 10
    icd2 = number(item_cooldown2)
    self.bitmap.draw_text(112, 36,32,32, icd2.to_s, 1) if item_cooldown2 > 10
    scd = number(skill_cooldown)
    self.bitmap.draw_text(144, 36,32,32, scd.to_s, 1) if skill_cooldown > 10
    scd2 = number(skill_cooldown2)
    self.bitmap.draw_text(176, 36,32,32, scd2.to_s, 1) if skill_cooldown2 > 10
    scd3 = number(skill_cooldown3)
    self.bitmap.draw_text(208, 36,32,32, scd3.to_s, 1) if skill_cooldown3 > 10
    scd4 = number(skill_cooldown4)
    self.bitmap.draw_text(240, 36,32,32, scd4.to_s, 1) if skill_cooldown4 > 10
  end
 
  def update_cooldown
    if @on_map and @actor != $game_player.actor
      @actor = $game_player.actor
      refresh_icons
      refresh_texts
    end
   
    if $game_player.refresh_skillbar > 0
      $game_player.refresh_skillbar -= 1
      if $game_player.refresh_skillbar == 0
        @actor.apply_usability
        refresh_icons
      end
    end
   
    if cool_down_active?
      refresh_texts if @framer == 0
      @framer += 1; @framer = 0 if @framer == 10
    else
      @framer = 0
    end
  end
 
  # if mouse exist update the mouse settings
  def update_mouse_tiles
    mx = (Mouse.pos[0] / 32) ; my = (Mouse.pos[1] / 32)
    case [mx, my]
    when [Tile_X,     Tile_Y] then $game_player.mouse_over = 1
    when [Tile_X + 1, Tile_Y] then $game_player.mouse_over = 2
    when [Tile_X + 2, Tile_Y] then $game_player.mouse_over = 3
    when [Tile_X + 3, Tile_Y] then $game_player.mouse_over = 4
    when [Tile_X + 4, Tile_Y] then $game_player.mouse_over = 5
    when [Tile_X + 5, Tile_Y] then $game_player.mouse_over = 6
    when [Tile_X + 6, Tile_Y] then $game_player.mouse_over = 7
    when [Tile_X + 7, Tile_Y] then $game_player.mouse_over = 8
    when [Tile_X + 8, Tile_Y] then $game_player.mouse_over = 9
    else
      $game_player.mouse_over = 0 if $game_player.mouse_over != 0
    end
    if $game_player.mouse_over > 0
      create_mouse_blink
      update_mouse_blink_position
      @mouse_blink.opacity -= 3
      @mouse_blink.opacity = 70 if @mouse_blink.opacity <= 6
    else
      dispose_mouse_blink
    end
  end
 
  # update mouse blink position
  def update_mouse_blink_position
    case $game_player.mouse_over
    when 1 then @mouse_blink.x = @layout.x + (5)
    when 2 then @mouse_blink.x = @layout.x + (5 + 32)
    when 3 then @mouse_blink.x = @layout.x + (5 + 64)
    when 4 then @mouse_blink.x = @layout.x + (5 + 96)
    when 5 then @mouse_blink.x = @layout.x + (5 + 128)
    when 6 then @mouse_blink.x = @layout.x + (5 + 160)
    when 7 then @mouse_blink.x = @layout.x + (5 + 192)
    when 8 then @mouse_blink.x = @layout.x + (5 + 224)
    when 9 then @mouse_blink.x = @layout.x + (5 + 256)
    end
  end
 
  def create_mouse_blink
    return if !@mouse_blink.nil?
    @mouse_blink = ::Sprite.new(@view)
    @mouse_blink.bitmap = Bitmap.new(22, 22)
    @mouse_blink.bitmap.fill_rect(0, 0, 22, 22, Color.new(255,255,255))
    @mouse_blink.y = @layout.y + 8
    @mouse_blink.z = self.z
    @mouse_blink.opacity = 70
  end
 
  def dispose_mouse_blink
    return if @mouse_blink.nil?
    @mouse_blink.dispose
    @mouse_blink = nil
  end
  #--------- end of mouse settings
 
  def dispose
    self.bitmap.dispose
    @layout.bitmap.dispose
    @layout.dispose
    @icons.bitmap.dispose
    @icons.dispose
    @info_keys.bitmap.dispose
    @info_keys.dispose
    super
  end
 
  def draw_icon(icon_index, x, y, enabled = true)
    bit = Cache.system("Iconset")
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    @icons.bitmap.blt(x, y, bit, rect, enabled ? 255 : 150)
  end
end
 

Here is a screenshot:

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,479
Members
137,824
Latest member
dobratemporal
Top