[XP] Landith's Blizz-ABS Party-HUD

Started by Landith, May 31, 2009, 09:17:38 pm

Previous topic - Next topic

Landith

May 31, 2009, 09:17:38 pm Last Edit: December 28, 2010, 07:36:43 pm by game_guy
Landith's Blizz-ABS Party HUD
Authors: Landith, Winkio
Version: 1.0
Type: Blizz-ABS HUD
Key Term: Blizz-ABS Plugin



Introduction
This script allows you to have more than one party member showing at a time with Blizz-ABS. This is a heavily-modded version of Winkio's Flashy HUD.



Features


  • Allows up to 4 party members in your HUD
  • Pictures for your Party HUD
  • Shows currently equipped weapon/skill/item
  • Map Name/Gold Display
  • EXP Bar
  • Bigger Minimap Display(Thanks to Winkio)




Screenshots
Spoiler: ShowHide




Demo
Download Here!
Alternate Mirror



Script
Download Here!



Instructions
You need to create a new folder in your graphics/pictures folder called "HUD" and have 4 images in there called Parhud1, Parhud2, Parhud3, Parhud4. I have included 4 example pictures below for when you create your own images, or you can use these.
Images: ShowHide










Paste below Blizz-ABS but before Main.



Compatibility
Might cause Incompatibility issues when using another HUD.



Credits and Thanks

  • Landith
  • Winkio
  • Blizzard
  • Special Thanks to Aqua and Starrodkirby86 for Inspiration to improve it.



Author's Notes
I did not make this from scratch. This is just an edit of Winkio's Party HUD: Flashy Edition.
Enjoy :)


Aqua


Starrodkirby86

Separate the script into parts before making this post.

I'll help.
Spoiler: ShowHide
#===============================================================================
# Blizz-ABS Party HUD++ Landith
# Version: 1.00
#===============================================================================
#
#
#===============================================================================
# This script modifies the Blizz-ABS HUD to display the HP/SP of up to four
# party members at once.  It also moves the hud and skill bar to the bottom and
# scales down the minimap.
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#===============================================================================

module LandithHUD
  Font_Name = "Tahoma"                  # Your font name for the HUD here
end

#==============================================================================
# Game_System
#------------------------------------------------------------------------------
#  This class was modified to support the party hud
#==============================================================================
class Game_System
 
  attr_accessor :parhud
  attr_accessor :equiphud
  attr_accessor :exphud
  attr_accessor :bar_style
  attr_reader   :bar_opacity

  alias init_HUDFE_later initialize
  def initialize
    # turn HUD on, Hotkey Assignment Display off and Minimap off
    @hud, @parhud, @hotkeys, @minimap, @equiphud, @exphud = false, false, false, 0, false, false
    # Bar configuration
    @bar_style = 2                  # Configure this with 0-6   Default - 4
    self.bar_opacity = 255          # Opacity of the bars:      Default - 255
    # restart method
    init_HUDFE_later
  end

  #----------------------------------------------------------------------------
  # bar_opacity=
  #  alpha - opacity
  #  Encapsulation and range limitation of opacity.
  #----------------------------------------------------------------------------
  def bar_opacity=(alpha)
    @bar_opacity = [[alpha, 0].max, 255].min
  end
end

#==============================================================================
# Bitmap
#------------------------------------------------------------------------------
#  This class was enhanced with methods to support the drawing of gradient bars
#  and outlined text.
#==============================================================================

class Bitmap
 
  #----------------------------------------------------------------------------
  # Gradient_Bar_Hud, modified to fit my HUD
  #----------------------------------------------------------------------------
  # Method taken from TONS
  #----------------------------------------------------------------------------
  # gradient_bar_hud
  #  x          - x-coordinate
  #  y          - y-coordinate
  #  w          - width
  #  rate       - fill rate
  #  image_key  - image key for image used for drawing or two images
  #  change_hue - changing hue on changing fill rate
  #  Draws the HUD gradient bar.
  #----------------------------------------------------------------------------
  # alias gradient_bar_hud_parhud gradient_bar_hud
  def gradient_bar_hud(x, y, w, color1, color2, color3, rate, flag = false)
    # stop if not active or out of range
    return unless flag
    return if $game_system.bar_style < 0 || $game_system.bar_style > 6
    # styles with "vertical" black borders
    styles = [1, 3, 4, 5, 6]
    # setup of coordinates and offsets depending on style
    offs = 5
    x += offs
    y += 26
    if styles.include?($game_system.bar_style)
      offs += 2
      y -= 1
      [5, 6].include?($game_system.bar_style) ? y -= 2 :  x += 1
      # quantizes the width so it looks better (remove it and see what happens)
      w = w / 8 * 8
    end
    # temporary variable
    a = $game_system.bar_opacity
    if $game_system.bar_style < 5
      # draw black slanted back
      (0...(offs+3)).each {|i| fill_rect(x-i, y+i-2, w+3, 1, Color.new(0, 0, 0))}
      # draw white slanted back onto black, but let black borders stay
      (0...(offs+1)).each {|i| fill_rect(x-i, y+i-1, w+1, 1, Color.new(255, 255, 255))}
      if $game_system.bar_style < 2
        # iterate through each vertical bar
        (0...w+offs).each {|i|
            # calculate color
            r = color3.red * i / (w+offs)
            g = color3.green * i / (w+offs)
            b = color3.blue * i / (w+offs)
            # special offset calculation
            oy = i < offs ? offs-i : 0
            off = i < offs ? i : i > w ? w+offs-i : offs
            # draw this part of the bar
            fill_rect(x+i-offs+1, y+oy-1, 1, off, Color.new(r, g, b, a))}
        # if slanted bar is out of critical area
        if (w*rate).to_i >= offs
          # draw the little triangular part on the left
          (0...((w*rate).to_i+offs)).each {|i|
              r = color1.red + (color2.red-color1.red)*i / ((w+offs)*rate)
              g = color1.green + (color2.green-color1.green)*i / ((w+offs)*rate)
              b = color1.blue + (color2.blue-color1.blue)*i / ((w+offs)*rate)
              oy = i < offs ? offs-i : 0
              off = i < offs ? i : i > w*rate ? (w*rate).to_i+offs-i : offs
              fill_rect(x+i-offs+1, y+oy-1, 1, off, Color.new(r, g, b, a))}
        else
          # draw the little triangular part on the left using special method
          (0...(w * rate).to_i).each {|i| (0...offs).each {|j|
              r = color1.red + (color2.red-color1.red)*i / (w*rate)
              g = color1.green + (color2.green-color1.green)*i / (w*rate)
              b = color1.blue + (color2.blue-color1.blue)*i / (w*rate)
              set_pixel(x+i-j+1, y+j-1, Color.new(r, g, b, a))}}
        end
      else
        # iterate through all horizontal lines
        (0...offs).each {|i|
            # calculate colors
            r = color3.red * i / offs
            g = color3.green * i / offs
            b = color3.blue * i / offs
            # draw background line
            fill_rect(x-i+1, y+i-1, w, 1, Color.new(r, g, b, a))}
        if $game_system.bar_style == 4
          # iterate through half of all horizontal lines
          (0...offs/2+1).each {|i|
              # calculate colors
              r = color2.red * (i+1) / (offs/2)
              g = color2.green * (i+1) / (offs/2)
              b = color2.blue * (i+1) / (offs/2)
              # draw bar line
              fill_rect(x-i+1, y+i-1, w*rate, 1, Color.new(r, g, b, a))
              # draw bar line mirrored vertically
              fill_rect(x-offs+i+2, y+offs-i-2, w*rate, 1, Color.new(r, g, b, a))}
        else
          # iterate through all horizontal lines
          (0...offs).each {|i|
              # calculate colors
              r = color1.red + (color2.red-color1.red)*i / offs
              g = color1.green + (color2.green-color1.green)*i / offs
              b = color1.blue + (color2.blue-color1.blue)*i / offs
              # draw bar line
              fill_rect(x-i+1, y+i-1, w*rate, 1, Color.new(r, g, b, a))}
        end
      end
      # if style with black vertical slanted intersections
      if styles.include?($game_system.bar_style)
        # add black bars on 1st and 8th column every 8 pixels
        (0...w).each {|i| (0...offs).each {|j|
            if styles.include?($game_system.bar_style) && i % 8 < 2
              set_pixel(x+i-j+1, y+j-1, Color.new(0, 0, 0, a))
            end}}
      end
    else
      # fill white background
      fill_rect(x+1, y-3, w+2, 12, Color.new(255, 255, 255, a))
      # iterate through each of 6 lines
      (1...6).each {|i|
          # calculate background color
          color = Color.new(color3.red*i/5, color3.green*i/5, color3.blue*i/5, a)
          # draw background
          fill_rect(x+2, y+i-3, w, 12-i*2, color)
          # calculate bar color
          color = Color.new(color2.red*i/5, color2.green*i/5, color2.blue*i/5, a)
          # draw bar
          fill_rect(x+2, y+i-3, w*rate, 12-i*2, color)}
      # if style 5 (with vertical borders)
      if $game_system.bar_style == 5
        # add black bars on 1st and 8th column every 8 pixels
        (0...w/8).each {|i|
            fill_rect(x+2+i*8, y-2, 1, 10, Color.new(0, 0, 0, a))
            fill_rect(x+2+(i+1)*8-1, y-2, 1, 10, Color.new(0, 0, 0, a))}
      end
    end
  end
