Rain arrows in random positions within bounds? [duplicate]

Rain arrows in random positions within bounds? [duplicate] - Bokeh Photography of Windshield

How do I summon arrows from the sky in a random position but at the same time to be inside the coordinates that I want?

For example, if I use the following, will that summon an arrow in that position?

/summon Arrow x y z

I want it to be summoned in a random X, Y, Z but at the same time within a specific position of four points:

{x1,y1,z1} & {x2,y2,z2} & {x3,y3,z3} & {x4,y4,z4}

How could I do this?



Best Answer

setblock ~ ~1 ~ mob_spawner 0 replace {
    SpawnCount:1,
    SpawnRange:16,
    Delay:-1,
    MinSpawnDelay:1,
    MaxSpawnDelay:1,
    MaxNearbyEntities:32767,
    RequiredPlayerRange:32767,
    SpawnPotentials:[
        {
            Type:"Arrow",
            Weight:1,
            Properties:{
                Motion:[0.0,-1.0,0.0]
            }
        }
    ]
}

This will create a MobSpawner, spawning falling arrows at random in a square around it. The square is 3 high and 2*SpawnRange wide. On the current settings it will spawn one arrow per tick, you can increase SpawnCount to have more, or Min/MaxSpawnDelay to have less.

Of course this leaves us with a very derpy spawner up in the sky. The next step is to put it underground, and add a /fill clock that triggers a command block, teleporting arrows in the spawn square up in the air :

tp @e[type=arrow,x=...,y=...,z=...,dx=...,dy=...,dz=...] ~ 128 ~



Pictures about "Rain arrows in random positions within bounds? [duplicate]"

Rain arrows in random positions within bounds? [duplicate] - Diverse cheerful couple with coffee and umbrella walking
Rain arrows in random positions within bounds? [duplicate] - Crop smiling multiethnic couple wearing warm outerwear standing together with coffee cups in rainy day
Rain arrows in random positions within bounds? [duplicate] - Smiling diverse couple walking with umbrella in rainy day





How to spawn any object at random positions in Unity




More answers regarding rain arrows in random positions within bounds? [duplicate]

Answer 2

What you're asking for can be done by creating a customized Monster Spawner. It can be customized to spawn things other than monsters, and to activate even if the players are far away.

The key thing a spawner gets you is randomized spawning locations.

Here's a command for a command block (it's too long for chat) which will create such a spawner:

/setblock ~ ~13 ~ minecraft:mob_spawner 0 destroy {EntityId:Arrow,SpawnData:{Motion:[0.0,-0.25,0.0]},SpawnCount:15,SpawnRange:15,Delay:0,MinSpawnDelay:1,MaxSpawnDelay:1,RequiredPlayerRange:15,MaxNearbyEntities:150}

The key things I learned while getting this to work:

  • You must specify SpawnData for the arrows, or the arrows simply won't spawn at all.
  • For some reason, the initial Delay value matters; when I had it higher than 0, it would only spawn arrows once, even though the MaxSpawnDelay was low.

Extra bits:

  • The RequiredPlayerRange and location are set so that it'll activate when you're under it.
  • The Motion makes the arrows be moving downward immediately, rather than appearing motionless and starting to fall.

If you want the rain of arrows to be controllable by redstone rather than player proximity, then set the RequiredPlayerRange to a large number, and use setblock commands to create or destroy the spawner as needed.

Answer 3

Make a clock with command blocks around it.

Set each block to summon an arrow in a specific position, and set up the specific positions to make it appear random.

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Sebastiaan Stam, Klaus Nielsen, Klaus Nielsen, Klaus Nielsen