Minecraft zombie visible range (bedrock)

minecraft-bedrock-editionminecraft-commands

Im working on a Minecraft map similar to a 3d Mario game. I am currently struggling on enemy AI and would like some help. I want to make it so when you are within the 16 blocks of a zombie, they act and move normally, but if you aren't within their range they receive slowness making them unable to move. If it is possible I would like to make it so every zombie has its own system (example: if I was by a zombie, only that one would unfreeze, every other zombie would still be frozen.

Thanks everyone!

Best Answer

Keep running these two commands in repeating command blocks:

/execute @a ~ ~ ~ effect @e[type=zombie,rm=16] slowness 1 255 true

/execute @a ~ ~ ~ effect @e[type=zombie,r=16] slowness 

This solution works for one player only. Need a solution for multiplayer? Comment below.

Related Topic