end

#==============================================================================
# Scene_Title
#==============================================================================

class Scene_Title

  alias main_parhud_later main
  def main
    $map_infos = load_data('Data/MapInfos.rxdata')
    $map_infos.keys.each {|key| $map_infos[key] = $map_infos[key].name}
    main_parhud_later
  end
 
end

#==============================================================================
# Game_Map
#==============================================================================

class Game_Map
       
  def name
    return $map_infos[@map_id]
  end
   
end

#==============================================================================
# ParHud
#------------------------------------------------------------------------------
#  This class creates the top hud that shows the hp/sp of all party members and
#  their names.
#==============================================================================

class ParHud < Sprite
 
  #----------------------------------------------------------------------------
  # Initialization
  #  viewport - the viewport for the sprite
  #----------------------------------------------------------------------------
  def initialize(viewport = nil)
    # call superclass method
    super
    # set party size
    @psize = $game_party.actors.size
    # create positions
    create_positions
    # create bitmap
    #self.bg = Bitmap.new(128, 256)
    # create bitmap
    self.bitmap = Bitmap.new(128, 64*@psize)
    # set font
    self.bitmap.font.name = LandithHUD::Font_Name
    # set font size
    self.bitmap.font.size = 16
    # set font to bold
    self.bitmap.font.bold = true
    # set z coordinate
    self.y, self.z = 0, 1000
    # set other variables
    @leader = $game_party.actors[1]
    @poffset = 0
    @hp, @maxhp = [0, 0, 0, 0], [0, 0, 0, 0]
    @sp, @maxsp = [0, 0, 0, 0], [0, 0, 0, 0]
    #bg
    @hudbg = HudBG.new(2)
    # draw basic HUD
    draw_basic
    # update
    update
  end
  #----------------------------------------------------------------------------
  # create_positions
  #  Sets drawing positions. This method can be aliased and the positions
  #  modified to create a different HUD.
  #----------------------------------------------------------------------------
  def create_positions
    @name_x, @name_y, @status_x, @status_y, @hp_x, @hp_y, @sp_x, @sp_y =
      [], [], [], [], [], [], [], []
    (0...@psize).each {|i|
      ydat = i*64
      @name_x.push(13)
      @name_y.push(ydat+8)
      @status_x.push(70)
      @status_y.push(ydat+8)
      @hp_x.push(13)
      @hp_y.push(ydat+28)
      @sp_x.push(13)
      @sp_y.push(ydat+42)}
  end
  #----------------------------------------------------------------------------
  # draw_basic
  #  Draws the HUD template.
  #----------------------------------------------------------------------------
  def draw_basic
    self.bitmap.font.size = 16
    color = Color.new(255, 255, 255, 0)
    self.bitmap.font.color = Color.new(255, 255, 255)
    # if color exists
    if color.is_a?(Color)
      (0...@psize).each {|i|
        # draw outlines in color
        self.bitmap.fill_rect(@hp_x[i], @hp_y[i], 102, 14, color)
        self.bitmap.fill_rect(@sp_x[i], @sp_y[i], 102, 14, color)
        # draw actor's names
        self.bitmap.draw_text_full(@name_x[i], @name_y[i], 102, 20, actor(i).name, 1)
        }
    end
    self.bitmap.font.size = 12
  end
  #----------------------------------------------------------------------------
  # draw_empty
  #  Draws the HP and SP display when actor doesn't exist.
  #----------------------------------------------------------------------------
  def draw_empty
    # reset all flag variables
    @hp = @sp = @maxhp = @maxsp = nil
  end
  #----------------------------------------------------------------------------
  # draw_hp
  #  Draws the HP display.
  #----------------------------------------------------------------------------
  def draw_hp
    #clears current values
    @hp, @maxhp = [], []
    self.bitmap.font.color = normal_color
    (0...@psize).each {|i|
      # set current variables
      self.bitmap.fill_rect(@hp_x[i]-2, @hp_y[i]-2, 102, 14, Color.new(0,0,0,0))
      @hp.push(actor(i).hp)
      @maxhp.push(actor(i).maxhp)
      rate = (@maxhp[i] > 0 ? @hp[i].to_f / @maxhp[i] : 0)
      # create colors depending on rate
      if rate > 0.6
        color1 = Color.new(80 - 150 * (rate-0.6), 80, 50 * (rate-0.6), 192)
        color2 = Color.new(240 - 450 * (rate-0.6), 240, 150 * (rate-0.6), 192)
      elsif rate > 0.2 && rate <= 0.6
        color1 = Color.new(80, 200 * (rate-0.2), 0, 192)
        color2 = Color.new(240, 600 * (rate-0.2), 0, 192)
      elsif rate <= 0.2
        color1 = Color.new(400 * rate, 0, 0, 192)
        color2 = Color.new(240, 0, 0, 192)
      end
      # background color
      color3 = Color.new(0, 80, 0, 192)
      # draw gradient bar
      self.bitmap.gradient_bar_hud(@hp_x[i], @hp_y[i]-20, 100, color1, color2, color3, rate, true)
      # draw HP
      self.bitmap.draw_text_full(@hp_x[i]+1, @hp_y[i]-2, 100, 14, @hp[i].to_s + " / " + @maxhp[i].to_s, 1)
      self.bitmap.font.color = system_color
      self.bitmap.draw_text_full(@hp_x[i], @hp_y[i]-5, 40, 20, "HP", 0)
      self.bitmap.font.color = normal_color
      }
  end
  #----------------------------------------------------------------------------
  # draw_sp
  #  Draws the SP display.
  #----------------------------------------------------------------------------
  def draw_sp
    @sp, @maxsp = [], []
    self.bitmap.font.color = normal_color
    (0...@psize).each {|i|
      self.bitmap.fill_rect(@sp_x[i]-2, @sp_y[i]-2, 102, 14, Color.new(0,0,0,0))
      # set current variables
      @sp.push(actor(i).sp)
      @maxsp.push(actor(i).maxsp)
      rate = (@maxsp[i] > 0 ? @sp[i].to_f / @maxsp[i] : 0)
      if rate > 0.4
        color1 = Color.new(60 - 66 * (rate-0.4), 20, 80, 192)
        color2 = Color.new(180 - 200 * (rate-0.4), 60, 240, 192)
      elsif rate <= 0.4
        color1 = Color.new(20 + 100 * rate, 50 * rate, 26 + 166 * rate, 192)
        color2 = Color.new(60 + 300 * rate, 150 * rate, 80 + 400 * rate, 192)
      end
      # background color
      color3 = Color.new(0, 0, 80, 192)
      # draw gradient bar
      self.bitmap.gradient_bar_hud(@sp_x[i], @sp_y[i]-20, 100, color1, color2, color3, rate, true)
      # draw HP
      self.bitmap.draw_text_full(@sp_x[i]+1, @sp_y[i]-2, 100, 14, @sp[i].to_s + " / " + @maxsp[i].to_s, 1)
      self.bitmap.font.color = system_color
      self.bitmap.draw_text_full(@sp_x[i], @sp_y[i]-5, 40, 20, "SP", 0)
      self.bitmap.font.color = normal_color
      }
  end
  #----------------------------------------------------------------------------
  # update
  #  Checks if HUD needs refreshing.
  #----------------------------------------------------------------------------
  def update
    # if actor doesn't exist
    if actor == nil
      # unless already drawn empty HUD
      unless @empty_hud_drawn
        # draw HUD template
        draw_basic
        # draw empty HP, SP and EXP bars
        draw_empty
        # empty HUD was drawn
        @empty_hud_drawn = true
      end
    else
      if @psize != $game_party.actors.size or @leader != $game_party.actors[0]
        @psize = $game_party.actors.size
        self.bitmap.clear
        self.bitmap = Bitmap.new(128, 64*@psize)
        self.bitmap.font.name = LandithHUD::Font_Name
        self.bitmap.font.size = 16
        self.bitmap.font.bold = true
        @hudbg.dispose
        @hudbg = HudBG.new(2)
        @leader = $game_party.actors[0]
        create_positions
        draw_basic
        draw_empty
        draw_hp
        draw_sp
      end
      # if HUD needs refresh
      if $game_temp.hud_refresh
        # draw all data about actors
        draw_hp
        draw_sp
        # remove flag
        $game_temp.hud_refresh = nil
      else
        # draw data that needs to be updated
        test_offset
        test_hp
        test_sp
      end
      # empty HUD wasn't drawn
      @empty_hud_drawn = false
    end
    @hudbg.update
  end
  #----------------------------------------------------------------------------
  # test_hp
  #  Tests and draws the HP.
  #----------------------------------------------------------------------------
  def test_hp
    (0...@psize).each {|i|
      # draw new HP if HP or max HP have changed
      draw_hp if actor(i).hp != @hp[i] || actor(i).maxhp != @maxhp[i]}
  end
  #----------------------------------------------------------------------------
  # test_sp
  #  Tests and draws the SP.
  #----------------------------------------------------------------------------
  def test_sp
    (0...@psize).each {|i|
      # draw new HP if HP or max HP have changed
      draw_sp if actor(i).sp != @sp[i] || actor(i).maxsp != @maxsp[i]}
  end
  #----------------------------------------------------------------------------
  # test_offset
  #  Tests and draws the SP.
  #----------------------------------------------------------------------------
  def test_offset
    (0...@psize).each {|i|
    if $game_party.actors[(i + @poffset)%@psize].name != $game_actors[1].name
      @poffset += 1
    else
      return
    end}
    @poffset %= @psize
  end
  #----------------------------------------------------------------------------
  # actor
  #  Returns the party leader's battler for easier reference.
  #----------------------------------------------------------------------------
  def actor(id = 0)
    return $game_party.actors[id + @poffset]
  end 
  def dispose
    @hudbg.dispose
    super
  end
 
