tarek2 I thought about this system, but the game I'm creating is too big, and I would have to set a lot of settings for "team2"
This has its own challenges, I dont recommend you go that route as it can cause you a lot unnecessary problems, because when you compare (Family Vs Family1) you gonna pick yourself so you will need a lot of filtering to exclude yourself from the Picking list, either for LOS checks or for any other events that you will need to compare (Family Vs Family1)
But if you think you can handle then go for it and try it. This is normally for advanced users, who will know how to debug and resolve things.
In this picture, can I replace something from (for each) to something lighter? When there are more than 20 objects in the game using this configuration in the image below, the FPS drops a lot.
When I removed the "for each" for testing, even with 200 objects my game continued at 60 fps
The "For each" is needed as the event has to run per instance to check if it has LOS to enemies and then Pick the nearest.
Remember the example I gave you is just for demonstration of how to resolve the first issue you had about picking a turret target without adding the whole family as a target as you lose the filtering by teams, therefore you put the whole family as a target.
Since there are only a few objects for demonstrations in my example I dont need to do any extra filtering or performance tricks. But in your case, if you gonna have 200+ enemies you gonna have to adapt the events according to your game. This has to be done on your side as only you know what you have in the game.
The most common issues with the performance you can resolve them by (Filtering more the Picking & dont Run the events every tick)
Example:
Every 0.5 seconds
Family1 is on Screen:
---------->Family1 has LOS to Family2
------------>Etc...
https://www.construct.net/en/make-games/manuals/construct-3/project-primitives/events/how-events-work
I honestly never use the Turret as you can replicate it easily with the LOS behaviour and you have the freedom to filter and pick whichever you need.
For example:
Remove the Turret and you can do something like this
Then:
You just have to add some events to make sure you rotate towards Family 2.