I am currently working on a horror map, and I need a command that when someone steps on a specific block, it sends a redstone output into a command block.
So what im saying is: When someone walks over a certain x,y, and ,z, it triggers a command.
I've searched youtube, but non of the commands work, and when I find a command, it only works on a certain block. Ex) Only when you walk on wool.
The part of the map where I would like this command is made of black concrete, so when standing on a certain black concrete block in the area, it runs a signal into a command block.
Hope this makes sense, and I hope you can help me.
Edit: I would prefer this command to work in version 1.14.4, but if there is a better command in another version, it will do fine.
I maybe don't understand... You want the player to trigger an event when stepping on a specific block, but there are some similar blocks in your map that does not have to trigger?
I guess it would be /execute as @a[x=<x>,y=<y>,z=<z>,dy=0] run setblock XYZ minecraft:redstone_block
Dy=0 means "if player hitbox is touching xyz"
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
This is what I would try(it works on every block):
/execute as @p at @s if entity @s[x=(target x.5),y=(target y),z=(target z.5),distance=..0.35] run setblock (target x.5) (target y.5) (target z.5) minecraft:redstone_block replace
Target x and z must have a .5 so it's centered! As for distance, I prefer 0.35 because the player is within the majority of the block. If you want the command to trigger even if the player is right on the edge of the block, simply change it to like 0.5. If you don't include distance, the command will trigger regardless of your xyz coordinates. Put this command inside of a repeating command block and don't forget to remove the redstone block at some point:
/setblock (target x.5) (target y.5) (target z.5) air replace
if the area the black concrete is in is square-shaped, you can use this:
/execute at @a[x=,y=,z=,dx=,dy=,dz=] if block ~ ~-1 ~ black_concrete
x,y and z are the coordinates of one corner of that area and dx,dy and dz are the width, height and length of the detection area. For example, if you use @a[x=5,y=5,z=5,dx=10,dy=10,dz=10], the selector will target all players within the area from 5,5,5 to 15,15,15.
you can attach a comparator to this command block to get the output. If you don't want to use comparators, you can add "run setblock <x> <y> <z> redstone_block" to the command.
I am currently working on a horror map, and I need a command that when someone steps on a specific block, it sends a redstone output into a command block.
So what im saying is: When someone walks over a certain x,y, and ,z, it triggers a command.
I've searched youtube, but non of the commands work, and when I find a command, it only works on a certain block. Ex) Only when you walk on wool.
The part of the map where I would like this command is made of black concrete, so when standing on a certain black concrete block in the area, it runs a signal into a command block.
Hope this makes sense, and I hope you can help me.
Edit: I would prefer this command to work in version 1.14.4, but if there is a better command in another version, it will do fine.
I maybe don't understand... You want the player to trigger an event when stepping on a specific block, but there are some similar blocks in your map that does not have to trigger?
I guess it would be /execute as @a[x=<x>,y=<y>,z=<z>,dy=0] run setblock XYZ minecraft:redstone_block
Dy=0 means "if player hitbox is touching xyz"
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
You have the right idea about what I have in mind, but its still not working. Is there something that I am missing?
This is what I would try(it works on every block):
/execute as @p at @s if entity @s[x=(target x.5),y=(target y),z=(target z.5),distance=..0.35] run setblock (target x.5) (target y.5) (target z.5) minecraft:redstone_block replace
Target x and z must have a .5 so it's centered! As for distance, I prefer 0.35 because the player is within the majority of the block. If you want the command to trigger even if the player is right on the edge of the block, simply change it to like 0.5. If you don't include distance, the command will trigger regardless of your xyz coordinates. Put this command inside of a repeating command block and don't forget to remove the redstone block at some point:
/setblock (target x.5) (target y.5) (target z.5) air replace
if the area the black concrete is in is square-shaped, you can use this:
x,y and z are the coordinates of one corner of that area and dx,dy and dz are the width, height and length of the detection area. For example, if you use @a[x=5,y=5,z=5,dx=10,dy=10,dz=10], the selector will target all players within the area from 5,5,5 to 15,15,15.
you can attach a comparator to this command block to get the output. If you don't want to use comparators, you can add "run setblock <x> <y> <z> redstone_block" to the command.
Here is a world download in case you don't know how to set it up: https://www.dropbox.com/sh/zryh81vwps5foky/AACP1hsfQQ8u4QVQ8l0XcKWBa?dl=0
Command block engineer // Developer // #TeamTrees
This is exactly what I need! With a bit of testing, this works the way I want it to! Thank you so much.