end
#==============================================================================
# Hud
#------------------------------------------------------------------------------
#  This class was modified to support SR display and modify the number of
#  skills left to use.
#  Displays HUD window and exp/level bar
#==============================================================================

class ExpHud < Sprite
 
  #----------------------------------------------------------------------------
  # Initialization
  #  viewport - the viewport for the sprite
  #----------------------------------------------------------------------------
  def initialize(viewport = nil)
    # call superclass method
    super
    # create positions
    create_positions
    # create bitmap
    self.bitmap = Bitmap.new(320, 40)
    #self.bg = Bitmap.new(128, 64)
    # set font
    self.bitmap.font.name = LandithHUD::Font_Name
    # set font size
    self.bitmap.font.size = 16
    # set font to bold
    self.bitmap.font.bold = true
    # set x and y coordinates
    self.x, self.y = @hud_x, @hud_y
    # set z coordinate
    self.z = 1000
    # draw basic HUD
    draw_basic
    # update
    update
  end
  #----------------------------------------------------------------------------
  # create_positions
  #  Sets drawing positions. This method can be aliased and the positions
  #  modified to create a different HUD.
  #----------------------------------------------------------------------------
  def create_positions
    @hud_height, @hud_width, @hud_x, @hud_y = 40, 294, 181, 422
    @exp_x, @exp_y, = 6, 2
    @level_x, @level_y = 0, 20
  end
  #----------------------------------------------------------------------------
  # draw_basic
  #  Draws the HUD template.
  #----------------------------------------------------------------------------
  def draw_basic
    #bitmap = RPG::Cache.picture("HUD.png")
    #self.bg.blt(0, 0, bitmap, Rect.new(0, 0, 128, 64))
    # fill with grey rectangle
    self.bitmap.fill_rect(0, 0, @hud_width, @hud_height,
        Color.new(0, 0, 0, 0))
    self.bitmap.font.color = system_color
    self.bitmap.font.size = 16
    self.bitmap.draw_text_full(0,4,294,20,"EXP",1)
  end
  #----------------------------------------------------------------------------
  # draw_empty
  #  Draws the HP and SP display when actor doesn't exist.
  #----------------------------------------------------------------------------
  def draw_empty
    # reset all flag variables
    @name = @level = @hp = @sp = @maxhp = @maxsp = @exp = @states = @skill =
        @skills_left = @item = @items_left = @gold = @equip = nil
  end
  #----------------------------------------------------------------------------
  # draw_exp
  #  Draws the EXP display.
  #----------------------------------------------------------------------------
  def draw_exp
    # set current variables
    @exp, @level = actor.exp, actor.level
    # set fill rate
    rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp  : 1)
    # draw gradient bar
    if rate < 0.5
        color1 = Color.new(20 * rate, 60, 80, 192)
        color2 = Color.new(60 * rate, 180, 240, 192)
      elsif rate >= 0.5
        color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80, 192)
        color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192)
    end
    # background color
    color3 = Color.new(80, 80, 80, 192)
    self.bitmap.gradient_bar_hud(@level_x, @level_y-20, 294, color1, color2, color3, rate, true)
    # self.bitmap.gradient_bar(@level_x, @level_y-10, 294, color1, color2, color3, rate, true)
    # set font color depending on how many HP left
    self.bitmap.font.color = normal_color
    self.bitmap.font.size = 14
    self.bitmap.font.name = LandithHUD::Font_Name
    # draw EXP
    self.bitmap.draw_text_full(@level_x, @level_y-4, 294, 20, actor.exp_s + " / " + actor.next_exp_s, 1)
    self.bitmap.font.color = system_color
    self.bitmap.draw_text_full(@level_x, @level_y-4, 64, 20, "Lv: ", 0)
    self.bitmap.font.color = normal_color
    self.bitmap.draw_text_full(@level_x+25, @level_y-4, 64, 20, @level.to_s, 0)
  end
  #----------------------------------------------------------------------------
  # update
  #  Checks if HUD needs refreshing.
  #----------------------------------------------------------------------------
  def update
    # if actor doesn't exist
    if actor == nil
      # unless already drawn empty HUD
      unless @empty_hud_drawn
        # draw HUD template
        draw_basic
        # draw empty HP, SP and EXP bars
        draw_empty
        # empty HUD was drawn
        @empty_hud_drawn = true
      end
    else
      # if HUD needs refresh
      if $game_temp.hud_refresh
        # draw all data about actors
        draw_exp
        # remove flag
        $game_temp.hud_refresh = nil
      else
        # draw data that needs to be updated
        test_exp
      end
      # empty HUD wasn't drawn
      @empty_hud_drawn = false
    end
  end
  #----------------------------------------------------------------------------
  # test_exp
  #  Tests and draws the EXP.
  #----------------------------------------------------------------------------
  def test_exp
    # draw new HP if HP or max HP have changed
    draw_exp if actor.exp != @exp
  end
  #----------------------------------------------------------------------------
  # actor
  #  Returns the party leader's battler for easier reference.
  #----------------------------------------------------------------------------
  def actor
    return $game_player.battler
  end
  def dispose
    super
  end
end

What's osu!? It's a rhythm game. Thought I should have a signature with a working rank. ;P It's now clickable!
Still Aqua's biggest fan (Or am I?).




Starrodkirby86

May 31, 2009, 09:39:34 pm #3 Last Edit: May 31, 2009, 09:40:46 pm by Starrodkirby86
Add this RIGHT AFTER the first part before. Do NOT create a new script.

Spoiler: ShowHide

#==============================================================================
# Hud
#------------------------------------------------------------------------------
#  This class was modified to support SR display and modify the number of
#  skills left to use.
#  Displays HUD window and exp/level bar
#==============================================================================

