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.

Tiny Battle Status window update...

Status
Not open for further replies.
First of all, this is what my Battle system looks like right now (Minus the Exp Bar which I was able to remove myself):
http://img383.imageshack.us/img383/1678/jumpingky9.png[/img]
Notice the battle status at the top? Here is the script for it:

Code:
#==============================================================================
# ** Hud Menu
#==============================================================================
# Raziel
# Version 2.0
# 2007-08-18
#------------------------------------------------------------------------------
#===============================================================================
# * Module Raz_Hud
#===============================================================================

module Raz_Hud
  #switch to show/hide the hud
  #set it to true to center the hud if there are less than four party members
  Center_hud = true
end

#===============================================================================
# * Window_HUD
#===============================================================================

class Window_BattleStatus < Window_Base 
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize 
    super(0, -400, 800, 600) 
    self.contents = Bitmap.new(width - 32, height - 32) 
    self.opacity = 0 
    refresh 
  end 
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh 
    self.contents.clear 
    @old_hp, @old_sp, @old_exp, @old_size = [],[],[],$game_party.actors.size
    for actor in $game_party.actors
      @old_hp << actor.hp; @old_sp << actor.sp; @old_exp << actor.exp
      a = $game_party.actors.size - 1 
      center = Raz_Hud::Center_hud == true ? (240 - (a * 80)) : 0
      x = ($game_party.actors.index(actor) * 160 + 25) + center
      self.contents.font.size = 21 
      draw_actor_graphic(actor, x - 15, 445) 
      self.contents.font.color = normal_color 
      self.contents.draw_text(x - 25, 360, 100, 32, actor.name) 
      draw_slant_bar(x + 8, 396, actor.hp, actor.maxhp, 100, 6) 
      draw_slant_bar(x + 8, 416, actor.sp, actor.maxsp, 100, 6, Color.new(0, 0, 150), Color.new(60, 155, 155)) 
      draw_actor_state(actor, x + 45, 360) 
      self.contents.font.color = normal_color 
      self.contents.font.bold = true 
      self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color 
      self.contents.draw_text(x + 16, 382, 100, 32, "#{actor.hp}/#{actor.maxhp}", 1) 
      self.contents.font.color = actor.sp == 0 ? crisis_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color 
      self.contents.draw_text(x + 16, 402, 100, 32, "#{actor.sp}/#{actor.maxsp}", 1) 
      self.contents.font.color = system_color 
      self.contents.font.size = 20 
      self.contents.font.bold = false 
      self.contents.draw_text(x, 384, 50, 32, $data_system.words.hp) 
      self.contents.draw_text(x, 404, 50, 32, $data_system.words.sp) 
      self.contents.draw_text(x, 424, 50, 32, "") 
    end 
  end 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update 
    refresh if @old_size != $game_party.actors.size
    @old_hp.each_with_index {|hp, index| refresh if hp != $game_party.actors[index].hp}    
    @old_sp.each_with_index {|sp, index| refresh if sp != $game_party.actors[index].sp}
  end 
end 
#===============================================================================
# * Window_Dummy
#===============================================================================

class Window_Dummy < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #   size: Party's size
  #--------------------------------------------------------------------------
  def initialize(size)
    @old_size = $game_party.actors.size
    x = Raz_Hud::Center_hud == true ? 240 - ($game_party.actors.size - 1) * 80 : 0
    super(160 * size + x, 372, 160, 108)
    self.opacity = 0
  end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================

class Window_Base < Window 
  #--------------------------------------------------------------------------
  # * Draw Slant Bar (by SephirothSpawn)
  #--------------------------------------------------------------------------
  def draw_slant_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)) 
    for i in 0..height 
      self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255)) 
    end 
    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 + i, y + height - i, width, 1, Color.new(r, b, g, a)) 
    end 
    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 + j, y + height - j, 1, 1, Color.new(r, g, b, a)) 
      end 
    end 
  end 
end 
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor 
  #--------------------------------------------------------------------------
  # * Now Exp
  #--------------------------------------------------------------------------
  def now_exp 
    return @exp - @exp_list[@level] 
  end 
  #--------------------------------------------------------------------------
  # * Next Exp
  #--------------------------------------------------------------------------
  def next_exp 
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0 
  end 
end

Could somebody remove the HP/FP(SP) bars and replace them with the following images:
http://img481.imageshack.us/img481/1218/hpbaroz2.png[/img]
(The heart (HP)/flower (FP) one without the numbers.)
Also move up the overworld sprite a few pixels?

Also could they fix the thing where the characters take damage on the HP when an enemy's turn begins? (Add the script in a new project and you'll see what I mean.)

