Two objects not moving to the same spot

I try to make it that when one object is moving to one spot the other objects cant move to that spot at the same time.

While one Character is moving to a plot a different character should either just stay at the house or when possible move to a different plot.

So just for Information right now I am using Pathfinding because it avoids touching the other plots while moving. What is happening is that for some reason the object only move to one spot. They dont even do it at different times they do it all at the same time to the same plot.

If you need the project file I can copy that specific part to an empty file so its clearer.

There’s a lot going on in this. I hope this helps.

You don’t need the & All conditions need to be true. And is only really useful inside an OR condition.

When you check if a plot is available, it picks all of the plots. You can use pick a random or pick nearest or use some other methodology to narrow it to just 1 plot. I used random. Distance would work but then the closest would always be picked first. It’s up to you.

The same goes for the plot_farmer. The collision with house is picking all of them. Again, I chose random. I also changed the collision to a Boolean check.

I prefer Booleans. If you want to use numbers, that’s fine. I added an isAvailable to the plot_farmer object. The issue I had was when checking the collision with house, the plot_farmer would be still in collision with the house for several frames after it started to move. This allowed it to seem available. The IsAvailable Boolean sort of works like an instance trigger once.

I added reached destination to the collision with plot because where my plots were, the plot_mover was able to collide with different plots. This ties the plot_mover to a destination. You still need the collision so it picks the target plot and sets it to available. Otherwise, all of the plots would be changed.

I added another reached destination to flag the plot_mover as available. It needs the collision test so it doesn’t trigger when it reaches the plot. The reached destination triggers for every destination.

I used a button for testing. You would need your other conditions. I also used the opacity setting just for a visual cue for debugging.

If you’re just setting the plot to 1, the repeat isn’t needed.

I forgot about the wait be careful with waits. They can build up if the condition is still true. In your case, I believe they probably built up for 4 seconds while the plot_mover was in collision with the plot and then they all started to trigger once the 4 seconds passed.

For the wait, I would add another object Boolean to the mover object. If there was just 1 object, you could use trigger once but with multiple objects they need to be tracked separately.

There are so many different ways to accomplish the same thing. I’m not saying this is the best. I’m not even saying this is perfect. Depending on the rest of your events or your methodology this might not work properly. Use as much or as little of this as you want to.

1 Like

Thank you so much it finally works now.

1 Like