In this situation we have three outcomes (A,B,C) but only Outcome A is available at present. Still, the script has to get all Outcomes at all times because one or more of the currently Unavailable Outcomes may be Available at a later time.
Setting this up is pretty straightforward if we only have Three Outcomes and as much time as we want.
But, if we have, let’s say, 10 Outcomes (A,B,C,D,etc.) to check in one single tick before game over, than we’re stuck with a 10% probability of success.
What we need is a 100% success probability, that would need the Random MultiGate to run through Only the Available Outcomes leaving out the Unavailable Outcomes to be added only when, well, Available!
(Fig. 3 (Just a sketch))
And here is the core of the question: How could I go about doing that?
Here A is True, B and C are False. MultiGate is Random and Looping.
Here A is again True, B,C,D, etc. are false. MultiGate is Random and Not Looping.
Just to make a point. → In Fig.3 I forgot to tick Loop on the MultiGate, please pretend it’s ticked.
Make an array of all the options and then have another array of all the available options. Then, instead of using a multigate just get a random number and modulo that against the size of the array of available options.
Then you can simply take out and put in options into the array as they become available. 100% chance of getting an available option.
Thanks, that helps a lot.
I think I get how I could use it for my needs.
On the top of my head (I’m not on UE4 atm) I could take a string or int of random index from a “all options” array and place it in a “available options” array, delete the string or int from “all options” array so that I don’t end up getting the same entry in the future, get a string or int of random index from the “available options” array, apply it to a variable which runs through a string or int switch and that should go to the desired event.
What I can’t see clearly with my mind’s eye is how to get the right index number range for the random picking from both arrays, but I think it should be something on the line of generating a random int in range where the initial value of the range is 0 and the end value is the “last index” of the array.
Tomorrow I try it and let you know how it goes.
Thanks again mate
Yes, worked like a charm, cheers ^^