How to spawn a limited number of a certain type of enemy

Good Day,
I’m looking for a way to spawn a limited number of a certain type of enemy.
Current example:
I have to spawn 10 green orbs and then make 3 of them turn red and 1 of them turn purple at the start of the game. The position on the screen will remain the same but the purple/red orbs will replace the green ones.

In my level it appear like this

I’m trying to figure out how to make only 1 purple 3 red and the rest green among all enemy spawners

With this bp it spawn randomly green purple or red but i can’t decide how many for each type(surely the random integer in range is not the correct solution since it gives a random value between the 3).

Hello and welcome to the forum.

It spawns a random item because it is what you are asking it with our random item in range.
Why don’t you add an parameter to your ‘SpawnItem’ fonction allowing to pass it the kind of item to pick in the array ?

Thanks for the welcome!
However the problem is that spawnitem is a function of 1 sphere, so I can’t put a counter here, I don’t know how to create it in such a way that at the start of the game it limits the number of purple actors to 1 and the red ones to 3

The array has the right number of each enemy, no? If so, you can use Shuffle on it before spawning anything, then loop through it like normal.

There will be a dozen different ways to achieve that and what’s below is probably not the best; merely going by the literal description:

We’d need to know more regarding where you’re taking this and how expandable it needs to be in order to suggest something a bit more maintenance friendly and modular.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.