Edit: I've uploaded a cut down sample game to the new post below. It should explain things in more detail.
I've been trying to debug a game for a few hours now and I can't quite understand why something isn't working. I've looked through the forum but because I'm not sure what's going wrong I can't really find anything similar.
Basically, on the start of the layout I create 9 characters (In family 'AllCharacters') and set their associated ChracterID variable to their UID.
Then I create a random weapon (From the 'Weapons' family) for each of them and set their CharacterID variable to the same as their linked character's CharacterID variable.
The 'Weapons' family has a variable called 'Type' which indicates if it's a "Melee" or "Ranged" weapon.
I'm trying to pick all the 'Melee' weapons and their associated character like so:
When I run this it seems like the correct number of weapons are being picked however their linked character (based on CharacterID) is not being picked correctly.
If ALL weapons on screen are assigned 'Melee' then it works fine and their associated character is picked 100% of the time. However as soon as one of those weapons are no longer 'Melee' weapons it tends to break and not pick the correct number of characters:
I've debugged the game above where there is one 'Ranged' weapon and all characters and weapons have the correct CharacterID and Type assigned.
For the purposes of this test, I was hoping to be able to set all their opacities to 70%.
I'm obviously not understanding how Construct 2 picking works, so would value some insight into why this might be ocurring.