Author Topic: What was that one command that lets you change your character's position?  (Read 1850 times)

I remember there being an eval function that allows you to teleport your player, like fcbn("TristanBomb").player.setPosition(); or something.

If that isn't working, did you define fcbn

If that isn't working, did you define fcbn
I changed it to findClientByName, turns out fcbn was added by the eval add-on. However, I still don't know the function :/

playerObject.setTransform() X Y Z Rot

$somePos = %player.getPosition();
%player.position = $somePos;

Also, I guess you will get a faster response if you post in coding help.

$somePos = %player.getPosition();
%player.position = $somePos;

Setting %player.position won't do anything.

findClientByName("NAME").player.setTransform("POSITION eg. 15 63 2");

Or if you want a /command

function serverCmdTeleTo(%c, %x, %y, %z) {if(isObject(%p = %c.player)) %p.setTransform(%x SPC %y SPC %z);}

Note that that isn't admin only. Admin only version:

function serverCmdTeleTo(%c, %x, %y, %z) {if(isObject(%p = %c.player) && %c.isAdmin) %p.setTransform(%x SPC %y SPC %z);}


If anyone is going to use this in an add-on, make sure to fully define the transform of the player (with axis rotation). I dont think you have to, but it might rotate you funnily each time otherwise.

I dont think you have to, but it might rotate you funnily each time otherwise.

It would just default to "0 0 0 1".

Setting %player.position won't do anything.

It does work, actually. It's a stupid way to do it and you SHOULDN'T do it that way, but it does work.

It does work, actually. It's a stupid way to do it and you SHOULDN'T do it that way, but it does work.

Wait, seriously? What the hell.

It doesn't make much sense to have position, rotation, getPosition, setPosition, getTransform and setTransform anyway.
Why not just have a single transform attribute which applies it when set?

Wait, seriously? What the hell.

It doesn't make much sense to have position, rotation, getPosition, setPosition, getTransform and setTransform anyway.
Why not just have a single transform attribute which applies it when set?
cuz torque

It would make more sense to save getPosition as world coords, and getTransform as local coords (relative the the object's parent). Then it'd be useful to have both.

It would just default to "0 0 0 1".

Actually, i just tried doing it in my server, it keeps your current rotation.

Actually, i just tried doing it in my server, it keeps your current rotation.

Blame TGE for even caring about setting position.
setTransform defaults to "0 0 0 1".