Random Multigate with varying probabilities

Try this (click on link at the end of the answer to open a bigger version):

Good luck!

While this exact setup works for 2 cases you can put it in a macro and chain the macro calls together. E.g. player gets a loot drop. Roll first with 10% probability for Legendary item. If false, roll again will 30% probability for Exotic item. If false roll again with 50% probability for Rare item, otherwise spawn Common item. Another alternative would be to use the stream to generate “random integer in range” (there is a node for it, just like the bool node) and work from that generated integer. E.g. if generate integer is between 90 and 100 then do a Legendary drop, otherwise if it is between 70 and 90 then do an Exotic drop and etc… There may be many combinations. Please accept the answer if it helped, thanks!

Please do not feel embarrassed, I have spent a lot of time thinking on and prototyping things similar to this so I was more or less ready to answer. I know first hand its a daunting thing to finally figure out. The weighted boolean node wasn’t added until 4.13 or 4.14 so it was even harder before
Good luck with your project!

Hello all,

In an Actor BP, I want to have two different chains of script and let the engine randomly choose either one of these chains to be executed.
So far I figured I should use the Multigate, have the two chains plugged in the two Out pins, and set the IsRandom bool to true.

Here’s what I can’t figure out, though: is there any way to make one of the Out chains more likely to be executed?
Say I want “Out 0” to have a probability of 70% to be chosen and “Out 1” a probability of 30%.

There should be a simple solution to this, but I have no idea how!
I’m not very experienced with UE in general, so the more thorough the explanation (or the more simple the solution) the better :slight_smile:

This seems to work, thank you!

Am I correct in assuming that this only works in the case of needing two outputs (because bools only work with two)? What should I do if I have more than two possible outcomes I want to randomly have executed, just for knowledge?

That sounds like it makes sense and is simple too! I almost feel stupid for not coming up with that myself, haha. Thanks for your help!