TransWikia.com

How can I keep mobs from being too close together with /spreadplayers and /execute?

Arqade Asked by A.J. Ruckman on December 11, 2020

I want to summon multiple Slimes, then make sure that they are never in the same block. (If it’s not possible to keep them from being in the same block, having them be at least 1 block from each other would work too.)

To do this I tried nesting execute commands like this:

execute @e[type=Slime,name=explore1] ~ ~ ~ execute @e[type=Slime,name=explore1,r=0,c=1] ~ ~ ~ spreadplayers ~.5 ~.5 0 1 false @e[type=Slime,name=explore1,r=1,c=1]

But that didn’t work. I also tried

execute @e[type=Slime,name=explore1] ~ ~ ~ spreadplayers ~.5 ~.5 0 1 false @e[type=Slime,name=explore1,c=1,r=0]

I figured the r=0 tag might be off but I also tried with r=1 and it still didn’t work.

The first command groups all the Slimes together and randomly teleports them, and the second command just does nothing.

Any ideas on how to do this?

One Answer

The following command should work:

execute @e[type=Slime,name=explore1] ~ ~ ~ spreadplayers ~ ~ 2 3 false @e[type=Slime,rm=0,r=1,name=explore1]

All slimes will try to spread nearby (r=1) slimes that aren't themselves (rm=0) a maximum of 3 blocks around them.

Answered by SirBenet on December 11, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP