Teleporting
by Mike G · in General Discussion · 01/27/2012 (11:01 am) · 6 replies
I am trying to make a code where i can teleport to other players or teleport them to me. I am trying to figure out how to change my position by typing in 12 15 14 basicly.
THANKS!
function TPCODE::setPOS()
{
%tempHolder = LocalClientConnection.getControlObject();
%tempHolder = %tempHolder.getposition();
TP_PositionSelector.text = %tempHolder;
}This is the script that lets me find my position. How would i set my current position without going into editor?THANKS!
About the author
#2
We cover this in the T3D 1.2 demo/tutorial.
01/27/2012 (12:19 pm)
@Mike G - Something like this:// Center of the world. Replace with your actual TP position %teleportPosition = "0 0 0"; %rot = getWords(%player.getTransform(), 3, 6); %targetPosition = %pos SPC %rot; %player.setTransform(%targetPosition);
We cover this in the T3D 1.2 demo/tutorial.
#3
How would i use that code to select my position from a UI?
I want to be able to type the code in and go to that position.
Thanks!
01/27/2012 (1:10 pm)
@Michael PerryHow would i use that code to select my position from a UI?
I want to be able to type the code in and go to that position.
Thanks!
#4
01/27/2012 (1:35 pm)
@Mike G - I'm not quite following. So you want to type the position in a GUI and then use that to teleport?
#5
01/27/2012 (5:52 pm)
Yes. My goal was to be able to teleport to players. All i want to do is type their coordinates and teleport their.
#6
You should check out the section of the FPS Tutorial that covers networking: Networking in T3D
01/27/2012 (6:30 pm)
Once you get the text coordinate, you need to send it across the network. function WarpPlayer(%position)
{
commandToServer('TeleportPlayer', %position);
}
serverCmdTeleportPlayer(%client, %position)
{
%rot = getWords(%player.getTransform(), 3, 6);
%targetPosition = %position SPC %rot;
%client.player.setTransform(%targetPosition);
}You should check out the section of the FPS Tutorial that covers networking: Networking in T3D
Associate Scott Burns
GG Alumni
So for instance: