First of all, thanks for this detail. You even color coded your explanations, it was very nice
If there is only 1 type of car object, the family is useless. Using multiple instances of the same object type is normal and doesn't require a family. A family would be useful for having cars, trucks, and other vehicle types that share some properties, but may differ in some points. That doesn't change your problem, but I thought I'd say it just in case.
Your problem here seems to be the selection of both cars, yep.
The LoS detection will need a loop on each car that you want to analyse, so a "For each car" or "For each Vehicule_Group". You will also want to filter the cars, to only check cars that need checking. For example, a test on the "car_ID" variable you want to set.
Once you do that, even without the check on the variable, all your cars should stop when they first see another car, so your game should stop quite fast.
Second problem will be to set the variable correctly, to be able to have 2 different entities in the action. The easiest way is to create a new family containing all the vehicles from the first family, but with nothing else. This family is only here for being able to manipulate both vehicles independently. Let's call this new Family "LoS_Target".
So at this point, the trigger of your action should be :
- For Each Vehicle_Group
- Vehicle_Group.car_ID = 0 // so if we already set the variable, we don't do the detection action again
- Vehicle_Group Has LoS to LoS_Target
I'll add some propositions to that :
- LoS_Target.UID < Vehicle_Group.UID // this will prevent that 2 vehicle check each other. The first will check the second, but not the other way. It depends on what you want to do but it can be useful sometimes
- Vehicle_Group.UID =/= LoS_Target.UID // this is redondant if you did use my first proposition, but is essential if not, as it will prevent a car from detecting itself. I'm not sure if this is integrated in the behavior by default, so I always add it to be sure.
Now, in the action, we can manipulate both objects as we wish. For example :
- Vehicle_Group.car_ID = LoS_Target.UID // we set the variable as you described.
- Vehicle_Group.AI_var_SPEED = LoS_Target.Car.Speed // or something close to that, I didn't reproduce your code
Be aware that LoS check are costly if done too much, don't overdo it if useless.