Why array random and put a deleted item ?

Hi !

It’s me, again :rofl:

I’m actually having an array with the known items of the player. (Length : 4)

I want to random 2 items from this array.

I make an array only with index of ID

image

To get this, i do this …

(I tried the “Random Array Item” but i thought it was this the problem. But not !)

It’s randomly found index 3 => 204 (Fraise)

At the end, it’s erase an index (IndexToRemove) which is index 3 and continue to find, at all, 2 items.

Here, it’s good ! Second item …

Index 203 => Looks OK

Sometimes, i don’t know why, it’s find 2 item which is the same but the index should be removed at the end … :frowning:

image
(not all time, and debug so long :rofl: so i post the ending UI which is shown to ending user)

I hope everything is understandable :pray:
Thanks a lot !

So …

I find an other solution, i don’t know why it’s happening … Strange but i do this, in case someone has this problem :

Adding the branch to test if the item exist in bag, in this case, it go back before to random again

Thanks :slight_smile: