Unlocking a door and allowing the player to move pass the door
Brian5757
08 Mar 2020, 01:42I'm trying to find a way to have the player unlock a door in room 1 then be able to move to west room 2
If I select Exit:Room 2 then I can tick the "locked" option so if I try to go west then I get the message "That way is locked" (the message I decided to use)
If I pick up the key and unlock the door then how am I able to remove the barred west direction?
I tried a script for 'After Unlocking the Object' from the container tab which changed the Exit:Room 2 locked flag to false but that does not seem to work.
I also tried giving it a name "Door 1" as suggested but with no luck.
mrangel
08 Mar 2020, 01:59I tried a script for 'After Unlocking the Object' from the container tab which changed the Exit:Room 2 locked flag to false but that does not seem to work.
That sounds like it should work; what's the actual script you're using? Are you sure you're unlocking the right exit?
(I know that sounds an obvious thing to check, but it's the only issue I can think of)
I've never actually used it quite that way; instead of locking the exit, I only lock the container-door, and then give the exit a script like:
if (GetBoolean (name of door/container, "locked")) {
msg ("That way is locked")
}
else {
MovePlayer (this.to)
}
But I'm pretty sure both methods should work just the same.
Brian5757
10 Mar 2020, 00:06Hi mrangel.
Quest can't find the function 'MovePlayer' in your suggested code. However I changed the code to MoveObject(player, this.to) and this worked.
The 'this.to' is useful to know thanks.
mrangel
10 Mar 2020, 02:14Sorry, my bad :p MovePlayer only exists in Gamebook mode.
I normally would use game.pov.parent = this.to
anyway, but figured I should try to make the code more readable.
Brian5757
10 Mar 2020, 08:43Hi mrangel.
It's interesting how there is more than one way to do things in Quest.