1

I made a command creation that tests for an iron block 1 block lower from an armor stand and after that it test for a diamond block 2 blocks lower and when it does that it spawns a command block that spawn a structure block to finally spawn a house. This worked fine but i saw that it only works if there is no other armor stand around it and when there is one that is closer to the command then it does not work. Here are the commands:

/execute @e[type=Armor_Stand,c=1] ~ ~ ~ /testforblock ~ ~-1 ~ iron_block

/execute @e[type=Armor_Stand,c=1] ~ ~ ~ /testforblock ~ ~-2 ~ diamond_block

/execute @e[type=Armor_Stand,c=1] ~ ~ ~ /scoreboard players tag @e[type=Armor_Stand,c=1] add stone

/execute @e[type=Armor_Stand,c=1] ~ ~ ~ /setblock ~ ~-2 ~ minecraft:structure_block 0 0 {metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"AlexDAM",rotation:"NONE",posX:-4,mode:"LOAD",posY:-1,sizeX:9,posZ:-4,integrity:1.0f,showair:0b,name:"9x9House",id:"minecraft:structure_block",sizeY:6,sizeZ:9,showboundingbox:1b}

/execute @e[type=Armor_Stand,c=1] ~ ~ ~ /setblock ~ ~-1 ~ redstone_block

/kill @e[type=Armor_Stand,tag=stone,c=1]

Also all the chain commands are on Conditional mode.

1
  • 1
    Are you on PC 1.13, bedrock or another version?
    – DM01131
    Dec 19 '18 at 18:27
1

If you're spawning the armor stands via commands or command blocks, you can simply specify a name attribute for them, and test for that name in your selector with @e[type=Armor_Stand,name=Whatever]. Otherwise, it might be possible to name an armor stand via a name tag at an anvil, but I'm not 100% sure on that.

1

You use scoreboard tag in your third command:

/scoreboard players tag @e[type=Armor_Stand,c=1] add stone

It is used to target the stand to kill it in the last command.

I recommend summoning the armor stand with a tag and using that tag to target it for all the commands:

/summon armor_stand ~ ~ ~ {Tags:["Build"]}

This will allow you to target just that specific armor stand in all your commands, as well as, eliminate that third command completely. If nothing else has that tag, you can use only that tag in the target selector.

One final unrelated note: the first two commands are execute commands with a testforblock command. The execute command has an optional testforblock style check built in. You can replace the first two command with a single command.

All this together would give you the commands:

/execute @e[tag=Build] ~ ~ ~ detect ~ ~-1 ~ iron_block -1 testforblock ~ ~-2 ~ diamond_block

/execute @e[tag=Build] ~ ~ ~ /setblock ~ ~-2 ~ minecraft:structure_block 0 0 {metadata:"",mirror:"NONE",ignoreEntities:0b,powered:0b,seed:0L,author:"AlexDAM",rotation:"NONE",posX:-4,mode:"LOAD",posY:-1,sizeX:9,posZ:-4,integrity:1.0f,showair:0b,name:"9x9House",id:"minecraft:structure_block",sizeY:6,sizeZ:9,showboundingbox:1b}

/execute @e[tag=Build] ~ ~ ~ /setblock ~ ~-1 ~ redstone_block

/kill @e[tag=Build]
1

To find out the name of the armor stand, stand in the middle and execute this command:
/execute @e[r=1, type=armor_stand] ~ ~ ~ say @s
In the chat should appear the name of the entity. you can now affect only this armour stand by adding name=[what appeared in the chat].

Example=
/execute @e[r=1, type=armor_stand] ~ ~ ~ say @s
In the chat appears= 123456789
I want to kill this armour stand, so the command I would use is:
/kill @e[type=armor_stand, name=123456789].

I hope you found that clear. If you have any questions, feel free to comment.

1
  • NB: This set of commands only works on bedrock edition. If you are on 1.13 or 1.12 or a different version, comment and I will let you know the different commands.
    – DM01131
    Dec 19 '18 at 18:33
0

What you want to do when stringing commands together like this is to use radius selectors on the 'inside' execute commands, so the first one executes at all armor stands and the later ones execute at a radius of 0 to those armor stands that passed the first 'test'. Add r=0 to your selector like @e[type=Armor_Stand,c=1,r=0], to all the commands after the first execute. Also the c=1 becomes more-or-less redundant (barring multiple stands in exactly the same location. You can further simplify to @e[type=Armor_Stand,r=0].

Please mark as an answer if this solution works.

There is a youtube video on this here:

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.