class Hud < Sprite
 
 #----------------------------------------------------------------------------
 # Initialization
 #  viewport - the viewport for the sprite
 #----------------------------------------------------------------------------
 def initialize(viewport = nil)
   # call superclass method
   super
   # create positions
   create_positions
   # create bitmap
   self.bitmap = Bitmap.new(148, 148)
   #self.bg = Bitmap.new(128, 64)
   # set font
   self.bitmap.font.name = LandithHUD::Font_Name
   # set font size
   self.bitmap.font.size = 16
   # set font to bold
   self.bitmap.font.bold = true
   # set x and y coordinates
   self.x, self.y = @hud_x, @hud_y
   # set z coordinate
   self.z = 1000
   # draw basic HUD
   draw_basic
   # update
   update
 end
 #----------------------------------------------------------------------------
 # create_positions
 #  Sets drawing positions. This method can be aliased and the positions
 #  modified to create a different HUD.
 #----------------------------------------------------------------------------
 def create_positions
   @hud_height, @hud_width, @hud_x, @hud_y = 128, 148, 0, 480-64
   @gold_x, @gold_y, @loc_x, @loc_y,  = 64, 48, 6, 32
 end
 #----------------------------------------------------------------------------
 # draw_basic
 #  Draws the HUD template.
 #----------------------------------------------------------------------------
 def draw_basic
   #bitmap = RPG::Cache.picture("HUD.png")
   #self.bg.blt(0, 0, bitmap, Rect.new(0, 0, 128, 64))
   # fill with grey rectangle
   self.bitmap.fill_rect(0, 0, @hud_width, @hud_height,
       Color.new(0, 0, 0, 0))
   # set font color
   self.bitmap.font.color = system_color
   # draw "G"
   self.bitmap.font.size = 14
   self.bitmap.draw_text_full(@gold_x-64, @gold_y, 20, 20, " G")
 end
 #----------------------------------------------------------------------------
 # draw_empty
 #  Draws the HP and SP display when actor doesn't exist.
 #----------------------------------------------------------------------------
 def draw_empty
   # reset all flag variables
   @name = @level = @hp = @sp = @maxhp = @maxsp = @exp = @states = @skill =
       @skills_left = @item = @items_left = @gold = @equip = nil
 end
 #----------------------------------------------------------------------------
 # draw_gold
 #  Draws the gold display.
 #----------------------------------------------------------------------------
 def draw_gold
   # set current variable
   @gold = $game_party.gold
   # remove old display
   self.bitmap.fill_rect(@gold_x-50, @gold_y, 64, 20, Color.new(0, 0, 0, 0))
   # set font color
   self.bitmap.font.color = normal_color
   # draw party's gold  
   self.bitmap.draw_text_full(@gold_x-48, @gold_y, 64, 20, $game_party.gold.to_s, 0)
 end
 #----------------------------------------------------------------------------
 # draw_loc
 #  Draws the map location display.
 #----------------------------------------------------------------------------
 def draw_loc
   # set current variable
   @loc = $game_map.name
   # remove old display
   self.bitmap.fill_rect(@loc_x-20, @loc_y, 200, 20, Color.new(0, 0, 0, 0))
   # set font color
   self.bitmap.font.color = normal_color
   self.bitmap.font.size = 14
   # draw location
   self.bitmap.draw_text_full(@loc_x-20, @loc_y, 200, 20, @loc, 1)
 end
 #----------------------------------------------------------------------------
 # update
 #  Checks if HUD needs refreshing.
 #----------------------------------------------------------------------------
 def update
   # if actor doesn't exist
   if actor == nil
     # unless already drawn empty HUD
     unless @empty_hud_drawn
       # draw HUD template
       draw_basic
       # draw empty HP, SP and EXP bars
       draw_empty
       # empty HUD was drawn
       @empty_hud_drawn = true
     end
   else
     # if HUD needs refresh
     if $game_temp.hud_refresh
       # draw all data about actors
       draw_gold
       draw_loc
       # remove flag
       $game_temp.hud_refresh = nil
     else
       # draw data that needs to be updated
       test_gold
       test_loc
     end
     # empty HUD wasn't drawn
     @empty_hud_drawn = false
   end
 end
 #----------------------------------------------------------------------------
 # test_er
 #  Tests and draws the er.
 #----------------------------------------------------------------------------
 def test_gold
   # draw new er if er has changed
   draw_gold if $game_party.gold != @gold
 end
 #----------------------------------------------------------------------------
 # test_loc
 #  Tests and draws the loc.
 #----------------------------------------------------------------------------
 def test_loc
   # draw new er if er has changed
   draw_loc if $game_map.name != @loc
 end
 #----------------------------------------------------------------------------
 # actor
 #  Returns the party leader's battler for easier reference.
 #----------------------------------------------------------------------------
 def actor
   return $game_player.battler
 end
 def dispose
   super
 end
end

#==============================================================================
# Equip Hud
#==============================================================================

class Equip_Hud < Sprite
 
 #----------------------------------------------------------------------------
 # Initialization
 #  viewport - the viewport for the sprite
 #----------------------------------------------------------------------------
 def initialize(viewport = nil)
   # call superclass method
   super
   # create positions
   create_positions
   # create bitmap
   self.bitmap = Bitmap.new(200, 70)
   #self.bg = Bitmap.new(128, 64)
   # set font
   self.bitmap.font.name = LandithHUD::Font_Name
   # set font size
   self.bitmap.font.size = 16
   # set font to bold
   self.bitmap.font.bold = true
   # set x and y coordinates
   self.x, self.y = @hud_x, @hud_y
   # set z coordinate
   self.z = 1000
   # draw basic HUD
   draw_basic
   # update
   update
 end
 #----------------------------------------------------------------------------
 # create_positions
 #  Sets drawing positions. This method can be aliased and the positions
 #  modified to create a different HUD.
 #----------------------------------------------------------------------------
 def create_positions
   @hud_height, @hud_width, @hud_x, @hud_y = 128, 200, 640-200, 4
   @equip_x, @equip_y = 0, 22
   @hot_x, @hot_y, @left_x, @left_y = 132, 22, 66, 22
 end
 #----------------------------------------------------------------------------
 # draw_basic
 #  Draws the HUD template.
 #----------------------------------------------------------------------------
 def draw_basic
   #bitmap = RPG::Cache.picture("HUD.png")
   #self.bg.blt(0, 0, bitmap, Rect.new(0, 0, 128, 64))
   # fill with grey rectangle
   self.bitmap.fill_rect(0, 0, @hud_width, @hud_height,
       Color.new(0, 0, 0, 0))
   self.bitmap.font.size = 16
   self.bitmap.font.color = Color.new(255, 128, 128, 255)
   self.bitmap.draw_text_full(45, 4, 120, 16,"Equipment")
   self.bitmap.font.size = 16
   self.bitmap.font.name = LandithHUD::Font_Name
   self.bitmap.font.color = system_color
   self.bitmap.draw_text_full(0, 50, 40, 16, "WPN")
   self.bitmap.draw_text_full(64, 50, 40, 16, "ITEM")
   self.bitmap.draw_text_full(132, 50, 40, 16, "SKILL")
 end
 #----------------------------------------------------------------------------
 # draw_empty
 #  Draws the HP and SP display when actor doesn't exist.
 #----------------------------------------------------------------------------
 def draw_empty
   # reset all flag variables
   @name = @level = @hp = @sp = @maxhp = @maxsp = @exp = @states = @skill =
       @skills_left = @item = @items_left = @gold = @equip = nil
 end
 #----------------------------------------------------------------------------
 # draw_equip
 #  Draws the equip display.
 #----------------------------------------------------------------------------
 def draw_equip
   # set current variable
   @equip = $data_weapons[$game_party.actors[0].weapon_id]
   # remove old display
   self.bitmap.fill_rect(@equip_x, @equip_y, 200, 28, Color.new(0, 0, 0, 0))
   # set font color
   self.bitmap.font.color = normal_color
   self.bitmap.font.size = 14
   # draw location
   bitmap = RPG::Cache.icon($data_weapons[$game_party.actors[0].weapon_id].icon_name)
   # draw bitmap
   self.bitmap.blt(@equip_x, @equip_y, bitmap, Rect.new(0, 0, 24, 24))
 end
 #----------------------------------------------------------------------------
 # draw_hskill
 #  Draws the hot skill display.
 #----------------------------------------------------------------------------
 def draw_hskill
   # set current variable
   @skill = actor.skill
   # remove old display
   self.bitmap.fill_rect(@hot_x-8, @hot_y, 24, 24, Color.new(255, 0, 0, 0))
   # if skill hot skill exists
   if @skill != 0
     # load bitmap
     bitmap = RPG::Cache.icon($data_skills[@skill].icon_name)
     # draw bitmap
     self.bitmap.blt(@hot_x-8, @hot_y, bitmap, Rect.new(0, 0, 24, 24))
   end
   # removes skills left to use display
   draw_lskill
 end
 #----------------------------------------------------------------------------
 # draw_lskill
 #  Draws the skills left to use display.
 #----------------------------------------------------------------------------
 def draw_lskill
   self.bitmap.font.name = "Tahoma"
   # remove old display
   self.bitmap.fill_rect(@hot_x+16, @hot_y+12, 24, 16, Color.new(0, 0, 0, 0))
   # get the number of skills left
   @skills_left = get_skills_left
   # if hot skill exists
   if @skill != nil && @skill > 0
     # if normal SP cost
     if @skills_left >= 0
       # if not enough sp to use
       if @skills_left == 0
         # set font color
         self.bitmap.font.color = Color.new(255, 0, 0)
       # if enough SP for 5 or less skill uses
       elsif @skills_left <= 5
         # set font color
         self.bitmap.font.color = Color.new(255, 255, 0)
       else
         # set font color
         self.bitmap.font.color = normal_color
       end
       # decrease font color
       self.bitmap.font.size += 2
       # draw number how many skills left to use
       self.bitmap.draw_text_full(@hot_x+12, @hot_y+12, 24, 16, @skills_left.to_s, 2)
       # increase font size
       self.bitmap.font.size -= 2
     # if infinite skills left
     elsif @skills_left == -1
       # set font color
       self.bitmap.font.color = Color.new(0, 255, 0)
       # increase font size
       self.bitmap.font.size += 2
       # draw "∞" skill uses left
       self.bitmap.draw_text_full(@hot_x+12, @hot_y+12, 16, 20, '∞', 2)
       # decrease font size
       self.bitmap.font.size -= 2
     end
   end
 end
 #----------------------------------------------------------------------------
 # get_skills_left
 #  Gets the number of skill usages left.
 #----------------------------------------------------------------------------
 def get_skills_left
   @sp = actor.sp
   # if skill hot skill exists
   if @skill != nil && @skill > 0
     # if SP cost is zero
     if $data_skills[@skill].sp_cost > 0
       # get basic SP cost
       sp_cost = $data_skills[@skill].sp_cost
       # if using SP Cost Mod Status
       if $tons_version != nil && $tons_version >= 6.54 &&
           $game_system.SP_COST_MOD
         # get modified cost
         sp_cost = BlizzCFG.get_cost_mod(actor.states, sp_cost)
       end
       # infinite
       return -1 if sp_cost == 0
       # calculate skills left to use
       return @sp / sp_cost
     end
     # set flag
     return -1
   end
   # set flag
   return -2
 end
 #----------------------------------------------------------------------------
 # draw_hitem
 #  Draws the hot item display.
 #----------------------------------------------------------------------------
 def draw_hitem
   # set current variable
   @item = actor.item
   # remove old display
   self.bitmap.fill_rect(@left_x-8, @left_y, 24, 24, Color.new(255, 0, 0, 0))
   # if hot item exists
   if @item != 0
     # load bitmap
     bitmap = RPG::Cache.icon($data_items[@item].icon_name)
     # draw bitmap
     self.bitmap.blt(@left_x-8, @left_y, bitmap, Rect.new(0, 0, 24, 24))
   end
   # removes items left to use display
   draw_litem
 end
 #----------------------------------------------------------------------------
 # draw_litem
 #  Draws the items left to use display.
 #----------------------------------------------------------------------------
 def draw_litem
   # set current variable
   @items_left = $game_party.item_number(@item)
   # remove old display
   self.bitmap.fill_rect(@left_x+16, @left_y+12, 16, 16, Color.new(255, 0, 0, 0))
   # if hot item exists
   if @item != nil && @item > 0
     # if item exists and cannot be consumed
     if $data_items[@item] != nil && !$data_items[@item].consumable
       # set font color
       self.bitmap.font.color = Color.new(0, 255, 0)
       # increase font size
       self.bitmap.font.size += 2
       # draw "∞" items left
       self.bitmap.draw_text_full(@left_x+12, @left_y+12, 24, 20, '∞', 1)
       # decrease font size
       self.bitmap.font.size -= 2
     else
       # if no items left
       if @items_left == 0
         # set font color
         self.bitmap.font.color = Color.new(255, 0, 0)
       # if equal or less items left
       elsif @items_left <= 10
         # set font color
         self.bitmap.font.color = Color.new(255, 255, 0)
       else
         # set font color
         self.bitmap.font.color = normal_color
       end
       # decrease font color
       self.bitmap.font.size += 2
       # draw number how many items left to use
       self.bitmap.draw_text_full(@left_x+12, @left_y+12, 24, 20, @items_left.to_s, 1)
       # increase font size
       self.bitmap.font.size -= 2
     end
   end
 end
 #----------------------------------------------------------------------------
 # update
 #  Checks if HUD needs refreshing.
 #----------------------------------------------------------------------------
 def update
   # if actor doesn't exist
   if actor == nil
     # unless already drawn empty HUD
     unless @empty_hud_drawn
       # draw HUD template
       draw_basic
       # draw empty HP, SP and EXP bars
       draw_empty
       # empty HUD was drawn
       @empty_hud_drawn = true
     end
   else
     # if HUD needs refresh
     if $game_temp.hud_refresh
       # draw all data about actors
       draw_equip
       draw_hskill
       draw_lskill
       draw_hitem
       draw_litem
       # remove flag
       $game_temp.hud_refresh = nil
     else
       # draw data that needs to be updated
       test_equip
       test_hskill
       test_lskill
       test_hitem
       test_litem
     end
     # empty HUD wasn't drawn
     @empty_hud_drawn = false
   end
 end
 #----------------------------------------------------------------------------
 # test_loc
 #  Tests and draws the loc.
 #----------------------------------------------------------------------------
 def test_equip
   # draw new er if er has changed
   draw_equip if $data_weapons[$game_party.actors[0].weapon_id] != @equip
 end
 #----------------------------------------------------------------------------
 # test_hskill
 #  Tests and draws the hskill.
 #----------------------------------------------------------------------------
 def test_hskill
   # draw new skill icon if assigned skill has changed
   draw_hskill if actor.skill != @skill
 end
 #----------------------------------------------------------------------------
 # test_lskill
 #  Tests and draws the lskill.
 #----------------------------------------------------------------------------
 def test_lskill
   # draw how many skills left to use if this number has changed
   draw_lskill if get_skills_left != @skills_left
 end
 #----------------------------------------------------------------------------
 # test_hitem
 #  Tests and draws the hitem.
 #----------------------------------------------------------------------------
 def test_hitem
   # draw new item icon if assigned item has changed
   draw_hitem if actor.item != @item
 end
 #----------------------------------------------------------------------------
 # test_litem
 #  Tests and draws the litem.
 #----------------------------------------------------------------------------
 def test_litem
   # draw how many items left to use if this number has changed
   draw_litem if $game_party.item_number(@item) != @items_left
 end
 #----------------------------------------------------------------------------
 # actor
 #  Returns the party leader's battler for easier reference.
 #----------------------------------------------------------------------------
 def actor
   return $game_player.battler
 end
