Charas-Project
Game Creation => Requests => RPG Maker Programming => Topic started by: SqareMan on September 20, 2009, 03:46:10 AM
-
I need a good tutorial on variables please!
-
Variables are expressions.
A conditional branch and event precondition have the option to check if the expression is true.
You can set a value to an expression, decrease it, increase it, set it equal to or give it a random value between something and something.
In a conditional branch:
You chose that you want to check a varaible - an expression
You enter the expression the maker should check. i.e: "If varaible 1 is equal to 5"
If the variable "Variable 1" have the value of 5 - the expression is true and the "true" fork of the conditional branch will play.
In a precondition:
Say that you have a mercenary who offers his services. He wants buckles if you want him to fight with you.
The merc event have 3 pages.
1: A page with nothing.
2: A page with the precondition that "variable 2" is larger than or equal to 3000.
3: A page with the precodition that the switch "merc in party" is ON.
Now, the first page is just when you speaks to him. He'll tell you that he want nothing to do with you unless you pay up.
The second page however will only exist if the precondition is true. In this case. If the varaible 2 is large than or equal to 3000.
If you have 3000 or more buckles - the event will play. Otherwise it won't.
(PS: You can make this easier by placing a conditional branch in the first page with the same check. This was just so you understand it.)
So - to sum it up. Variables are much more flexible than switches.
Switches are either On or Off. Yes or No. True or False. there are two options. Nothing more.
Variables on the other hand ranges from -9999999 to 99999999. So you can check if you have a certain amount of items. use them as health bars, use it as a pedometer. The list goes on. Programming with c++ as such depends on variables after all.
-
Thanks :), but what are buckles?
-
He's just saying if you have x number of ___________, then the variable will trigger a different event. Buckles were an example item.
I think.
-
I figured buckles would be currency.
That is what most mercenaries' services are purchased with.
-
I figured belt buckles, but that'd be ridiculous.
-
Maybe Purple had a utopian setting in mind. Can't imagine there would be too much work for a mercenary in a paradise. To the point that they can't even afford belt buckles.