1

I've been trying to set up a command block in a mine cart, that does damage when a player is above it and 15 blocks along the Z axis, but it has to use tildes, right now I'm using:

/effect @a[x=~0,y=~4,z=~15] minecraft:instant_damage

Edit: /effect @a[dx=0,dy=7,dz=26] minecraft:instant_damage

Works perfectly! I put the cart to the edge of the room (The rooms are about 30 blocks wide), and put activator rails below the cart to trigger the command.

0

1 Answer 1

5

Tildes cannot be used in target selector arguments. You must instead use an execute command. This command should execute it as the command block minecart.

/execute @e[c=1,r=0] ~ ~4 ~15 /effect @a[r=1] minecraft:instant_damage
2
  • Keep in mind that this does not replicate what the original command is doing. The original command is executing relatively from the minecart, while this one is executing relatively to the nearest player. If there's only one player then it's essentially useless since they'll never be able to target themselves.
    – Skylinerw
    Mar 8, 2017 at 1:52
  • 2
    Edited accordingly
    – El Six
    Mar 8, 2017 at 2:19

You must log in to answer this question.

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