end

#==============================================================================
# Hotkey_Assignment
#------------------------------------------------------------------------------
#  This class creates and display currently assigned hotkeys and is more
#  effiecient than the Window class.
#==============================================================================

class Hotkey_Assignment < Sprite
 
 #----------------------------------------------------------------------------
 # Initialization
 #  viewport - the viewport for the sprite
 #----------------------------------------------------------------------------
 def initialize(viewport = nil)
   # call superclass
   super
   # create bitmap
   self.bitmap = Bitmap.new(320, 64)
   # set x and y position
   self.x, self.y, self.z = 160, 435, 1100
   #bg
   # skill IDs on hotkeys
   @skills = BlizzABS::Cache::EmptyKeys
   # item IDs on hotkeys
   @items = BlizzABS::Cache::EmptyKeys
   # update display
   update
 end
 #----------------------------------------------------------------------------
 # draw
 #  Draws the hotkey display.
 #----------------------------------------------------------------------------
 def draw(index = nil)
   # iterate through all hotkeys
   (index == nil ? BlizzABS::Cache::HotkeyRange : [index]).each {|i|
       # if hotkey is skill hotkey
       if $game_player.skill_hotkeys[i%10] != 0
         # temporary object
         object = $data_skills[$game_player.skill_hotkeys[i%10]]
       # if hotkey is item hotkey
       elsif $game_player.item_hotkeys[i%10] != 0
         # temporary object
         object = $data_items[$game_player.item_hotkeys[i%10]]
       end
       # if any change applied (10 is used for 0)
       if @items[i%10] != $game_player.item_hotkeys[i%10] ||
           @skills[i%10] != $game_player.skill_hotkeys[i%10]
         # remove this icon
         self.bitmap.fill_rect(30*(i-1)+22, 20, 24, 24, Color.new(128, 0, 0, 128))
         # if object exists
         if object != nil
           # load bitmap
           bitmap = RPG::Cache.icon(object.icon_name)
           # draw bitmap
           self.bitmap.blt(30*(i-1)+22, 20, bitmap, Rect.new(0, 0, 24, 24))
         end
         # draw hotkey number
         self.bitmap.font.name = "Tahoma"
         self.bitmap.font.size = 12
         self.bitmap.font.color = system_color
         self.bitmap.draw_text_full(30*(i-1)+20, 24, 30, 32, (i%10).to_s, 2)
         self.bitmap.font.size += 4
       end}
   # set new items
   @items = $game_player.item_hotkeys.clone
   # set new skills
   @skills = $game_player.skill_hotkeys.clone
 end
 #----------------------------------------------------------------------------
 # update
 #  Updates the hotkey display.
 #----------------------------------------------------------------------------
 def update
   # call superclass method
   super
   # if actor has changed
   if @actor != $game_player.battler
     # set new actor
     @actor = $game_player.battler
     # redraw
     draw
   end
 end
 
 def dispose
   super
 end
end

#==============================================================================
# HudBG
#------------------------------------------------------------------------------
#  This class allows backgrounds for your HUD
#==============================================================================

class HudBG < Sprite
 
 #----------------------------------------------------------------------------
 # Initialization
 #  viewport - the viewport for the sprite
 #----------------------------------------------------------------------------
 def initialize(type, viewport=nil)
   # call superclass method
   super(viewport)
   # create bitmap
   self.bitmap = Bitmap.new(640, 480)
   # set z coordinate
   if type != 4
     self.z = 900
   else
     self.z = 0
   end
   @done = false
   @type = type
   @hotkey = false
   @parhud = false
   @psize = 0
   @hud = false
   # update
   update
 end
 #----------------------------------------------------------------------------
 # draw_hud
 #  Draws the HUD template.
 #----------------------------------------------------------------------------
 def draw_hud
   bitmap = RPG::Cache.picture("HUD.png")
   self.bitmap.blt(0, 0, bitmap, Rect.new(0, 0, 128, 64))
 end
 #----------------------------------------------------------------------------
 # draw_hotkey
 #  Draws the hotkey bg.
 #----------------------------------------------------------------------------
 def draw_hotkey
   #bitmap = RPG::Cache.picture("HotkeyDisplayFull.png")
   #self.bitmap.blt(138, 435, bitmap, Rect.new(0, 0, 320, 64))
 end
 #----------------------------------------------------------------------------
 # draw_parhud
 #  Draws the hotkey bg.
 #----------------------------------------------------------------------------
 def draw_parhud
   @psize = $game_party.actors.size
   if @psize == 1
     bitmap = RPG::Cache.picture("HUD/Parhud_1.png")
   else
     bitmap = RPG::Cache.picture("HUD/Parhud_2.png")
   end
   self.bitmap.blt(0, 0, bitmap, Rect.new(0, 0, 128, 64))
   if @psize > 1
     bitmap = RPG::Cache.picture("HUD/Parhud_4.png")
     self.bitmap.blt(0, 64*@psize-64, bitmap, Rect.new(0, 0, 128, 64))
   end
   if @psize > 2
     bitmap = RPG::Cache.picture("HUD/Parhud_3.png")
     self.bitmap.blt(0, 64, bitmap, Rect.new(0, 0, 128, 64))
     self.bitmap.blt(0, 128, bitmap, Rect.new(0, 0, 128, 64)) if @psize > 3
   end
 end
 #----------------------------------------------------------------------------
 # update
 #  Checks if HUD needs refreshing.
 #----------------------------------------------------------------------------
 def update
   super
   if !@done
     if @type == 1
       draw_hud
     elsif @type == 2
       draw_parhud
     elsif @type == 3
       draw_hotkey
     else
       draw_hud
       draw_parhud
       draw_hotkey
     end
     @done = true
   end
 end
 
