Count number of true booleans in array
Is there a way that you can count the number of true variables in an array of booleans? I want to have an updating int variable that returns 0 if all false, 1 if 1 true, 4 if 4 true etc. Is this possible with blueprints? I've tried a ForEachLoop node and a length node but those don't allow you to actually test the variables in the array, just simply get all of them.
Thanks for your help!
asked Apr 17 '17 at 09:51 PM in Blueprint Scripting
you could try something like this
where the for each loop gets the value of the array at every index (1 the first pass, 2 the second, so on...) then this converts the bool into integer where 1 = true and 0 = false and if the value is equal to 1 then it adds up the count of true bools.
answered Apr 17 '17 at 11:00 PM
Why not just use the array element in the branch?
answered Apr 18 '17 at 12:12 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here