Climbing a Tree
In this tutorial you will create a tree that the player can climb up into.
We will be demonstrating how to add new commands (verbs) to ADRIFT using a general task, how to change the way the standard commands work at a specific location, and how to call an existing task from your own to execute its actions and give its output.
Creating a tree
First create a "Front Yard" location in which you describe a large climbable tree.
In its description text box add a more detailed description of the tree than you had in the front yard description. You could describe what type of tree it is, how tall it is, and what the player would see looking up into it.
Close both of these items with their OK buttons and create a new location called "Top of tree".
We should get a good view from up here, so in its text box we could describe what all of the surrounding area would look like from above, and say how far into the distance they can see.
On the directions tab select "Front Yard" as the destination for the "Down" direction, then click OK to close the location.
ADRIFT will ask you if you want to create the reverse link "Up" from the front yard to the top of tree (unless you have turned off this feature). Choose YES.
Climbing up & down
ADRIFT already has a "Climb %object%" general task, so we override it with a specific task for our tree object.
Add a restriction so that our climb task is specific to the player being at the "Front Yard" location.
- Leaving the restriction's text box blank causes the default (general task) message to be shown, or you could add a message like "There are no climbable tree's here" that is shown if the player types "climb tree" at another location.
- We will be using this same restriction, or one for the "Top of tree" location, in most of the specific tasks for the tree.
We want the player to be at the "Top of the tree" location after climbing it, so add an action to move them there:
If the player types "up" or "climb up" instead of "climb tree", then they will just get the default "You move up" message.
To change this you can override the "Player Movement" task with a specific task for the "up" direction, and with a restriction for the "Front Yard" location.
The UP and CLIMB TREE commands are separate commands that in this case we want to give the same output and do exactly the same actions. Instead of re-entering the description and any restrictions and actions, we can just call the existing task like this:
Dropping Objects to the Ground
If we drop an object while we are at the top of the tree then it should fall to the ground below. To do this we need a specific task that overrides the default "Drop Objects" and describes the object falling.
Make it specific to this location by adding a restriction that the "Player Character" must be at the "Top of the tree".
The dropped object needs to end up in the front yard below the tree, so add an action to move it there:
Jumping out of the Tree
The standard library (v5.00.21) does not have a "Jump" command, so we need to create a general task to add it.
A general task describes what the command generally does. Most of the time jumping wont do much so we do:
But if they jump while at the top of a tree then they are going to end up at the bottom of it, so create a specific task for "Jump" with a restriction that the player must be at the top of the tree.
If its a particularly tall tree and there is nothing soft to land on then they may be seriously injured, so we would describe a bad fall in the task and then call the "End game in defeat" action.
Requiring an Object to Reach the Lowest Branch
If climbing the tree is part of a puzzle the player needs to solve then we may want to make it a bit harder.
Lets move the lowest branches up out of the players reach so that they need to use a ladder or stand on a chair to reach them.
First change the description of the tree object to say that the lowest branches are just out of the players reach.
Create a dynamic object like a ladder or a chair that the player could bring to the tree and climb to reach the branches.
Put this object somewhere nearby so that they can find it and carry it to the front yard.
Now add a restriction that requires this object to be at the "Front Yard" location, to both the "Climb tree" and "Up (Front Yard)" specific tasks.
The failure message for these restrictions should say something like "The lowest branch of the tree is too high for you to reach".
When the player brings the ladder to the tree they can say "drop ladder", but they might also try "put ladder against tree" or "put chair under branch" or anything else that sounds reasonable. You should add general and/or specific tasks for any command that seems reasonable, using an action to move the ladder to the front yard location.
Instead of "climb tree" they might try "climb ladder", "use ladder" or "stand on chair", so ensure you create specific tasks for each of these, containing an "execute task climb tree" action.
- Any object that the player can bring to the tree and stand on or climb should work unless there is a good reason why it wont.
One good reason is that its not high enough. If the player needs a ladder to reach the branch but can also carry a chair there, then we need to add a specific task to override "stand on chair" to give a message like "You are still not high enough to reach the branch, you will probably need a ladder".
|<<< Chopping through a locked door with an axe||Main Page||Refreshing the screen display when entering a location >>>|