end

#==============================================================================
# Minimap by Winkio
#------------------------------------------------------------------------------
#  This class creates and handels the minimap/fullscreen map display and is
#  more efficient than the Window class.
#  Changed to 6x6 tiles with rounded edges
#==============================================================================

class Minimap < Sprite
 
 # setting all accessible variables
 attr_reader :map_id
 #----------------------------------------------------------------------------
 # Initialization
 #----------------------------------------------------------------------------
 def initialize
   # call superclass method
   super(Viewport.new(480, 360, 160, 120))
   # get autotile image from Blizz-ABS Cache
   @autotile = minimap_autotile #$BlizzABS.cache.image('minimap_autotile')
   # creates the passable floor map
   create_passable_floor
   # set x and y position
   self.x = self.y = 0
   # set z position
   viewport.z = 5000
   # store events
   @events, @names = check_events
   # create sprites for events
   create_sevents
   # set all sprites visible
   self.visible = true
 end
 #----------------------------------------------------------------------------
 # create_passable_floor
 #  Creates the passable floor map on the bitmap.
 #----------------------------------------------------------------------------
 def create_passable_floor
   # delete bitmap if bitmap exists
   self.bitmap.dispose if self.bitmap != nil
   # store new map ID
   @map_id = $game_map.map_id
   # temporary width and height
   w, h = $game_map.width, $game_map.height
   # create bitmap
   self.bitmap = Bitmap.new(8*w, 8*h)
   # fill rectangle
   self.bitmap.fill_rect(0, 0, 8*w, 8*h, Color.new(0, 0, 0, 0))
   # get passability data
   v_map = $game_map.virtual_passability
   # iterate through all tiles
   (0...v_map.xsize).each {|x| (0...v_map.ysize).each {|y|
       # depending on passable direction, draw the path using the autotile
       case v_map[x, y]
       when 0x01 #    D
         self.bitmap.blt(x*8, y*8+4, @autotile, Rect.new(0, 0, 8, 4), 128)
       when 0x02 #   L
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(4, 0, 4, 8), 128)
       when 0x03 #   LD
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(16, 8, 8, 8), 128)
       when 0x04 #  R
         self.bitmap.blt(x*8+4, y*8, @autotile, Rect.new(0, 0, 4, 8), 128)
       when 0x05 #  R D
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(0, 8, 8, 8), 128)
       when 0x06 #  RL
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(8, 8, 8, 4), 128)
         self.bitmap.blt(x*8, y*8+4, @autotile, Rect.new(8, 28, 8, 4), 128)
       when 0x07 #  RLD
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(8, 8, 8, 8), 128)
       when 0x08 # U
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(0, 4, 8, 4), 128)
       when 0x09 # U  D
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(0, 16, 4, 8), 128)
         self.bitmap.blt(x*8+4, y*8, @autotile, Rect.new(20, 16, 4, 8), 128)
       when 0x0A # U L
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(16, 24, 8, 8), 128)
       when 0x0B # U LD
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(16, 16, 8, 8), 128)
       when 0x0C # UR
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(0, 24, 8, 8), 128)
       when 0x0D # UR D
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(0, 16, 8, 8), 128)
       when 0x0E # URL
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(8, 24, 8, 8), 128)
       when 0x0F # URLD
         self.bitmap.blt(x*8, y*8, @autotile, Rect.new(8, 16, 8, 8), 128)
       end}}
 end
 #--------------------------------------------------------------------------
 # minimap_autotile
 #  Creates the minimap autotile for passability.
 #--------------------------------------------------------------------------
 def minimap_autotile
   b = Bitmap.new(24, 32)
   c1 = Color.new(223, 223, 223)
   c2 = Color.new(128, 128, 128)
   b.fill_rect(2, 0, 4, 1, c2)
   b.set_pixel(1, 1, c2)
   b.fill_rect(2, 1, 4, 6, c1)
   b.set_pixel(6, 1, c2)
   b.fill_rect(0, 2, 1, 4, c2)
   b.fill_rect(1, 2, 1, 4, c1)
   b.fill_rect(6, 2, 1, 4, c1)
   b.fill_rect(7, 2, 1, 4, c2)
   b.set_pixel(1, 6, c2)
   b.set_pixel(6, 6, c2)
   b.fill_rect(2, 7, 4, 1, c2)
   b.fill_rect(7, 8, 10, 1, c2)
   b.set_pixel(6, 9, c2)
   b.fill_rect(7, 9, 10, 22, c1)
   b.set_pixel(17, 9, c2)
   b.set_pixel(5, 10, c2)
   b.fill_rect(6, 10, 1, 20, c1)
   b.fill_rect(17, 10, 1, 20, c1)
   b.set_pixel(18, 10, c2)
   b.set_pixel(4, 11, c2)
   b.fill_rect(5, 11, 1, 18, c1)
   b.fill_rect(18, 11, 1, 18, c1)
   b.set_pixel(19, 11, c2)
   b.set_pixel(3, 12, c2)
   b.fill_rect(4, 12, 1, 16, c1)
   b.fill_rect(19, 12, 1, 16, c1)
   b.set_pixel(20, 12, c2)
   b.set_pixel(2, 13, c2)
   b.fill_rect(3, 13, 1, 14, c1)
   b.fill_rect(20, 13, 1, 14, c1)
   b.set_pixel(21, 13, c2)
   b.set_pixel(1, 14, c2)
   b.fill_rect(2, 14, 1, 12, c1)
   b.fill_rect(21, 14, 1, 12, c1)
   b.set_pixel(22, 14, c2)
   b.fill_rect(0, 15, 1, 10, c2)
   b.fill_rect(1, 15, 1, 10, c1)
   b.fill_rect(22, 15, 1, 10, c1)
   b.fill_rect(23, 15, 1, 10, c2)
   b.set_pixel(1, 25, c2)
   b.set_pixel(22, 25, c2)
   b.set_pixel(2, 26, c2)
   b.set_pixel(21, 26, c2)
   b.set_pixel(3, 27, c2)
   b.set_pixel(20, 27, c2)
   b.set_pixel(4, 28, c2)
   b.set_pixel(19, 28, c2)
   b.set_pixel(5, 29, c2)
   b.set_pixel(18, 29, c2)
   b.set_pixel(6, 30, c2)
   b.set_pixel(17, 30, c2)
   b.fill_rect(7, 31, 10, 1, c2)
   return b
 end
 
end


#==============================================================================
# Scene_Map By Winkio
#------------------------------------------------------------------------------
#  This class was enhanced to support HUD control and creation system and
#  Blizz-ABS battle handling and level up text display.
#  Changed to enable the party hud
#==============================================================================

