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.

HP/SP/RTB Bars for RMXP

I am making a game of my own and I would like to know if there are any scripts for some nice HP/SP/RTB Bars. Yes, I have looked around quite a lot for them. I was able to find one last year on my other computer. But i deleted that script, and I'd really like to add that too my game!

Thank you!,
~SonicBounty50
 

Atoa

Member

Code:
#==============================================================================

# HP/SP/EXP Bars

# by XRXS

# modified by Atoa

#==============================================================================

#==============================================================================

# ? Window_Base

#==============================================================================

class Window_Base < Window

  #--------------------------------------------------------------------------

  # 0 = red

  # 1 = blue

  # 2 = green

  # 3 = pink

  # 4 = clear blue

  # 5 = yellow

  # 6 = withe

  #--------------------------------------------------------------------------

  HP_COLOR  = 0

  SP_COLOR  = 1

  EXP_COLOR = 2

  #--------------------------------------------------------------------------

  alias draw_actor_hp_meter draw_actor_hp

  alias draw_actor_sp_meter draw_actor_sp

  alias draw_actor_exp_meter draw_actor_exp

  #--------------------------------------------------------------------------

  def draw_actor_hp(actor, x, y, width = 120, type = 0)

    draw_actor_hp_meter(actor, x, y)

    self.contents.fill_rect(x-1 , y + 24, width + 2, 6, Color.new(0, 0, 0, 255))

    w = width * actor.hp / actor.maxhp

    color = HP_COLOR

    bar_color(x, y, w, color)

  end

  #--------------------------------------------------------------------------

  def draw_actor_sp(actor, x, y, width = 120, type = 0)

    draw_actor_sp_meter(actor, x, y)

    self.contents.fill_rect(x - 1 , y + 24, width + 2, 6, Color.new(0, 0, 0, 255))

    w = width * actor.sp / actor.maxsp if actor.maxsp > 0

    w = 0 if actor.maxsp == 0

    color = SP_COLOR

    bar_color(x, y, w, color)

  end

  #--------------------------------------------------------------------------

  def draw_actor_exp(actor, x, y, width = 120, type = 0)

    draw_actor_exp_meter(actor, x, y)

    self.contents.fill_rect(x - 1 , y + 24, width + 2, 6, Color.new(0, 0, 0, 255))

    w = width * actor.now_exp / actor.next_exp

    color = EXP_COLOR

    bar_color(x, y, w, color)

  end

  #--------------------------------------------------------------------------

  def bar_color(x, y, w, color)

    case color

    when 0

      self.contents.fill_rect(x, y + 25, w, 1, Color.new(255, 96, 96, 255))

      self.contents.fill_rect(x, y + 26, w, 1, Color.new(255, 0, 0, 255))

      self.contents.fill_rect(x, y + 27, w, 1, Color.new(192, 0, 0, 255))

      self.contents.fill_rect(x, y + 28, w, 1, Color.new(128, 0, 0, 255))

    when 1

      self.contents.fill_rect(x, y + 25, w, 1, Color.new(96, 96, 255, 255))

      self.contents.fill_rect(x, y + 26, w, 1, Color.new(0, 0, 255, 255))

      self.contents.fill_rect(x, y + 27, w, 1, Color.new(0, 0, 192, 255))

      self.contents.fill_rect(x, y + 28, w, 1, Color.new(0, 0, 128, 255))

    when 2

      self.contents.fill_rect(x, y + 25, w, 1, Color.new(96, 255, 96, 255))

      self.contents.fill_rect(x, y + 26, w, 1, Color.new(0, 255, 0, 255))

      self.contents.fill_rect(x, y + 27, w, 1, Color.new(0, 192, 0, 255))

      self.contents.fill_rect(x, y + 28, w, 1, Color.new(0, 128, 0, 255))

    when 3

      self.contents.fill_rect(x, y + 25, w, 1, Color.new(255, 128, 255, 255))

      self.contents.fill_rect(x, y + 26, w, 1, Color.new(255, 0, 255, 255))

      self.contents.fill_rect(x, y + 27, w, 1, Color.new(192, 0, 192, 255))

      self.contents.fill_rect(x, y + 28, w, 1, Color.new(128, 0, 128, 255))

    when 4

      self.contents.fill_rect(x, y + 25, w, 1, Color.new(128, 255, 255, 255))

      self.contents.fill_rect(x, y + 26, w, 1, Color.new(0, 255, 255, 255))

      self.contents.fill_rect(x, y + 27, w, 1, Color.new(0, 192, 192, 255))

      self.contents.fill_rect(x, y + 28,w, 1, Color.new(0, 128, 128, 255))

    when 5

      self.contents.fill_rect(x, y + 25, w, 1, Color.new(255, 255, 128, 255))

      self.contents.fill_rect(x, y + 26, w, 1, Color.new(255, 255, 0, 255))

      self.contents.fill_rect(x, y + 27, w, 1, Color.new(192, 192, 0, 255))

      self.contents.fill_rect(x, y + 28, w, 1, Color.new(128, 128, 0, 255))

    when 6

      self.contents.fill_rect(x, y + 25, w, 1, Color.new(255, 255, 255, 255))

      self.contents.fill_rect(x, y + 26, w, 1, Color.new(255, 255, 255, 255))

      self.contents.fill_rect(x, y + 27, w, 1, Color.new(192, 192, 192, 255))

      self.contents.fill_rect(x, y + 28, w, 1, Color.new(128, 128, 128, 255))

    end

  end

end

 

#==============================================================================

# ? Game_Actor

#==============================================================================

class Game_Actor < Game_Battler

  #--------------------------------------------------------------------------

  def now_exp

    return @exp - @exp_list[@level]

  end

  #--------------------------------------------------------------------------

  def next_exp

    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0

  end

end
you can change the colors of the bars on the lines

HP_COLOR = 0
SP_COLOR = 1
EXP_COLOR = 2

just change the value to a number from 0 to 6.
 

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