Main Menu
  • Welcome to The RPG Maker Resource Kit.

HP/SP/EXP Bars by Tsunokiette

Started by Tsunokiette, February 01, 2006, 09:17:37 PM

0 Members and 1 Guest are viewing this topic.

Tsunokiette

Just place this in a new script right bellow Window_Base.

  #------------------------------------------------------------------------------
  # Begin Game_Actor Edit
  #------------------------------------------------------------------------------
  class Game_Actor < Game_Battler
     #--------------------------------------------------------------------------
     # * Return the exp needed to reach the next level
     #--------------------------------------------------------------------------
     def needed_exp(current_lvl)
        return @exp_list[current_lvl + 1]
     end
     #--------------------------------------------------------------------------
     # * Return the currently gained exp
     #--------------------------------------------------------------------------
     def gained_exp(current_lvl,current_exp)
        return (current_exp - @exp_list[current_lvl])
      end
     #--------------------------------------------------------------------------
     # * Return the current level
     #--------------------------------------------------------------------------
     def lvl
        return @level
     end
  end
  #------------------------------------------------------------------------------
  # End Game_Actor Edit
  #------------------------------------------------------------------------------

  #------------------------------------------------------------------------------
  # Begin Window_Base Edit
  #------------------------------------------------------------------------------
  class Window_Base < Window
     #--------------------------------------------------------------------------
     # * Draw HP Bar
     #--------------------------------------------------------------------------
     def draw_hp_bar(actor,x,y,w = 202)
        #get hp and max hp
        hp = actor.hp
        max_hp = actor.maxhp
        #define colors to be used
        border_color = Color.new(0,0,0,255)
        line1_color = Color.new(0,145,0,255)
        line2_color = Color.new(0,176,0,255)
        line3_color = Color.new(0,215,0,255)
        line4_color = Color.new(0,253,0,255)
        line5_color = Color.new(0,215,0,255)
        line6_color = Color.new(0,176,0,255)
        line7_color = Color.new(0,145,0,255)
        line8_color = Color.new(0,120,0,255)
        empty_color = Color.new(75,75,75,255)
        #get widths and x's
        line_width = (((hp * 1.0) / max_hp) * (w - 2))
        empty_width = ((w - 2) - line_width)
        empty_x = ((x + 1) + line_width)
        #make border Rects
        border1 = Rect.new(x, y, w, 1)
        border2 = Rect.new(x, y + 9, w, 1)
        border3 = Rect.new(x, y + 1, 1, 8)
        border4 = Rect.new(x + (w - 1), y + 1, 1, 8)
        #make line Rects
        line1 = Rect.new(x + 1, y + 1, line_width, 1)
        line2 = Rect.new(x + 1, y + 2, line_width, 1)
        line3 = Rect.new(x + 1, y + 3, line_width, 1)
        line4 = Rect.new(x + 1, y + 4, line_width, 1)
        line5 = Rect.new(x + 1, y + 5, line_width, 1)
        line6 = Rect.new(x + 1, y + 6, line_width, 1)
        line7 = Rect.new(x + 1, y + 7, line_width, 1)
        line8 = Rect.new(x + 1, y + 8, line_width, 1)
        #make empty Rect
        empty = Rect.new(empty_x, y + 1, empty_width, 8)
        #fill border Rects
        self.contents.fill_rect(border1,border_color)
        self.contents.fill_rect(border2,border_color)
        self.contents.fill_rect(border3,border_color)
        self.contents.fill_rect(border4,border_color)
        #fill line Rects
        self.contents.fill_rect(line1,line1_color)
        self.contents.fill_rect(line2,line2_color)
        self.contents.fill_rect(line3,line3_color)
        self.contents.fill_rect(line4,line4_color)
        self.contents.fill_rect(line5,line5_color)
        self.contents.fill_rect(line6,line6_color)
        self.contents.fill_rect(line7,line7_color)
        self.contents.fill_rect(line8,line8_color)
        #fill empty Rect
        self.contents.fill_rect(empty,empty_color)
     end
     #--------------------------------------------------------------------------
     # * Draw SP Bar
     #--------------------------------------------------------------------------
     def draw_sp_bar(actor,x,y,w = 202)
        #get sp and max sp
        sp = actor.sp
        max_sp = actor.maxsp
        #get percentage width
        percentage_width = ((w - 2) / 100)
        #define colors to be used
        border_color = Color.new(0,0,0,255)
        line1_color = Color.new(112,0,223,255)
        line2_color = Color.new(130,4,255,255)
        line3_color = Color.new(155,55,255,255)
        line4_color = Color.new(170,85,255,255)
        line5_color = Color.new(155,55,255,255)
        line6_color = Color.new(130,4,255,255)
        line7_color = Color.new(112,0,223,255)
        line8_color = Color.new(88,0,176,255)
        empty_color = Color.new(75,75,75,255)
        #get widths and x's
        line_width = (((sp * 1.0) / max_sp) * (w - 2))
        empty_width = ((w - 2) - line_width)
        empty_x = ((x + 1) + line_width)
        #make border Rects
        border1 = Rect.new(x, y, w, 1)
        border2 = Rect.new(x, y + 9, w, 1)
        border3 = Rect.new(x, y + 1, 1, 8)
        border4 = Rect.new(x + (w - 1), y + 1, 1, 8)
        #make line Rects
        line1 = Rect.new(x + 1, y + 1, line_width, 1)
        line2 = Rect.new(x + 1, y + 2, line_width, 1)
        line3 = Rect.new(x + 1, y + 3, line_width, 1)
        line4 = Rect.new(x + 1, y + 4, line_width, 1)
        line5 = Rect.new(x + 1, y + 5, line_width, 1)
        line6 = Rect.new(x + 1, y + 6, line_width, 1)
        line7 = Rect.new(x + 1, y + 7, line_width, 1)
        line8 = Rect.new(x + 1, y + 8, line_width, 1)
        #make empty Rect
        empty = Rect.new(empty_x, y + 1, empty_width, 8)
        #fill border Rects
        self.contents.fill_rect(border1,border_color)
        self.contents.fill_rect(border2,border_color)
        self.contents.fill_rect(border3,border_color)
        self.contents.fill_rect(border4,border_color)
        #fill line Rects
        self.contents.fill_rect(line1,line1_color)
        self.contents.fill_rect(line2,line2_color)
        self.contents.fill_rect(line3,line3_color)
        self.contents.fill_rect(line4,line4_color)
        self.contents.fill_rect(line5,line5_color)
        self.contents.fill_rect(line6,line6_color)
        self.contents.fill_rect(line7,line7_color)
        self.contents.fill_rect(line8,line8_color)
        #fill empty Rect
        self.contents.fill_rect(empty,empty_color)
     end
     #--------------------------------------------------------------------------
     # * Draw EXP Bar
     #--------------------------------------------------------------------------
     def draw_exp_bar(actor,x,y,w = 202)
        #get exp and needed exp
        exp = actor.exp
        gained_exp = actor.gained_exp(actor.lvl,exp)
        needed_exp = actor.needed_exp(actor.lvl)
        #define colors to be used
        border_color = Color.new(0,0,0,255)
        line1_color = Color.new(140,140,0,255)
        line2_color = Color.new(157,157,0,255)
        line3_color = Color.new(170,170,0,255)
        line4_color = Color.new(196,196,0,255)
        line5_color = Color.new(170,170,0,255)
        line6_color = Color.new(157,157,0,255)
        line7_color = Color.new(140,140,0,255)
        line8_color = Color.new(128,128,0,255)
        empty_color = Color.new(75,75,75,255)
        #get widths and x's
        line_width = (((gained_exp * 1.0) / needed_exp) * (w - 2))
        empty_width = ((w - 2) - line_width)
        empty_x = ((x + 1) + line_width)
        #make border Rects
        border1 = Rect.new(x, y, w, 1)
        border2 = Rect.new(x, y + 9, w, 1)
        border3 = Rect.new(x, y + 1, 1, 8)
        border4 = Rect.new(x + (w - 1), y + 1, 1, 8)
        #make line Rects
        line1 = Rect.new(x + 1, y + 1, line_width, 1)
        line2 = Rect.new(x + 1, y + 2, line_width, 1)
        line3 = Rect.new(x + 1, y + 3, line_width, 1)
        line4 = Rect.new(x + 1, y + 4, line_width, 1)
        line5 = Rect.new(x + 1, y + 5, line_width, 1)
        line6 = Rect.new(x + 1, y + 6, line_width, 1)
        line7 = Rect.new(x + 1, y + 7, line_width, 1)
        line8 = Rect.new(x + 1, y + 8, line_width, 1)
        #make empty Rect
        empty = Rect.new(empty_x, y + 1, empty_width, 8)
        #fill border Rects
        self.contents.fill_rect(border1,border_color)
        self.contents.fill_rect(border2,border_color)
        self.contents.fill_rect(border3,border_color)
        self.contents.fill_rect(border4,border_color)
        #fill line Rects
        self.contents.fill_rect(line1,line1_color)
        self.contents.fill_rect(line2,line2_color)
        self.contents.fill_rect(line3,line3_color)
        self.contents.fill_rect(line4,line4_color)
        self.contents.fill_rect(line5,line5_color)
        self.contents.fill_rect(line6,line6_color)
        self.contents.fill_rect(line7,line7_color)
        self.contents.fill_rect(line8,line8_color)
        #fill empty Rect
        self.contents.fill_rect(empty,empty_color)
      end
     end
  #------------------------------------------------------------------------------
  # End Window_Base Edit
  #------------------------------------------------------------------------------


