Help - Search - Members - Calendar
Full Version: Bar O Meter
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS2-Submissions
Pages: 1, 2
SojaBird
Bar O Meter

Version v2.2
Author SojaBird
Release Date 19-06-'08


Introduction
I'm realy proud on this script of mine.
It's the best I've ever done so far (3th hehe).

I spend a lot of time finding out how some scriptings works.
For example I had a hard time figuering out how to draw a picture.
Also the way to fill de bar was very hard to get.
Though I knew how I wanted to do it but I just couldn't get it working.

I started scripting this since I found some question on this forum.
First one was from JamesBlackwing who requested a "Basic hud addon, a bar", what didn't seemd so basic at all.
Second was from Neclords who also had a "HUD request"

However, I took the challenge and did it!! biggrin.gif
It's finaly complete and perhaps I'll use it in my own game as well now I know it's just awsome and mine. cool.gif


Hopefully it's worth your while trying.
HAVE FUN




Features
v1.0
- Draw a bar useing 2 images. One for a empty bar, a second one (same size) for the filling.
- You can use just a 50%-gray fill and change the tone in the script self (optional).
- Set the amount that causes the bar to be totaly filled.
- Show or hide the amountnumber.
- Change the place of the hud to show.
- Super Easy Setup.
v1.5
- Four different fillstyles (Left>Right, Right>Left, Bottom>Top, Top>Bottom)
v1.7
- Chose the fill to by variable or item
- Show hud directly when swich turned on (but when turned off again, it only turns of numbers and bar after open>close a window)
- Chose to use or don't use the tone instead of changing it back to [0,0,0,0]
v1.8
- Enable to changes the huds opacity.
- Smooth fill animation.
v2.0
- Use variable/item/hp/mp to fill the bar.
- Problem fixed with show and hide the amount.
- Blendingmode of the bar and the fill added.
v2.0.1
- Use exp as value to fill the bar with.
v2.1
- Fixed lag thanks to Puppeto!
v2.2
- More easy setup than before.
- And more...

To come features
- Show/hide total hud (getting it working properly)
- Call script functions.
- Disable count up the variable when bar is full (when using variables).
- Enable to changes place of number to show.
- Get the use time working to fill the bar.

Script
Click to view attachment



Customization
The whole setup is in the script self.
All you have to do is change it to your own style.

the setup in the script starts from
CODE
#############
# Start SETUP #
#############


and ends with
CODE
############
# End SETUP #
############



Compatibility
VX only.
Needs a picture of a empty bar and the filling (or a full bar) in the picturefolder of your game.


Screenshot



DEMO


v1.0 DEMO FILE HERE
The demo contains the project wich include some examplebars.
Sorry for the missing ingame info but talk to the butterfly to changes the show or hide of the number (do a window open>close to update it).
Talk to the fairy to get the bar filled and use the fire to empty the bar a little (sorry again for, this time, the missing of the amount input when empty the bar).



Installation
Put the script above main.
Set the script up by changing it to your project.
Put a empty and a filling or full bar picture in the picturefolder of your game (same size).
Credit me pls.
When you get an item that is tracked by the bar, change the in the script set up variable with the amount of that item that you get.
Also do this when you use or lose that item.
When you have reached the max amout of items, make sure the variable doesn't get over that item, it'll cause a uncorect display of the tracked amount.


FAQ
Non jet...

Terms and Conditions
Credit me pls with site, and the script is yours.
If anyone want some changes, pls pm me or post it here, I'll track the topic.
YanXie
Well,nice HUD script,kinda different snce most scripter will use figure only instead of image HUD.

Anyway,you might want to add ability to call the HUD using Input button.

If you wanna do that...here's an example :

CODE
  #--------------------------------------------------------------------------
  # * Determine If HUD Is Called By ALT + Z Keys
  #--------------------------------------------------------------------------
  def update_call_HUD
    if Input.press?(Input::ALT) and @hud_window.visible == false
      if Input.trigger?(Input::Z)
        @hud_window.visible = true
        $game_switches[PuppetHUDSwitch] = true
        Sound.play_decision  
      end
    elsif  Input.press?(Input::ALT) and @hud_window.visible == true
      if Input.trigger?(Input::Z)
        @hud_window.visible = false
        $game_switches[PuppetHUDSwitch] = false
        Sound.play_cancel
      end
    end  
  end


This way,you can urn on/off the HUD by pressing ALT + whatver buttons.

