mojira.dev
MCPE-107238

Command isn't executing correctly within a command block

The command doesn't execute correctly from the trigger location I set (-481 4 307), it only triggers from the command block.

I want the command to summon lightning when a player is within 2 blocks of -481 4 307 to strike lightning at -481 4 294 so I wrote in the command block: /execute @p [r=2] -481 4 307 summon lightning_bolt -481 4 294

The lightning hits the right location but it triggers 2 blocks from where the command block is hidden -481 3 327 and not the first set of co-ordinates before the word summon.

Attachments

Comments 5

Having the same issue. Only, it goes deeper than the block. I am trying to condense what would be hundreds of blocks into a file but the execute command only effects closest to the command block. Both in a file and in the block itself is not working. I am trying to remaster my old parkour map that I was reconized by Utk io (Android app for all MCPE) with a cleaner, more functional appearance but this bug is stopping that. 

@Etanarvazac Taseet I don't know if this would be any help for what you need but I managed to get a command to execute away from the command block and trigger at a place I wanted instead of where the command block is by typing: /execute @p[x=-481,y=4,z=307,r=2] ~~~ summon lightning_bolt -481 4 294 or /execute @p[x=,y=,z=~-6,r=1] ~~~ summon lightning_bolt ~~~-5

I still don't get why you have to enter the ~~~ or some co-ordinates before the word summon because it doesn't seem to matter what numbers I would put in the command it would still execute from the command block (for the original bug inquiry I posted). It just seems meaningless.

@Edward I will have to give that a try. It would definitely be weird for it to work that way as it is technically a syntax error. But perhaps a good workaround for now. 

The coordinates after the target selector in /execute specify the location that the command is to be run from. <~ ~ ~> means at the position of the entity selected by the target selector. The target selector arguments are relative to the command block itself.

So your command: /execute @p [r=2] -481 4 307 summon lightning_bolt -481 4 294
means "find the nearest player with 2 blocks of the where the command is run, then on behalf that player and as if that player is at -481 4 307, summon a lightning bolt at -481 4 294."

See https://minecraft.fandom.com/wiki/Commands/execute#Arguments

Edward Pink

(Unassigned)

Unconfirmed

Xbox

1.16.100

Retrieved