Teleporting & Return

3 posts / 0 new
Last post
Offline
Last seen: 8 months 3 weeks ago
Joined: 02/18/2014 - 07:48
Gems: 0
Teleporting & Return

Hello, Im not sure if this is 'advance' modding but it does require coding knowledge so I put it under advance modding.

So, I'm getting the player to teleport away after clicking on a block; to get the player back I just made 3 varibles and called them x,y & z then just before the teleport event I set those varibles to the same as i, j & k but when the player gets teleported back it teleports them back to inside the block. This is because of the way the code works... when I set I added the event it thought I meant the i, j & k coords of the block but I need to know how to access the i, j & k coords of the player and that I do not know how to do. I have coded before and know how to edit the code to a fairly large extend so If someone could just help me but telling me what code I need to write I can work it out... probably. anyway thanks for reading, Kye_the_miner (now changed to FoodLover135 but oh well)

Edited by: Kye_the_miner on 04/05/2015 - 06:04


AquilaNova's picture
Offline
Last seen: 1 year 8 months ago
Joined: 04/22/2015 - 14:39
Gems: 0
You could just add x +1 which

You could just add x +1 which would put the player 1 block in front of the block where they were, this of course does not take into account any building someone may do there in the mean time.

Best solution would be to get the coords (whichh you have in the Entity entity.posX etc) then check for the closest air block to the teleport block to teleport the player to.

Offline
Last seen: 1 year 7 months ago
Joined: 11/09/2014 - 06:49
Gems: 0
i think y+1 is better cause

i think y+1 is better cause then they would teleport on top of it.