Gw Temp

Menu

Tutorial - 'Fork Conditions' by fakecowboy

An item about RPGMaker 2000 posted on

Blurb

Learn the basics of forks as fakecowboy explains them using a Random Treasure chest example.

Body

Forks have literally a ton of possibilities, that’s why they are called ‘forks’! Some people underestimate these handy little functions, but they can be extremely useful. For example:

Say you want to create a treasure box that gives you random items, or none at all. What you can do, is use a variable randomizer and forks to control it, here’s how:

Create an event; let’s call it “treasure1”. Make sure it is set to push key, unless you want other wise. Inside that event, first make a variable called “treasure1” (Wow how exciting…) make it a random number from 0 to 2. Next create a fork conditions (found on page 3 of the functions, right side). On the fork it should display some options:



Switch: You can make things occur if a certain switch is on or off.
Variable: Same as a switch, but a variable can be more than just on or off.
There is WAY more options, so after the tutorial I suggest you explore them all. If you have any further questions about these you can email me.

Ok, for the first possibility we need to make the fork variable set to 0 (default). Basically what this does is shows you this code:
<>FORK Optn:Varb[0001:treasure1]-0
<>
: ELSE Case
<>
: END Case
<>

(note: your variable may not be 0001, just whichever is your “treasure1” variable is fine).
The <>FORK Optn:Varb[0001:treasure1]-0 just means that if the “treasure1” variable is set to 0, then perform these tasks.
The : ELSE Case means that if “treasure1” doesn’t equal 0, then do something else, or perform another FORK to see if it equals another number.
The : END Case is what happens at the end of the fork, no matter what. So in this we would probably place a switch to make the treasure box open, and so you can’t get any more items from it.

Back to the code! Under the <>FORK Optn:Varb[0001:treasure1]-0 place a message that says “You got a Sword!” (or whatever you want) and then add an item to the party, or do basically anything! Under the ELSE Case, place another FORK (or copy the present one and paste DIRECTLY UNDER the ELSE Case, where the “<>” is) with the same settings as the previous, except make the variable set to 1 instead of 0. Now set all the things you would need to your hearts content, I chose to add money, with a message of “You got 15 gold!”. (Note: At this point you can stop and have a fully functional treasure box randomizer, but you can also choose to proceed with the tutorial.) Once more, place a FORK under the ELSE case of the previous one. This time set the variable to 2. Your even window should look like this:



Inside this FORK you make wish to make it say “Hah hah too bad, no treasure” or use a little more creativity and make an arrow fly at your character (maybe in the next tutorial), but from here you are limitless in what you can do. This is the technique that exceptional RM coders such as Qheretic, blue_moogle, and RPG use to create side view battle systems. I am the best at it though ;-). Make sure to make your treasure box have 2 pages and set a switch in END Case to make the treasure box empty. Good luck on your future games!