I want to tp an entity (an
"note" exactly) to a random position in axis X and Y, how can I do this ?
/spreadplayers only teleport random entities on axis X and Z, but it's not what I want.
I'm on 1.16 last snapshot (20w22a).
Arqade is a question and answer site for passionate videogamers on all platforms. It only takes a minute to sign up.Sign up to join this community
You could randomly generate 2 numbers with a range of your choice and modify the armor stand's x and y position to that number if there is enough space at that location. You can do random number generation with the following videoand modify the armor stand's location with mcstacker's /data generation https://mcstacker.net/ command example
/data modify entity 'armor stand selector goes here' 'directory to x and y pos goes here' 'after that i cant remember the syntax after that but you can replace the nbt with scores'
as well you can do
/execute as 'armor stand selector' at @s store result entity @s 'directory to x and y pos goes here' 1 run 'scoreboard get command'
this doesnt work with players if you plan to use that method in the future. To make it work with players you would have to teleport the player to a armor stand or aec with random cords using this method. I hope this helped.