is it possible to tell the AI to target anyone. meaning it fires on friends, enemys, neutrals, non identifiable - simply everything targetable in the system; i'd need that for a mod.
It isn't exactly fitting into this topic, but whatever...
Yes you can do that. Before creating the AI, create a App.ObjectGroup object, and add to it the names of all targeteable objects. Then pass this ObjectGroup instance to the AI when you create it. The ObjectGroup instance is basically a list of ships. When passing it to a AI, the AI uses it as the list of enemy ships to target and fire. Dunno if this will get updated correctly tho, when ships exit the game and new ships come in...
Or you could do something like i'm trying to do: add a preprocessor before the Compound Attack AIs, and make it select a target for the ship. So you could make it choose targets kinda like how the SelectTarget preprocessor does, but choosing a target from all targetable ships available. Just remember to make it NOT target itself lol
And nope can't do something like the Fleet Orders mod does because all that it does is overwrite the ship's AI with a NEW attack AI, and passing in a ObjectGroup with a single name in the list: your target.
And that also doesn't get updated corretly. When the target ship is destroyed/exits the set/etc, the override AI is cancelled, and the old AI is restored to the ship so it resumes doing what it was doing.
BTW, I was "studying" the SelectTarget preprocess today, to see what it did that mine wasn't doing to work. After that I made my "ConcentrateFire" preprocess to call all externally registered SetTarget functions in the AIs beneath it, just like the SelectTarget preprocess does.
And it worked =P Ships finally concentrated fire on my target.
However sometimes they acted a little weird, like they didn't updated correctly. For example for the attack AI in these ships to be active, the ship needs to be at least 70km away from the lead ship, otherwise they shall intercept the lead ship. But sometimes the ships seemed to get "stuck" in the attack AIs, and even more than 70km away from the lead ship they continued in the attack AI instead of intercepting the lead ship.
When I noticed this happened, I called "Ship.GetAI().Reset()" from the console and the ships updated correctly, intercepted me and when they got close they resumed attack procedures.
So I still gotta test this more to see if it is working correctly... I can, but I don't want to make something to keep caling .Reset() in these AIs...