3

I was watching this video by dragnoz about using the stats command to detect effected blocks or entities nearby:

I downloaded the world, watched the video 100 times, and tried adding to/changing blocks to recognize Armor Stands instead of creepers. Hovever, it's either not working or counting them as Creepers on the sidebar.

I basically need a command that will tp all armorstands to ~ ~ ~ (the not moving is perfect) and then detect the number of ArmorStands affected. It should then do A if affected armor stands are > 0, and do B if affected armorstands are 0.

The solution at Test true if NO ArmorStand matched the bottom line of what I was trying to do, but the command can't be run on a fill clock without giving a "Failed to execute ... as ... " error. A slower clock won't work, as the commands are going to be looped through until the surrounding armorstands are equal to 0 and players may be waiting for who knows how many minutes when on a public server.

I've reached the end of the internet, any help would be super awesome!

Minecraft Version: 1.8.8 / Vanilla

3
  • 1
    Just for future reference, you should only add the [minecraft-redstone] tag if your question is about redstone. If your question is only about commands, the [minecraft-commands] tag is all you need. Oct 31, 2015 at 2:06
  • 1
    Also, when you wish to teleport all armour stands to ~ ~ ~, do you mean to the player, or to exactly the same spot? If you want them to go to the same spot, wouldn't the armourstands never be affected, and hence always trigger B? Oct 31, 2015 at 2:09
  • @angussidney In the video/downloaded copy of the world it recognizes the tp to ~~~, but even if it was tping up 1, and then down 1, that would work too. I basically just need a reliable way to detect if there's an armorstand near the player, but at the same time detect if there isn't, and have it run on a fill clock.
    – theBeaks
    Oct 31, 2015 at 3:05

1 Answer 1

1

I assume, based on your previous question, that you want the number of affected armor stands stored on the player. For that there is no need for CommandStats or /tp. You simply need to ensure the commands are activated in the correct order for a /fill clock (see here for a tutorial that covers activation order via /fill).

Otherwise, the set of commands is essentially the same as those in your previous question, albeit adding instead of setting to mimic CommandStats.

Prerequisites:

Objective to state how many armor stands were near the player.

/scoreboard objectives add ASNum dummy

Clock commands:

The following must be run in numerical order on a clock.

  1. Reset the player's ASNum score to a default of 0.

    /scoreboard players set @a ASNum 0
    
  2. Cause armor stands around the player to increase their "ASNum" score by 1. This causes the player's score to be equal to the number of armor stands around them, rather than always 1, to mimic CommandStats.

    /execute @e[type=ArmorStand] ~ ~ ~ scoreboard players add @a[r=10] ASNum 1
    
  3. Players with an ASNum score of 0 would be those not within 10 blocks of an armor stand. Players with a score of 1 or higher will have that many armor stands around them.

    /say @a[score_ASNum=0] had no armor stands near them.
    /say @a[score_ASNum_min=1] has at least 1 armor stand near them.
    /say @a[score_ASNum_min=10] has at least 10 armor stands near them.
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .