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.

HUD Script Editing

I've downloaded the HUD script from the downloads section. I was wondering if you could help me with an annoying problem.
I turn the hud off. But, whenever I enter the menu or a save screen it turns back on. Could someone find the part of the script I need to edit, and tell me what to do. I would be very grateful.

Code:
class Scene_Map
  
  alias raz_hud_main main
  alias raz_hud_update update
  
  def main
    @size = $game_party.actors.size
    raz_hud_main
    @hud_window.dispose
    @hud_dummy[0].dispose
    @hud_dummy[1].dispose
    @hud_dummy[2].dispose
    @hud_dummy[3].dispose
  end
  
  def update
  if @size != $game_party.actors.size
     @hud_window.refresh
      show_window
    end
  if @hud == true
      else
    main_window
  end
  
    @hud_window.update
    raz_hud_update
  end
  
  def show_window
    @size = $game_party.actors.size
    if $game_party.actors[0] == nil
      @hud_dummy[0].visible = false
      else
      @hud_dummy[0].visible = true
    end
    
    if $game_party.actors[1] == nil
      @hud_dummy[1].visible = false
      else
      @hud_dummy[1].visible = true
    end

    if $game_party.actors[2] == nil
      @hud_dummy[2].visible = false
      else
      @hud_dummy[2].visible = true
    end

    if $game_party.actors[3] == nil
      @hud_dummy[3].visible = false
      else
      @hud_dummy[3].visible = true
    end
  end
  
  def main_window
    @opacity = 200
    @hud_dummy = []
    @hud_dummy[0] = Window_Base.new(0, 140,160, 108)
    @hud_dummy[1] = Window_Base.new(160, 370,160, 108)
    @hud_dummy[2] = Window_Base.new(320, 370,160, 108)
    @hud_dummy[3] = Window_Base.new(480, 370,160, 108)
    @hud_dummy[0].opacity = @opacity
    @hud_dummy[1].opacity = @opacity
    @hud_dummy[2].opacity = @opacity
    @hud_dummy[3].opacity = @opacity
    @hud_window = Window_HUD.new
    if $game_party.actors[0] == nil
      @hud_dummy[0].visible = false
      else
      @hud_dummy[0].visible = true
    end
    
    if $game_party.actors[1] == nil
      @hud_dummy[1].visible = false
      else
      @hud_dummy[1].visible = true
    end

    if $game_party.actors[2] == nil
      @hud_dummy[2].visible = false
      else
      @hud_dummy[2].visible = true
    end

    if $game_party.actors[3] == nil
      @hud_dummy[3].visible = false
      else
      @hud_dummy[3].visible = true
    end
    @hud = true
  end
  
  def turn_hud_off
    for i in 0...$game_party.actors.size
    @hud_window.visible, @hud_dummy[i].visible = false, false
    end
    return
  end
  
  def turn_hud_on
    for i in 0...$game_party.actors.size
    @hud_window.visible, @hud_dummy[i].visible = true, true
    end
    return
  end
  
