2

I want to make a parkour map and when players fall they will be teleported back to the beginning of the parkour.

Is there a command or a set of commands to detect whether or not a player is falling?

2
  • 3
    What do you want? Do this with Redstone or a plugin?
    – William
    May 8, 2015 at 11:58
  • 3
    The simple solution would be to teleport all players inside a specific area. Otherwise, you will have to deal with checking how far a player has fallen, to distinguish it from simply jumping.
    – MrLemon
    May 8, 2015 at 12:18

7 Answers 7

6

This is actually not too difficult to implement by using scoreboard magic.

First, set up some scoreboard commands

scoreboard objectives add airborne dummy
scoreboard objectives add fallen dummy

Next, run the following commands on a fast clock (I suggest using a fill clock), in this order.

scoreboard players set @a airborne 0
execute @a ~ ~ ~ detect ~ ~-1 ~ minecraft:air -1 scoreboard players set @p airborne 1
scoreboard players set @a[score_airborne=0] fallen 0
scoreboard players add @a[score_airborne_min=1] fallen 1

The first two will set airborne to 1 for every player who is not standing on something, i.e. the block beneath him is air. The third command will reset the fallen score to 0 for everyone who is not airborne, the fourth increments the score 20 times a second instead. This means that fallen is 0 as long as you were standing on something since your last fall.

Now you can select the falling players for teleportation using @a[score_fallen_min=XYZ]. Replace XYZ with however many seconds a player has to be above air to be considered "falling", multiplied by 20.

There is an issue with this however: Standing on the edge of a block will make you be considered falling, and I can't think of an elegant solution to this, short of chaining execute detect commands to check a 3×3 area below the player for blocks.

1
  • This method is a smart way to detect the timing of fall, thanks!
    – vintprox
    Jun 1, 2021 at 10:44
2

You don't need redstone to accomplish what you are describing here. Either make the floor lava, or void, or something like that, and have the player spawn back at the beginning.

You can do it with redstone, but just having the player die upon falling off is just as effective.

1

Yes. You can use scoreboards, like this:

scoreboard players set @a falling 1 {Motion:[0.0,-1.0,0.0]}

Make sure you add the 'falling' objective first:

scoreboard objectives add falling dummy
1
  • 1
    That looks like it does not work if a player has any sort of horizontal speed. Nor can it distinguish jumping players.
    – MrLemon
    May 8, 2015 at 12:26
1

/tp @a[x=#,y=#,z=#,r=#] X Y Z

This will teleport all players in a radius centered at an XYZ to the second XYZ. Make sure that the r (Radius of area in which players will be affected) is large enough to cover the entire bottom of your parkour, so that way it will teleport the player from the specified radius to the XYZ coordinates you put in. Loop it on a fill clock or set it to always active if you are in 1.9. however, you may want to create several areas that will teleport players if you are planning on checkpoints.

1

Perhaps fill an area with structure voids and execute a command when he player is near that block, or teleport the player when they fall below a certain height. If this doesn't work, try a testfor tag that detects downward motion.

0

To add on to Unionhawk just make a lava pool like he said and set the players' spawn points to the beginning of the parkour course.

0

Run tripwire hooks across the forbidden ground. Then attach a command block to them that does whatever to the player.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .