Object groups create references to the objects in them. They don’t maintain their own pick lists. I wish they would. They create picklist for the objects that are referenced just as if there wasn’t a group. So, if you have 2 groups with the same objects, the pick lists would be identical because it’s looking at the reference objects not the list. In the end, it’s comparing the same object. It can be difficult to compare instances of the same object.
You can get around this in multiple ways. You could store the position of one object in variables and then compare the objects to the position. Instead of using IDs, I made it visual and drew a line between the objects.
I just noticed in your screenshot, the 2nd for each instance isn’t a subevent of the 2nd pick all object. It wouldn’t have made the project work bc of the same issue but the 2nd for each object wouldn’t be using all of the objects, it would’ve only used the object from the 1st for each instance. Each level or indentation maintains its own pick list. It can be confusing. There’s a lot of hierarchy.
Imagine each indentation as a room. In the first room are all of the objects. When you add conditions then it creates another room with only those objects. Another subevent and more conditions then you get another room. When you leave a room and return to an event on an indentation that’s more to the left than it’s like returning to that room. If you go back further than that room is used.
My result.
When you use for each instance it’s best to reduce the list first. That’s why I compared the objects distance twice. Before you check the distance the 2nd time, you would probably want to make sure they’re not the same object. In my example I could make sure that X ≠Obj1.X() and Y ≠Obj1.Y(). In your project, you could also save the ID and make sure the ID in the variable doesn’t equal the ID of the object in the 2nd loop.
There’s no condition to check for the distance between an object and a position. So, you need to use the expression inside a compare 2 numbers condition.
You could also use multiple objects as long as you were only checking for something like the distance between players or players and enemies. You would still have a problem if you also want to check the distance between players or between enemies.
You could use the same object and stick a 2nd object to the first object. Each object would be made of 2 objects. The 2nd could be hidden. Then you could check for the distance between obj1 and obj2.
You could the locations in an array ahead of time and then compare the objects to the array. You could also use the array by itself and compare element to element. This is getting more advanced and depending on the needs, a bit inefficient. The array would need to be continuously updated.
I would recommend either storing 1 position in an array or using multiple objects.
There are infinite ways to do things. We all have our preferences and knowledge.