Special conition for GO EAST
Brian5757
11 Feb 2020, 00:21Normally 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?
mrangel
11 Feb 2020, 02:47On 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.
Brian5757
11 Feb 2020, 04:11Thanks mrangel, I'll try that.
mrangel
11 Feb 2020, 10:22it'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.
Brian5757
12 Feb 2020, 00:04Thanks for the tip mrangel.