I'm making a minesweeper minigame, and I'm using NoAI chickens to represent mines, and armorstands to represent everything else. I want to increase the armorstands' scoreboard value by one for each adjacent chicken (diagonally or cardinally). I've figured out that it would be easiest to use an execute command from the chickens, but the problem is that @e[type=ArmorStand,r=1] doesn't get the diagonals, and @e[type=ArmorStand,r=2] gets armorstands two spaces away. Any ideas?

  • Does r=1.5 work?
    – AccioBooks
    Mar 18 '16 at 18:36
  • When did Minecraft add scripting? Or is this a mod?
    – mpen
    Mar 18 '16 at 18:46
  • 1
    @mpen I'm using command blocks. You can get them with /give <username> minecraft:command_block
    – Angelica
    Mar 18 '16 at 19:06
  • If you can space the chickens 1 block apart than you could test for those within a radius of 3
    – Shelvacu
    Mar 19 '16 at 4:40
  • @AccioBooks Target selectors only allow integer data types. Floats and doubles do not work, so 1.5 will probably fail parsing, or something
    – Angelica
    Mar 19 '16 at 13:30

I found a solution myself. It involves using the relative coordinates in the /execute command. The command is:

/execute @e[type=Chicken] ~-1 ~ ~-1 scoreboard players add @e[type=ArmorStand,dx=2,dz=2] mine 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.