end

  
class Window_HUD < Window_Base
  def initialize
    super(0, 0, 800, 600)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    unless $game_party.actors[0] == nil
    @old_hp1 = $game_party.actors[0].hp
    @old_sp1 = $game_party.actors[0].sp
    @old_exp1 = $game_party.actors[0].now_exp
    end
    unless $game_party.actors[1] == nil
    @old_hp2 = $game_party.actors[1].hp
    @old_sp2 = $game_party.actors[1].sp
    @old_exp2 = $game_party.actors[1].now_exp
    end
    unless $game_party.actors[2] == nil
    @old_hp3 = $game_party.actors[2].hp
    @old_sp3 = $game_party.actors[2].sp
    @old_exp3 = $game_party.actors[2].now_exp
    end
    unless $game_party.actors[3] == nil
    @old_hp4 = $game_party.actors[3].hp
    @old_sp4 = $game_party.actors[3].sp
    @old_exp4 = $game_party.actors[3].now_exp
    end

    refresh
  end
  
  def refresh
    self.contents.clear
    for i in 0...$game_party.actors.size
    actor = $game_party.actors[i]
    x = 25 + i * 160
    self.contents.font.size = 21
    draw_actor_graphic(actor, x - 10, 200)
    self.contents.font.color = normal_color
    self.contents.draw_text(x - 25, 360, 100, 32, actor.name)
    draw_slant_bar(x + 8, 150, actor.hp, actor.maxhp, width = 100, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(155, 155, 60, 255))
    draw_slant_bar(x + 8, 180, actor.sp, actor.maxsp, width = 100, height = 6, bar_color = Color.new(0, 0, 150, 255), end_color = Color.new(60, 155, 155, 255))
    unless actor.level == 99
    draw_slant_bar(x + 8, 210, actor.now_exp, actor.next_exp, width = 100, height = 6, bar_color = Color.new(0, 150, 0, 255), end_color = Color.new(60, 255, 60, 255))
  else
    draw_slant_bar(x + 8, 436, 1, 1, width = 100, height = 6, bar_color = Color.new(0, 150, 0, 255), end_color = Color.new(60, 255, 60, 255))
    end
    self.contents.font.size = 16
    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, "Exp")
  end
end

def update
  super
    unless $game_party.actors[0] == nil
  if @old_hp1 != $game_party.actors[0].hp or @old_sp1 != $game_party.actors[0].sp or @old_exp1 != $game_party.actors[0].now_exp
      refresh
      @old_hp1 = $game_party.actors[0].hp
      @old_sp1 = $game_party.actors[0].sp
      @old_exp1 = $game_party.actors[0].now_exp
    end
  end
  unless $game_party.actors[1] == nil
      if @old_hp2 != $game_party.actors[1].hp or @old_sp2 != $game_party.actors[1].sp or @old_exp2 != $game_party.actors[1].now_exp
      refresh
      @old_hp2 = $game_party.actors[1].hp
      @old_sp2 = $game_party.actors[1].sp
      @old_exp2 = $game_party.actors[1].now_exp
    end
  end
  unless $game_party.actors[2] == nil
  if @old_hp3 != $game_party.actors[2].hp or @old_sp3 != $game_party.actors[2].sp or @old_exp3 != $game_party.actors[2].now_exp
      refresh
      @old_hp3 = $game_party.actors[2].hp
      @old_sp3 = $game_party.actors[2].sp
      @old_exp3 = $game_party.actors[2].now_exp
    end
  end
  unless $game_party.actors[3] == nil
  if @old_hp4 != $game_party.actors[3].hp or @old_sp4 != $game_party.actors[3].sp or @old_exp4 != $game_party.actors[3].now_exp
      refresh
      @old_hp4 = $game_party.actors[3].hp
      @old_sp4 = $game_party.actors[3].sp
      @old_exp4 = $game_party.actors[3].now_exp
    end
    end

  end
end
    
class Window_Base < Window
  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

class Game_Actor
  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
 
That's my script, I forgot to update it in the download manager. Just exchange the script with this one:
Code:
class Scene_Map
  
  SWITCH_ID = 1
  $center_hud = true
  
  alias raz_hud_main main
  alias raz_hud_update update
  
  def main
    @size = $game_party.actors.size
    raz_hud_main
    @hud_window.dispose
    for i in 0...$game_party.actors.size
      @hud_dummy[i].dispose
    end
  end
  
  def update
    if @size != $game_party.actors.size
      @hud_window.refresh
      show_window
    end
    if @hud != true
      main_window
    end
    turn_hud_on_off
    @hud_window.update
    raz_hud_update
  end
  
  def show_window
    @size = $game_party.actors.size
    for i in 0..3
      @hud_dummy[i].visible = ($game_party.actors[i] != nil)
    end
  end
  
  def main_window
    @opacity = 200
    @hud_dummy = []
    for i in 0...4
      y = $game_party.actors.size - 1
        x = 240 - (y * 80)
      if $center_hud == true
      @hud_dummy[i] = Window_Base.new(160 * i + x, 372,160, 108)
    else
      @hud_dummy[i] = Window_Base.new(160 * i, 372,160, 108)
      end
      @hud_dummy[i].opacity = @opacity
      @hud_dummy[i].visible = false
    end
    @hud_window = Window_HUD.new
    for i in 0...$game_party.actors.size
      @hud_dummy[i].visible = $game_party.actors[i] != nil
    end
    @hud = true
  end
  