Now in the window you want to show the bars in, just do this -

For HP -
draw_hp_bar(actor,x position,y position,width)

For SP
draw_sp_bar(actor,x position,y position,width)

For EXP
draw_exp_bar(actor,x position,y position,width)
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Neko

QuoteZxmelee says: I FUCKED A CHICK GEEZ
Neko says: I doubt it was a girl
Neko says: Was "she" working the corners?
Zxmelee says: Well, I was lying...
Zxmelee says: but, oh man. They were all over me
Neko says: With a few bucks
Neko says: That hapens
Pwnzorz'd

Tsunokiette

Quote from: NekoWhere do I put the things?

in the refresh method of the chosen menu

EDIT: the bars should look something like this-

HP-

SP-

EXP-


NOTE: you can change the colors if you want

everywhere you see

#define colors to be used
border_color = Color.new(0,0,0,255)
line1_color = Color.new(140,140,0,255)
line2_color = Color.new(157,157,0,255)
line3_color = Color.new(170,170,0,255)
line4_color = Color.new(196,196,0,255)
line5_color = Color.new(170,170,0,255)
line6_color = Color.new(157,157,0,255)
line7_color = Color.new(140,140,0,255)
line8_color = Color.new(128,128,0,255)
empty_color = Color.new(75,75,75,255)


