I have a list of 35 predefined values. I want to pick a random value from this list and use it in my game. What is the best way to implement this?
I can create a Switch node with 35 outputs and 35 Set nodes. But it looks too complicated.
Also I can create an array variable in one of my actors and fill it with default values. But in this case, I suspect all instances of this actor will have a copy of this array. It looks not very good because all copies will be identical. Or I am wrong and constant variables are not copied to instances of a class and have only one instance per class?
asked Apr 27 '19 at 03:59 AM in Blueprint Scripting
make array with those 35 predefined values, get array length - random int - get from the array a copy or reference (whichever you fancy)...
you are right that every instance will have this array though with the predefined values, so maybe you can just put this array in the gamemode or some actor that only has 1 instance and can be referenced..
note: maybe if you tell us what are you trying to do maybe we can help you better...
Follow this question
Once you sign in you will be able to subscribe for any updates here