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


Solution 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.