def turn_hud_on_off
 if $game_switches[SWITCH_ID] == false
  @hud_window.visible = false
    for i in 0...$game_party.actors.size
      @hud_dummy[i].visible = false
    end
  end
  
  
  if $game_switches[SWITCH_ID] == true
    @hud_window.visible = true
    for i in 0...$game_party.actors.size
      @hud_dummy[i].visible = true
    end
  end
end

end

  
class Window_HUD < Window_Base
  def initialize
    super(0, 0, 800, 600)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      eval("@old_hp#{i+1} = actor.hp; @old_sp#{i+1} = actor.sp; @old_exp#{i+1} = actor.now_exp")
    end
    refresh
  end
  
  def refresh
    self.contents.clear
    for i in 0...$game_party.actors.size
      a = $game_party.actors.size - 1
      actor = $game_party.actors[i]
      if $center_hud == true
      x = (i * 160 + 25) + (240 - (a * 80))
    else
      x = i * 160 + 25
      end
      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)
      width = 100
      height = 6
      draw_slant_bar(x + 8, 396, actor.hp, actor.maxhp, width, height, Color.new(150, 0, 0), Color.new(155, 155, 60))
      draw_slant_bar(x + 8, 416, actor.sp, actor.maxsp, width, height, Color.new(0, 0, 150), Color.new(60, 155, 155))
      unless actor.level == 99
        draw_slant_bar(x + 8, 436, actor.now_exp, actor.next_exp, width, height, Color.new(0, 150, 0), Color.new(60, 255, 60))
      else
        draw_slant_bar(x + 8, 436, 1, 1, width = 100, height = 6, Color.new(0, 150, 0), Color.new(60, 255, 60))
      end
      self.contents.font.size = 16
      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, "Exp")
    end
  end

  def update
    super
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if (eval("@old_hp#{i+1}") != actor.hp or eval("@old_sp#{i+1}") != actor.sp or
        eval("@old_exp#{i+1}") != actor.now_exp)
        refresh
        eval("@old_hp#{i+1} = actor.hp; @old_sp#{i+1} = actor.sp; @old_exp#{i+1} = actor.now_exp")
      end
    end
  end
end
    
class Window_Base < Window
  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

class Game_Actor
  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

Just search at the beginning of the script for
Code:
SWITCH_ID = 1

Just exchange the 1 with the switches number you want to use to turn the HUD on and off.
 
delete this line and add:
Code:
self.contents.blt(x - 10, 200,RPG::Cache.picture(actor.character_name + "hud"), Rect.new(0,0,180,120))

Just name the picture like your character sprite only with a "hud" at the end, for example if your character sprite is named 001-Fighter01 name you picture 001-Fighter01hud. You probably have to modify the x and y position on this part, but that shouldn't be hard.
Code:
x - 10, 200

Just ask if you have some questions. ^_^
 
Make a class that inherits from Window_Base. Example:

Code:
Window_Whatever < Window_Base
  def initialize
    super(x, y, width, height)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  def refresh
    self.contents.draw_text(x, y, width, height, "text")
    self.contents.draw_text(x, y, width, height, "text")
    # Add more self.contents.draw_text lines to add more lines of text
  end
end
 
I'm having trouble with this script. I've managed to modify it so that the bars display vertically instead of horizonally, and changed the windows around. Problem is that the text doesnt display, and never did. Here is a screen... (note that im using a primitive version of my actual game to beta test the script)

http://www.geocities.com/onlinewarehous ... ptdemo.PNG[/img]

Just wondering if anyone knows the solution

