0

I am creating a map where the player can only step on certain blocks, and if he/she steps off, they die.

How do I run a testfor where it tests for if the player is on the path, and if the player goes off of the path?

1

Simple! The command is:

/execute @a ~ ~ ~ detect ~ ~-1 ~ bedrock 0

Where bedrock is the block, and 0 is the damage counter.

After the "0" you can run any command you want! For example:

/execute @a ~ ~ ~ detect ~ ~-1 ~ stone 0 kill @a[c=1]

kill is the equivalent of the /kill @p command

So with this you can do whatever you want with your path!

  • 1
    You should not be mixing @a as the executor with @p as the nested selector. @a is the only selector that can target dead players, meaning @p cannot. The executor is killed on top of stone, but will continue being on top of that stone while dead. Since @p could not target them, it will instead target the nearest-living player, and continue to do so until every single player is dead and will not stop until that executor respawns. The fix is to use the same selector (@a with @a[c=1] or @e[type=Player] with @p). – Skylinerw Jun 20 '16 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy