Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

special HUD

umm well...nobody really cared about my last post, but anyways im trying once again.

What do i need?
i need a custom HUD, for an Action battle system.

Any reference image?
yes:
http://img514.imageshack.us/img514/2289/image1li1.png[/IMG]
this is how i would like it.
the bars can be made how you like, i dont really care, i just need them to be red and blue (for HP and MP).

this is the character image:
http://img183.imageshack.us/img183/1118/image2fu1.png[/IMG]
should be placed on "Picture" folder i guess...
the other part of HUD can be made with default windowskin i guess.

Any aditional information?
not that i can remember...
please help me ^^
 
yeah i thought about it, but Mr.Mo's has too many options, and i dont know how to edit them to make them dissapear, and im using other ABS...but anywayi will try it again, thanks...
 
Code:
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================
class Scene_Map
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias raz_hud_map_main main
  alias raz_hud_map_update update
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    @hud_window = Window_HUD.new
    @hud_sprite = Window_HUDFace.new
    raz_hud_map_main
    @hud_sprite.dispose
    @hud_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    @hud_sprite.update
    raz_hud_map_update
  end
end

#==============================================================================
# ** Window_HUD
#------------------------------------------------------------------------------
#  This class draws the equipment Icons
#==============================================================================
class Window_HUD < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(440, 416, 200, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 50
    @icons = []
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    actor = $game_party.actors[0]
    blank = RPG::Cache.icon("")
    weapon_icon = RPG::Cache.icon($data_weapons[actor.weapon_id].icon_name) rescue blank
    shield_icon = RPG::Cache.icon($data_armors[actor.armor1_id].icon_name) rescue blank
    armor_icon = RPG::Cache.icon($data_armors[actor.armor3_id].icon_name) rescue blank
    accessory_icon = RPG::Cache.icon($data_armors[actor.armor4_id].icon_name) rescue blank
    @icons << weapon_icon
    @icons << shield_icon
    @icons << armor_icon
    @icons << accessory_icon
    for icon in @icons
      x = @icons.index(icon) * 45
      self.contents.blt(x + 4, 2, icon, Rect.new(0, 0, 24, 24))
    end
  end
end    
#==============================================================================
# ** Window_HUDFace
#------------------------------------------------------------------------------
#  This class draws the actor's face, his HP and SP
#==============================================================================
class Window_HUDFace < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(-5, 370, 320, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    @actor = $game_party.actors[0]
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @old_hp = @actor.hp
    @old_sp = @actor.sp
    bitmap = RPG::Cache.picture("image2fu1")
    self.contents.blt(0, 0, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
    draw_bar(100, 17, @actor.hp, @actor.maxhp, 135, 8, Color.new(150, 0, 0, 255), Color.new(255, 0, 0, 255))
    draw_bar(100, 33, @actor.sp, @actor.maxsp, 135, 8, Color.new(0, 0, 150, 255), Color.new(0, 0, 255, 255))
    self.contents.font.size = 18
    self.contents.font.italic = true
    self.contents.font.color = Color.new(0, 0, 0)
    self.contents.draw_text(162, 11, 150, 32, "#{@actor.hp}/#{@actor.maxhp}")
    self.contents.draw_text(164, 11, 150, 32, "#{@actor.hp}/#{@actor.maxhp}")
    self.contents.draw_text(162, 9, 150, 32, "#{@actor.hp}/#{@actor.maxhp}")
    self.contents.draw_text(164, 9, 150, 32, "#{@actor.hp}/#{@actor.maxhp}")
    self.contents.draw_text(162, 27, 150, 32, "#{@actor.sp}/#{@actor.maxsp}")
    self.contents.draw_text(164, 27, 150, 32, "#{@actor.sp}/#{@actor.maxsp}")
    self.contents.draw_text(162, 25, 150, 32, "#{@actor.sp}/#{@actor.maxsp}")
    self.contents.draw_text(164, 25, 150, 32, "#{@actor.sp}/#{@actor.maxsp}")
    self.contents.font.color = @actor.hp <= @actor.maxhp / 4 ? crisis_color : 
    @actor.hp == 0 ? knockout_color : normal_color
    self.contents.draw_text(163, 10, 150, 32, "#{@actor.hp}/#{@actor.maxhp}")
    self.contents.font.color = @actor.sp == 0 ? crisis_color : normal_color
    self.contents.draw_text(163, 26, 150, 32, "#{@actor.sp}/#{@actor.maxsp}")
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if @old_hp != $game_party.actors[0].hp or
       @old_sp != $game_party.actors[0].sp
       refresh
       @old_hp = $game_party.actors[0].hp
       @old_sp = $game_party.actors[0].sp
     end
   end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Slant Bar(by SephirothSpawn)
  #--------------------------------------------------------------------------
  def draw_bar(x, y, min, max, width = 152, height = 6,
      bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
    # Draw Border
    for i in 0..height
      self.contents.fill_rect(x, y + height - i, width, 1, Color.new(50, 50, 50, 255))
    end
    # Draw Background
    for i in 1..(height - 1)
      r = 100 * (height - i) / height + 0 * i / height
      g = 100 * (height - i) / height + 0 * i / height
      b = 100 * (height - i) / height + 0 * i / height
      a = 255 * (height - i) / height + 255 * i / height
      self.contents.fill_rect(x, y + height - i, width, 1, Color.new(r, b, g, a))
    end
    # Draws Bar
    for i in 1..( (min / max.to_f) * width - 1)
      for j in 1..(height - 1)
        r = bar_color.red * (width - i) / width + end_color.red * i / width
        g = bar_color.green * (width - i) / width + end_color.green * i / width
        b = bar_color.blue * (width - i) / width + end_color.blue * i / width
        a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
        self.contents.fill_rect(x + i - 1, y + height - j, 1, 1, Color.new(r, g, b, a))
      end
    end
  end
end

Just tell me if there something you want me to change.
Credits to SephirothSpawn for the HP and SP bars.
 
wowow thats just perfect, thank you sooo much!!!
the face image must be more to the left, but don't worry, i know basics about scripting, so i can handle the rest, thank you soo very much!!!

edit: oh yeah...one more thing, how can i control it via switches? i mean, make it appear when switch X is on...
 
Use this script instead:
Code:
SWITCH_ID = 1
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================
class Scene_Map
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias raz_hud_map_main main
  alias raz_hud_map_update update
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    @old_switch = $game_switches[SWITCH_ID]
    @hud_window = Window_HUD.new
    @hud_sprite = Window_HUDFace.new
    @hud_window.visible = $game_switches[SWITCH_ID]
    @hud_sprite.visible = $game_switches[SWITCH_ID]
    raz_hud_map_main
    @hud_sprite.dispose
    @hud_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    @hud_sprite.update
    if $game_switches[SWITCH_ID] != @old_switch
      @hud_window.visible = $game_switches[SWITCH_ID]
      @hud_sprite.visible = $game_switches[SWITCH_ID]
      @old_switch = $game_switches[SWITCH_ID]
    end
    raz_hud_map_update
  end
end

#==============================================================================
# ** Window_HUD
#------------------------------------------------------------------------------
#  This class draws the equipment Icons
#==============================================================================
class Window_HUD < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(440, 416, 200, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 50
    @icons = []
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    actor = $game_party.actors[0]
    blank = RPG::Cache.icon("")
    weapon_icon = RPG::Cache.icon($data_weapons[actor.weapon_id].icon_name) rescue blank
    shield_icon = RPG::Cache.icon($data_armors[actor.armor1_id].icon_name) rescue blank
    armor_icon = RPG::Cache.icon($data_armors[actor.armor3_id].icon_name) rescue blank
    accessory_icon = RPG::Cache.icon($data_armors[actor.armor4_id].icon_name) rescue blank
    @icons << weapon_icon
    @icons << shield_icon
    @icons << armor_icon
    @icons << accessory_icon
    for icon in @icons
      x = @icons.index(icon) * 45
      self.contents.blt(x + 4, 2, icon, Rect.new(0, 0, 24, 24))
    end
  end
end    
#==============================================================================
# ** Window_HUDFace
#------------------------------------------------------------------------------
#  This class draws the actor's face, his HP and SP
#==============================================================================
class Window_HUDFace < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(-5, 370, 320, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    @actor = $game_party.actors[0]
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @old_hp = @actor.hp
    @old_sp = @actor.sp
    bitmap = RPG::Cache.picture("image2fu1")
    self.contents.blt(0, 0, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
    draw_bar(100, 17, @actor.hp, @actor.maxhp, 135, 8, Color.new(150, 0, 0, 255), Color.new(255, 0, 0, 255))
    draw_bar(100, 33, @actor.sp, @actor.maxsp, 135, 8, Color.new(0, 0, 150, 255), Color.new(0, 0, 255, 255))
    self.contents.font.size = 18
    self.contents.font.italic = true
    self.contents.font.color = Color.new(0, 0, 0)
    self.contents.draw_text(162, 11, 150, 32, "#{@actor.hp}/#{@actor.maxhp}")
    self.contents.draw_text(164, 11, 150, 32, "#{@actor.hp}/#{@actor.maxhp}")
    self.contents.draw_text(162, 9, 150, 32, "#{@actor.hp}/#{@actor.maxhp}")
    self.contents.draw_text(164, 9, 150, 32, "#{@actor.hp}/#{@actor.maxhp}")
    self.contents.draw_text(162, 27, 150, 32, "#{@actor.sp}/#{@actor.maxsp}")
    self.contents.draw_text(164, 27, 150, 32, "#{@actor.sp}/#{@actor.maxsp}")
    self.contents.draw_text(162, 25, 150, 32, "#{@actor.sp}/#{@actor.maxsp}")
    self.contents.draw_text(164, 25, 150, 32, "#{@actor.sp}/#{@actor.maxsp}")
    self.contents.font.color = @actor.hp <= @actor.maxhp / 4 ? crisis_color : 
    @actor.hp == 0 ? knockout_color : normal_color
    self.contents.draw_text(163, 10, 150, 32, "#{@actor.hp}/#{@actor.maxhp}")
    self.contents.font.color = @actor.sp == 0 ? crisis_color : normal_color
    self.contents.draw_text(163, 26, 150, 32, "#{@actor.sp}/#{@actor.maxsp}")
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if @old_hp != $game_party.actors[0].hp or
       @old_sp != $game_party.actors[0].sp
       refresh
       @old_hp = $game_party.actors[0].hp
       @old_sp = $game_party.actors[0].sp
     end
   end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Slant Bar(by SephirothSpawn)
  #--------------------------------------------------------------------------
  def draw_bar(x, y, min, max, width = 152, height = 6,
      bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
    # Draw Border
    for i in 0..height
      self.contents.fill_rect(x, y + height - i, width, 1, Color.new(50, 50, 50, 255))
    end
    # Draw Background
    for i in 1..(height - 1)
      r = 100 * (height - i) / height + 0 * i / height
      g = 100 * (height - i) / height + 0 * i / height
      b = 100 * (height - i) / height + 0 * i / height
      a = 255 * (height - i) / height + 255 * i / height
      self.contents.fill_rect(x, y + height - i, width, 1, Color.new(r, b, g, a))
    end
    # Draws Bar
    for i in 1..( (min / max.to_f) * width - 1)
      for j in 1..(height - 1)
        r = bar_color.red * (width - i) / width + end_color.red * i / width
        g = bar_color.green * (width - i) / width + end_color.green * i / width
        b = bar_color.blue * (width - i) / width + end_color.blue * i / width
        a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
        self.contents.fill_rect(x + i - 1, y + height - j, 1, 1, Color.new(r, g, b, a))
      end
    end
  end
end

In the first line you have SWITCH_ID = 1, just change the 1 to the id of the switch you want to use.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top