class Scene_Map
 
 #----------------------------------------------------------------------------
 # override main
 #----------------------------------------------------------------------------
 def main
   # create HUD if HUD is turned on and HUD active
   @hud = Hud.new if $game_system.hud
   @parhud = ParHud.new if $game_system.parhud
   @equiphud = Equip_Hud.new if $game_system.equiphud
   # if HOTKEYS is turned on and assignment display active
   if $game_system.hotkeys
     # create assignment display
     @hotkeys = Hotkey_Assignment.new
     @exphud = ExpHud.new
   end
   # if MINIMAP is turned on and minimap active
   if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
     # create HUD
     @minimap = Minimap.new
   end
   # tests and sets the in_battle flag
   test_in_battle
   # call original method
   # Make sprite set
   @spriteset = Spriteset_Map.new
   # Make message window
   @message_window = Window_Message.new
   # Transition run
   Graphics.transition
   # Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame update
     update
     # Abort loop if screen is changed
     if $scene != self
       break
     end
   end
   # Prepare for transition
   Graphics.freeze
   # Dispose of sprite set
   @spriteset.dispose
   # Dispose of message window
   @message_window.dispose
   # If switching to title screen
   if $scene.is_a?(Scene_Title)
     # Fade out screen
     Graphics.transition
     Graphics.freeze
   end
   # set in_battle flag
   $game_temp.in_battle = false
   # delete HUD elements that exist
   [@hud, @parhud, @hotkeys, @minimap, @equiphud, @exphud].each {|s| s.dispose if s != nil}
 end
 #----------------------------------------------------------------------------
 # hud_update
 #  This method contains a couple of routine calls to handle with the HUD.
 #----------------------------------------------------------------------------
 def hud_update
   # check activation of HUD parts
   check_huds
   # update minimap
   update_minimap
   # update hotkey assignment display
   update_hotkeys
   # iterate through all the HUD sprites
   [@hud, @parhud, @minimap, @hotkeys, @equiphud, @exphud].each {|s|
       # if sprite exists
       if s != nil
         # update sprite
         s.update
         # if player is on the same position as one of the sprites on the screen
         if $game_player.screen_x < s.vx + s.vw + 16 &&
             $game_player.screen_y < s.vy + s.vh + 48 &&
             $game_player.screen_x > s.vx && $game_player.screen_y > s.vy &&
             ((s == @minimap) ? ($game_system.minimap < 2) : true)
           # decrease opacity quickly if critical opacity not reached
           s.opacity -= 25 if s.opacity > 80
         # if not full opacity
         elsif s.opacity <= 255
           # increase opacity quickly if critical opacity not reached
           s.opacity += 25
         end
       end}
 end
 #----------------------------------------------------------------------------
 # check_huds
 #  This method handles enabling and disabling the HUD parts on the map.
 #----------------------------------------------------------------------------
 def check_huds
   # if minimap button is enabled and pressed
   if $game_system.minimap_button && Input.trigger?(Input::Minimap)
     # trigger minimap active
     $game_system.minimap = ($game_system.minimap + 1) % 3
   end
   # if hotkey display button is enabled and pressed
   if $game_system.hotkey_button && Input.trigger?(Input::Hotkey)
     # trigger hotkey display active
     $game_system.hotkeys = (!$game_system.hotkeys)
     $game_system.exphud = (!$game_system.exphud)
   end
   # if HUD button is enabled and pressed
   if $game_system.hud_button && Input.trigger?(Input::Hud)
     # trigger it active
     $game_system.hud = (!$game_system.hud)
     $game_system.parhud = (!$game_system.parhud)
     $game_system.equiphud = (!$game_system.equiphud)
   end
   # if minimap not active and minimap exists
   if $game_system.minimap == 0 && @minimap != nil
     # delete it
     @minimap.dispose
     @minimap = nil
   # if minimap is turned on and active and doesn't exist
   elsif BlizzABS::Config::MINIMAP && $game_system.minimap > 0
     # create it
     @minimap = Minimap.new if @minimap == nil
   end
   # if assignment display not active and exists
   if !$game_system.hotkeys && @hotkeys != nil
     # delete it
     @hotkeys.dispose
     @hotkeys = nil
     @exphud.dispose
     @exphud = nil
   # if HOTKEYS is turned on and active and doesn't exist
   elsif BlizzABS::Config::HOTKEYS && $game_system.hotkeys
     # create it
     @hotkeys = Hotkey_Assignment.new if @hotkeys == nil
     @exphud = ExpHud.new if @exphud == nil
   end
   # if HUD not active and HUD exists
   if !$game_system.hud && @hud != nil
     # delete it
     @hud.dispose
     @hud = nil
     @parhud.dispose
     @parhud = nil
     @equiphud.dispose
     @equiphud = nil
   # if HUD is turned on and HUD active and HUD doesn't exist
   elsif BlizzABS::Config::HUD_ENABLED && $game_system.hud
     # create it
     @hud = Hud.new if @hud == nil
     @parhud = ParHud.new if @parhud == nil
     @equiphud = Equip_Hud.new if @equiphud == nil
   end
 end
 
end

#==============================================================================
# Scene_Hotkeys
#------------------------------------------------------------------------------
#  This class handles the skill/item hotkey processing.
#  The position of the arrow has been changed to the bottom of the screen.
#  Also included the upside down arrow.
#==============================================================================

class Scene_Hotkeys
 
 #----------------------------------------------------------------------------
 # main
 #  The main processing method.
 #----------------------------------------------------------------------------
 def main
   # create spriteset
   @spriteset = Spriteset_Map.new
   # create viewport
   @view = Viewport.new(0, 0, 640, 480)
   # set tone to current screen tone
   @view.tone = @tone.clone
   # create HUD if HUD is turned on and HUD active
   @hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud
   # if ASSIGNMENT is turned
   if BlizzABS::Config::HOTKEYS
     # create assignment display
     @hotkeys = Hotkey_Assignment.new
     # set z position
     @hotkeys.z = 5000
   end
   # if MINIMAP is turned on and minimap active
   if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
     # create HUD
     @minimap = Minimap.new
   end
   # create sprite
   @choice = Sprite.new
   # create bitmap
   @choice.bitmap = menu_arrow
   # set x, y and z positions
   @choice.x, @choice.y, @choice.z, @choice.opacity = 160, 440, 500, 128
   # set x position offset
   @choice.ox = -8
   # set active flag
   @active = true
   # set index
   @index = 0
   # set up mode flag
   @up_mode = true
   # create modified skill window
   @skill_window = Window_Skill_Hotkey.new($game_player.battler)
   @skill_window.y = 0
   # create modified item window
   @item_window = Window_Item_Hotkey.new
   @item_window.y = 0
   # set last active
   @last_active = true
   # transtition
   Graphics.transition
   # loop
   loop do
     # update game screen
     Graphics.update
     # update input
     Input.update
     # frame update
     update
     # stop if chosen an option
     break if $scene != self
   end
   # freeze screen
   Graphics.freeze
   # delet spriteset
   @spriteset.dispose
   # delete HUD elements that exist
   [@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}
   # delete choice sprite
   @choice.dispose
   # delete skill window
   @skill_window.dispose
   # delete item window
   @item_window.dispose
   # delete viewport
   @view.dispose
 end
 #--------------------------------------------------------------------------
 # menu_arrow
 #  Creates the arrow displayed in the hotkey assignment menu.  Upside down
 #--------------------------------------------------------------------------
 def menu_arrow
   b = Bitmap.new(16, 9)
   c1 = Color.new(0, 0, 0)
   c2 = Color.new(255, 128, 128)
   c3 = Color.new(127, 0, 0)
   b.fill_rect(7, 8, 2, 1, c2)
   b.set_pixel(6, 7, c2)
   b.fill_rect(7, 7, 1, 7, c3)
   b.fill_rect(8, 7, 1, 7, c1)
   b.set_pixel(9, 7, c2)
   b.set_pixel(5, 6, c2)
   b.fill_rect(6, 6, 1, 6, c3)
   b.fill_rect(9, 6, 1, 6, c1)
   b.set_pixel(10, 6, c2)
   b.set_pixel(4, 5, c2)
   b.fill_rect(5, 5, 1, 5, c3)
   b.fill_rect(10, 5, 1, 5, c1)
   b.set_pixel(11, 5, c2)
   b.set_pixel(3, 4, c2)
   b.fill_rect(4, 4, 1, 4, c3)
   b.fill_rect(11, 4, 1, 4, c1)
   b.set_pixel(12, 4, c2)
   b.set_pixel(2, 3, c2)
   b.fill_rect(3, 3, 1, 3, c3)
   b.fill_rect(12, 3, 1, 3, c1)
   b.set_pixel(13, 3, c2)
   b.set_pixel(1, 2, c2)
   b.fill_rect(2, 2, 1, 2, c3)
   b.fill_rect(13, 2, 1, 2, c1)
   b.set_pixel(14, 2, c2)
   b.set_pixel(0, 1, c2)
   b.set_pixel(1, 1, c3)
   b.set_pixel(14, 1, c1)
   b.set_pixel(15, 1, c2)
   b.fill_rect(1, 0, 14, 1, c2)
   return b
 end

 #----------------------------------------------------------------------------
 # update_choice
 #  Updates input during the hotkey selection.
 #----------------------------------------------------------------------------
 def update_choice
   @choice.z = 1000
   # set x position
   @choice.x = 175 + @index * 30
   # if pressed B
   if Input.trigger?(Input::B)
     # play cancel sound
     $game_system.se_play($data_system.cancel_se)
     # create map scene
     $scene = Scene_Map.new
   # if C is pressed
   elsif Input.trigger?(Input::C)
     # play sound
     $game_system.se_play($data_system.decision_se)
     # not active
     @active = false
     # the one that was active the last time is now active
     @skill_window.active = @last_active
     @item_window.active = (!@last_active)
   # if RIGHT is being pressed
   elsif Input.repeat?(Input::RIGHT)
     # if RIGHT is pressed or index is less than 9
     if Input.trigger?(Input::RIGHT) || @index < 9
       # play sound
       $game_system.se_play($data_system.cursor_se)
       # set new index
       @index = (@index + 1) % 10
     end
   # if LEFT is being pressed
   elsif Input.repeat?(Input::LEFT)
     # if LEFT is pressed or index is equal or greater than 1
     if Input.trigger?(Input::LEFT) || @index >= 1
       # play sound
       $game_system.se_play($data_system.cursor_se)
       # set new index
       @index = (@index + 9) % 10
     end
   end
 end
