locked door

how do i make it so a player can use a key on a locked door so they can get through?


Many methods but I use this...

  1. Have object door with open verb attached. Make statement that says it’s locked.
  2. Have invisible exit.
  3. Have use verb on object key on object door.
  4. Make door invisible (or remove object door), remove object key, and make exit visible.

It’s cheap but it’s easy especially if the door no longer needs to be visible. And why would it? It’s already open. Using doors as containers is a pain in the ass. Just an FYI.


Using doors as containers is a pain in the ass.

It is the expected way to do it, however, especially now that 'open' and 'close' are reserved, meaning the suggested first step above doesn't work in the latest version of Quest.

Another method would be:

  1. Decide on the desired behaviour of the door. Let's assume that commands to open, unlock, and go to the room beyond the door, nextroom, all result in the door being automatically unlocked, opened, and the player going forward into that room, if the player has the key.
  2. Define the door as a container with (a) isopen set to false (open is the default); (b) in the script section for "after opening the object" put: MoveObject (player, next_room) (c) identify the key that will open the door; (d) if desired, fill in the message fields associated with open, close, lock and unlock. (e) leave the defaults of the door being unlocked and opened automatically if the player has the key.
  3. For the exit into the next room, select "run a script (instead of moving the player automatically)" and insert the code do (door, "openscript")
  4. Define the script for the command "use key with door" in the same way do (door, "openscript")

This seems to work pretty well, though at the moment there does seem to be a problem if you try to close the door after going through it, using door.isopen = false


can't you use the 'openable' Object Type? (or, has this been removed in the most recent version of quest (I'm still using '550', before Pixie's improvements-to/development-work-with quest software/engine) ( http://docs.textadventures.co.uk/quest/attributes/openable.html )

but, you'd still have to handle the 'locking' stuff (you'd just have to add the built-in 'locked' Boolean Attribute, along with all the handling)

http://docs.textadventures.co.uk/quest/attributes/container_lockable.html

hmm... maybe you could use the 'surface' and 'container_lockable'... if not... then you got to implement the 'locking' stuff yourself (see the 'container_lockable link' above, along)


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums