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.
Thank you,
TIG
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 <
30, return 1 if 30 <
roll <
60, return 2 if 60 <
roll <
85, return 3 if 85 <
roll or something like that).
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.
Thanks for replying! The top picture controls the probability of the actors, but by some super rare chance only one of the actors could spawn, and there has to be certainty that at least one of each will spawn. What would I need is either one of the actors to spawn once or for the spawn to be random but at least once. How would I do the thing that you mentioned at the bottom?