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.

sub7

ok i've put the tested script in the list but no bars show up.

When my little dude is walking around the map are they supposed to appear at the top-left?

Tsunokiette

Quote from: sub7ok i've put the tested script in the list but no bars show up.

When my little dude is walking around the map are they supposed to appear at the top-left?

If you just put the bar script in, you wont see any bars, because that's just the code to make the bars.

If your talking about the script I posted for sacul, you press shift to show it.
"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."

Aus Ace Leader

K', I just got here and am intrested in this, yet I am lost, can you tell me what goes where?(I read over the topic and It still gets me lost)
Sir Acer is back. This time, he has nothing. Its a fresh start.
____

Tsunokiette

Quote from: Aus Ace LeaderK', I just got here and am intrested in this, yet I am lost, can you tell me what goes where?(I read over the topic and It still gets me lost)

just put it above main, but showing the actual bars requires a little bit of very simple scripting.
"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."

Aus Ace Leader

Start anew, or the one already there?
Sir Acer is back. This time, he has nothing. Its a fresh start.
____

vinco

Hey, the code worked for me but it lags alot!

Blizzard

Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

Tsunokiette

Quote from: vincoHey, the code worked for me but it lags alot!

I figured I might as well log in for this one, seeing as it pertains to code which I provided.

Let me put it simply -

The code shouldn't lag, it hasn't on anything I've tested it on. It's either the computer's processing power (bps) or something's just seriously wrong with your copy of RMXP. (Which I hope BTW: Is LEGAL)

PS: To those who read my goodbye post: what I said in it still remains true, however the reasons I posted in topic are obvious, and therefore reasonable causes for breach of trust so-to-speak. (Is-done-trying-to-sound-smart)

PSS: DOH!
"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."

Snailer

I am replying because i used it but It  doesn't work for me at a level 99 Char.

gotix

well, this might be sorta late (XD) but, the code dosn't work for me. And also, where do I put the little codes under the big one? I keep getting error messages for some reaon =C

&&&&&&&&&&&&&

you dont put them anywhere.  ;8
He was just showing you where in the code you can change to get diffrent color bars.
&&&&&&&&&&&&&&&&

Blizzard

Hey, Tsuno, are you going to decrease the lag? If yes, check my ABS, there is a HUD code in it which is highly optimized. Just use the same "Refresh it only if it changes" algorythm.:)
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

Tsunokiette

Well, that's part is completely out of my control Bliz. *points at script* lolz.

I just posted the script for the bars. Of course I could post the script for those other bars I made, but yours are very similar *cough*andBETTER*cough* so I see no point in doing so lol.

:D
"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."

Blizzard

Lol! I guess there is no point in making a script if there already is a better one. The only 3 points in making one are:

1. Don't want to credit somebody else to have done something, what you can do yourself.

2. Want to make a better one, even if it's only a little bit more efficient code.

3. To make a script to help somebody, because the script from the other guy is ruggish~

At least these are my three reasons, lol!
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

Fallen Angel

Ok I just tried to use your script and it looks good from pics but it wont work im a little confused  I whant to have the bars in battle only to replace the numbers for hp sp ect. Can someone help me plz?  :)

Shinami

....okies. You just resurrected a very, very old thread. In the words of the great Milk-chan I shall scold you! You dumbass! Now...

#1:If you find an old thread like this with a script that you need help with, post a thread in the Script Request section detailing what you want and link to the old thread for reference.

#2:Necro posting is bad! It may bring about the wrath of Falcon and nobody wants the wrath of Falcon to be brought.

#3:If you want to add bars to the battle system, then look at Scene_Battle's "main" method to find out which windows are created for the battles. Then, you look through each window until you find the one that displays the actor hp/sp etc. That will be the window you want to use.

#4:To use a bar script, you have to have some sort of knowledge on how windows and scenes work.

Fallen Angel

#41
srry bringing this old thread up but i was desprete and didn't thinkof making a new one  my bad anyways im fairly good at working rmxp and a little about scrpts just not how to write them I was just confused wether to put the thing the Bar script or somthing els for where the bars will be just scripts. The directions were vaige to me i got confused.  but thnx for replying anyway. And thnx for the help srry if i pissed any 1 off.

:)

Quote from: Shinami on December 05, 2007, 08:18:16 AM
....okies. You just resurrected a very, very old thread. In the words of the great Milk-chan I shall scold you! You dumbass! Now...

#1:If you find an old thread like this with a script that you need help with, post a thread in the Script Request section detailing what you want and link to the old thread for reference.

#2:Necro posting is bad! It may bring about the wrath of Falcon and nobody wants the wrath of Falcon to be brought.

#3:If you want to add bars to the battle system, then look at Scene_Battle's "main" method to find out which windows are created for the battles. Then, you look through each window until you find the one that displays the actor hp/sp etc. That will be the window you want to use.

#4:To use a bar script, you have to have some sort of knowledge on how windows and scenes work.

People who say bumping old topics is bad are idiots.
It's relevant to him, he has all rights to post in it. It's not like he's bumping a topic in spam, no need to call him a dumbass.
Watch out for: HaloOfTheSun

Tsunokiette

Quote from: Fallen Angle on December 05, 2007, 08:28:06 AM
srry bringing this old thread up but i was desprete and didn't thinkof making a new one  my bad anyways im fairly good at working rmxp and a little about scrpts just not how to write them I was just confused wether to put the thing the Bar script or somthing els for where the bars will be just scripts. The directions were vaige to me i got confused.  but thnx for replying anyway. And thnx for the help srry if i pissed any 1 off.

No problem. *smiles as if he actually did something*
"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."

Fallen Angel

thnx im still new to the site idk wats good or bad on this site intirly btw I like the script alot but if you dont mind um Im having some trouble getting it to work idk were to put  the other 3 strips( hp sp ect.) for it to replac the numbers for battle ive been searching for a good Bar script and this is the best one i found  :)

TheWorld

 Tsunokiette could you do me a favor & combine these two scripts?
#------------------------------------------------------------------------------
   # 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
   #------------------------------------------------------------------------------

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   

Guardian

Looks very good, maybe I'll use it in my game...

zen03y

Alright, I've been putting scripts into classes and groups, but nothing happens.....how do I get them working? I think I've been putting them in the right place but nothing happens...

Tsunokiette

Quote from: TheWorld on January 08, 2008, 01:39:43 AM
Tsunokiette could you do me a favor & combine these two scripts?

Could you provide me with a link to a topic with the second script? Just so I can get an idea as to what it's supposed to do.

Quote from: zen03y on February 03, 2008, 04:33:53 AM
Alright, I've been putting scripts into classes and groups, but nothing happens.....how do I get them working? I think I've been putting them in the right place but nothing happens...

If you read the first post you'll notice that I say the bars don't show up by themselves. :)
This is just the code that draws the bars, but you have to tell the system to draw them, otherwise it's like giving a builder the blueprints to a house without telling him to build the house.

I don't remember what the code is exactly (it should be in the first post) but you put it in the refresh method of most windows where it draws everything that is supposed to be in the window.

If this doesn't work post the code you have and I'll fix it for you. ^_^
"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."