Skip to main content
edited tags
Link
Fabian Röling
  • 20.7k
  • 6
  • 39
  • 78
Source Link
theBeaks
  • 621
  • 1
  • 12
  • 22

Test true if NO ArmorStand

The system I'm setting up is supposed to teleport players forward if an armorstand is within a radius, and down if there isn't one (to find a vacant area for the player).

The commands are supposed to run in a loop if it keeps finding armor stands:

Runs on a clock, executes the rest if positive:

/execute @a[paramaters=true] ~ ~ ~ /testfor @e[type=ArmorStand,name=Marker,r=20]

/tp @a[paramaters=true] ~100 245 ~100
/setblock x y z redstone_block                 - this activates another check

/execute @a[paramaters=true] ~ ~ ~ /testforblock ~ 245 ~ minecraft:air - Check for ArmorStand at co-ordinates (looking for a true if not present)

Executes if true:

/scoreboard players set @a[paramaters=true] paramaters (something new)
/tp @a[paramaters=new] ~ 68 ~

So far if there is an armorstand (invisible or not) it is still testing positive for finding air in the same space. I tried going into Creative and standing in the starting point and manually typing the commands:

/summon ArmorStand ~ 245 ~

And then:

/testforblock ~ 245 ~ minecraft:air

The armor stand summons, and then the testforblock return "Successfully found the block...".

I have commands that need to execute on a loop ending in a check for if there is an armor stand present, and separate commands that need to be executed if there isn't one. Is there another way to get a positive result when there is no armor stand present?

I basically need it to do:

01 Check for armorstand within radius

02 If found:

03 tp forward then goto line 01

04 Else:

05 do something else

Is there not a way to find out if there isn't an armor stand nearby?