the first three numbers are the r,b,g values, just keep the fourth one 255, that's the opacity.

the lines are numbered 1-8 from top to bottem (the colored ones)
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Neko

error =\ Im not sure how to edit this stuff so could you like make it so it has all the bars for me? Lol I dont mean to beg, but I dont understand what to do.
QuoteZxmelee says: I FUCKED A CHICK GEEZ
Neko says: I doubt it was a girl
Neko says: Was "she" working the corners?
Zxmelee says: Well, I was lying...
Zxmelee says: but, oh man. They were all over me
Neko says: With a few bucks
Neko says: That hapens
Pwnzorz'd

Tsunokiette

Quote from: Nekoerror =\ Im not sure how to edit this stuff so could you like make it so it has all the bars for me? Lol I dont mean to beg, but I dont understand what to do.

kk, where do you want them, and are you using the default systems?
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Neko

:O_o: ? Umm I want the at the top left corner and what do you mean by default?
QuoteZxmelee says: I FUCKED A CHICK GEEZ
Neko says: I doubt it was a girl
Neko says: Was "she" working the corners?
Zxmelee says: Well, I was lying...
Zxmelee says: but, oh man. They were all over me
Neko says: With a few bucks
Neko says: That hapens
Pwnzorz'd

Tsunokiette

Quote from: Neko:O_o: ? Umm I want the at the top left corner and what do you mean by default?

I mean, if you want them in the menu/battle system, are you using the default systems.

So you want it on the map. right?

add this above main - (should work)

Window_Bars < Window_Base
  def initialize
     super(0,0,234,158)
     self.contents = Bitmap.new(width - 32, height - 32)
     self.contents.font.name = 'Times New Roman'
     self.contents.font.size = 22
     refresh_stats
  end
  def refresh_stats
     self.contents.clear
     actor = $game_party.actors[1]
     draw_actor_hp(actor,0,0,202)
     draw_hp_bar(actor,0,32)
     draw_actor_sp(actor,0,42,202)
     draw_sp_bar(actor,0,74)
     draw_actor_exp(actor,0,84)
     draw_exp_bar(actor,0,116)
  end
  def update
     refresh_stats
  end
