O TEMA DO FÓRUM ESTÁ EM MANUTENÇÃO. FEEDBACKS AQUI: ACESSAR

Ajuda com Hud e sistema Khas Awesome Light Effects

Iniciado por darkai245, 12/11/2017 às 03:04

12/11/2017 às 03:04 Última edição: 15/11/2017 às 02:25 por darkai245
Olá, eu não sei muito bem como mexer com scripts então resolvi pedir auxílio aqui, vou explicar a situação :

Eu gostaria de usar a Hud do projeto SAS no meu jogo, porem eu estou usando o script "Falcao Pearl ABS Liquid v3" pois este me fornece mais opções de criação de magias e afins, entretanto a Hud do Abs liquid fica oculta/ escurecida já que estou usando o script "Khas Awesome Light Effects" que é essencial para o meu jogo que se passa dentro de uma masmorra.

por isso o meu pedido é que alguém possa fazer com que o script da Hud do "Falcao Pearl ABS Liquid v3" fique visivel mesmo eu utilizando o script "Khas Awesome Light Effects" da mesma forma que a Hud do SAS fica.

Se for possível a ajuda serei extremamente grato.


Hud SAS
Spoiler
#-------------------------------------------------------------------------------
# * [ACE] SAS IV HUD
#-------------------------------------------------------------------------------
# * Por Khas Arcthunder (khasarcthunder.wordpress.com)
# * Versão: 1.0 BR
# * Lançada em: 05/01/2012
#
#-------------------------------------------------------------------------------
# * Termos de Uso
#-------------------------------------------------------------------------------
# Termos de uso – 22 de Junho de 2012
# 1. Você deve dar crédito a Khas se estiver usando algum script Khas;
# 2. Todos os scripts e aulas Khas estão sob licença Creative Commons;
# 3. Todos os scripts Khas são livres para uso não comercial. Caso queira
#    algum script para uso comercial, confira abaixo destes termos quais
#    scripts são de uso comercial livre e quais são de uso comercial pago;
# 4. Todos os scripts Khas são para uso pessoal, você pode usar e editar
#    para uso no seu projeto, porém você não pode postar nenhuma versão
#    modificada;
# 5. Você não pode dar créditos a si próprio por postar algum script Khas;
# 6. Caso queira compartilhar um script Khas, não poste o script ou o link
#    direto de download, apenas redirecione o usuário para
#    http://arcthunder.site40.net/
# 7. Todos os scripts Khas são para uso no maker em que foram feitos.
#    Não é autorizada nenhuma espécie de conversão;
# 8. É sua obrigação (usuário) conferir esta página de termos no dia em que
#    lançar seu projeto. As normas aqui presentes devem ser cumpridas pelo
#    seu projeto.
#
# Scripts de uso comercial livre:
# - Sapphire Action System IV (RPG Maker VX Ace)
# - Awesome Light Effects (RPG Maker VX Ace)
# - Pixel movement (RPG Maker VX e RPG Maker VX Ace)
# - Sprite & Window Smooth Sliding (RPG Maker VX e RPG Maker VX Ace)
# - Pathfinder (RPG Maker VX Ace)
#
# Veja todos os termos em: http://arcthunder.site40.net/termos/
#
#-------------------------------------------------------------------------------
# * Caracteristicas
#-------------------------------------------------------------------------------
# HUD do SAS IV. Configure abaixo.
#
#-------------------------------------------------------------------------------
# * Configuração
#-------------------------------------------------------------------------------
module HUD_Core
  # Nome da imagem de fundo
  Background_Name = "hud_bg"
  # Imagem da barra de HP
  HPBar_Image = "hp_bar"
  # Imagem da barra de MP
  MPBar_Image = "mp_bar"
  # Imagem da barra de EXP
  EXPBar_Image = "exp_bar"
  # Largura do conteúdo
  Contents_Width = 544
  # Altura do conteúdo
  Contents_Height = 416
  # Tamanho da fonte
  Font_Size = 16
  # Nome da fonte
  Font_Name = "Verdana"
  # Cor da fonte
  Font_Color =  Color.new(255,255,255)
  # Negrito?
  Font_Bold = true
  # Itálico?
  Font_Italic = false
  # ID do ícone de ausência de habilidade
  No_Skill_Icon = 0
  # Posição X da barra de HP
  Health_X = 0
  # Posição Y da barra de HP
  Health_Y = 10
  # Largura da barra de HP
  Health_Width = 133
  # Altura da barra de HP
  Health_Height = 9
  # Cor da barra de HP
  Health_Color = Color.new(77,4,4)
  # Posição X da barra de EXP
  Exp_X = 0
  # Posição Y da barra de EXP
  Exp_Y = 401
  # Largura da barra de EXP
  Exp_Width = 544
  # Altura da barra de EXP
  Exp_Height = 4
  # Cor da barra de EXP
  Exp_Color = Color.new(214,214,214)
  # Posição X da barra de MP
  Magic_X = 0
  # Posição Y da barra de MP
  Magic_Y = 26
  # Largura da barra de MP
  Magic_Width = 96
  # Altura da barra de MP
  Magic_Height = 9
  # Cor da barra de MP
  Magic_Color = Color.new(83,129,255)
  # Posição X do nome
  Name_X = 40
  # Posição Y do nome
  Name_Y = 40
  # Posição X da Habilidade
  Spell_X = 4
  # Posição Y da Habilidade
  Spell_Y = 74
  # Posição X do ícone
  Icon_X = 8
  # Posição Y do ícone
  Icon_Y = 44
  # Posição X do nível
  Level_X = 24
  # Posição Y do nível
  Level_Y = 55
  # String do nível
  Level_String = "Nv "
  # Posições do char do herói
  Character_X = 0
  Character_Y = 0
