Chopping through a locked door with an axe

From ADRIFT 5 Manual Wiki
Jump to: navigation, search

This example is from the game "Jacaranda Jim" by Campbell Wild.

What if the player needs to get through a locked door, but instead of the key they are carrying an axe.

They should be able to use it to chop down the door, but the verb "chop" is not defined in the standard library.

So, as with any new verb, this needs to be set up as a General Task. The task is defined with a very simple command:

ChopObjectWithObject.jpg

The default response for chopping an object with another object is simply an error, saying you can’t chop the first object with the second one. Because, for example, if the player tries to chop a door with a torch, I need to tell them that's not a good idea, but they still need to know that chop is a valid action. For an explanation of the functions used in this response, see the Functions section.

I added a few restrictions to the task as follows:

ChopRestrictions.jpg

Most General tasks will have restrictions that any objects referred to must exist, that they have been seen by the player (because if they haven't, they may as well not exist as far as the player is concerned), and that the object doing the chopping (Referenced Object 2) must be held. I also need to ensure that the object the player is trying to chop is visible, otherwise I give an error saying "You can't see that."

There are no actions for the default 'chop' command, because it is generic and I don't want anything to happen when the user tries it on an incorrect object.

Now, if the player tries to chop something with an axe, I don't want a generic "You can't do that" sort of response. So I can create a Specific task for the axe by selecting the axe from the second object hyperlink, like so:

ChopObjectWithAxe.jpg

I can then give a sensible response to this action when the player tries chopping random objects with the axe. This task is a sort of cross between a General task and a Specific one, because one reference has been left general, and one has been specified.

Clearly, many objects could be changed drastically with an action such as this, so the real purpose of this task is to prevent us having to create a response for every single object the player tries to chop. There are no restrictions (because it obviously passed all the General task restrictions) and no actions (because it is again a generic response) on this task.

There will be certain objects that when chopped, you want to give a specific response to, or do actions. In my case, I want something specific to happen when the player tries to chop through a door. So I create a new Specific task which overrides the General/Specific task defined above, like so:

ChopDoorWithAxe.jpg

In the actions for this task, I increase the score. I also have a restriction on the movement from one of the rooms that depends on this task being completed.


<<< Adding a new commandMain PageClimbing a Tree >>>