end
class Scene_Map
  def main
     @spriteset = Spriteset_Map.new
     @message_window = Window_Message.new
     @bar_window = Window_Bars.new
     Graphics.transition
     loop do
        Graphics.update
        Input.update
        update
        if $scene != self
           break
        end
     end
     Graphics.freeze
     @spriteset.dispose
     @message_window.dispose
     @bar_window.dispose
     if $scene.is_a?(Scene_Title)
        Graphics.transition
        Graphics.freeze
     end
  end
  def update
     loop do
        $game_map.update
        $game_system.map_interpreter.update
        $game_player.update
        $game_system.update
        $game_screen.update
        unless $game_temp.player_transferring
           break
        end
        transfer_player
        if $game_temp.transition_processing
           break
        end
     end
     @spriteset.update
     @message_window.update
     @bar_window.update
     if $game_temp.gameover
        $scene = Scene_Gameover.new
        return
     end
     if $game_temp.to_title
        $scene = Scene_Title.new
        return
     end
     if $game_temp.transition_processing
        $game_temp.transition_processing = false
        if $game_temp.transition_name == ""
           Graphics.transition(20)
        else
           Graphics.transition(40, "Graphics/Transitions/" +
           $game_temp.transition_name)
        end
     end
     if $game_temp.message_window_showing
        return
     end
     if $game_player.encounter_count == 0 and $game_map.encounter_list != []
        unless $game_system.map_interpreter.running? or
           $game_system.encounter_disabled
           $game_temp.battle_calling = true
           $game_temp.battle_can_escape = true
           $game_temp.battle_can_lose = false
           $game_temp.battle_proc = nil
           n = rand($game_map.encounter_list.size)
           $game_temp.battle_troop_id = $game_map.encounter_list[n]
        end
     end
     if Input.trigger?(Input::B)
        unless $game_system.map_interpreter.running? or
           $game_system.menu_disabled
           $game_temp.menu_calling = true
           $game_temp.menu_beep = true
        end
     end
     if $DEBUG and Input.press?(Input::F9)
        $game_temp.debug_calling = true
     end
     unless $game_player.moving?
        if $game_temp.battle_calling
           call_battle
        elsif $game_temp.shop_calling
           call_shop
        elsif $game_temp.name_calling
           call_name
        elsif $game_temp.menu_calling
           call_menu
        elsif $game_temp.save_calling
           call_save
        elsif $game_temp.debug_calling
           call_debug
        end
   end
end
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Neko

QuoteZxmelee says: I FUCKED A CHICK GEEZ
Neko says: I doubt it was a girl
Neko says: Was "she" working the corners?
Zxmelee says: Well, I was lying...
Zxmelee says: but, oh man. They were all over me
Neko says: With a few bucks
Neko says: That hapens
Pwnzorz'd

Tsunokiette

Quote from: NekoIt says syntax error =\

it would help if you gave me the line... :|
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Neko

Syntax error line 22 so far.. I would fix it, but I have no clue how to do ruby =\
QuoteZxmelee says: I FUCKED A CHICK GEEZ
Neko says: I doubt it was a girl
Neko says: Was "she" working the corners?
Zxmelee says: Well, I was lying...
Zxmelee says: but, oh man. They were all over me
Neko says: With a few bucks
Neko says: That hapens
Pwnzorz'd

Tsunokiette

Quote from: NekoSyntax error line 22 so far.. I would fix it, but I have no clue how to do ruby =\

kk, I made just a little oopsie, Window_Bars was supposed to be class Window_Bars, but that's fixed now, here yoos go.

class Window_Bars < Window_Base
  def initialize
     super(0,0,234,158)
     self.contents = Bitmap.new(width - 32, height - 32)
     self.contents.font.name = 'Times New Roman'
     self.contents.font.size = 22
     refresh_stats
  end
  def refresh_stats
     self.contents.clear
     actor = $game_party.actors[1]
     draw_actor_hp(actor,0,0,202)
     draw_hp_bar(actor,0,32)
     draw_actor_sp(actor,0,42,202)
     draw_sp_bar(actor,0,74)
     draw_actor_exp(actor,0,84)
     draw_exp_bar(actor,0,116)
  end
  def update
     refresh_stats
  end
end
class Scene_Map
  def main
     @spriteset = Spriteset_Map.new
     @message_window = Window_Message.new
     @bar_window = Window_Bars.new
     Graphics.transition
     loop do
        Graphics.update
        Input.update
        update
        if $scene != self
           break
        end
     end
     Graphics.freeze
     @spriteset.dispose
     @message_window.dispose
     @bar_window.dispose
     if $scene.is_a?(Scene_Title)
        Graphics.transition
        Graphics.freeze
     end
  end
  def update
     loop do
        $game_map.update
        $game_system.map_interpreter.update
        $game_player.update
        $game_system.update
        $game_screen.update
        unless $game_temp.player_transferring
           break
        end
        transfer_player
        if $game_temp.transition_processing
           break
        end
     end
     @spriteset.update
     @message_window.update
     @bar_window.update
     if $game_temp.gameover
        $scene = Scene_Gameover.new
        return
     end
     if $game_temp.to_title
        $scene = Scene_Title.new
        return
     end
     if $game_temp.transition_processing
        $game_temp.transition_processing = false
        if $game_temp.transition_name == ""
           Graphics.transition(20)
        else
           Graphics.transition(40, "Graphics/Transitions/" +
           $game_temp.transition_name)
        end
     end
     if $game_temp.message_window_showing
        return
     end
     if $game_player.encounter_count == 0 and $game_map.encounter_list != []
        unless $game_system.map_interpreter.running? or
           $game_system.encounter_disabled
           $game_temp.battle_calling = true
           $game_temp.battle_can_escape = true
           $game_temp.battle_can_lose = false
           $game_temp.battle_proc = nil
           n = rand($game_map.encounter_list.size)
           $game_temp.battle_troop_id = $game_map.encounter_list[n]
        end
     end
     if Input.trigger?(Input::B)
        unless $game_system.map_interpreter.running? or
           $game_system.menu_disabled
           $game_temp.menu_calling = true
           $game_temp.menu_beep = true
        end
     end
     if $DEBUG and Input.press?(Input::F9)
        $game_temp.debug_calling = true
     end
     unless $game_player.moving?
        if $game_temp.battle_calling
           call_battle
        elsif $game_temp.shop_calling
           call_shop
        elsif $game_temp.name_calling
           call_name
        elsif $game_temp.menu_calling
           call_menu
        elsif $game_temp.save_calling
           call_save
        elsif $game_temp.debug_calling
           call_debug
        end
   end
