Special conition for GO EAST

Normally when the player types GO EAST then the player is taken to another room if there is a room in the East direction.
I have a special condition where the player is told that there is a door to the East of the player. This door is closed and needs to be opened for the player to move into a new room. if the player types GO EAST without opening the door then the player gets a message YOU CAN'T GO THOUGH CLOSED DOORS.
The problem is if I put this in the Commands section of Quest then every time I type GO EAST a check is make to see if DOOR 3 is available and if DOOR 3 is open, if not then the command fails, which stops me from going East elsewhere in the game.
Is there a solution please?


On the exit going east, you can put a script which is run instead of moving them when that exit is used.

You'd probably want the script to look something like:

if (GetBoolean (door3, "isopen")) {
  MovePlayer (this.to)
}
else {
  msg ("You can't walk through closed doors.")
}

This assumes that there is a separate 'door' object in the room, which can be opened using the standard open/close mechanic.


Thanks mrangel, I'll try that.


it's probably worth mentioning that Quest's built-in open/close/lock/unlock commands are designed to work with containers.

If you want to have the player opening and closing a door, one simple way is to make the door a container, and then change its addscript attribute ("Script to run when trying to add an object" on the Container tab in the GUI) to something like:

msg ("You can't put it there.")

(which prevents Quest doing silly things if the player types something like "put fish in door")

I do think that "openable" and "lockable" should be types separate from "container"; but that's not the way Quest currently works.


Thanks for the tip mrangel.


Log in to post a reply.

Support

Forums