Spawn object in random location

Hello!
i want to randomize 3 type of object spawning location.
i want to spawn only one at time after player collide it will destroy and spawn a new one in different location.
I started to set the logic in level blueprint and the first object is spawning but i dont know how to spawn new one afer it destroyed

The easiest method would be via an Event Dispatcher, the entire thing could look like so:

Note this does not take repetitions into account, chances are the very same location / object will be chosen again. Not sure if that part is important, do tell.

Make Actor spawner blueprint:

  • use random stream, if you want it to repeat same pattern set its SEED manually, or set random seed there.
  • then spawner can have two ways of spawning: random range and random angle, so stuff spawns in circle. Or box: x for -rang to +range same for y.
  • you can also use: random Reachable Point in Radius:

https://www.youtube.com/watch?v=rSuCvggfItE

And when you got point spawn your destination actor there.

When player collides with destination actor, trigger event in spawner blueprint, and destroy destination actor. Whole reason for spawner is that you need something to remeber variables, and if you spawn and destroy actor it will not remember. However instead of spawner you can use game instance blueprint that can remember all you need, and just spawn destination. But this is moving code from spawner to game instance, so i recommend having spawner actor, so you can have more than single spawner.

With one BP is working but i have 3 type of blueprint so i need to create 3 dispatcher and bind them to spawn actor?
How should i do that?

One is enough, as in the pic. Actors already come with the onDestroyed delegate so you can use just that. Note there is no need to make those cascading Branches, as seen in your script. The provided example covers that part, too:

You can as many as you need. Consider it.


However, if you prefer to stick to your script, you can:

i

Or, if it’s inside a function:

But the signature on the Custom Event must match, here it’s just an Actor reference.


And lastly, this will also work: