[ROUND-ABOUT SOLUTION FOUND] How to call Instance ID in code?

I want to compare the X and Y position of two objects. However, I want to make sure if the X and Y position of two objects in the same group occupy the same space then it triggers a set of events.

One way to do that would be to compare if X and Y of object that have different instance ID to each other are equal to each other.

How do you go about writing that code? For now I am faking this by registering InstanceID with the following at the end of every turn (but the code is still not working because it doesn’t know how to compare X and Y of a group with one instance ID vs X and Y of the same group with a different instance ID).

I can maybe do it with collision (but that seems like a cheap way to code :frowning: ) and also because of how groups (families) work, there is a chance it won’t work.

image

If it’s only 2 objects you want to check, then you could try something along the lines of:


I’ve declared the local variables as:

Thanks, MrMen. I actually accomplished it a different way. The game was tile centric - so I gave a variable to each tile where the number of units that have the same X and Y as it are counted.

So then if the tile has 2 or more count and there are units on that tile, it will trigger the effect I want it to do.