If anybody could do this for me, this is a crucial part of my game so that's why I'll be VERY grateful. I could even repay anyone who does this by making some sprites for whatever project they are currently working on.

Thank you to whomever for taking the time to read this.
 
Code:
#==============================================================================
# ** Hud Menu
#==============================================================================
# Raziel
# Version 2.0
# 2007-08-18
#------------------------------------------------------------------------------
#===============================================================================
# * Module Raz_Hud
#===============================================================================

module Raz_Hud
  #switch to show/hide the hud
  #set it to true to center the hud if there are less than four party members
  Center_hud = true
end

#===============================================================================
# * Window_HUD
#===============================================================================

class Window_BattleStatus < Window_Base 
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize 
    super(0, -400, 800, 600) 
    self.contents = Bitmap.new(width - 32, height - 32) 
    self.opacity = 0 
    refresh 
  end 
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh 
    self.contents.clear 
    @old_hp, @old_sp, @old_exp, @old_size = [],[],[],$game_party.actors.size
    for actor in $game_party.actors
      @old_hp << actor.hp; @old_sp << actor.sp; @old_exp << actor.exp
      a = $game_party.actors.size - 1 
      center = Raz_Hud::Center_hud == true ? (240 - (a * 80)) : 0
      x = ($game_party.actors.index(actor) * 160 + 25) + center
      self.contents.font.size = 21 
      draw_actor_graphic(actor, x - 15, 445) 
      self.contents.font.color = normal_color 
      draw_heart_bar(x + 8, 396, actor.hp, actor.maxhp) 
      draw_flower_bar(x + 8, 416, actor.sp, actor.maxsp) 
      draw_actor_state(actor, x + 45, 360) 
      self.contents.font.color = normal_color 
      self.contents.font.bold = true 
      self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color 
      self.contents.draw_text(x + 16, 382, 100, 32, "#{actor.hp}/#{actor.maxhp}", 1) 
      self.contents.font.color = actor.sp == 0 ? crisis_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color 
      self.contents.draw_text(x + 16, 402, 100, 32, "#{actor.sp}/#{actor.maxsp}", 1) 
      self.contents.font.color = system_color 
      self.contents.font.size = 20 
      self.contents.font.bold = false 
    end 
  end 
end 
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw Heart Bar
  #--------------------------------------------------------------------------
  def draw_heart_bar(x, y, min, max)
    background = RPG::Cache.picture("background")
    heart = RPG::Cache.picture("heart")
    heart_bg = RPG::Cache.picture("hp_back")
    hb_width = heart_bg.width * (min.to_f / max.to_f * 100) / 100
    self.contents.blt(x, y, background, Rect.new(0, 0, background.width, background.height))
    self.contents.blt(x, y, heart_bg, Rect.new(0, 0, hb_width, heart.height))
    self.contents.blt(x, y - 5, heart, Rect.new(0, 0, heart.width, heart.height))
  end
  #--------------------------------------------------------------------------
  # * Draw Flower Bar
  #--------------------------------------------------------------------------
  def draw_flower_bar(x, y, min, max)
    background = RPG::Cache.picture("background")
    flower = RPG::Cache.picture("flower")
    flower_bg = RPG::Cache.picture("fp_back")
    fb_width = flower_bg.width * (min.to_f / max.to_f * 100) / 100
    self.contents.blt(x, y, background, Rect.new(0, 0, background.width, background.height))
    self.contents.blt(x, y, flower_bg, Rect.new(0, 0, fb_width, flower.height))
    self.contents.blt(x, y - 5, flower, Rect.new(0, 0, flower.width, flower.height))
  end
end

Just insert this ppictures in your picture folder and name them:

background
http://img250.imageshack.us/img250/621/ ... undvf5.png[/img]

flower
http://img249.imageshack.us/img249/4611/flowerma4.png[/img]

heart
http://img249.imageshack.us/img249/8073/hearthc1.png[/img]

fp_back
http://img249.imageshack.us/img249/3079/fpbackci1.png[/img]

hp_back
http://img249.imageshack.us/img249/3157/hpbackqv6.png[/img]


If you have any questions or want me to change something, just post. :)
 
That's ALMOST perfect, I don't want the bar to shrink when they get hit. =p It's pretty much just a pretty decorative thingy like they use in Mario games.

But thank you so very much for being kind enough to reply. =D

Edit: Nevermind, I changed the "background" for each one to their HP_/FP_ backgrounds. =D Thanks for you help!

Also if you need anything spriting related feel free to PM me about it, I might be able to help.
 
Oh, I see. :p I don't need anything, but thanks. ^^

This topic has been resolved. If Boo Mansion or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
Status
Not open for further replies.

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