TransWikia.com

How do I test when a player moves forward?

Arqade Asked on August 22, 2021

I’m working on a one command creation called Magical Weapons. There’s a weapon called the Reverse Crystal, and it basically reverses the movement. If you move +1 on the x-axis, you are teleported -2 on the x-axis, and so on and so forth. But how do I test for when a player moves, like +1 X or -1 Z?

2 Answers

I redid the command blocks and got a much better, but still not excellent solution:

Look! Some orange squares!

Now, what the command blocks have:

1:

/testfor @e[type=ArmorStand]

2:

/execute @a ~ ~ ~ testfor @e[type=ArmorStand,r=0]

3:

/execute @a ~ ~ ~ summon ArmorStand ~ ~ ~

4:

/kill @e[type=ArmorStand]

5:

/tp @a @e[type=ArmorStand]

Notes:

  • Sorry for not using the 1.9 Command blocks, because I really don't know how to do this with them.

Answered by user143228 on August 22, 2021

I made a movement detection system a while ago that I think could be useful for this. You can use it as a reference or modify it to fit your creation.

You will need 1 repeating command block and 15 chain command blocks connected to it (all set to always active). Here are the commands: https://pastebin.com/445LRfFz

And here is the system in action: enter image description here

it stores the player's current position into some scoreboard objectives (x and z). Then, it constantly compares the player's x objective to the player's prev_x objective to see if there are any changes. If x is greater than prev_x, that means the player has moved towards positive x. I also made it so it tags the player with "x+" and then says "x+" in chat.

Answered by MegaCrafter10 on August 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP