[Solved] Conditional collision, based on variable values, not working

Hi!

I have some “Clients” who move via pathfinding to tables. I want to change their animation when they reach their chairs.

Chairs are related to tables by a variable called TableId.
Chairs also have an Id variable.
And Clients have two variables for each one: TableId and IdInTable.

So, I set the following conditions:
• Clients (group of sprites) in collision with Chairs (group of sprites)
• The variable TableId of Chairs equals Clients.TableId
• The variable Id of Chairs equals Clients.IdInTable

To test these conditions, I stop the sprites’ movement and change the clients’ animation (replacing each Client with a green cross) when the conditions are met. I also log all the relevant IDs in the console.

The result is not what I expected: it seems the conditions are met when the first chair collides with any Client. But what I don’t understand is that, although every Client collides with a chair (not necessarily the correct one), I only see the logs of the Clients that strictly meet the conditions in the console. This means all Clients perform the actions, except for the log action, which is triggered by the correct Clients?…

Here’s a video of the first test:

(You will also see a pathfinding issue, and I don’t understand why some of the Clients go through Tables instead of contourning it)

The second test:

Here’s the related console of the second test (you can see only 5 Clients are present instead of 6, those who met the conditions):

I’m a bit confused.

Thanks a lot for your help!

ADF

Have you tried using “for each object (client)” event?

1 Like

You’re right, it works now. I was persuaded that it was not necessary in this context…
When is this loop mandatory to make conditions work?

Thanks!