Game Development Reference
In-Depth Information
Riddles!
Riddles are one of my favorite ways of flexing my gray matter. Quite a few RPGs have one quest or another that involves
having to solve a riddle. For this exercise, we'll have that locked door pose a riddle to the player when he/she
interacts with it. If the player can answer the riddle correctly, the door will open; otherwise, it will remain shut,
patiently waiting.
Overview
How do we begin? We have two ways of handling a riddle.
We could use Show Choices to display three possible answers and a Cancel option.
Alternatively, we could have Show Choices display four answers and set the “When Cancel”
option to Disallow (forcing the player to choose an answer) or Branch (and then have a
Continue/Cancel branch pop up if the player would rather not try to answer).
We can use Name Input Processing to have the player write his/her answer to the riddle in
question and then have a conditional branch that triggers if the answer is correct.
I'll be showing off the second method, as it is a little more involved eventing-wise.
Our Riddle of Choice
The first order of business is to figure out what riddle we want the player to solve. I'll be using a classic riddle solved
by Oedipus. Here it is (well, one translation of it, anyway): “What is that which has one voice and yet becomes four-
footed and two-footed and three-footed?” (The traditional answer for that, by the way, is man. For the purposes of this
exercise, we'll make human the answer.) As the correct answer has five letters, we want the input box generated by
the Name Input Processing command to have a limit of five characters. As you may have already noticed, we are using
this event command in quite an unconventional way. It is intended as the means of changing a character's name. For
example, you could have a Name Input Processing event that allows the player to change Eric's name to something
else. Here, we want to use the command, to allow the player to answer a riddle.
Creating Our Riddle Event
To begin, you'll want to make your way to the Actors tab of the Database and increase the maximum number of actors
from ten to eleven. Once you do that, you'll get a blank actor on the new slot. That's exactly what we want. You could
have a portrait for the riddle giver in this way, if you so desire. Because the player is talking to a door, we'll skip that.
Next, we have to write the player's input into a variable. This is where we call upon scripting once again to come to our
aid. Thankfully, the scripting required is not nearly as elaborate as that for the Smoke Bombs in Chapter 9. We need
scripting for four small things.
1.
Placing the blank actor's name into a variable. We need to find out where RMVXA stores
actor names.
2.
Using a Ruby method to make the player's answer case insensitive.
3.
Using the Script option in the Conditional Branch command to write out the conditional
we need.
4.
For subsequent attempts, we want to clear out the blank actor's name before the player
tries again.
 
Search WWH ::




Custom Search