How do I make an Array be chosen randomly, but each actor at least once?
Hello, I have connected up a random integer in range to a Get Actor Array which is plugged into a Spawn actor. This spawn actor is triggered by a for loop to spawn 25 actors in a grid. The Actor Array has 4 different actors, so the grid has 4 different actors that are spawned in a combination that is different every time. I want to either make some actors less probable or some actors happen only once (but still spawn randomly). How do I do that? I've included a picture of the current setup. The for-loop that I was talking about comes from the Input's top execution.
asked Aug 20 '16 at 01:03 AM in Blueprint Scripting
To get control over spawn percentages, you could just set the index value of the Get node as a variable, determined by something like a d100 roll (if you're familiar with tabletop games) with ranges for certain spawn percentages (return 0 if roll
Here's a quick function I whipped up, but with the spawn chance variables disconnected so you could see the numbers in the < nodes.
And here's what it would look like in use. You don't have to pass the integer value through as an output since we could always just Get the variable instead. But this feels cleaner and makes me happier.
If you only want it to spawn once, then you can simply store nothing or a base enemy type in its place in the Actor Array after its spawn logic fires.
EDIT: This will need a lot of additional stuff if you're wanting to spawn potential groups of things on each run through the loop.
Follow this question
Once you sign in you will be able to subscribe for any updates here