end
#-------------------------------------------------------------------------------
# * Registrar
#-------------------------------------------------------------------------------
if $khas_awesome.nil?
  $khas_awesome = []
end
scripts = []
$khas_awesome.each { |script| scripts << script[0] }
unless scripts.include?("Sapphire Action System")
  error = Sprite.new
  error.bitmap = Bitmap.new(544,416)
  error.bitmap.draw_text(0,208,544,32,"Por favor, instale o Sapphire Action System IV",1)
  error.bitmap.draw_text(0,240,544,32,"Os scripts adicionais precisam do principal",1)
  continue = Sprite.new
  continue.bitmap = Bitmap.new(544,416)
  continue.bitmap.font.color = Color.new(0,255,0)
  continue.bitmap.font.size = error.bitmap.font.size - 3
  continue.bitmap.draw_text(0,384,544,32,"Tecle ENTER para sair",1)
  add = Math::PI/80; max = 2*Math::PI; angle = 0
  loop do
    Graphics.update; Input.update
    angle += add; angle %= max
    continue.opacity = 185 + 70* Math.cos(angle)
    break if Input.trigger?(Input::C)
  end
  error.bitmap.dispose; continue.bitmap.dispose
  error.bitmap = nil; continue.bitmap = nil
  error.dispose; continue.dispose
  error = nil; continue = nil
  exit
end

$khas_awesome << ["SAS HUD",4.0]

#-------------------------------------------------------------------------------
# * Script
#-------------------------------------------------------------------------------