Try using this script and seeing if it displays text for you
Code:
class Scene_Map
  
  alias raz_hud_main main
  alias raz_hud_update update
  
  def main
    @size = $game_party.actors.size
    raz_hud_main
    @hud_window.dispose
    @hud_dummy[0].dispose
    @hud_dummy[1].dispose
    @hud_dummy[2].dispose
    @hud_dummy[3].dispose
  end
  
  def update
  if @size != $game_party.actors.size
     @hud_window.refresh
      show_window
    end
  if @hud == true
      else
    main_window
  end
  
    @hud_window.update
    raz_hud_update
  end
  
  def show_window
    @size = $game_party.actors.size
    if $game_party.actors[0] == nil
      @hud_dummy[0].visible = false
      else
      @hud_dummy[0].visible = true
    end
    
    if $game_party.actors[1] == nil
      @hud_dummy[1].visible = false
      else
      @hud_dummy[1].visible = true
    end

    if $game_party.actors[2] == nil
      @hud_dummy[2].visible = false
      else
      @hud_dummy[2].visible = true
    end

    if $game_party.actors[3] == nil
      @hud_dummy[3].visible = false
      else
      @hud_dummy[3].visible = true
    end
  end
  
  def main_window
    @opacity = 200
    @hud_dummy = []
    @hud_dummy[0] = Window_Base.new(1, 444,461, 11)
    @hud_dummy[1] = Window_Base.new(1, 456,461, 11)
    @hud_dummy[2] = Window_Base.new(1, 468,461, 11)
    @hud_dummy[3] = Window_Base.new(0, 0,0, 0)
    @hud_dummy[0].opacity = @opacity
    @hud_dummy[1].opacity = @opacity
    @hud_dummy[2].opacity = @opacity
    @hud_dummy[3].opacity = @opacity
    @hud_window = Window_HUD.new
    if $game_party.actors[0] == nil
      @hud_dummy[0].visible = false
      else
      @hud_dummy[0].visible = true
    end
    
    if $game_party.actors[1] == nil
      @hud_dummy[1].visible = false
      else
      @hud_dummy[1].visible = true
    end

    if $game_party.actors[2] == nil
      @hud_dummy[2].visible = false
      else
      @hud_dummy[2].visible = true
    end

    if $game_party.actors[3] == nil
      @hud_dummy[3].visible = false
      else
      @hud_dummy[3].visible = true
    end
    @hud = true
  end
  
  def turn_hud_off
    for i in 0...$game_party.actors.size
    @hud_window.visible, @hud_dummy[i].visible = false, false
    end
    return
  end
  
  def turn_hud_on
    for i in 0...$game_party.actors.size
    @hud_window.visible, @hud_dummy[i].visible = true, true
    end
    return
  end
  
end

  
class Window_HUD < Window_Base
  def initialize
    super(0, 0, 800, 600)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    unless $game_party.actors[0] == nil
    @old_hp1 = $game_party.actors[0].hp
    @old_sp1 = $game_party.actors[0].sp
    @old_exp1 = $game_party.actors[0].now_exp
    end
    unless $game_party.actors[1] == nil
    @old_hp2 = $game_party.actors[1].hp
    @old_sp2 = $game_party.actors[1].sp
    @old_exp2 = $game_party.actors[1].now_exp
    end
    unless $game_party.actors[2] == nil
    @old_hp3 = $game_party.actors[2].hp
    @old_sp3 = $game_party.actors[2].sp
    @old_exp3 = $game_party.actors[2].now_exp
    end
    unless $game_party.actors[3] == nil
    @old_hp4 = $game_party.actors[3].hp
    @old_sp4 = $game_party.actors[3].sp
    @old_exp4 = $game_party.actors[3].now_exp
    end

    refresh
  end
  
  def refresh
    self.contents.clear
    for i in 0...$game_party.actors.size
    actor = $game_party.actors[i]
    x = 25 + i * 12
    self.contents.font.size = 21
    draw_actor_graphic(actor, y + 16, 476)
    self.contents.font.color = normal_color
    self.contents.draw_text(x - 25, 360, 100, 32, actor.name)
    draw_slant_bar(x + 403, 38, actor.hp, actor.maxhp, width = 100, height = 10, bar_color = Color.new(24, 248, 74, 255), end_color = Color.new(224, 254, 214, 255))
    draw_slant_bar(x + 403, 138, actor.sp, actor.maxsp, width = 100, height = 10, bar_color = Color.new(228, 211, 118, 255), end_color = Color.new(250, 247, 226, 255))
    unless actor.level == 99
    draw_slant_bar(x + 403, 238, actor.now_exp, actor.next_exp, width = 100, height = 10, bar_color = Color.new(0, 150, 0, 255), end_color = Color.new(60, 255, 60, 255))
  else
    draw_slant_bar(x + 8, 436, 1, 1, width = 100, height = 10, bar_color = Color.new(0, 150, 0, 255), end_color = Color.new(60, 255, 60, 255))
    end
    self.contents.font.size = 12
    draw_actor_state(actor, x + 280, 303, 32)
    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 + 460, 282, 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 + 200, 100, 400, 320, "#{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(y + 75, 403, 500, 32, $data_system.words.hp)
    self.contents.draw_text(y + 170, 403, 500, 32, $data_system.words.sp)
    self.contents.draw_text(y + 280, 403, 500, 32, "Pain")
  end
