About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
World Teleport Location
Author Message
dragonfly3 Offline
Member

Post: #1
World Teleport Location
Using world teleport tutorial we have the teleport working but cannot see the position within the world. We are using an object with access mode set to constant for the teleport trigger instead of a particle. We set a waypoint to teleport to but the location is not changing.

Code snippet:
In SaveGame.cpp:
Code:
if(player_data.size()) // if the file contains any data
   {
      player_data.pos(0); // reset file position to the start
      Game::Waypoint *waypoint=Game::World.getWaypoint("TeleportFrom_pvpisland");
      //Vec v2 = waypoint->points[0].pos;
      Vec *v2 = new Vec(809, 16.5, 59);
      Game::World.objInject(OBJ_PLAYER, player_data, v2);

We think the objInject function isn't doing what we want. We thought the vector was the location to teleport to in the new world. Instead we always appear at the start point (start x,y,z axis of terrain) in the world.

Any ideas as to what we're missing or how we can get it to work?
11-12-2011 07:50 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: World Teleport Location
so the location is not changing at all, or you're transported to (0,0,0) position?
do you delete the original player before adding one from File data?

objInject works by setting position using Game::Obj::pos(..) if the position pointer is specified
11-13-2011 02:03 PM
Find all posts by this user Quote this message in a reply
dragonfly3 Offline
Member

Post: #3
RE: World Teleport Location
(11-13-2011 02:03 PM)Esenthel Wrote:  so the location is not changing at all, or you're transported to (0,0,0) position?
do you delete the original player before adding one from File data?

objInject works by setting position using Game::Obj::pos(..) if the position pointer is specified

Position isn't changing. We aren't being teleported to 0,0,0.

When you open the world editor and load or start a world the colored x,y,z axis arrows appear on the sea level grid. I assumed that this was a default start position for the camera. THIS position is the position that we are being teleported to. So I'm guessing this axis point for a world is more than just an editor camera default point and is somehow the default teleport point. We're just not sure how or where to find how in the tutorial/sample code.

We deleted the player from the Players structure in World1 as in the tutorial. It seems the only thing done to player data is:
Code:
player_data.pos(0); //reset file position to the start

We thought that adding a vector to the objInject function call would put the object there. Is there something that we are missing or forgetting?
11-16-2011 05:26 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: World Teleport Location
Hi,

Quote:colored x,y,z axis arrows
the axis is 0,0,0 position
you say that player gets teleported to that location:
Quote:THIS position is the position that we are being teleported to.
So I understand correctly you are teleported to the axis which is 0,0,0 position?
11-17-2011 01:37 PM
Find all posts by this user Quote this message in a reply
dragonfly3 Offline
Member

Post: #5
RE: World Teleport Location
Aaah, ok. I didn't realize that position was 0,0,0. So then yes, that is the location we are being teleported to.
11-18-2011 04:03 AM
Visit this user's website Find all posts by this user Quote this message in a reply
dragonfly3 Offline
Member

Post: #6
RE: World Teleport Location
So any ideas on what we are missing?
11-22-2011 10:44 PM
Visit this user's website Find all posts by this user Quote this message in a reply
dragonfly3 Offline
Member

Post: #7
RE: World Teleport Location
We don't want to teleport to 0,0,0. We want to teleport to the waypoint we have set. What are we missing in our code? Is there a better way to do this other than using a waypoint?
11-25-2011 03:40 AM
Visit this user's website Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #8
RE: World Teleport Location
I'm going to throw something in the ring here that might be dumb as I haven't read the whole thread, but have you looked at the Multiple Worlds tutorial in the Projects folder. I believe it does exactly what you want?
11-25-2011 03:45 AM
Find all posts by this user Quote this message in a reply
dragonfly3 Offline
Member

Post: #9
RE: World Teleport Location
Yes, we used the multiple worlds tutorial to do our teleport but we are not using a particle to teleport, we are using an object. The problem we are having is that when the player is teleported he's teleported to 0,0,0 and not the location we designated via waypoint.
11-26-2011 08:16 PM
Visit this user's website Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #10
RE: World Teleport Location
So why not use a "teleport" particle with no emitter so you can't see it at the location you want to teleport to.

Alternatively, just create your player at 0,0,0 in the world, then moving him to the right location after he's been created.
11-27-2011 01:40 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #11
RE: World Teleport Location
can you post your current code?

if you're teleporting to the same world, there is no need to use objInject, but just change player position

plr.pos(Game::World.getWaypoint("TeleportFrom_pvpisland")->points[0].pos);
11-27-2011 03:43 PM
Find all posts by this user Quote this message in a reply
dragonfly3 Offline
Member

Post: #12
RE: World Teleport Location
(11-27-2011 03:43 PM)Esenthel Wrote:  can you post your current code?

if you're teleporting to the same world, there is no need to use objInject, but just change player position

plr.pos(Game::World.getWaypoint("TeleportFrom_pvpisland")->points[0].pos);

I posted our current code at the beginning of this thread.

We are teleporting from one world to another. We are teleporting from pvpisland.world to teleport_test.world.

We have the actual teleport working, but it will not teleport to the waypoint we want it to teleport to. Instead, it keeps teleporting to 0,0,0.
11-30-2011 05:11 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #13
RE: World Teleport Location
are you using any custom save/load method for your player class? does it correctly handle super save load?
12-01-2011 12:04 PM
Find all posts by this user Quote this message in a reply
dragonfly3 Offline
Member

Post: #14
RE: World Teleport Location
We just copied it from the tutorial
12-01-2011 11:37 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #15
RE: World Teleport Location
what happens if you just teleport to current world to some other location:
player.pos(Vec(..));
does that work correctly?

if you use save/load during game (Game::World.save,load), does the player save and load correctly? (especially its position)
12-02-2011 04:43 PM
Find all posts by this user Quote this message in a reply
Post Reply