end
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Neko

XD Error on lline 120 XD Sorry for being such a noob... This script is great for me though
QuoteZxmelee says: I FUCKED A CHICK GEEZ
Neko says: I doubt it was a girl
Neko says: Was "she" working the corners?
Zxmelee says: Well, I was lying...
Zxmelee says: but, oh man. They were all over me
Neko says: With a few bucks
Neko says: That hapens
Pwnzorz'd

Tsunokiette

do dis work?

class Window_Bars < Window_Base
def initialize
super(0,0,234,158)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = 'Times New Roman'
self.contents.font.size = 22
refresh_stats
end
def refresh_stats
self.contents.clear
actor = $game_party.actors[1]
draw_actor_hp(actor,0,0,202)
draw_hp_bar(actor,0,32)
draw_actor_sp(actor,0,42,202)
draw_sp_bar(actor,0,74)
draw_actor_exp(actor,0,84)
draw_exp_bar(actor,0,116)
end
def update
refresh_stats
end
end
class Scene_Map
def main
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
@bar_window = Window_Bars.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@message_window.dispose
@bar_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
def update
loop do
$game_map.update
$game_system.map_interpreter.update
$game_player.update
$game_system.update
$game_screen.update
unless $game_temp.player_transferring
break
end
transfer_player
if $game_temp.transition_processing
break
end
end
@spriteset.update
@message_window.update
@bar_window.update
if $game_temp.gameover
$scene = Scene_Gameover.new
return
end
if $game_temp.to_title
$scene = Scene_Title.new
return
end
if $game_temp.transition_processing
$game_temp.transition_processing = false
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
if $game_temp.message_window_showing
return
end
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
$game_temp.battle_calling = true
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
n = rand($game_map.encounter_list.size)
$game_temp.battle_troop_id = $game_map.encounter_list[n]
end
end
if Input.trigger?(Input::B)
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
if $DEBUG and Input.press?(Input::F9)
$game_temp.debug_calling = true
end
unless $game_player.moving?
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
end
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Neko

No errors, but no bars either =\
QuoteZxmelee says: I FUCKED A CHICK GEEZ
Neko says: I doubt it was a girl
Neko says: Was "she" working the corners?
Zxmelee says: Well, I was lying...
Zxmelee says: but, oh man. They were all over me
Neko says: With a few bucks
Neko says: That hapens
Pwnzorz'd

Sacul

i got an error for the first script you posted up above. The error comes up as the very end where it says Editing Windows Base then has #----- you know

Sacul

here is the specific error, hopes this help I really want to use this...


?????? ' ' ? 65 ??? name error ????????
undefined local variable or method 'border_1' for #<Windows_Bars:0x457a1a0>


there might be one to many or too few ?, but thats pretty much what it said. If its something im doing very sorry, scriptings not one of my things, but if this helps you good good good because im interested in using this script in my new game, thanks man.

Tsunokiette

I apologize, that was a lazy error, you see, when I started making the bars, I named them border1, border2, etc.

But for some reason when I tried to fill them with color, I typed border_1, etc.

