5

How to detect a player standing in a block in Bedrock?account_box

SoapSoapSoap's Avatar SoapSoapSoap3/30/23 4:38 am
3/31/2023 1:05 pm
A Lost Boy's Avatar A Lost Boy
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?
Posted by SoapSoapSoap's Avatar
SoapSoapSoap
Level 44 : Master Procrastinator
276

Create an account or sign in to comment.

12

A Lost Boy
03/30/2023 7:44 pm
Level 31 : Artisan Magical Boy
A Lost Boy's Avatar
/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.
2
SoapSoapSoap
03/31/2023 4:01 am
Level 44 : Master Procrastinator
SoapSoapSoap's Avatar
This works, thanks!
1
A Lost Boy
03/31/2023 1:05 pm
Level 31 : Artisan Magical Boy
A Lost Boy's Avatar
no problem!
2
SoapSoapSoap
03/30/2023 6:00 am
Level 44 : Master Procrastinator
SoapSoapSoap's Avatar
No one answered :(
2
rotgruengelb
03/30/2023 4:20 pm
Level 45 : Master Answer
history
rotgruengelb's Avatar
/execute as x unless block ~ ~-1 ~ air run x
3
rotgruengelb
03/30/2023 4:29 pm
Level 45 : Master Answer
history
rotgruengelb's Avatar
If the target stands ON a block, the command above will succeed


/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)
3
SoapSoapSoap
03/30/2023 11:06 pm
Level 44 : Master Procrastinator
SoapSoapSoap's Avatar
Thank you!
3
rotgruengelb
03/31/2023 12:25 am
Level 45 : Master Answer
rotgruengelb's Avatar
np
2
SoapSoapSoap
03/31/2023 3:39 am
Level 44 : Master Procrastinator
SoapSoapSoap's Avatar
Execute subcommand "unless block" test failed. Did I do something wrong?
2
Lioncat6
03/30/2023 6:43 pm
Level 65 : High Grandmaster Button Pusher
Lioncat6's Avatar
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
3
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome