RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[VX] [REQUEST]Requiem 9 ABS HUD tweaks.

Started by micusficus, December 18, 2011, 08:06:22 PM

0 Members and 1 Guest are viewing this topic.

micusficus

This should be pretty easy stuff. I don't know how to script but I'm picking it up little by little. I've managed to scoot the hud around until everything is where I want it, but I still want to tweak it a little.

Here is the HUD script.

#==============================================================================
# Requiem HUD
#==============================================================================

OnOff_Switch = 0 # Switch ID that show or hide the HUD

Skills_Text = "Skills" # Text displayed on skills window

Items_Text = "Items" # Text displayed on items window

Ammo_Text = "Ammo" # Text displayed on ammunitions window

#------------------------------------------------------------------------------
if Requiem_Masterpiece.enabled?("Requiem ABS", 5.0)
#------------------------------------------------------------------------------
Requiem_Masterpiece.register("Requiem HUD", 1.1, "06/05/2009")
#------------------------------------------------------------------------------
class Requiem_HUD1 < Window_Base
 
  def initialize
    super(-32, 340, 608, 480)
    self.opacity = 0
    @actor = $game_party.members[0]
    @old_hp = @actor.hp if @actor != nil
    @old_mp = @actor.mp if @actor != nil
    @old_exp = @actor.exp if @actor != nil
    update
    refresh
  end
 
  def update
    return if $game_party.members.size <= 0
    @actor = $game_party.members[0] if @actor != $game_party.members[0]
    return unless @old_hp != @actor.hp or @old_mp != @actor.mp or @old_exp != @actor.exp
    @old_hp = @actor.hp
    @old_mp = @actor.mp
    @old_exp = @actor.exp
    refresh
  end
 
  def refresh
    return if $game_party.members.size <= 0
    self.contents.clear
    draw_hpbar(@actor, 42, 16)
    draw_mpbar(@actor, 42, 26)
    draw_expbar(@actor, 42, 36) if @actor.next_exp > 0
    self.contents.font.size = 16
    self.contents.draw_outlined_text(18, 16, 24, 24, Vocab::hp_a)
    self.contents.draw_outlined_text(18, 26, 24, 24, Vocab::mp_a)
    self.contents.draw_outlined_text(18, 36, 24, 24, "Exp") if @actor.next_exp > 0
  end
 
  def draw_hpbar(actor, x, y)
    base = Cache.system("Base")
    self.contents.blt(x, y, base, base.rect)
    bar = Cache.system("HP Bar")
    meter = Rect.new(0, 0, base.width * actor.hp / actor.maxhp, base.height)
    self.contents.blt(x, y, bar, meter)
  end 
 
  def draw_mpbar(actor, x, y)
    base = Cache.system("Base")
    self.contents.blt(x, y, base, base.rect)
    bar = Cache.system("MP Bar")
    meter = Rect.new(0, 0, base.width * actor.mp / actor.maxmp, base.height)
    self.contents.blt(x, y, bar, meter)
  end
 
  def draw_expbar(actor, x, y)
    base = Cache.system("Base")
    self.contents.blt(x, y, base, base.rect)
    bar = Cache.system("Exp Bar")
    meter = Rect.new(0, 0, base.width * actor.current_exp / actor.next_exp, base.height)
    self.contents.blt(x, y, bar, meter)
  end
 
end