Here's a completely tested, bug-proof system. It's completed, I've tested it and it works.

  #------------------------------------------------------------------------------
  # Begin Game_Actor Edit
  #------------------------------------------------------------------------------
  class Game_Actor < Game_Battler
     #--------------------------------------------------------------------------
     # * Return the exp needed to reach the next level
     #--------------------------------------------------------------------------
     def needed_exp(current_lvl)
        return @exp_list[current_lvl + 1]
     end
     #--------------------------------------------------------------------------
     # * Return the currently gained exp
     #--------------------------------------------------------------------------
     def gained_exp(current_lvl,current_exp)
        return (current_exp - @exp_list[current_lvl])
      end
     #--------------------------------------------------------------------------
     # * Return the current level
     #--------------------------------------------------------------------------
     def lvl
        return @level
     end
  end
  #------------------------------------------------------------------------------
  # End Game_Actor Edit
  #------------------------------------------------------------------------------

  #------------------------------------------------------------------------------
  # Begin Window_Base Edit
  #------------------------------------------------------------------------------
  class Window_Base < Window
     #--------------------------------------------------------------------------
     # * Draw HP Bar
     #--------------------------------------------------------------------------
     def draw_hp_bar(actor,x,y,w = 202)
        #get hp and max hp
        hp = actor.hp
        max_hp = actor.maxhp
        #define colors to be used
        border_color = Color.new(0,0,0,255)
        line1_color = Color.new(0,145,0,255)
        line2_color = Color.new(0,176,0,255)
        line3_color = Color.new(0,215,0,255)
        line4_color = Color.new(0,253,0,255)
        line5_color = Color.new(0,215,0,255)
        line6_color = Color.new(0,176,0,255)
        line7_color = Color.new(0,145,0,255)
        line8_color = Color.new(0,120,0,255)
        empty_color = Color.new(75,75,75,255)
        #get widths and x's
        line_width = (((hp * 1.0) / max_hp) * (w - 2))
        empty_width = ((w - 2) - line_width)
        empty_x = ((x + 1) + line_width)
        #make border Rects
        border1 = Rect.new(x, y, w, 1)
        border2 = Rect.new(x, y + 9, w, 1)
        border3 = Rect.new(x, y + 1, 1, 8)
        border4 = Rect.new(x + (w - 1), y + 1, 1, 8)
        #make line Rects
        line1 = Rect.new(x + 1, y + 1, line_width, 1)
        line2 = Rect.new(x + 1, y + 2, line_width, 1)
        line3 = Rect.new(x + 1, y + 3, line_width, 1)
        line4 = Rect.new(x + 1, y + 4, line_width, 1)
        line5 = Rect.new(x + 1, y + 5, line_width, 1)
        line6 = Rect.new(x + 1, y + 6, line_width, 1)
        line7 = Rect.new(x + 1, y + 7, line_width, 1)
        line8 = Rect.new(x + 1, y + 8, line_width, 1)
        #make empty Rect
        empty = Rect.new(empty_x, y + 1, empty_width, 8)
        #fill border Rects
        self.contents.fill_rect(border1,border_color)
        self.contents.fill_rect(border2,border_color)
        self.contents.fill_rect(border3,border_color)
        self.contents.fill_rect(border4,border_color)
        #fill line Rects
        self.contents.fill_rect(line1,line1_color)
        self.contents.fill_rect(line2,line2_color)
        self.contents.fill_rect(line3,line3_color)
        self.contents.fill_rect(line4,line4_color)
        self.contents.fill_rect(line5,line5_color)
        self.contents.fill_rect(line6,line6_color)
        self.contents.fill_rect(line7,line7_color)
        self.contents.fill_rect(line8,line8_color)
        #fill empty Rect
        self.contents.fill_rect(empty,empty_color)
     end
     #--------------------------------------------------------------------------
     # * Draw SP Bar
     #--------------------------------------------------------------------------
     def draw_sp_bar(actor,x,y,w = 202)
        #get sp and max sp
        sp = actor.sp
        max_sp = actor.maxsp
        #get percentage width
        percentage_width = ((w - 2) / 100)
        #define colors to be used
        border_color = Color.new(0,0,0,255)
        line1_color = Color.new(112,0,223,255)
        line2_color = Color.new(130,4,255,255)
        line3_color = Color.new(155,55,255,255)
        line4_color = Color.new(170,85,255,255)
        line5_color = Color.new(155,55,255,255)
        line6_color = Color.new(130,4,255,255)
        line7_color = Color.new(112,0,223,255)
        line8_color = Color.new(88,0,176,255)
        empty_color = Color.new(75,75,75,255)
        #get widths and x's
        line_width = (((sp * 1.0) / max_sp) * (w - 2))
        empty_width = ((w - 2) - line_width)
        empty_x = ((x + 1) + line_width)
        #make border Rects
        border1 = Rect.new(x, y, w, 1)
        border2 = Rect.new(x, y + 9, w, 1)
        border3 = Rect.new(x, y + 1, 1, 8)
        border4 = Rect.new(x + (w - 1), y + 1, 1, 8)
        #make line Rects
        line1 = Rect.new(x + 1, y + 1, line_width, 1)
        line2 = Rect.new(x + 1, y + 2, line_width, 1)
        line3 = Rect.new(x + 1, y + 3, line_width, 1)
        line4 = Rect.new(x + 1, y + 4, line_width, 1)
        line5 = Rect.new(x + 1, y + 5, line_width, 1)
        line6 = Rect.new(x + 1, y + 6, line_width, 1)
        line7 = Rect.new(x + 1, y + 7, line_width, 1)
        line8 = Rect.new(x + 1, y + 8, line_width, 1)
        #make empty Rect
        empty = Rect.new(empty_x, y + 1, empty_width, 8)
        #fill border Rects
        self.contents.fill_rect(border1,border_color)
        self.contents.fill_rect(border2,border_color)
        self.contents.fill_rect(border3,border_color)
        self.contents.fill_rect(border4,border_color)
        #fill line Rects
        self.contents.fill_rect(line1,line1_color)
        self.contents.fill_rect(line2,line2_color)
        self.contents.fill_rect(line3,line3_color)
        self.contents.fill_rect(line4,line4_color)
        self.contents.fill_rect(line5,line5_color)
        self.contents.fill_rect(line6,line6_color)
        self.contents.fill_rect(line7,line7_color)
        self.contents.fill_rect(line8,line8_color)
        #fill empty Rect
        self.contents.fill_rect(empty,empty_color)
     end
     #--------------------------------------------------------------------------
     # * Draw EXP Bar
     #--------------------------------------------------------------------------
     def draw_exp_bar(actor,x,y,w = 202)
        #get exp and needed exp
        exp = actor.exp
        gained_exp = actor.gained_exp(actor.lvl,exp)
        needed_exp = actor.needed_exp(actor.lvl)
        #define colors to be used
        border_color = Color.new(0,0,0,255)
        line1_color = Color.new(140,140,0,255)
        line2_color = Color.new(157,157,0,255)
        line3_color = Color.new(170,170,0,255)
        line4_color = Color.new(196,196,0,255)
        line5_color = Color.new(170,170,0,255)
        line6_color = Color.new(157,157,0,255)
        line7_color = Color.new(140,140,0,255)
        line8_color = Color.new(128,128,0,255)
        empty_color = Color.new(75,75,75,255)
        #get widths and x's
        line_width = (((gained_exp * 1.0) / needed_exp) * (w - 2))
        empty_width = ((w - 2) - line_width)
        empty_x = ((x + 1) + line_width)
        #make border Rects
        border1 = Rect.new(x, y, w, 1)
        border2 = Rect.new(x, y + 9, w, 1)
        border3 = Rect.new(x, y + 1, 1, 8)
        border4 = Rect.new(x + (w - 1), y + 1, 1, 8)
        #make line Rects
        line1 = Rect.new(x + 1, y + 1, line_width, 1)
        line2 = Rect.new(x + 1, y + 2, line_width, 1)
        line3 = Rect.new(x + 1, y + 3, line_width, 1)
        line4 = Rect.new(x + 1, y + 4, line_width, 1)
        line5 = Rect.new(x + 1, y + 5, line_width, 1)
        line6 = Rect.new(x + 1, y + 6, line_width, 1)
        line7 = Rect.new(x + 1, y + 7, line_width, 1)
        line8 = Rect.new(x + 1, y + 8, line_width, 1)
        #make empty Rect
        empty = Rect.new(empty_x, y + 1, empty_width, 8)
        #fill border Rects
        self.contents.fill_rect(border1,border_color)
        self.contents.fill_rect(border2,border_color)
        self.contents.fill_rect(border3,border_color)
        self.contents.fill_rect(border4,border_color)
        #fill line Rects
        self.contents.fill_rect(line1,line1_color)
        self.contents.fill_rect(line2,line2_color)
        self.contents.fill_rect(line3,line3_color)
        self.contents.fill_rect(line4,line4_color)
        self.contents.fill_rect(line5,line5_color)
        self.contents.fill_rect(line6,line6_color)
        self.contents.fill_rect(line7,line7_color)
        self.contents.fill_rect(line8,line8_color)
        #fill empty Rect
        self.contents.fill_rect(empty,empty_color)
      end
     end
  #------------------------------------------------------------------------------
  # End Window_Base Edit
  #------------------------------------------------------------------------------
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Sacul

