How to get random spawner and only spawn if in range?

Hi, i’m new, and this is my first project. I have some spawners in the level (one in each corner for example), and i want to only when the player gets near the spawner, only that spawner spawn the enemie. I made this but it don’t work well

With what i have now, the enemies only spawn if i´m in range a spawner, but they spawn in the others spawners to. If someone can help i appreciate, thanks.

Each object should be responsible for its own thing. If you have a spawner, make it spawn things. Avoid relaying on the Level Blueprint as much as you can, no matter how tempting it is. It’s a death trap worse than a spider spawner. :o


Consider the following approach:

Spawner actor:

  • I have a bunch of these in the level

  • each spawner can do this:

To visualise:

Image from Gyazo

Do tell if that helps.

1 Like

Regarding me insulting the Level Blueprint - I exaggerate, it sure has its uses. You can use it as a manager if this level has some unique functionality.

If I wanted to choose a random spawner and have it create a monster regardless of the player being close by:

  • a new Custom Event in the Spawner blueprint hooked up to the same nodes as its timer

  • get the Spawner references:

Image from Gyazo

  • this makes the array of Spawner actors, starts a Timer and makes it pick one spawner at random
  • we then call the custom event mentioned above

  • now the spawners work even if the player is away
  • and if we step into the spawner sphere, both timer will run - the one in the spawner and the one in the level blueprint

Image from Gyazo

Hope this helps.

1 Like

And if you working with timers, these can come in handy:

You can pause Times and see how long they’ve been running for. So the Level Blueprint can easily create time-based waves of enemies, for example.

Good luck with the rest!

Thank you very much, is working really nice now. I will adapt the other things to this new spawner, i don’t think there will be problems. Once again, thank you very much!

Ok, thanks for the tip