I should clarify my comments to emphasize that creating a new ai goal isn't impossible
, just - as Battuta said - annoyingly complex. There are a lot of things to keep track of, you'd be blazing a trail where few non-
coders have ventured before, and you'd run a risk of breaking something in the process.
But it's definitely solvable, especially if you broke the goal into several sub-problems to be solved one-at-a-time. One way you could approach it is by essentially duplicating the "approach" part of the ai-chase code. Instead of transitioning into the "attack" or "shoot" sub-goal, you'd just maintain a certain distance until the scan time elapsed. The AI automatically breaks off an attack if it receives a certain amount of damage, so you could copy that logic without changes (albeit maybe adjusting for importance, since scanning something is less important than attacking a critical target). But you'd also have to make sure the scan timestamp is reset if the fighter falls too far behind or moves outside of the "view cone" while it's in the middle of scanning. And if the fighter "loses scan lock", you may find that it crashes around wildly before reacquiring it.