5
How to detect a player standing in a block in Bedrock?account_box
Hey! I am making a map right now and I'm trying to find a way to detect a player standing in a block so that it can give a jump boost to that said player for 2 seconds (reset by standing in the same block). In my case, it's in Bedrock and I've searched for tutorials in the internet and only found ones for Java. The tutorials in Java helped but it detected if a block is on that coordinate and not the player. Can someone help?
Create an account or sign in to comment.
12
/execute as @a[r = 3] run effect @s jump_boost 2 <1> <2>
where the command is run in a repeating command block exactly 2 blocks below the player. the block the player is standing on can be something else, but the block directly under that needs to be this command block.
<1> - int between 0 and 255 - effect strength. Note that a value of 0 gives an effect strength of 1, a value of 1 gives a strength of 2, etc.
<2> - boolean value - when set to true, hides particles. otherwise, set to false or omit.
This works, thanks!
no problem!
No one answered :(
/execute as x unless block ~ ~-1 ~ air run x
If the target stands ON a block, the command above will succeed
This will execute when the target is in a block (from the bottom half of the target)
This will execute when the target is in a block (from the half, upper half of the target)
This will execute when the target is completely in a block (upper and lower half of the target)
x is the target
c is the command (you want to run if the command succeeds)
/execute as x at @s unless block ~ ~ ~ air run c
This will execute when the target is in a block (from the bottom half of the target)
/execute as x at @s unless block ~ ~1 ~ air run c
This will execute when the target is in a block (from the half, upper half of the target)
/execute as x at @s unless block ~ ~1 ~ air run execute as x at @s unless block ~ ~ ~ air run c
This will execute when the target is completely in a block (upper and lower half of the target)
x is the target
c is the command (you want to run if the command succeeds)
Thank you!
np
Execute subcommand "unless block" test failed. Did I do something wrong?
view more replies ( 1 )
Now... if you want to get into the gametest framework/scripting... there are a bunch more ways to do it (more complicated/functional too!)... would not recommend tho lol
also, you could use a sculk sensor if placed in the precise right spot above a command block if you want to skip the coordinate part
also, you could use a sculk sensor if placed in the precise right spot above a command block if you want to skip the coordinate part