Fork Conditions Tutorial
by Psygon

What's a fork condition?
A fork condition is a way of determining if the player has done a certain thing, then having different things happen depending on whether they did it or not. It's a bit like Event pages, but easier to use. Fork Conditions are vital to making a good RPG.

To make a fork condition...
Step 1.
Make a new event, and set everything up.
Step 2.
Create a new action, and go to the third page. There will be a button marked "Fork Conditions". Click it.
Step 3.
A wndow will come up, asking what type of fork condition you want. The types are:

Switch:
This type of fork condition is based on whether or not you have set a certain switch on or not. (You do know about switches right? If you don't read Iron Knight's great switch tutorial or one of the switch tutorials at Don Miguel's site) Check the switch button, and click the [...] button beside the first box. A window will open displaying all of your game's current switches. Choose a switch and click OK. Your event page will look something like this:

    <> FORK Optn:Switch [0001: ASwitch] - ON
     <>
    :ELSE Case
     <>
    :END Case
     <>

The "<>" on the second line is what will happen when the conditions are met. Under the ":ELSE Case" is what will happen if the conditions are not met. Whatever is after the ":END Case" is what will happen after the fork condition is over, if the conditions are met or not.  For example, if you put

    <> FORK Optn:Switch [0001: BeatTheBadGuy] - ON
     <>Messg:You beat him!
     <>
    :ELSE Case
     <>Messg:You must defeat that evil
         :           guy before the world is
         :           safe again.
     <>
    :END Case
     <> Move Event...: Hero, Start Jump, End Jump
     <>

In this example, if the switch " [0001: BeatTheBadGuy] " is ON, a message will appear saying "You beat him!", then the hero will jump. If the switch ISN'T on, a message will say "You must defeat that evil guy before the world is safe again.", then the hero will jump.

Switch fork conditions are the easiest type to use. Let's see some others.

Variable

The next option is the Variable fork conditions. Click the variable circle, then click the [...] box and choose which variable to use. Below the Variable circle, there are two options that you can choose. One of them says "Set" and the other is a menu. The set option should be checked if you want to see what the variable is in relation to the number. In the menu, there will be a few options: (in these examples, the number is "5")

Same: This means that the variable has to be exactly the same as the number chosen. So in this case it must be 5.

Above: This means that the variable has to be the number or above.

Below: This means that the variable has to be the number or below.

Bigger: This means that the variable has to be bigger than the number.

Smaller: This means that the variable has to be smaller than the number.

Others: This means that the variable has to be anything BUT the number.

For this example, choose "Above".

    <> FORK Optn:Varbl[0001:TheVariableofDoom]-5abov
     <>
    :ELSE Case
     <>
    :END Case
     <>

The rest of this works exactly like the switches fork condition.
(So the second "<>" means if the variable is the number above, the third "<>" means if the variable is not the number or above, and the third "<>" is what will happen afterwards either way.

Timer

Now click the circle next to timer. Set the number of minutes and seconds you want this fork condition to be based on. In the third box, you can choose whether you want the timer to be above or below the time you have set. For this example, I have set the time to 10 seconds or more.

    <> FORK Optn:Timer  0m.10s.more
     <>
    :END Case
     <>

This works exactly like the switch type of fork conditions also, except it doesn't have an ":ELSE Case". A useful thing to do with this type of fork condition is set the time to 0 seconds or less, so when the timer runs out, something happens, like this:

    <> FORK Optn:Timer  0m.00s.less
     <>Messg:Too Late! Try again.
     <>
    :END Case
     <>Messg:OK.
     <>

In this example, if the time runs out, it will desplay the message "Too Late! Try again." then the message "OK."

Money

This option allows you to say different things depending on how much money the player has.  Choose an amount (in the examples I use I picked "50").  Then choose whether the player needs to have "above" the amount or "below" the amount, like in the Timer fork condition  (in the examples I use I picked "above"). You will see this:

    <> FORK Optn:Money  50abov
     <>
    :ELSE Case
     <>
    :END Case
     <>

You already know about ":ELSE Case" and all that, so I won't explain it again. This type of fork condition is often used in a little shop. For example:

    <>Messg: Would you like to buy a rose?
    <> FORK Optn:Money  50abov
     <>Messg: You have enough! Here you go.
     <> Add/Remove Item:Rose-> 1 Incr.
     <>ChangeMoney:ChangeMoney50Decrease
     <>
    :ELSE Case
     <>You don't have enough money! Sorry.
     <>
    :END Case
     <>Messg:Thank you!
     <>

Item

Choose the item you want this based on (I chose "Rose"). Choose "Has It" or "Doesn't Have It" (for the example, I chose "Has It")

    <> FORK Optn:Rose Item Got
     <>
    :ELSE Case
     <>
    :END Case
     <>

As usual, the first "<>" is if you have the item, and so on.

Hero

Pick the Hero you would like to base this on, then choose an option about that hero. The options are...

Name: This doesn't do much because the "Choose Hero Name" event doesn't work.

Level: If the hero is at or above a certain level or not.

HP: If the hero has an amount or above the amount of HP or not.

Special Skill: If the hero has a certain skill or not.

Item: If the hero has a certain item EQUIPPED to him.

Condition: If the player has a certain status change. (EX. poison, sleep, etc.)

Example.

    <> FORK Optn:Bob- Poison is in condition
     <>Messg:Bob is poisoned! Stay at the inn
         :            to cure him.
     <>
    :ELSE Case
     <>Messg:Look's like Bob is healthy as usual.
     <>
    :END Case
     <>Messg: Check out the inn!

Direction

This is very self-explanatory, it's if you are facing the specified direction or not. EX:

    <> FORK Optn:Hero- Up Face Direct
     <>Messg: Hi!
     <>
    :ELSE Case
     <>Messg: Face UP!!!!
     <>
    :END Case
     <>

Vehicle

If the player is riding a certain vehicle or not.

Start by decision key

If the player pushed a key or not.

Play BGM Once

If the background has played a full time around or not.

Fork conditions in fork conditions?

If you wanted the player to have to set 2 switches, you could do it like this:
 
    <> FORK Optn:Switch [0001: SwithThing] - ON
     <> FORK Optn:Switch [0002: SwithThing2] - ON
      <>
     :ELSE Case
      <>
     :END Case
      <>
    :ELSE Case
     <>
    :END Case
     <>

The first "<>" would be if both switches are on.
The second "<>" would be if the first switch is on but the second isn't.
The third "<>" would be if none of the switches are on.
The last "<>" will happen after any of these.

    <> FORK Optn:Switch [0001: ABCSwitch] - ON
     <> FORK Optn:Switch [0002: SwitchBlah] - ON
      <>
     :ELSE Case
      <>
     :END Case
      <>
    :ELSE Case
     <> FORK Optn:Switch [0002: SwitchBlah] - ON
      <>
     :ELSE Case
      <>
     :END Case
      <>
    :END Case
     <>

This script will allow you to check if the first switch is off but the second is on.
 

Closing

Thank you for reading my fork conditions tutorial! I hope it helped you understand fork conditions better.

copyright 2001 Psygon
copyright 2001 Crystal Fyre Studios
copyright 2001 Gryphonsoft