end


EDIT: I guess doing that works too. Regardless, this is coolbeans~

What's osu!? It's a rhythm game. Thought I should have a signature with a working rank. ;P It's now clickable!
Still Aqua's biggest fan (Or am I?).




Diokatsu

WOW THIS SUCKS.

J/k j/k It's very spiffy and cool looking.

Landith

I love you too Dio. :-*

Any way on how to improve it guys? I feel like it needs more...

crimsonroark

I love the HUD landith. But for some reason I get an error whenever I try to switch between characters.

Landith

What's the error?

I haven't received any errors nor my beta testers. So I need to know what it is...

Calintz

You don't need to put me in the credits Landith ..

Landith

But your such an inspiration to get me to improve...

But I'll remove you then... :P

*removes Cal from credits*

Calintz


iJaco

I get this error when I have more then 2 party members and try to switch the leader

Landith

to fix that change line 468 to:


    return $game_party.actors[(id += @poffset) % $game_party.actors.size]


But that ends up getting different things happening to it when you have more than 2 characters... I'm still working on the solution to it.

fireman199

Quote from: Landith on June 19, 2009, 07:39:48 pm
to fix that change line 468 to:


    return $game_party.actors[(id += @poffset) % $game_party.actors.size]


But that ends up getting different things happening to it when you have more than 2 characters... I'm still working on the solution to it.


thank you very much.

legacyblade

woot, this hud lets you make your own look. I think you should give the ability to pictures behind the equipment section too, and maybe the other parts of the hud. that would make it look nicer, IMHO

matte012

This hud IS customizable, but I really do not like the fact that it displays ALL members sideways. I think that displaying the HP and SP (or MP) of all the characters on top would be more efficient. And, do you HAVE to have an enlarged map. I would prefer a true or false thing myself. Don't mind me. I am a noob a scripting. Good job on it though, I prefer the customizable one by Winkio (spelling??) myself. Oh, and I might add that the humor on the screen shot made me chuckle. Good job both Landith and Blizzard for making such a good ABS. Easily tops all others. *hold out 'juice' to everyone*

(Edit: Got HUD confused with Winkio's -_-')

Landith

Quote from: legacyblade on July 03, 2009, 12:58:06 am
woot, this hud lets you make your own look. I think you should give the ability to pictures behind the equipment section too, and maybe the other parts of the hud. that would make it look nicer, IMHO


This HUD originally had pictures for everything but the minimap, but I took most of it out since it would make things easier on my part. I'll probably update this soon with more customization and improved coding.

Quote from: matte012 on July 03, 2009, 02:38:18 am
This hud IS customizable, but I really do not like the fact that it displays ALL members sideways. I think that displaying the HP and SP (or MP) of all the characters on top would be more efficient. And, do you HAVE to have an enlarged map. I would prefer a true or false thing myself. Don't mind me. I am a noob a scripting. Good job on it though, I prefer the customizable one by Winkio (spelling??) myself. Oh, and I might add that the humor on the screen shot made me chuckle. Good job both Landith and Blizzard for making such a good ABS. Easily tops all others. *hold out 'juice' to everyone*

(Edit: Got HUD confused with Winkio's -_-')


Ok, I just got really confused on this one. I didn't make the ABS, Blizzard did. :P  I liked the enlarged minimap as it showed more than the original one, if you want to make it smaller just take out the class minimap in it and it will change it. I'll add an option to have it big or small later.

Any other suggestions guys? I really want to improve this.

G_G

What he wants is to have the health display on the top from left to right instead of on teh side from top to bottom.

Landith

Quote from: matte012 on July 03, 2009, 02:38:18 am
I really do not like the fact that it displays ALL members sideways. I think that displaying the HP and SP (or MP) of all the characters on top would be more efficient.


Unless I'm reading that completely wrong, he wants it as is.

G_G

well I think he meant on the side of the screen I dunno we'll see lets just wait and have him tell us

Aqua


matte012

Sorry guys, I was quite tired.

I want the HP and MP Bars to be displayed on the top of the screen instead of going across the sides. I would also prefer that you could include a option for using facesets/chipsets instead of their names, again another option.

winkio

There is no point in making this HUD exactly like mine (the one in the script section, not the one from dissipate)  :<_<:  Variety is very good.  Definitely add backgrounds for the equipped hot skill and item though.

Landith

I agree with Winkio, with a little modding all you have to do is add the equipment and it's almost exactly like Winkio's first HUD.
There is no reason why you shouldn't just use Winkio's...

But yeah I will add the backgrounds for the rest of the stuff when I have time sometime this week/next week.

matte012

Well, there MIGHT be features on this HUD that Winkio's HUD doesn't have.  :^_^': I do like Winkio's set his up but it messes with other scripts I have, this one does not. How odd? But this one is my favorite just because it has no errors. Heh...  :shy: My bad..

LiTTleDRAgo

January 18, 2011, 03:25:49 am #25 Last Edit: January 19, 2011, 09:36:22 am by LiTTleDRAgo
sory for reviving an old topic
currently I use this hud and facing the same problem like this

Quote from: iJaco on June 19, 2009, 06:30:07 pm
I get this error when I have more then 2 party members and try to switch the leader



then I do Landith suggestion

Quote from: Landith on June 19, 2009, 07:39:48 pm
to fix that change line 468 to:


    return $game_party.actors[(id += @poffset) % $game_party.actors.size]


But that ends up getting different things happening to it when you have more than 2 characters... I'm still working on the solution to it.


the problem is solved but my game becomes lagg like hell 

Kiwa

I LOVE this hud! really!
Its exactly what I wanted.

However.. the error has me stuck too... ):
I also tried the suggestion for line 468.

i tried REPLACING 'END' with that line..and that caused a crash at load up.
then i tried INSERTING the line BEFORE the 'END'...to only get another error..
so then i tried AFTER the 'END' For another error...

what am i doing wrong!? ):

halp! :P



thank you :P

KK20

I think he meant this:
  def actor(id = 0)
    return $game_party.actors[(id += @poffset) % $game_party.actors.size]
  end
That was at line 467 for me.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Kiwa

Hm..thought i tried that lol.
maybe I was just not paying attention.

Any way.. thanks kk20 :D saved me as usual.
It works great..i sat there happily spamming the 'char change' button while listening to the Darkworld from a "link to the past" on my Tester map...lol

Thanks :D

Kiwa

Actually.. i found another BUG!

This one isn't so much trouble cuz it does not cause the game to crash. but i just wanted to point it out.
as i shift thru my characters in a party.
the 4th character never becomes 'Top' in the hud. as the 'Main' character.
so when I change to char4...it then places char1's HP, MP and name at the top of the hud.

if i hit escape and then return to the game screen.. it will reconstruct the hud placing char4's info at the top.

I tested this on party of 2, 3 and 4.
It works fine with 2.
3 and 4 seem to forget about a party member.

Just wanted to point it out :D

Thanks fora great HUD!

Kiwa

Hey!

I found another bug with the hud. thought id report on it.

When I change classes using Eventing it will crash giving the error:
------------------------------------------------
line 874: nomethoderror occurred

undefined method 'icon_name' for nil:NilClass
------------------------------------------------

Now im not sure why its happening but i was thinking i could perhaps Disable the script and re enable it after the class change? or will that bug it out too....or can i even do that? lol.

anyway. thoguht id report that and ask for suggestions.

Thanks :D

KK20

First bug:
Line 456
@poffset += 1

Delete it or comment out. I don't understand what its purpose is.

Second bug:
Caused by removing the actor's equip when changing class and then asking to draw the weapon icon at top right of screen. Because the actor is equipped with no weapon, it is asking to draw a graphic for a weapon that doesn't exist.
Line 873

    # draw location
    wep_id = $game_party.actors[0].weapon_id
    unless wep_id == 0
      bitmap = RPG::Cache.icon($data_weapons[wep_id].icon_name)
    else
      return
    end
    # draw bitmap

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Kiwa

Cheers KK20

it works great!

I made a class change system thru eventing but i found an error in my eventing system.
They don't unlearn current class spells and learn new ones.. they keep their original ones lol.

I'll have to think of a way to do that..perhaps i can create a common event that will troubleshoot it and the class change NPC will trigger it.. idk..im so sleepy atm lol..long day..

really, thanks a ton KK20. your always there for me. :D

ThalliumShine

Not a necropost but a request update, it seems there's an error on the hp that occurs whenever I change my party leader. Help?

KK20

Did you do what was posted a few messages before your's?

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

ThalliumShine

Ohhh, sorry, I just posted without reading the threads. You're a life saver. Thanks, it works perfectly now.

Krozandir

Links are broken, i cant download it...  :'( Can anyone reupload it please?  :D