#------------------------------------------------------------------------------
class Requiem_HUD2 < Window_Base
 
  def initialize
    super(-32, -32, 608, 480)
    self.opacity = 0
    @actor  = $game_party.members[0]
    @skills = (@actor.nil? ? nil : @actor.skill_hotkeys.values)
    @items  = (@actor.nil? ? nil : @actor.item_hotkeys.values)
    refresh
  end
 
  def update
    return if $game_party.members.size <= 0
    refresh if something_changed?
  end
 
  def something_changed?
    return true if @actor != $game_party.members[0]
    return true if @actor != nil and @skills != @actor.skill_hotkeys.values
    return true if @actor != nil and @items  != @actor.item_hotkeys.values
    return false
  end
 
  def refresh
    return if $game_party.members.size <= 0
    @actor = $game_party.members[0]
    @skills = @actor.skill_hotkeys.values
    @items = @actor.item_hotkeys.values
    self.contents.clear
    bitmap = Cache.system("HUD")
    self.contents.font.size = 16
    rect = Rect.new(0, 0, 544, 416)
    self.contents.blt(16, 16, bitmap, rect)
    draw_skills(200, 396)
    draw_items(332, 396)
    draw_ammo(484, 396)
  end
 
  def draw_skills(x, y)
    count = 0
    @actor.skill_hotkeys.each { |key, value|
    next if value.nil?
    skill = $data_skills[value]
    next if skill.nil?
    draw_icon(skill.icon_index, (32*count)+x-4, y)
    self.contents.draw_outlined_text((32*count)+x+5, y+17, 64, 24, Keys.name(key))
    count += 1
    }
    self.contents.draw_outlined_text(x-7, y-15, 96, 24, Skills_Text, 1)
  end
 
  def draw_items(x, y)
    count = 0
    @actor.item_hotkeys.each { |key, value|
    next if value.nil?
    item = $data_items[value]
    next if item.nil?
    draw_icon(item.icon_index, (32*count)+x-4, y)
    self.contents.draw_outlined_text((32*count)+x+5, y+17, 64, 24, Keys.name(key))
    count += 1
    }
    self.contents.draw_outlined_text(x-7, y-15, 96, 24, Items_Text, 1)
  end
 
  def draw_ammo(x, y)
    if @actor.weapons[0] != nil and @actor.weapons[0].ranged?
      if @actor.weapons[0].ammo1 != nil
        draw_icon(@actor.equips[0].ammo1.icon_index, x-4, y) if @actor.equips[0].ammo1 != nil
      end
      if @actor.weapons[0].ammo2 != nil
        draw_icon(@actor.equips[0].ammo2.icon_index, x+28, y) if @actor.equips[0].ammo2 != nil
      end
      self.contents.draw_outlined_text(x+5, y+17, 32, 24, Keys.name($Requiem_ABS.attack_key1))
      self.contents.draw_outlined_text(x+37, y+17, 32, 24, Keys.name($Requiem_ABS.attack_key2))
    end

    self.contents.draw_outlined_text(x-7, y-16, 64, 24, Ammo_Text, 1)
  end
 
end

#------------------------------------------------------------------------------
class Scene_Map < Scene_Base
 
  alias requiem_hud_start start
  alias requiem_hud_update update
  alias requiem_hud_terminate terminate
 
  def start
    requiem_hud_start
    @hud_window1 = Requiem_HUD1.new
    @hud_window2 = Requiem_HUD2.new
    @hud_window1.visible = false
    @hud_window2.visible = false
    showing_hud
  end
 
  def update
    requiem_hud_update
    showing_hud
    @hud_window1.update if @hud_window1.visible
    @hud_window2.update if @hud_window2.visible
  end
 
  def terminate
    requiem_hud_terminate
    @hud_window1.dispose
    @hud_window2.dispose
  end
 
  def showing_hud
    if OnOff_Switch <= 0 or $game_switches[OnOff_Switch]
      @hud_window1.visible = true
      @hud_window2.visible = true
    else
      @hud_window1.visible = false
      @hud_window2.visible = false
    end
  end

end
#------------------------------------------------------------------------------
end


I've got everything moved down to the bottom of the screen and now I just want my HP/MP/EXP bars (hud window 1) to sit on top of the hud background image like everything else (hud window 2).

I'd also like the items and ammo windows to display a count of the item they are displaying. The Vampyr SBABS does this and has a couple other features I prefer, but overall I'd rather use Requiem 9. I've used every ABS I could find at this point and it's the one that does what I want it to do the most frequently.

