Darn you Hito, I didnt see your variables topic *rolls eyes* Delete this now
This tutorial is completely community ran, so if you feel you would like to add/change anything, feel free to do it!
Table of Contents
1.What Are Variables?
2.How Do They Work?
3.Internal Variables
4.External Variables
5.Using Variables To Track Game Progress
6.Using Variables To Track Money
7.Using Variables To Trigger Events
8.Using Variables To Track Passing of Time
9.Q&A
Section 1: What Are Variables?
Variables are numeric strings that stores a value to something that the creator chooses, think of them as a box that holds numbers inside.
Section 2: How Do They Work?
When a creator decides to create a variable, there is always a reason for it, and there are millions of things to use a variable for. The most common types being explained later on in the tutorial.
When stored, a variable stays in memory as a numeric string which can be recalled at any time the creator needs it. All variables have a default value of 0. It is also best to keep track of variables in a notebook so you don't forget them.
Section 3: Internal Variables
Internal variables are assigned to specific people, towns, or dungeons, and are used to more easily keep track of what each variable does. Internal and External variables behave the same way, and they are not restricted to being used by the named area/person(For example, you could use a "Misty Town" variable for something in "Water Town". Of course this makes no sense, it's just used as an example .)
Section 4: External Variables
External variables are global, which means they can be used for any number of global events, such as controlling money flow(as explained in Section 6), keeping track of how many enemies one has killed, and any other global cause, and again Internal and External variables behave the same way.
Section 5: Using Variables To Track Game Progress
Most often used with External Variables, assign a variable to "Game Progress" in your notebook, lets say for example you used Variable 01, when you start the game it'll default to 0, when the player completes the first section of the game, change the variable to "1", and so on.
This is best used when you want people to say new things depending on what section of the game you're in, also, you can use this to unlock more towns/dungeons/secrets, or anything, it is a very useful variable to have because of the vast amount of uses it has.
Section 6: Using Variables To Track Money
Since RPGM3 doesn't have a money condition in its scripts, its pretty much up to the user to track it. Why would this be useful? Let's say you wanted custom stores, or you have to buy skills or magic or anything else other then items from someone, this would have to be done.
The only thing with this is that you have to have all your battles event based, and if you include random battles, you CAN NOT under any circumstances allow the player to win money from these random encounters OR obtain money from "treasure" events.
First thing is to assign a "money" variable, we'll use Variable 01. Now when you script you have to make sure that whenever the player recieves any money, you also have to increase that variable by the same amount of money recieved, for example, you fight a battle and you win, if the enemy gives you 30 gold, you also have to increase the variable by 30, this way both the variable and money stays the same.
When creating a custom store, when you go to buy something from it, let's say for 30 gold, you'll have to put a val-cond branch before the purchase.
EX:
Code:
Val-Condition -> If Variable 01 >= 30G Lose Gold -> 30 Variable 01 -30 [item] -> +1
This is probably the most common use of variables. Let's say Jack has to talk to "Billy" before getting an item from "Maria". How would you accomplish this? Using a variable! When creating the message for "Billy", add this script(good to use Billy's internal variable for this):
Code:
"Hi my name is Billy, go talk to Maria to recieve the item you seek" Billy Internal Variable 01 +1
Code:
Val Branch Internal Variable:Billy 01 = "0" "Go talk to Billy" = "1" "Heres your item"
Here's another good variable use, tracking the number of days that has passed. Its simple, whenever you sleep, add +1 to the variable you select as the "Day" variable.
The downside to this is that you cannot use pre-made Inns, you'll have to make your own custom script Inns.
With this variable you can use it to make certain events happen on certain days, you can also make the days reset after a certain amount(such as 30 for a month, 7 for a week) and have events repeat depending on what day of the month/week it is.
Chapter 9: Q&A



thanks
Comment