~( -3-)~
cheers,puppeto4. smile.gif
cheers,puppeto4. smile.gif
SojaBird
Well actualy I just want it to apear when a swich is on or not...But can't realy get it just how to smile.gif
YanXie
Well,first,in the HUd class,set this :

CODE
self.visible = false


Then...in Scene_Map :

CODE
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================

class Scene_Map < Scene_Base
  PuppetHUDSwitch = 10 # Switch ID for the HUD
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  if @new_stack.nil?            
    alias puppet_hud_start start          # Alias start method
    alias puppet_hud_terminate terminate  # Alias terminate method
    alias puppet_hud_update update        # Alias update method
    @new_stack = true
  end  
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    # Add @hud_window.
    @hud_window = Window_HUD.new
    if $game_switches[PuppetHUDSwitch] != false
      @hud_window.visible = true
    else
      @hud_window.visible = false
    end
    # The usual.
    puppet_hud_start
  end

  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    # Dispose the @hud_window
    @hud_window.dispose
    # The usual.
    puppet_hud_terminate
  end

  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    update_call_HUD
    if @hud_window.visible != false
      if Input.trigger?(Input::R)
        @hud_window.update
      elsif Input.trigger?(Input::L)      
        @hud_window.update
      end  
    end
    # The usual.
    puppet_hud_update    
  end
  #--------------------------------------------------------------------------
  # * Determine If HUD Is Called By ALT + Z Keys
  #--------------------------------------------------------------------------
  def update_call_HUD
    if Input.press?(Input::ALT) and @hud_window.visible == false
      if Input.trigger?(Input::Z)
        @hud_window.visible = true
        $game_switches[PuppetHUDSwitch] = true
        Sound.play_decision  
      end
    elsif  Input.press?(Input::ALT) and @hud_window.visible == true
      if Input.trigger?(Input::Z)
        @hud_window.visible = false
        $game_switches[PuppetHUDSwitch] = false
        Sound.play_cancel
      end
    end  
  end
end


something like that.

