# Summon armorstands recursively from an origin with only one armorstand per block

I want to summon a flat area of armorstands like demonstrated here in minecraft 1.9:

``````  3
323
32123
323
3
``````

Every number represents an armorstand, the number itself the tick in which the armorstand was summoned. Ofcourse I would add a limitation to this myself to prevent the mechanism to spawn infinite amounts of armorstands.

My problem is to only spawn one armorstand on each block, here's what I have so far. This spawns more than one armorstand on each block. First a single armorstand is placed in the world, then the following chain is executed by a repeating command block:

``````/execute @e[type=ArmorStand,name=move] ~ ~ ~ /summon ArmorStand ~1 ~ ~ {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move] ~ ~ ~ /summon ArmorStand ~-1 ~ ~ {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move] ~ ~ ~ /summon ArmorStand ~ ~ ~1 {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move] ~ ~ ~ /summon ArmorStand ~ ~ ~-1 {NoGravity:1b,CustomName:"move"}
``````

I would also be fine with a solution which temporarily spawns more than one armorstand per block, but it should leave a area of one armorstand per block behind. If you think that this is impossible it would be nice if you could leave a comment.

This solution is really resource intensive, there may be a better one!

Actually i just simplified the problem to 2D, here's a working solution for 3D:

Once:

``````/scoreboard objectives add dir dummy
/summon ArmorStand ~ ~5 ~ {NoGravity:1b,CustomName:"move"}
``````

Repeat:

``````/scoreboard players set @e[type=ArmorStand,name=move] dir 0

/execute @e[type=ArmorStand,name=move,score_dir=0] ~1 ~ ~ summon ArmorStand ~ ~ ~ {NoGravity:1b,CustomName:"move"
/execute @e[type=ArmorStand,name=move,score_dir=0] ~1 ~ ~ scoreboard players set @e[type=ArmorStand,name=move,r=0,c=-1] dir 1
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~1 ~ summon ArmorStand ~ ~ ~ {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~1 ~ scoreboard players set @e[type=ArmorStand,name=move,r=0,c=-1] dir 2
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~ ~1 summon ArmorStand ~ ~ ~ {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~ ~1 scoreboard players set @e[type=ArmorStand,name=move,r=0,c=-1] dir 3
/execute @e[type=ArmorStand,name=move,score_dir=0] ~-1 ~ ~ summon ArmorStand ~ ~ ~ {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move,score_dir=0] ~-1 ~ ~ scoreboard players set @e[type=ArmorStand,name=move,r=0,c=-1] dir 4
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~-1 ~ summon ArmorStand ~ ~ ~ {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~-1 ~ scoreboard players set @e[type=ArmorStand,name=move,r=0,c=-1] dir 5
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~ ~-1 summon ArmorStand ~ ~ ~ {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~ ~-1 scoreboard players set @e[type=ArmorStand,name=move,r=0,c=-1] dir 6

/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~ ~ kill @e[type=ArmorStand,name=move,r=0,score_dir_min=1]
/execute @e[type=ArmorStand,name=move,score_dir=1] ~ ~ ~ kill @e[type=ArmorStand,name=move,r=0,score_dir_min=2]
/execute @e[type=ArmorStand,name=move,score_dir=2] ~ ~ ~ kill @e[type=ArmorStand,name=move,r=0,score_dir_min=3]
/execute @e[type=ArmorStand,name=move,score_dir=3] ~ ~ ~ kill @e[type=ArmorStand,name=move,r=0,score_dir_min=4]
/execute @e[type=ArmorStand,name=move,score_dir=4] ~ ~ ~ kill @e[type=ArmorStand,name=move,r=0,score_dir_min=5]
/execute @e[type=ArmorStand,name=move,score_dir=5] ~ ~ ~ kill @e[type=ArmorStand,name=move,r=0,score_dir_min=6]
``````

Summon the armorstands first, this will create some overlap, which will need to be removed.

This is quite easy, just let every armorstand set a score of one armorstand in each pile, and kill those without the score.

``````scoreboard players set @e[name=move] temp 0
execute @e[name=move] ~ ~ ~ scoreboard players set @e[r=0,c=1] temp 1
kill @e[name=move,score_temp=0]
``````

This works because all the armorstands in each pile will select only one armorstand among them, the oldest one.

• Oh i totally forgot about c selecting not only a specific count but also the oldest one! Thanks you so much Jan 3, 2016 at 15:38
• While testing this I discovered that they unfortunately all select themselves instead of the oldest one. This is weired, minecraft.gamepedia.com/Commands says the same as you. Jan 3, 2016 at 17:49
• try dx=0,dy=0,dz=0 instead of r=0 Jan 3, 2016 at 18:10
• Still the same problem Jan 3, 2016 at 18:18
• @lennartVH01 @timgame Keep in mind that `c` will not target based on age unless the possible targets are equidistant. But on top of that, `c=1` initiates a sender bias, meaning if the entity running the command is within the list of possible targets before `c=1`, they will become the target no matter what. Jan 3, 2016 at 20:08

I see your problem! Where you have

``````/execute @e[type=ArmorStand,name=move] ~ ~ ~ /summon ArmorStand ~1 ~ ~ {NoGravity:1b,CustomName:"move"}
``````

The first 3 `~ ~ ~` are the coordinates where they spawn, `~ ~ ~` is set as default in front of you. Change the coordinates to where you what them to have move to. I may be wrong but hey, its worth a try!

• In the case of execute ~ ~ ~ is relative to the armorstand, this answer is wrong. Jan 3, 2016 at 14:56