end

def update
  super
    unless $game_party.actors[0] == nil
  if @old_hp1 != $game_party.actors[0].hp or @old_sp1 != $game_party.actors[0].sp or @old_exp1 != $game_party.actors[0].now_exp
      refresh
      @old_hp1 = $game_party.actors[0].hp
      @old_sp1 = $game_party.actors[0].sp
      @old_exp1 = $game_party.actors[0].now_exp
    end
  end
  unless $game_party.actors[1] == nil
      if @old_hp2 != $game_party.actors[1].hp or @old_sp2 != $game_party.actors[1].sp or @old_exp2 != $game_party.actors[1].now_exp
      refresh
      @old_hp2 = $game_party.actors[1].hp
      @old_sp2 = $game_party.actors[1].sp
      @old_exp2 = $game_party.actors[1].now_exp
    end
  end
  unless $game_party.actors[2] == nil
  if @old_hp3 != $game_party.actors[2].hp or @old_sp3 != $game_party.actors[2].sp or @old_exp3 != $game_party.actors[2].now_exp
      refresh
      @old_hp3 = $game_party.actors[2].hp
      @old_sp3 = $game_party.actors[2].sp
      @old_exp3 = $game_party.actors[2].now_exp
    end
  end
  unless $game_party.actors[3] == nil
  if @old_hp4 != $game_party.actors[3].hp or @old_sp4 != $game_party.actors[3].sp or @old_exp4 != $game_party.actors[3].now_exp
      refresh
      @old_hp4 = $game_party.actors[3].hp
      @old_sp4 = $game_party.actors[3].sp
      @old_exp4 = $game_party.actors[3].now_exp
    end
    end

  end
end
    
class Window_Base < Window
  def draw_slant_bar(y, x, 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, 200))
    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

class Game_Actor
  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
 
I fixed the text problem, it had nothing to do with this script, now I'm trying to figure out how to make the text display vertically like the bars.

The problem is this...
Code:
  def refresh
    self.contents.clear
    for i in 0...$game_party.actors.size
    actor = $game_party.actors[i]
    x = 25 + i * 12

The '12' in line "x = 25 + i * 12" represents the distance between the bars vertically, but for text, this represents the distance between them horizontally. How do I; a) Set the text to vertica...wait...I think I know!...wait, nope. Didn't work. How do I set the text to vertical display instead of horizontal? For the bars, to make them vertical, what I did was change...

Code:
class Window_Base < Window
  def draw_slant_bar(x, y, min, max, width = 152, height = 6,

to:

Code:
class Window_Base < Window
  def draw_slant_bar([B]y, x,[/B] min, max, width = 152, height = 6,

Didnt affect the text unfortunately, and changing the X infront of the text's coordinates to a Y causes all 4 to be placed directly ontop of one another
 

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