Very good, is there any way to call it by a certain key?

Tsunokiette

Quote from: SaculVery good, is there any way to call it by a certain key?

Say what?
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Sacul

haha,

i mean like... I dont want it to always be on the map, i want it to pop and go away when you click the "S" key. So like you press "S" and you can see the status, you press "S" again and it hides...get it? thanks if you can do it

Tsunokiette

Quote from: Saculhaha,

i mean like... I dont want it to always be on the map, i want it to pop and go away when you click the "S" key. So like you press "S" and you can see the status, you press "S" again and it hides...get it? thanks if you can do it

The window on the map was a separate project which I finished at my grandparents house. I'll edit it to support what you want and upload it here.

What key do you want to be pressed? I was thinking maybe the shift key? If not, I'll use the keyboard input script to do what you want.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Sacul

Shift key works. If you want to do the KB input script then S, but right shift works just as well. Thanks

-sacul

Dalton

Hey Tsuno, the map version doesn't have any defined colors, you might want to fix that.

Tsunokiette

Quote from: DeathTrooperHey Tsuno, the map version doesn't have any defined colors, you might want to fix that.

here's the map version completed. (the other was premature -_- lol)

Make sure you use the most recently posted bar script, and just paste this above main, call it something like Map Addition. Press 'shift' to make it visible/invisible, and use the q/w keys to rotate the actors' stats

