I'm basically looking for a structure that spawns stunners but only targets ships within a certain radius of the spawner. Is this possible, and if so, can somebody help me out with a script?
It's possible to make the script find a ship in a radius and spawn a stunner, but i do not think you can change the stunner's target. Stunners seem to find a random target and will continue to pursue that target until destroyed. Interestingly enough, when making the overcharge module, stunners will still pursue their original target even after they have switched teams.
So sadly, i don't think there is a way, but who knows!
This may be doable, I think planetfall's map sudo rm lathe had stunner generation/targeting code. Managing the radius might involve DestroyUnit for Stunners which wander too far.