class Sapphire_Hud
  include HUD_Core
  def initialize
    @contents = Sprite.new
    @background = Sprite.new
    @base = Sprite.new
    @contents.bitmap = Bitmap.new(Contents_Width, Contents_Height)
    @base.bitmap = Bitmap.new(Contents_Width, Contents_Height)
    @background.bitmap = Cache.system(Background_Name)
    @base.bitmap.font.bold = Font_Bold
    @base.bitmap.font.italic = Font_Italic
    @base.bitmap.font.size = Font_Size
    @base.bitmap.font.color = Font_Color
    @base.bitmap.font.name = Font_Name
    @contents.z = 200
    @background.z = 210
    @base.z = 220
    @locked = false
    hide(true)
  end
  def refresh_bars(current_hp=@actor.hp)
    return if @hidden
    hp = ((current_hp)*Health_Width)/@actor.mhp
    mp = (@actor.mp*Magic_Width)/@actor.mmp
    exp = ((@actor.exp-@actor.current_level_exp)*Exp_Width)/(@actor.next_level_exp-@actor.current_level_exp)
    @contents.bitmap.clear
    hpbar = Cache.system(HPBar_Image)
    hpbar_srcrect = hpbar.rect
    hpbar_srcrect.width = hp
    mpbar = Cache.system(MPBar_Image)
    mpbar_srcrect = mpbar.rect
    mpbar_srcrect.width = mp
    expbar = Cache.system(EXPBar_Image)
    expbar_srcrect = expbar.rect
    expbar_srcrect.width = exp
    @contents.bitmap.blt(Health_X, Health_Y, hpbar, hpbar_srcrect)
    @contents.bitmap.blt(Magic_X, Magic_Y, mpbar, mpbar_srcrect)
    @contents.bitmap.blt(Exp_X, Exp_Y, expbar, expbar_srcrect)
    character = Cache.character(@actor.character_name)
    sign = @actor.character_name[/^[\!\$]./]
    if sign != nil and sign.include?('$')
      cw = character.width / 3
      ch = character.height / 4
    else
      cw = character.width / 12
      ch = character.height / 8
    end
    @contents.bitmap.blt(Character_X, Character_Y, character,
        Rect.new(0, 0, cw, ch))
  end
  def refresh_base
    return if @hidden
    @base.bitmap.clear
    @actor = $game_party.members[0]
    skill = $game_player.current_skill[0]
    @base.bitmap.draw_text(Name_X, Name_Y,100,Font_Size+4,@actor.name)
    @base.bitmap.draw_text(Level_X, Level_Y,64,Font_Size+4,Level_String+@actor.level.to_s,1)
    temp = Cache.system("Iconset")
    unless skill.nil?
      @base.bitmap.draw_text(Spell_X,Spell_Y,68,Font_Size+4,skill.name)
      @base.bitmap.blt(Icon_X,Icon_Y,temp,Rect.new(skill.icon_index%16*24,skill.icon_index/16*24,24,24))
    else
      @base.bitmap.blt(Icon_X,Icon_Y,temp,Rect.new(No_Skill_Icon%16*24,No_Skill_Icon/16*24,24,24))
    end
    temp.dispose
    temp = nil
  end
  def hide(lock=false)
    unless @background.nil?
      @background.bitmap.dispose
      @background.dispose
      @background = nil
    end
    unless @base.nil?
      @base.bitmap.dispose
      @base.dispose
      @base = nil
    end
    unless @contents.nil?
      @contents.bitmap.dispose
      @contents.dispose
      @contents = nil
    end
    @hidden = true
    @locked = lock unless @locked
  end
  def show(unlock=false)
    @actor = $game_party.members[0]
    return if @locked && !unlock
    @contents = Sprite.new
    @background = Sprite.new
    @base = Sprite.new
    @contents.bitmap = Bitmap.new(Contents_Width, Contents_Height)
    @base.bitmap = Bitmap.new(Contents_Width, Contents_Height)
    @background.bitmap = Cache.system(Background_Name)
    @base.bitmap.font.bold = Font_Bold
    @base.bitmap.font.italic = Font_Italic
    @base.bitmap.font.size = Font_Size
    @base.bitmap.font.color = Font_Color
    @base.bitmap.font.name = Font_Name
    @contents.z = 200
    @background.z = 210
    @base.z = 220
    @hidden = false
    refresh_base
    refresh_bars
    @locked = false
  end
end
[close]






Hud Falcao (essa é a que eu preciso)

