Get array difference?

Hi guys, if I have for example of two arrays:

array1: [apple, apple, apple, pineapple]

array2: [apple, pineapple]

How do I get the difference using blueprints?
In the case of the example that would be arrayDiff: [apple, apple]

If you are asking if there is a function that does this in UE4 then the answer is no. It is possible to do this with blueprints just like it is possible to do it through code. You just need to translate the logic to blueprint

could you be a bit more specific what you mean with difference? please post same example cases with the expected result.

I think Array Filter might do the job. An example case would be:

string a1 = [‘a’, ‘b’];

string a2 = [‘a’, ‘b’, ‘c’, ‘d’];

// need [“c”, “d”]

Hi ,

I would do something like this in blueprints:

In this case, the “Quest Items” is what items you are checking against, the “Inventory” is what you currently have. You use a foreachloop to check each quest item, and only print the string "Still Needs: " if the Inventory array does not contain said item.

The only alteration you may need is to temporarily remove an item from the second array when it has been used once or create a temporary array and do this to prevent the “apple” from registering three times when you only have one.