class Window_Bars < Window_Base
  attr_accessor  :actor_id
  def initialize
     super(0,0,234,190)
     self.contents = Bitmap.new(width - 32, height - 32)
     self.contents.font.name = 'Times New Roman'
     self.contents.font.size = 22
     self.opacity = 100
     self.back_opacity = 100
     self.visible = false
     self.active = false
     @actor_id = 0
     refresh_stats
  end
  def refresh_stats
     self.contents.clear
     actor = $game_party.actors[@actor_id]
     draw_actor_name(actor,0,0)
     draw_actor_hp(actor,0,32,202)
     draw_hp_bar(actor,0,64)
     draw_actor_sp(actor,0,74,202)
     draw_sp_bar(actor,0,106)
     draw_actor_exp(actor,0,116)
     draw_exp_bar(actor,0,148)
   end
   def id(id,type)
     if type == 0
       @actor_id = id
     elsif type == 1
       @actor_id += id
     elsif type == 2
       @actor_id -= id
     end
   end
   def current_id(id)
     if @actor_id == id
       return true
     end
     return false
   end
  def update
     refresh_stats
  end
end
class Scene_Map
  def main
     @spriteset = Spriteset_Map.new
     @message_window = Window_Message.new
     @bar_window = Window_Bars.new
     @wait_count = 15
     Graphics.transition
     loop do
        Graphics.update
        Input.update
        update
        if $scene != self
           break
        end
     end
     Graphics.freeze
     @spriteset.dispose
     @message_window.dispose
     @bar_window.dispose
     if $scene.is_a?(Scene_Title)
        Graphics.transition
        Graphics.freeze
     end
  end
  def update
     loop do
        $game_map.update
        $game_system.map_interpreter.update
        $game_player.update
        $game_system.update
        $game_screen.update
        unless $game_temp.player_transferring
           break
        end
        transfer_player
        if $game_temp.transition_processing
           break
        end
      end
      if @bar_window.active
        if Input.repeat?(Input::L)
          if @bar_window.current_id(0)
            @bar_window.id(3,0)
          else
            @bar_window.id(1,2)
          end
        elsif Input.repeat?(Input::R)
          if @bar_window.current_id(3)
            @bar_window.id(0,0)
          else
            @bar_window.id(1,1)
          end
        end
      end
     if Input.press?(Input::A) and @wait_count >= 15
        if @bar_window.active
          @bar_window.active = false
          @bar_window.visible = false
          @wait_count = 0
        else
          @bar_window.active = true
          @bar_window.visible = true
          @wait_count = 0
        end
      end
      @wait_count += 1
     @spriteset.update
     @message_window.update
     @bar_window.update
     if $game_temp.gameover
        $scene = Scene_Gameover.new
        return
     end
     if $game_temp.to_title
        $scene = Scene_Title.new
        return
     end
     if $game_temp.transition_processing
        $game_temp.transition_processing = false
        if $game_temp.transition_name == ""
           Graphics.transition(20)
        else
           Graphics.transition(40, "Graphics/Transitions/" +
           $game_temp.transition_name)
        end
     end
     if $game_temp.message_window_showing
        return
     end
     if $game_player.encounter_count == 0 and $game_map.encounter_list != []
        unless $game_system.map_interpreter.running? or
           $game_system.encounter_disabled
           $game_temp.battle_calling = true
           $game_temp.battle_can_escape = true
           $game_temp.battle_can_lose = false
           $game_temp.battle_proc = nil
           n = rand($game_map.encounter_list.size)
           $game_temp.battle_troop_id = $game_map.encounter_list[n]
        end
     end
     if Input.trigger?(Input::B)
        unless $game_system.map_interpreter.running? or
           $game_system.menu_disabled
           $game_temp.menu_calling = true
           $game_temp.menu_beep = true
        end
     end
     if $DEBUG and Input.press?(Input::F9)
        $game_temp.debug_calling = true
     end
     unless $game_player.moving?
        if $game_temp.battle_calling
           call_battle
        elsif $game_temp.shop_calling
           call_shop
        elsif $game_temp.name_calling
           call_name
        elsif $game_temp.menu_calling
           call_menu
        elsif $game_temp.save_calling
           call_save
        elsif $game_temp.debug_calling
           call_debug
        end
     end
  end
end  
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Sacul

I love you man, defintely going to be credited in my newest game... Also, you can be first to get a demo to! Add me to MSN if you want my email is littleoppelt@hotmail.com, I can fill you in on my game.