#Summon in a relative area around the player (1.21.1)

1 messages · Page 1 of 1 (latest)

azure pine
#

How can achieve this?

I'm trying to use the distance argument but as soon as I add a second line of command in the .mcfunction file the game stops identigfying the function.

vocal stone
#

When the game stops identifying the function this usually means that you've made a syntax error.

strong willow
#

are you splitting the same command over 2 lines?

vocal stone
#

anyways here is the best a method:

  1. run a random roll command and store this in a storage using execute store do this for each of the axis. X Y and Z
  2. create a macro function that uses these values to summon the entity from an offset to the player corresponding to the values stored in the storage
  3. run the function with the storage as macro provider
strong willow
#

one thing to add so the entity doesn't spawn in the ground, add the positioned over sub comand in the summon command to let it spawn on the surface.

vocal stone
#

If you want that, it's easier to ommit the Y position, saves you a command

robust glacier
#

If you want them to spawn on the surface, just use the /spreadplayers command

strong willow
#

True, no need to overcomplicate such a simple thing.

azure pine
strong willow
#

you can do that only if you end the line in \ or \ I don't remember which way around.

grim owlBOT
#

the first one \ for example: ```ansi
execute if entity @s[tag=test] 
run say hi

vocal stone
#

huh why is it black that's very unreadable

strong willow
#

ansi messup

azure pine
#

spreadplayers worked for me!

So I'm going for spreadplayers ~ ~ 1 15 false @e[tag=scattered_zombie] and then kill th tag so any previously generated zombie can be repositioned

#

Thanks for the help here

strong willow
#

Small extra thing. If you kill mobs to reposition them, they drop stuff. If that's an issue, you can just teleport them to y -10000