Submit Your Article Guild Wars 2 Forum RPG Maker VX.com
 
RPG Maker
 

 Username:
 Password:
   Not a member? Register!



Home > Tutorials > RPG Maker VX > Easy Bar Making *Scripting

Easy Bar Making *Scripting


Okay This tutorial will explain how you can make bars for anything! Even Variables! Now lets begin...
Even if you are new to rpg maker vx you will still be able to do this without downloading anything! First step... creating an individual section on the Script Editor... Right click and click insert... then copy Window_Help (Easy Template to start on) then paste on that spot that has an empty section. You see on line 14 - 29 a thing that is refered to Set_Text... Remove it. at the super(0, 0, 544, WLH + 32) part change the last two things 544 is the width of your window (Length of your bar.), and that WLH + 32... change to 416. After that then make a new line by pressing enter at the end of line 12... now to change the reference of your window... change line 7's Window_Help to something like Window_HPMAP... after that then go to line 13 Should be empty and put: self.windowskin = "" File location... if you don't want a window put self.windowskin = nil... that will remove the image that appears in stuff like menus with that blue window. Now for the string = reference part... strings always start with $ then you can have just about any name for example we will have $actorhp that will be our string... now put $actorhp = (Your Reference) *Reference Guide... if you want a actors stats to be found your reference will be $game_actors[(The number show on the database)], if you want a variable... then it is $game_variables[(The number show when you open the Control Variables thing)]... then the next part that finds what the reference contains... winhp will be our variable in our window... this is the code... winhp = width * $actorhp.hp / $actorhp.maxhp and we are done with finding what our bar refers to. Now for designing the bars and creating them. barc1 will be our variable for the first gradient color... barc1 = Color.new(Red, Green, Blue[, Opacity]) Opacity is not necessary is you don't want to put it use Color.new(Red, Green, Blue), for the tutorial i will use barc1 = Color.new(0,100,0,245)... now that we are done with that part we will put the next gradient color... barc2 = Color.new(0,255,0,250)... now that we are finally done with that we still need a back color. bbar = Color.new(155,155,155,155)... now we need to create the bars... self.contents.fill_rect (our back color will be in use here...) here is our code self.contents.fill_rect(7, 7, width, 6, bbar)... now that we are done with creating the back of our bar... we need the gradient colors in use. (Back color template: self.contents.fill_rect(X, Y, width reference, Skinny or Big, color reference))... the gradients... self.contents.gradient_fill_rect(7, 7, winhp, 6, barc1, barc2) (Gradient Bar template: self.contents.gradient_fill_rect(X, Y, Width Reference, Height Reference, Color 1, Color 2[, Vertical? Default is false]) If you wanted to create a vertical bar then use the vertical? as true...)... Now this part is optional... creating text that shows the amount of health this actor have, for example 3182 HP... for the tutorial self.contents.draw_text(7, 10, 544, 416, [$actorhp.hp,' ',Vocab.hp])... (Template: self.contents.draw_text(X, Y, MAXWIDTH, MAXHEIGHT, TEXT,CENTER? (if 1 means it centers it on the screen)))
Now go to Scene_Map... in the script menu... go to line 15 at the end of it make a new line and put @HP = Window_HPMAP.new (Template: Reference = MyWindow.new) Now for updating it... go to 57 and add a new line... and put @HP.update (Template: Reference.update)... and at line 36 add a new line... and put @HP.dispose (Template: Reference.dispose (Removes the window))

And that is all there is to it... thank you for viewing!
I have tested it and it works. 
Details
Tutorial: Easy Bar Making *Scripting
Date Listed: Thu, 20 May 2010 16:32:56 -0400
Author: MK621
Total Hits: 3566


Embed
Short URL:

HTML:

BB Code:



RPG RPG Revolution
RPG RPG Revolution is your #1 stop for game development and console RPG games, as well as those created by people like you. Link to us to support us, so we may grow to be better website community for you.

RPG RPG Revolution is an Privacy Policy and Legal