Many adventure games use locked doors to keep the player out of certain area's until they have completed earlier parts of the game and obtained the key from where it was hidden, or were given it by another character as a reward for completing a quest.
A locked door blocks the path between two locations, so it must exist as a static object in both of them.
You could place a separate door object at each location, but then it would be difficult to synchronise them so they are both open, closed or locked at the same time.
Fortunately ADRIFT provides a better way. You can place a single static object in several locations by using a location group.
Open the "Groups" folder, right-click on it and select "Add Group" to open the New Group dialog.
In this example i am creating a doorway between a hallway and a study, so i enter an appropriate description, ensure the group type is set to "Locations", and click on the boxes next to those two rooms to tick them:
Select two adjacent rooms in your own game that you want to have a doorway between, and press "OK" to save the group.
Next, add a new object to your "Objects" folder.
This will be the key that unlocks the door. Give it a name and a description then make it a dynamic object so that the player can pick it up and carry it around.
Put the key somewhere the player can find it by setting its "Initial Location" to "In Location" and selecting a location.
Create another new object. This will be our actual door object, so give it a name (eg. wooden door, red door, study door) and a description.
- Set the "Initial Location" to "Location Group" and select the group we created above from the dropdown list.
- Switch to the Properties page and select the following properties for your door:
- "Object can be opened and closed" (Selecting this allows you to select the next two dependant properties).
- "Object can be locked" (This adds Locked to the Open Status selections, and the Key for lock property).
- Change Open status to locked.
- Select your key object from the "Key for lock" dropdown.
- Edit one of your door's locations and select the Directions tab.
- Add the link to the second location to the direction that leads to the other side of the door, if its not already set.
- Click the new restriction button and create the following object restriction:
- In the text box of the description is written a message to be displayed if someone tries to go through the door when it is closed.
- This restriction requires the player to first unlock the door and then open it before they can move through it. If the restriction was [the study door][must not][be in state][Locked] then they could go through the unlocked door without having to explicitly open it as well.
After clicking OK you will see the restriction listed next to the destination for the direction:
- Depending on your settings, this restriction may be copied to the second location automatically, or you may be asked if you want to. If not, then duplicate the restriction in the second location for the opposite direction.
- The door will now block movement in both directions, until it is unlocked using the key.
- If there are multiple directions leading through the door, such as "north" and "in", then you need to add the same restriction to all of them.
Describing the two sides of the door differently
If you want the two sides of a door to have different descriptions then you can create Alternate Descriptions using restrictions on which of the two locations the player is in.
- Right-click the description text box of the door object and select "Add Alternate Description"
- In the new text box tab, type the extra details that only apply to one side of the door. (This will be displayed following the Default Description)
This will cause the description of the brass knocker to only be appended to the description of the door when the player is in the front yard.
- You can also add an extra description to the other side of the door by creating another alternate description and giving it the restriction that the player must be in the other room.
- If the two sides of the door are completely different, then just change the compositing option of the alternate description from "append this to previous" to "start description with:" using the drop-down list to the right of the restriction. Then write the description for the other side of the door on the "Default Description" tab.
When a game requires the player to periodically return to a home base it will often provide a short-cut to a later area that only becomes available after the player has completed that area.
One way to do this is to have a door that can only be opened from one side.
- Create a location group for the doorway and select the locations for the two sides of the door.
- Create the static door object and set its location to the above location group. (Called "The side door" in the examples)
- Select the "Object can be opened and closed" property and set "Open status" to "Closed".
- To stop the player from moving through the closed door, add an object restriction "The side door must be in state Open" to the correct line of the Directions tab of both locations.
These restrictions can be given appropriate descriptions such as "You need to open the door first" and "You can't go through the door because it is latched from the other side"
The Lock/Unlock commands always use an object as a key, but a latch is part of the door so we dont want to use the lock/unlock mechanism.
The door can be opened, but only from one side, so we need a restriction that prevents the "open door" command from working when the player is on the wrong side.
- Create a specific task for "Open %object%", then make it specific to this door.
- Enter a message saying thet the door can't be opened from this side.
- Ensure task is repeatable.
- Add a restriction that the Player Character must be at the location that we DONT want them to be able to open the door.
- You could add a similar specific task, for the location on the other side of the door, to display a more informative message like "You lift the latch and slide the door open". This would be set to "Run Before" and "Execute parent actions" so the door opens. "Display parent message" can be selected if you want to display something like "(First lifting the latch)" followed by the default message.
- You may want to create a static "Latch" object in the room, in case the player tries to "examine latch" or "open latch". The description would just say that the door can be opened easily from this side, but not the other side.
- "Open Latch" can be overridden to open the door, but remember to add the restriction so it only works from the correct side.
- The player may also try "unlatch door", so you may want to add a general task for an "unlatch %object%" command and a specific "unlatch door" task which also opens the door.
- "Unlock Door" could also be overridden so that it opens this door instead of giving an "It is not locked!" message.
|<<< Connecting locations using the Map||Introductory Tutorials||Drawers and Cupboards >>>|