Spoiler
#===============================================================================
# * 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, 255),   Color.new(10, 220, 45,  200)]
  MP_Color = [Color.new(180, 225, 245, 255),   Color.new(20, 160, 225, 200)]
  EX_Color = [Color.new(180, 225, 245, 255),   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 battler.nil?
      dispose
      return
    end
   
    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
[close]



"Khas Awesome Light Effects"

Spoiler
#-------------------------------------------------------------------------------
# * [ACE] Khas Awesome Light Effects
#-------------------------------------------------------------------------------
# * Por Khas Arcthunder - arcthunder.site40.net
# * Versão: 1.0 BR
# * Lançada em: 12/01/2012
#
#-------------------------------------------------------------------------------
# * Termos de uso
#-------------------------------------------------------------------------------
# Ao utilizar qualquer script feito por Khas, você concorda com os termos abaixo
# 1. Você deve dar crédito a Khas se estiver usando algum script Khas;
# 2. Todos os scripts Khas estão sob licença Creative Commons;
# 3. Todos os scripts Khas são para projetos não comerciais, se você precisar de
#    algum script Khas em seu projeto comercial (aceito pedidos para esse tipo
#    de projeto), envie um email para nilokruch@live.com com o pedido;
# 4. Todos os scripts Khas são para uso pessoal, você pode usar e editar para uso
#    no seu projeto, porém você não pode postar nenhuma versão modificada;
# 5. Você não pode dar créditos a si próprio por postar algum script Khas;
# 6. Caso queira compartilhar um script Khas, não poste o link direto de
#    download, apenas redirecione o usuário para arcthunder.site40.net
#
#-------------------------------------------------------------------------------
# * Características
#-------------------------------------------------------------------------------
# - Efeitos de luz realista
# - Luz real (não passa paredes!)
# - Fontes de luz estática (que não se move)
# - Fonte de luz dinâmica (uma lanterna para o jogador, por exemplo)
# - Efeitos multiplos podem se juntar
# - Fácil configuração
# - Uso por comentário
#
#-------------------------------------------------------------------------------
# * IMPORTANTE - Desempenho
#-------------------------------------------------------------------------------
# Esse script pode vir a ser pesado para processadores muito antigos! O Awesome
# Light Effects foi testado em um Core 2 Duo E4500 e em um Core i5, sem lag.
# Porém, além do processador, há vários fatores que influenciam no desempenho
# do script:
#
# 1. Tamanho do mapa
# Este script analiza o mapa em busca de superfícies para cortar a luz. Em um
# mapa muito grande, esse número de superfícies pode aumentar muito, afetando
# o desempenho da LUZ DINÂMICA. O tamanho do mapa não influência nas luzes
# estáticas.
#
# 2. Quantidade de efeitos
# Este script desenha os efeitos na tela, conforme sua posição. Antes de
# atualizá-los, a sua posição é verificada. Portanto, em mapas muito grandes
# com excesso de efeitos pode a vir ocorrer lag. Note que isso é apenas uma
# previsão, pois nos testes atuais não foi detectado lag.
#
# 3. Tamanho da imagem
# O tamanho da imagem da luz dinâmica influencia diretamente no desempenho.
# O corte de luz é feito linha a linha, quanto maior a resolução da imagem,
# mais tempo será gasto para cortá-la. A recomendação é até 200x200 pixels.
#
#-------------------------------------------------------------------------------
# * IMPORTANTE - Imagens de luz
#-------------------------------------------------------------------------------
# Para o funcionamento correto do script, as imagens de luz DEVEM obedecer
# os seguintes critérios:
#
# 1. O tamanho da imagem DEVE ser par. Exemplo: 150x150
# 2. A imagem DEVE ser quadrada, com dimensões IGUAIS. Exemplo: 156x156
# 3. A imagem DEVE estar com as cores invertidas! Isso é nescessário, pois o
#    script inverte as cores para desenhar o efeito na superfície de efeitos.
#    Lembre-se que a cor preta ficará transparente!
#
#-------------------------------------------------------------------------------
# * Instruções - 1. Configurando efeitos estáticos
#-------------------------------------------------------------------------------
# Para configurar efeitos estáticos, vá até a configuração (logo abaixo) e
# defina os efeitos dentro da hash Effects. Faça do seguinte modo:
#
# X => [imagem, opacidade, variação, corte],   <= Lembre dessa vírgula no final!
#
# Onde:
# Imagem => Nome da imagem na pasta "Graphics/Lights";
# Opacidade => Opacidade da imagem;
# Variação => Variação POSITIVA da opacidade;
# Corte => Coloque true para cortar a imagem e false para não cortar;
# X => É o ID do efeito, para ser usado nos eventos. Use um ID para cada efeito.
#
# Veja os efeitos pré configurados para entender como funciona.
#
#-------------------------------------------------------------------------------
# * Instruções - 2. Usando o efeitos em eventos:
#-------------------------------------------------------------------------------
# Para usar o efeito definido em um evento, coloque o seguinte comentário:
#
# [light x]
#
# Onde x deve ser o ID do efeito configurado.
#
#-------------------------------------------------------------------------------
# * Instruções - 3. Utilizando a luz dinâmica (lanterna)
#-------------------------------------------------------------------------------
# A lanterna é automaticamente inicializada como invisível. Você pode usar os
# seguintes métodos com o comando "Chamar Script":
#
# l = $game_map.lantern
# Adiquire a lanterna em uma variável.
# Você pode usar todos os comandos abaixo com "$game_map.lantern" ao
# invés de adiquirir a lanterna em uma variável, porém tome cuidado, pois
# o comando "Chamar Script" corta o código e pode gerar erros.
#
# l.set_graphic(i)
# Muda o gráfico da lanterna para i, onde i deve ser o nome, entre aspas,
# da imagem na pasta Graphics/Lights
#
# l.set_multiple_graphics(h)
# Muda os gráficos da lanterna para h, onde h deve ser uma Hash com o seguinte
# formato:
#
# h = {2=>"ld",4=>"ll",6=>"lr",8=>"lu"}
#
# Onde:
# "ld" é o nome da imagem quando o portador está virado para baixo;
# "ll" é o nome da imagem quando o portador está virado para esquerda;
# "lr" é o nome da imagem quando o portador está virado para direita;
# "lu" é o nome da imagem quando o portador está virado para cima.
#
# l.change_owner(char)
# Muda o portador da lanterna para char, onde char pode ser:
# $game_player           <= O jogador;
# self_event             <= O evento em que o comando é chamado;
# $game_map.events
  •     <= O evento de ID x do mapa.
    #
    # l.set_opacity(o,p)
    # Ajusta a opacidade da lanterna, onde:
    # o é a opacidade padrão;
    # p é a variação POSITIVA da opacidade.
    #
    # l.show
    # Depois de configurar a lanterna com os comandos acima, use este comando para
    # tornar a lanterna visível.
    #
    # l.hide
    # Use este comando para esconder a lanterna.
    #
    #-------------------------------------------------------------------------------
    # * Instruções - 4. Utilizando a superfície de efeitos (Chamar Script)
    #-------------------------------------------------------------------------------
    # O Awesome Light Effects desenha os efeitos sobre uma superfície. Para que
    # os efeitos estejam visíveis, a superfície de efeitos deve estar visível.
    # Para utilizar a superfície de efeitos, utilize os comandos abaixo:
    #
    # s = $game_map.effect_surface
    # Adiquire a superfície em uma variável.
    # Você pode usar todos os comandos abaixo com "$game_map.effect_surface" ao
    # invés de adiquirir a superfície em uma variável, porém tome cuidado, pois
    # o comando "Chamar Script" corta o código e pode gerar erros.
    #
    # s.set_color(r,g,b)
    # Muda a cor da superfície instantâneamente para a cor fornecida:
    # r => valor da cor vermelha;
    # g => valor da cor verde;
    # b => valor da cor azul.
    #
    # s.set_alpha(a)
    # Muda a opacidade da superfície instantâneamente para a.
    #
    # s.change_color(time,r,g,b)
    # Muda SOMENTE a cor da superfície em um certo tempo, onde:
    # time => tempo para a mudança (em frames);
    # r => valor da cor vermelha;
    # g => valor da cor verde;
    # b => valor da cor azul.
    #
    # s.change_color(time,r,g,b,a)
    # Muda a cor da superfície e a opacidade em um certo tempo, onde:
    # time => tempo para a mudança (em frames);
    # r => valor da cor vermelha;
    # g => valor da cor verde;
    # b => valor da cor azul;
    # a => opacidade.
    #
    # s.change_alpha(time,a)
    # Muda a opacidade da superfície em um certo tempo, onde:
    # time => tempo para a mudança (em frames);
    # a => opacidade.
    #
    #-------------------------------------------------------------------------------
    # * Instruções - 5. Utilizando a superfície de efeitos (Evento)
    #-------------------------------------------------------------------------------
    # Você pode acessar a superfície de efeitos pelo comando "Tonalidade de Tela",
    # para isso, coloque a opção "Surface_UE" (nas configurações) como true. Caso
    # queria desabilitar essa opção e ter controle sobre o tom da tela, coloque a
    # opção "Surface_UE" como false.
    #
    # Observe os seguintes detalhes, se for usar esta opção:
    # 1. Os valores de cor devem estar entre 0 e 255;
    # 2. O tempo é em frames;
    # 3. O valor "Cinza" será enviado como a opacidade da superfície.
    #
    #-------------------------------------------------------------------------------
    # * Instruções - 6. Configurando as Tags do mapa
    #-------------------------------------------------------------------------------
    # Afim de que as luzes sejam cortadas de forma precisa e realista, há 3 tipos
    # de comportamento para um tile: telhado, parede e bloco. Pense de maneira
    # lógica: um telhado gera sombras como telhado, uma parede como uma parede, e
    # assim por diante.
    #
    # Para isso, as tags do tileset DEVEM ser configuradas. Por padrão, são
    # configuradas para 6,7 e 8. Veja a demo para ter noção de como isso funciona.
    #
    # Note que o script só irá analizar a primeira camada (camada A) do mapa. Certos
    # tilesets não irão funcionar caso os tiles não estejam configurados de modo
    # correto. Note ainda que este script depende do bom mapeamento para funcionar,
    # preste atenção aos detalhes do seu mapa.
    #
    #-------------------------------------------------------------------------------
    # * Configuração
    #-------------------------------------------------------------------------------
    module Light_Core
      Effects = { # Não mude isto!
    #-------------------------------------------------------------------------------
    # ADICIONE ABAIXO OS SEUS EFEITOS!
    #-------------------------------------------------------------------------------
      0 => ["light",255,0,true],
      1 => ["torch",200,20,true],
      2 => ["torch_m",180,30,true],
      3 => ["light_s",255,0,true],
     
    #-------------------------------------------------------------------------------
    # Fim da configuração de efeitos
    #-------------------------------------------------------------------------------
      } # Não mude isto!
     
      # Coordenada Z da superfície de efeitos:
      Surface_Z = 180
     
      # Habilitar controle da superfície por "Tonalidade da Tela"?
      Surface_UE = true
     
      # Tag para a superfície se comportar como "telhado"
      Roof_Tag = 5
      # Tag para a superfície se comportar como "parede"
      Wall_Tag = 6
      # Tag para a superfície se comportar como "bloco" (semelhante ao telhado)
      Block_Tag = 7
     
      # Constante de correção de ângulo (não altere)
      ACC = Math.tan(Math::PI/26)
    end
    #-------------------------------------------------------------------------------
    # Fim da configuração - Início do 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,shado
[close]

Encontre essas linhas no script de iluminação:
Spoiler
[close]
Esse valor determina a prioridade dos efeitos sobre os outros elementos na tela. Tente ir reduzindo e testando até que a HUD se sobreponha aos efeitos.

Muito obrigado, funcionou perfeitamente.
kkkk Quem diria que o próprio magnifico escritor Edgar Allan Poe em pessoa iria me responder e ajudar com o meu jogo.
Duvida respondida, ja pode fechar aqui