Anyway, here is the vampyr sbabs hud script if that helps (although it's obviously different)

#==============================================================================
# Vampyr HUD
#==============================================================================
# Switch ID that show or hide the HUD
OnOff_Switch = 0

# Text displayed on skills window
Show_Skills = true
Skills_Text = "Skills"

# Text displayed on items window
Show_Items = true
Items_Text = "Items"

# Text displayed on ammunitions window
Show_Ammos = true
Ammo_Text = "Ammo"

# The name of the font
Font_Name = Font.default_name

# The size of the font
Font_Size = 16

#------------------------------------------------------------------------------
if Vampyr_Kernel.enabled?("Vampyr SBABS")
#------------------------------------------------------------------------------
Vampyr_Kernel.register("Vampyr HUD", 1.1, "12/06/2009")
#------------------------------------------------------------------------------
class Vampyr_HUD1 < Sprite
 
  def initialize(viewport)
    super(viewport)
    self.x, self.y = 1, 1
    @base   = Cache.system("Actor Base")
    @hpbar  = Cache.system("Actor HP Bar")
    @mpbar  = Cache.system("Actor MP Bar")
    @expbar = Cache.system("Actor Exp Bar")
    self.bitmap = Bitmap.new(156, 64)
    self.bitmap.font.name = Font_Name
    self.bitmap.font.size = Font_Size
    refresh
  end
 
  def update
    super
    self.visible = (OnOff_Switch <= 0 or $game_switches[OnOff_Switch])
    update_opacity
    refresh if something_changed?
  end
 
  def refresh
    @actor = $game_party.members[0]
    return if @actor == nil
    @old_hp  = @actor.hp
    @old_mp  = @actor.mp
    @old_exp = @actor.exp
    self.bitmap.clear
    draw_hpbar(@actor, 0, 0)
    draw_mpbar(@actor, 0, 20)
    draw_expbar(@actor, 0, 40) if @actor.next_exp > 0
  end
 
  def draw_hpbar(actor, x, y)
    self.bitmap.draw_outlined_text(x, y, 24, Font_Size, Vocab::hp_a)
    rect = Rect.new(0, 0, @hpbar.width*actor.hp/actor.maxhp, @hpbar.height)
    self.bitmap.blt(x+24, y, @base, @base.rect)
    self.bitmap.blt(x+24, y, @hpbar, rect)
  end
 
  def draw_mpbar(actor, x, y)
    self.bitmap.draw_outlined_text(x, y, 24, Font_Size, Vocab::mp_a)
    rect = Rect.new(0, 0, @mpbar.width*actor.mp/actor.maxmp, @mpbar.height)
    self.bitmap.blt(x+24, y, @base, @base.rect)
    self.bitmap.blt(x+24, y, @mpbar, rect)
  end
 
  def draw_expbar(actor, x, y)
    self.bitmap.draw_outlined_text(x, y, 24, Font_Size, "Exp")
    rect = Rect.new(0, 0, @expbar.width*actor.current_exp/actor.next_exp, @expbar.height)
    self.bitmap.blt(x+24, y, @base, @base.rect)
    self.bitmap.blt(x+24, y, @expbar, rect)
  end
 
  def something_changed?
    return false if $game_party.members.size <= 0
    return true if @old_hp  != @actor.hp
    return true if @old_mp  != @actor.mp
    return true if @old_exp != @actor.exp
    return true if @actor   != $game_party.members[0]
    return false
  end
 
  def update_opacity
    if $game_player.screen_x <= (self.bitmap.width+16) and $game_player.screen_y <= (self.bitmap.height+16)
      self.opacity -= 10
    elsif self.opacity < 255
      self.opacity += 10
    end
  end
 
  def dispose
    self.bitmap.dispose
    super
  end
 
end

#------------------------------------------------------------------------------
class Vampyr_HUD2 < Sprite
 
  def initialize(viewport)
    super(viewport)
    @bg = Cache.system("Ammos Base")
    self.y = Graphics.height-@bg.height-(Font_Size/2)-1
    self.bitmap = Bitmap.new(@bg.width, @bg.height+(Font_Size/2))
    self.bitmap.font.name = Font_Name
    self.bitmap.font.size = Font_Size
    refresh
  end
 
  def update
    super
    self.visible = (OnOff_Switch <= 0 or $game_switches[OnOff_Switch])
    update_opacity
    refresh if something_changed?
  end
 
  def refresh
    @actor = $game_party.members[0]
    return if @actor == nil
    @weapon1 = @actor.weapons[0]
    @weapon2 = @actor.weapons[1]
    @count1 = $game_party.item_number(@actor.ammos[@weapon1.id])
    @count2 = $game_party.item_number(@actor.ammos[@weapon2.id])
    self.bitmap.clear
    self.bitmap.blt(0, 10, @bg, @bg.rect)
    draw_ammos
  end
 
  def draw_ammos
    if @actor.weapons[0] != nil and @actor.ammos[@actor.weapons[0].id] != nil
      draw_icon(@actor.ammos[@actor.weapons[0].id].icon_index, 4, 14)
      self.bitmap.draw_outlined_text(0, self.bitmap.height-Font_Size, 32, Font_Size, @count1.to_s, 1)
    end
    if @actor.weapons[1] != nil and @actor.ammos[@actor.weapons[1].id] != nil
      draw_icon(@actor.ammos[@actor.weapons[1].id].icon_index, 36, 14)
    end
    self.bitmap.draw_outlined_text(0, 0, self.bitmap.width, Font_Size, Ammo_Text, 1)
  end
 
  def something_changed?
    return false if $game_party.members.size <= 0
    return true if @weapon1 != @actor.weapons[0]
    return true if @weapon2 != @actor.weapons[1]
    return true if @actor   != $game_party.members[0]
    return true if @count1  != $game_party.item_number(@actor.ammos[@weapon1.id])
    return true if @count2  != $game_party.item_number(@actor.ammos[@weapon2.id])
    return false
  end
 
  def update_opacity
    if $game_player.screen_x <= (self.bitmap.width+16) and $game_player.screen_y >= (Graphics.height-self.bitmap.height-16)
      self.opacity -= 10
    elsif self.opacity < 255
      self.opacity += 10
    end
  end
 
  def dispose
    self.bitmap.dispose
    super
  end
 
end

#------------------------------------------------------------------------------
class Vampyr_HUD3 < Sprite
 
  def initialize(viewport)
    super(viewport)
    @bg = Cache.system("Skills Base")
    self.x = Graphics.width-@bg.width
    self.y = Graphics.height-@bg.height-(Font_Size/2)-1
    self.bitmap = Bitmap.new(@bg.width, @bg.height+(Font_Size/2))
    self.bitmap.font.name = Font_Name
    self.bitmap.font.size = Font_Size
    refresh
  end
 
  def update
    super
    self.visible = (OnOff_Switch <= 0 or $game_switches[OnOff_Switch])
    update_opacity
    refresh if something_changed?
  end
 
  def refresh
    @actor = $game_party.members[0]
    return if @actor == nil
    @hotkeys = {}
    @actor.skill_hotkeys.each { |k, v| @hotkeys[k] = v }
    self.bitmap.clear
    self.bitmap.blt(0, 10, @bg, @bg.rect)
    draw_skills
  end
 
  def draw_skills
    count = 0
    @actor.skill_hotkeys.sort.each { |key, value|
     next if value.nil?
     skill = $data_skills[value]
     next if skill.nil?
     draw_icon(skill.icon_index, 32*count+4, 14)
     self.bitmap.draw_outlined_text(32*count, self.bitmap.height-Font_Size, 32, Font_Size, Keys.name(key), 1)
     count += 1
    }
    self.bitmap.draw_outlined_text(0, 0, self.bitmap.width, Font_Size, Skills_Text, 1)
  end
 
  def something_changed?
    return false if $game_party.members.size <= 0
    return true if @actor != $game_party.members[0]
    return true if @hotkeys != @actor.skill_hotkeys
    return false
  end
 
  def update_opacity
    if $game_player.screen_x >= (Graphics.width-self.bitmap.width-16) and $game_player.screen_y >= (Graphics.height-self.bitmap.height-16)
      self.opacity -= 10
    elsif self.opacity < 255
      self.opacity += 10
    end
  end
 
  def dispose
    self.bitmap.dispose
    super
  end
 
end

#------------------------------------------------------------------------------
class Vampyr_HUD4 < Sprite
 
  def initialize(viewport)
    super(viewport)
    @bg = Cache.system("Items Base")
    self.x, self.y = Graphics.width-@bg.width, 1
    self.bitmap = Bitmap.new(@bg.width, @bg.height+(Font_Size/2))
    self.bitmap.font.name = Font_Name
    self.bitmap.font.size = Font_Size
    refresh
  end
 
  def update
    super
    self.visible = (OnOff_Switch <= 0 or $game_switches[OnOff_Switch])
    update_opacity
    refresh if something_changed?
  end
 
  def refresh
    @actor = $game_party.members[0]
    return if @actor == nil
    @hotkeys = {}
    @actor.item_hotkeys.each { |k, v| @hotkeys[k] = v }
    self.bitmap.clear
    self.bitmap.blt(0, 10, @bg, @bg.rect)
    draw_items
  end
 
  def draw_items
    count = 0
    @actor.item_hotkeys.sort.each { |key, value|
     next if value.nil?
     item = $data_items[value]
     next if item.nil?
     draw_icon(item.icon_index, 32*count+4, 14)
     self.bitmap.draw_outlined_text(32*count, self.bitmap.height-Font_Size, 32, Font_Size, Keys.name(key), 1)
     count += 1
    }
    self.bitmap.draw_outlined_text(0, 0, self.bitmap.width, Font_Size, Items_Text, 1)
  end
 
  def something_changed?
    return false if $game_party.members.size <= 0
    return true if @actor != $game_party.members[0]
    return true if @hotkeys.to_s != @actor.item_hotkeys.to_s
    return false
  end
 
  def update_opacity
    if $game_player.screen_x >= (Graphics.width-self.bitmap.width-16) and $game_player.screen_y <= (self.bitmap.height+16)
      self.opacity -= 10
    elsif self.opacity < 255
      self.opacity += 10
    end
  end
 
  def dispose
    self.bitmap.dispose
    super
  end
 
end

#------------------------------------------------------------------------------
class Spriteset_Map
 
  alias vampyr_hud_initialize initialize
  alias vampyr_hud_update update
  alias vampyr_hud_dispose dispose
 
  def initialize
    $vampyr_hud1 = Vampyr_HUD1.new(@viewport3)
    $vampyr_hud2 = Vampyr_HUD2.new(@viewport3) if Show_Ammos
    $vampyr_hud3 = Vampyr_HUD3.new(@viewport3) if Show_Skills
    $vampyr_hud4 = Vampyr_HUD4.new(@viewport3) if Show_Items
    vampyr_hud_initialize
  end
 
  def update
    vampyr_hud_update
    $vampyr_hud1.update
    $vampyr_hud2.update if Show_Ammos
    $vampyr_hud3.update if Show_Skills
    $vampyr_hud4.update if Show_Items
  end
 
  def dispose
    vampyr_hud_dispose
    $vampyr_hud1.dispose
    $vampyr_hud2.dispose if Show_Ammos
    $vampyr_hud3.dispose if Show_Skills
    $vampyr_hud4.dispose if Show_Items
  end
 
end

#------------------------------------------------------------------------------
end


If someone could help me, I'd greatly appreciate it.