Array of Actors, set random Boolean on each but with limits.

Hello again Unreal Engine Forums.

I have an array of 10 actors. What I want to do is set 1 out of 3 possible Booleans on each actor at random. BUT I would like to know how to limit how many Booleans of a each type can be set. For Example:

10 Actors
7 Booleans to Type 1 (Red)
2 Booleans to Type 2 (Blue)
1 Booleans to Type 3 (Green)

I would like all actors to be set with only 1 Boolean but I don’t want more than an assigned number of each Boolean to be set.

Perhaps a function like this:

1 Like

Thanks for your reply, I have managed to replicate this with the changes I needed but I can’t figure out how to use it properly.

When I execute the blueprint it is only setting one type for all. If I change the “Set Type” numbers on the node in the main blueprint, it only seems to effect which type is set, not the amount.

I’m not sure how to utilize this properly. Some further insight would be much appreciated.

Share the bp.

1 Like


Are Y, I and X local variables?.

1 Like

Ok. Lets be sure the function is working as expected:

If everything is working as expected here that means the bools are changed after elsewhere.

1 Like

The inputs are confirming 7,2,1

All the bools are selecting the first option (Skeleton)

When checking the X array, is reporting 7,2,1

Make sure that the Get node returns a reference, not a copy:


Change it and try again.

1 Like

That is where I went wrong then. The function is working perfectly now. Thank you for all your help.

1 Like

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