Problem with add force toward an object and Object Instances

I have a game I’m working on


As you can see multiple instances of enemy1 spawn on different points of the map, I have no problem with that.

The problem begins when I want to attach one instance of enemy1Vision per one instance of enemy1.

If you try this code, enemy1Vision spawns correctly but then they all become one and can’t decide which instance of enemy1 to follow.

This is tricky and I can’t figure out how to do it

You can either stick the one object to the other with the sticker behavior or create a link. Depending on your needs, you could do both. One for the physical link, the other for creating a reference to it.

This thread might help.

1 Like

Hi! Your answer was god-sent, it is what I needed.
There is only one problem. I tried the linking solution which seemed the most reasonable but now all three enemy1Vision follow the first instance of the enemy only :frowning:
This is the code

I think you need to reverse the objects in the among action. If you using the enemy in the for object then you know the enemy, you then need to find the object linked to it. It’s a subtle difference but important. Find vision linked to enemy.

1 Like

LOL I totally made the mistake you told us not to do!!!
Again you are God-sent with this solution!!! Thank you infinitely!!
There is definitely a subtle difference, but even though I am reading your explanation I don’t understand said difference, I just know it “works”

1 Like

Links are like tree branches. Or think of it like a family tree.

Find sons linked to father might give 5
Find father linked to a son might give 1

Same group just a different perspective. You can have infinite links to other objects just not between instances of the same object.

In this example: multiple fathers to sons links but not father to father or son to son. But multiple sons to single or multiple fathers and vice versa. For more advanced uses, there are extensions to help.