1
/testfor command help
I have made parkour in my adventure map across a city but have no way to kill the player when they mess up and hit the ground. I was thinking about using the /testfor command block lined up to one that kills the player and sets their spawn to the latest checkpoint. The problem is that if I use the radius tag for 12 the radius becomes a 12x12 square, what I want is to have them get detected at a certain y-value(12) anywhere on the world. So it would create a sheet of area where the command block would test positive for the player being at that y-value. I tried using more than one command block, but they show up in the world and look bad(it's a superflat world). Any Ideas?
Create an account or sign in to comment.
5
1
You can also just make the entire city floor turn to lava when you start it with /fill if your lazy.
1
Thank you so much! That is a lot easier!
1
There's actually another way to do this, if you don't want to put barriers all over your map. With a nested execute, you can run a command on any player who is in on a certain y value like so:
If you want to test for ALL damage values, instead of just assuming they are 0, you can put a -1 in the command instead of a 0. This way things that can rotate like buttons or torches, as well as things can change color like wool, will all get tested.
execute @a ~ ~ ~ execute @p[y=12,r=0] ~ ~ ~ kill @p
This will kill any player on y=12, thus eliminating the need for barriers.Noelscrap .... and "0" with the ID (normally IDs are 0) ....
If you want to test for ALL damage values, instead of just assuming they are 0, you can put a -1 in the command instead of a 0. This way things that can rotate like buttons or torches, as well as things can change color like wool, will all get tested.
1
Thank you so much!
1
/execute @a[m=2] ~ ~ ~ detect ~ ~-1 ~ minecraft:block 0 /spawnpoint @p
This sets a player's spawnpoint. Replace "minecraft:block" with a block name that is ONLY used for a checkpoint (for example, a redstone block) and "0" with the ID (normally IDs are 0). Now, onto the detecting.
/execute @a[m=2] ~ ~ ~ detect ~ ~-1 ~ minecraft:barrier 0 /kill @p
So with that command, anyone on adventure mode standing on barriers gets killed. They will spawn on the last checkpoint if you also use the first command.
Now, use a super fast redstone clock and hook it up with those two command blocks. It should work (but they have to be in adventure mode!). If you think they look bad, hide the commands in a building.
Hope this helped.
This sets a player's spawnpoint. Replace "minecraft:block" with a block name that is ONLY used for a checkpoint (for example, a redstone block) and "0" with the ID (normally IDs are 0). Now, onto the detecting.
/execute @a[m=2] ~ ~ ~ detect ~ ~-1 ~ minecraft:barrier 0 /kill @p
So with that command, anyone on adventure mode standing on barriers gets killed. They will spawn on the last checkpoint if you also use the first command.
Now, use a super fast redstone clock and hook it up with those two command blocks. It should work (but they have to be in adventure mode!). If you think they look bad, hide the commands in a building.
Hope this helped.