Sorry for all the questions recently! Thank you to everyone who spent time to read the posts and double thank you to those who replied.
So how to build a reliable combat system in GD? I have tried several approaches but they all have problems. The main problems are:
Selecting a target within range. Sometimes a target in range is selected and then immediately another is selected and then both enemies think they are being attacked when only one of them is…
Releasing a target after combat - When combat finishes, units just stand around thinking they are still in combat and won’t do anything else.
Units being killed by ranged units while also being attacked by melee units. Sometimes the melee units continue to stand in one place and think they are fighting the unit that just died…
I tried using linked objects and some variables to control what is happening, but there are big problems in all the implementations I have tried.