。・゚・(゚Д`)ノ
cheers,puppeto4. smile.gif
neclords
Thank you Pim321..

For the "HUD script" biggrin.gif
SojaBird
ya're welcome, hopfully your sister find is usefull as well wink.gif

o and im still working on it;)
Jirachiwish
How do you get the bar to fill horozontally
SojaBird
changes the fillstyle to 3(bottom to top) or 4(top to bottom)

all in the script wink.gif
SojaBird
bump
SojaBird
Update!!
demonicblade
I love it! So far it shows HP, am I right? Would it be possible to change it to a variable?

EDIT: Oh, I see it already has that option wink.gif

EDIT2: And what would happen if I copied the script example from Puppet4 into the very bottom of the script? Should it work that way or would it need to be inserted somewhere else in the script?
SojaBird
ya mean with the button or with the switch?

well I've tried but it will not work, since it's base on pictures
so actualy it's still a hard nut for me to crack to get that working as well

It could show HP/MP/EXP, I can implent that function if you like...

EDIT: or perhaps as timer?
SojaBird
Update to v2.0
The script allready has Exp and Timer function implented but those aren't working correct yet...so the CAN NOT BE USE!!
SojaBird
update v2.0.1
sorry for the fast reply but I fixed the exp problem now...its fully functioning now

lets work on this timer now
SojaBird
hehe bump and sorry for the many times I used "now" in my last post laugh.gif


ps working on sth els right now atm so can't work on this for a while...well actualy I just don't want to yet since it's also true that it's not realy popular...tongue.gif
Apkx24
does it show
HP
and
MP
and
EXP

or just HP? i red thru the posts but im not sure whether ishud replace my script..... it might like cause my game to go crazy
SojaBird
well it's just one bar so you can choose what you want to use
you can use:
- Item,
- Variable,
- HP,
- MP or
- EXP

you just need to pase it anywhere above main...that's all
though I does isn't working that good jet...still a bit laggy
it seems to update even when nothing is changes...it seems it's just like keep drawing new and new pics over each other...still need to fix that (A)
SojaBird
UPDATE to v2.1

NO LAG ANYMORE!!
rebirth2life
Thank you for the script, pim321!
Sycoslicer
Lol... Very nice. I suck at scripting myself, so I cant help you with that. But in your demo you spelled throw wrong.
SojaBird
QUOTE (Sycoslicer @ Jun 18 2008, 02:38 PM) *
Lol... Very nice. I suck at scripting myself, so I cant help you with that. But in your demo you spelled throw wrong.


hehe I don't care.
I'm Dutch and Dyslextic as hell biggrin.gif

Hope ya like it.




Anyone interested in some extra features? Just post...I'll see what I can do.
Sycoslicer
Well... I had it working at first, but now Im not sure what Im doing wrong e.e help would be appreciated. Im thinking about adding this to the game Im making (Ill put you in the credits DUH.). Anyways, Im making a Maze game. Its pretty basic, you run around dodging traps and fighting enemies. Only thing is, I dont have a working HP thing. So I found this topic, and I have no idea what the hell Im doing since it stopped working for me. If somebody could help me set it up it would be a lifesaver.

P.S. : Ive been working on the game for about a week, and its probably around 50% done. But now I need help with all the hard stuff.
SojaBird
update to v2.2



@sycoslicer
make sure you have set up everything the right way
line 40 should look like this
CODE
GetValueFrom = "HP" # Set where the value is from ["Var", "Item", "HP", "MP", "Exp", "Time"].
in your case
also make sure you have the switch to show the bar on and that the opacity isn't nil
BlasterBoy
Can this substitute for HP?
SojaBird
@BlasterBoy
pls read the feature list, it says that it can serve for HP as well yes.
Sycoslicer
Forgot to say thanks. I got the script working for my game now biggrin.gif. It works just as good as when I had it working the first time. I have a request though, Could you possibly create different style HUDs instead of just the Health potion one? I thought about trying to make one myself but I have no idea where to begin. I see you can change the picture yourself but what if you want multiple little pictures such as hearts, kinda like in Zelda. I need mini puzzle shaped pieces that go black when empty, if you can explain how to make it or possibly make a few that would be great. Thanks again.


EDIT: Every time I turn the switch off then back on the HUD doesnt show up again. I cant figure out why, and its a big problem. Because the HUD screws up whenever the character teleports too, so I thought that if I turned off the HUD then back on in the next map it would work. But its not, any ideas?
SojaBird
im still working on that problem...ill try to fix that tomorrow.

for the picturecreating, i'll do a tutorial as well tomorrow...though
here's a quick picture to show how ya could do it...(tomorrow as well tongue.gif)
Sycoslicer
Nvm, I fixed it. I tryed using variables and hp to make it show the numbers. Before I leave a map I just put an event before the screen goes black that turns the switch off, then when its done teleporting I make it turn it back on. Anyways, the games becoming a great success. I only need some people to help make it who are good at scripting (I SUCK at scripting). And I still need some pictures for the HUD though... The potion thing just doesnt quite give the proper effect Im looking for. And is it even possible to create multiple pictures for the HUD so it shows up the way I want it to? I might have to create multiple pictures and have certain ones show up when a certain amount of damage is dealt. But I think Im just gonna leave the game as having the traps deal 1 damage. If you could edit the script to make it be like:

picture1 = fullhp
picture2 = 1 damage dealt
picture3 = 2 damage dealt

etc. or another way to have it work the way Im looking for that would be great. Help please?

EDIT: By the way, do you have or know of a script that randomizes specific events on a map to different locations so theyre not always in the same spot? And also so they dont get moved onto unwalkable tiles and doesnt move certain events you dont want to be moved? Wow... That was awfully specific. Sorry to keep posting like this but I have no help whatsoever on this game and your the only person whos helped a little so far.
SojaBird
Well I'm not sure what you meen with the use of multiple pictures...since the bar fills itself by a amount.
So if your bar fill depens on HP it'll fill with the amount of HP.
> So if you get 1 damage, the bar will decrease one part of the total amount.
> If you get 2 damage, the bar will decrease two parts of the total amount.

Though I'm not sure what you mean with that, else I could make that if you want, it shouldn't be that hard.

An other way to fix that problem is something I'm still working on.
I'm trying to find out what the problem is so that it can be fixed.

About the randomizes event thing, that's something I want to try for you, it sounds nice.
It should be awsome for an ABS system right smile.gif?
I'll try that later as well.


Thanks and just keep commenting and asking, it's oke wink.gif.
Sycoslicer
Yeah, I saw something on a different post about randomizing events, but its all in another language I cant understand. And its really buggy, it moves events onto unmovable tiles sometimes and you get stuck, thats exactly why I didnt use it. As for the HP thing decreasing, I meant like if I want a custom HUD picture. Like if I dont want a bar. Cuz in my game a health bar doesnt match what Im looking for. I need the picture to be like mini pictures of mazes, and if you get hit 1 of them turns black, meaning you lose 1hp. And the only way I can think of doing this is by adding multiple pictures. That is, unless you have a better way of getting it to work.

EDIT: Forgot to mention, for the randomizing event thing. If you do decide to work on it, could you possibly make it so you can choose events that you dont want moved? And make it so they dont get randomized onto unmovable tiles?
SojaBird
hey i'm kind a back again


uhm...sycoslicer, i don't understand what you mean with the maze thing and all that stuff...so?

explain smile.gif
Ataris
do you have a bar picture so I can just use ur hp gauge smile.gif
SojaBird
well that's actualy all up to you, it depends on what you want
size and collor and all that, it's up to you actualy.

but if you give me a small discriptoin i can make it if you like
VampireLordAlucard
QUOTE (pim321 @ Jun 24 2008, 01:07 AM) *
Well I'm not sure what you meen with the use of multiple pictures...since the bar fills itself by a amount.
So if your bar fill depens on HP it'll fill with the amount of HP.
> So if you get 1 damage, the bar will decrease one part of the total amount.
> If you get 2 damage, the bar will decrease two parts of the total amount.

Though I'm not sure what you mean with that, else I could make that if you want, it shouldn't be that hard.



He wants his health gauge to work just like the Legend of Zelda games. In those games, you don't have a bar for your health, you have hearts.



Like in this picture. You have 3 hearts. If you get attacked, you might loose half of a heart, or a whole heart, or something. In this screenshot, the player has lost half of a heart, but still has 2 and 1/2 hearts left. In the Legend of Zelda games, you could also increase the total amount of hearts you had. Hope I helped explain it a little.
SojaBird
well i allready have made the heart thing, you can use one picture and variables to do that.
Zandalar
The demo is no longer on the site. How bad, I wanted to test it before doing some major changes on my script.
SojaBird
Well you could just take the script and look at it how it works.
Though, why do you want to test my script before you change your own script?

Cheers
Shadonn
Sorry to bug you guys but i have a point system set up with one of my variables. But for some reason when i the swirch turns on i cant move. i cant bring up menu or move. am i doing something wrong?
Shadonn
(bump)
Shadonn
QUOTE (Shadonn @ Aug 23 2008, 02:51 PM) *
(bump)

Does anyone know why i cant move when i turn the switch on. This is all I'm asking please assist!
SojaBird
All you do is spamming...pls read the rules before doing something that might look stupid (spamming)!
Normaly I won't help people that irritate me (yes you do), but because you're quite new, I'll strike my hand over the heart for once to help ya out...If I could.

It seems you have something running that denies acces to the menu or movement.
I don't realy get what kind of pointsystem yar useing so I can't help you fully...only if you explain your situation a bit better.
What other scripts are you useing and how did ya set up the script-options (pls copy and past in a [code ] [/code ] box).

It could be that you have running some other kind of event that denies the movement and menu-acces.
Try starting a new project with only the script and your setup's and look if you still got the problems.
If you have, it has something to do with my script, wich makes me look over it again to find the bug that's causing your problems.
If not, try figureing out yourself why it doens't work with you current project...Compare the two projects and see what difference they have.



Grz, SojaBird.
OrigamiRose
You can only bump a topic after 32 hours, so stop double post.
Shadonn
sorrry i figured it out i just got really aggravated with it. not tryin to be a pain. (slaps himself)
I feel like a jerk. Sorry guys. I shouldn't have been like that. I have moments.
SojaBird
sorry for that...
not sure if i still have the demo

any need for repost?
SojaBird
Oke, I shall make a new demo for that wink.gif
Misterzeno
Ah, I can't get this to work, I can get the bar to show up, and it has my total HP on it, but when I get hurt and my HP gets lower, it doesn't change at all, I have a picture of the full vile and an empty vile, what am I doing wrong?

SojaBird
Mmmm...could ya pls sent ya settings along so that I can have a look pls smile.gif
link5001
I can't dowload the example
it takes me to and add i skip it then it go to some wherer page
SojaBird
Well it seems that MassMirror is doing some weird stuff, wich meens that the file can't be found/downloaded.

Sorry for that.


Does the script work for you?
Omegas7
Hey nice script!

Hm, but how about being able to show more than 1 bar in the game? That would be really helpful smile.gif.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.