Minecraft – How to execute ArmorStands around me

minecraft-commandsminecraft-java-edition

I would like to execute from the red ArmorStand to the blue ArmorStands. And the blue ArmorStands should say "hi".

enter image description here

My problem is, that I can't use tags. So if I use "r=2" only the ArmorStands next to the red one will say "hi".

How can I select all eight blue ArmorStands without tags?

Best Answer

Easiest way would be to fiddle with execute's vertical offset until r=2 only selects the 8 you want:

/execute @e[name=Red] ~ ~1 ~ /execute @e[r=2,name=!Red] ~ ~ ~ /say hi

By placing the start of the spherical selection further up, you can avoid selecting the further away ones that you don't want to select.

A side view of this will look something like:

Spherical offset


Alternatively, you can use the dy, dx, dz cuboid volume selectors, again with an initial offset:

/execute @e[name=Red] ~-1 ~ ~-1 /execute @e[dx=2,dy=1,dz=2,name=!Red] ~ ~ ~ /say hi

Which looks like this:

Cuboid offset