Teleporting to rooms

Doctorepic
06 Aug 2022, 16:24

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?


DarkLizerd
06 Aug 2022, 20:43

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


Pertex
07 Aug 2022, 16:04

player.parent = newroom
is better


mrangel
07 Aug 2022, 17:39

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)


Father
14 Aug 2022, 13:10

Sorry to be a pain but I cannot understand the instructions for allowing. teleports to unvisited rooms using map
I set up variable VisitRoom attribute room but cannot understand where block of code goes in, there seems no space. I am too old to learn or understand code. But usually I manage without . I have not used maps before but am trying this time.


DarkLizerd
15 Aug 2022, 10:39

Teleportation and maps don't mix...
When you move room to room, Quest can map out your movements,
BUT, when you jump to a different room, Quest doesn't "understand" how you got there so it screws up the map.


redrocket2000
15 Aug 2022, 11:58

Teleportation is simply done with this:

game.pov.parent=roomName

We use "game.pov" instead of "player", and the most logical explanation (at least for me) is that Quest is hardcoded to operate with "game.pov" as the player since the player object can change during the game (if you implement its code it's possible).


Father
15 Aug 2022, 17:27

There’s a code in the instructions for using maps that allows teleports to unvisited rooms . It involves creating a variable “VisitRoom “with an attribute “ room” and pasting in a block of code. I just wanted to know where I put the code in ? I don’t understand coding and only put it in if someone tells me to.


Father
15 Aug 2022, 17:32

Then put in game.pov .parent