0

I am creating a apocalypse map and there is a radiation meter, the radiation works with armor stands that spawn close to zombies and they should disappear if there are no zombies nearby, i created a command for that but for some reason if i set the distance to less then 50 all of the existing armor stands despawn and new ones do not spawn This is the command that spawns them :

/execute as @e[team=mob] at @s run execute unless entity @e[tag=radiationzone,distance=..15] run summon armor_stand ~ ~-1 ~ {Small:1b,NoGravity:1b,Silent:1b,Invulnerable:1b,Invisible:1b,Tags:["radiationzone"],DisabledSlots:4144959}

This is the command that kills them

/execute as @e[tag=radiationzone] run execute unless entity @e[team=mob,distance=..30] run kill @s

1 Answer 1

2

First, let me get things straight: A /execute command should never need the words run execute in them. Your commands can be reduced to:

execute
  as @e[team=mob]
  at @s
  unless entity @e[tag=radiationzone,distance=..15]
run summon armor_stand ~ ~-1 ~ {
                                   Small:1b,
                                   NoGravity:1b,
                                   Silent:1b,
                                   Invulnerable:1b,
                                   Invisible:1b,Tags:[
                                       "radiationzone"
                                   ],
                                   DisabledSlots:4144959
                               }

execute
  as @e[tag=radiationzone]
  unless entity @e[team=mob,distance=..30]
run kill @s

And now I think I see your problem. The as subcommand of /execute only changes the executing entity, but doesn't change the execution location. You correctly remedied this by using at @s immediately after in command 1, but you forgot it in command 2.

1
  • Thank you so much for the help! it works perfectly now!
    – D3T0NA
    Dec 18, 2020 at 17:29

You must log in to answer this question.

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