This tutorial will result into a series of tutorials, helping beginning and advanced scripters to develop their own shops/ monster manuals/ states/ special battle skills/ level advancement systems.
This tutorial is VX based- but it may also help understanding scripting with ruby a bit better.
This tutorial will be a little bit more advanced than some others, for example own skills will be a very easy one...
So here we go- please give feedback (positive or negative doesn't matter, but just show you read my work )
The example used is a little itemsmith script I'm currently working on.
What parts do I need for an own shop?
First, you need windows, for example to show a list of items, informations or your character's stats. So you create a bunch of own windows, like I did- for example an item list, a status window for the characters, a window that shows you the items you need for your new item to forge.
Basic windows like an "Info Window" that shows you what the forged item does already exist, so we don't need to create that one- also I used the already existing "Window_ShopStatus"- why create something now that already is implemented so well?
Next thing we need is a scene class, that handles all the actions we do in our shop- like moving from one window to the other or buying something.
Here you see my classes:
Remember: Windows only show something- they actually never doing something- they are only like a picture, displaying something. The only one who does some work is the scene class (a little different is window selectable, but we'll come to that)
So were to start?
As a general rule, before you start doing a big script, make sure how exactly you want to have it work and how should it look like. For example, i always draw a layout on apiece of paper, looking were to place the windows and how big they have to be. The native resolution on VX is 544(x) * 416(Y)- keep that in mind and also write down how big in width and height each window should be.
Here's an example layout from me:
So now you know what you need and were to place it- so let's go to work!
Let's to the item list first!
Ok, here we go:
To make it easy- and we are lazy- we just copy the already existing "Window_ShopBuy" into a new field (strg+a, then strg+c to copy all), making a new window called "Window_ForgeBuy".
First thing we do: we change the class because it's a new window. So we write "class Window_ForgeBuy < Window_Selectable" on top instead of the old class name.
We don't have to modify much here, because we'll use the same shop list used in the original shop (with the old shop list, so we can use the list from the call shop event later on).
The only thing that changes is, which items are displayed as enabled (means they are not gray)- for this purpose, I replaced the old "enabled = ..." with enabled=$scene.incredients?(item) in the draw_item method. So $scene is always our scene_smith, so we will define "incredients?" later on (it means only to display the items as enabled you have the items needed for creation)
Also I removed the "self.contens.draw_text..." (also in draw_method) because I don't wanted to show the item price here.
For your own shop or menu: With self.contents.draw_text you can draw any text into a window at the assigned place- we'll use this later on a lot )
So here's the first script (not much changed, tough):
Window number one- finished!
Hey man- I don't want to just copy your lame script- what's the deal with this list?
So here we go again- just deleted one page of text by mistake. But as I'm willing to finish this tutorial, I'll write this chapter again