How can I add only the True values of several boolean arrays to just one?

Hi everyone and sorry if thi is already solved, but I really haven’t found a solution to my problem. I have several arrays with boolean vales that I want to fusion in a final boolean array, but only with the true values. It’s for the medals/achievements. Each level has 4 possible medals to achieve (4 arrays for the 4 different values for each of the 10 levels) and you can pass one level by achieve one of these boolean goals. The player may be playing level 7 and got only 7 medals. I want to show to him the sum of this value with a different picture for each value.

First I saw the node append but it adds all the values from one array to another, even the falses one. Then I thought about this and didn’t work either:

I want to get only the number of true values of the array (coffe 1 level) and add it to “total coffees”. Under that I will do the same with “coffee 2 level” array and other 2 boolean arrays more.

In the end, I want to use a picture depending of this final number of true booleans of the “total coffees” array that you can see here:

Hope this information is enough to help me with this. Sorry if it’s a dumb question. I’ve checked the UE4 documents and I can’t find a solution.

Thank you for your time and patience!

On mobile, so can’t show example, but…

You can add a branch after the for each loop connected to the Boolean array element. In the true output add the array element to your true Boolean array. In the false output add the array element to your false array. That should work. I can make an example later if you are still having trouble.

Oh… of course! I’m trying it right now and give you feedback. Thanks!!!

Mmm I think I didn’t get your advice correctly. Sorry for my level. I’ve tried these two options. I supose they are both wrong…

No worries I will make an example when I get home in about 6 hours.

code should be:
coffeelevel1array>for each loop> branch(using for each loop array element as input)>
trueoutput frombranch> add to array total coffees using foreachloop array element output.

In your first picture add a branch after the foreachloop and connect it to the array element. Then add the rest of your code to the true output.


Got it! I’m trying with the rest of the arrays. Million thanks boss!!