Teleporting to rooms

Okay, I assume this is a super simple problem. I started using quest today and can not figure out how to make a script teleport the player to another room. Can anyone help?


Short answer:
player.room=newroom
newroom is where you are going to.
and player.room is where you are now.
I don't think it's correct to say player.room, but I think you get the idea.
Also, in the UI, there is a command for moving the player to a new room.
(And I think this was covered recently.)
https://textadventures.co.uk/forum/quest/topic/xu_lksiiz0_db6bdnkm7da/teleportation


player.parent = newroom
is better


player.parent = newroom
is better

game.pov.parent = newroom is better.

Even if your player object is named player, you shouldn't get into the habit of relying on that. Because someday you might have a game where there's multiple playable characters or something, and then you'll type player without thinking and end up with a bug that can be a real pain to track down. game.pov is always the current player object, so if you get into the habit of using it, you won't have those problems.

(it's also useful if somebody else finds this thread when looking for help with a similar problem; because a new user might have renamed the player object to the name of the character or something)


Log in to post a reply.

Support

Forums