It is very possible indeed.
A five SEXP set for one turret group.
Example for controlling a Leviathan's SGreen:
First make sure that the Leviathan's beam is locked.
Also, make the following Variables: (name/type/starting value)
- [istargettingsgreen] integer - 0
- [targetsgreen] string - (none)
- [canfiresgreen] integer - 1
- [delaysgreen] integer - 0
Event 1. Fire button is pressed - Activate when {key to fire the beam} is pressed while [istargettingsgreen] is at 0. Key Reset and set [targetsgreen] to the current target of the player. Set [istargettingsgreen] to 1. Message to player "Targetting with small beam cannon".
Event 2. Fire button is pressed again - Activate when {key to fire the beam} is pressed while [istargettingsgreen] is at 1. Key Reset and set [istargettingsgreen] to 0. Message to player "Small beam cannon deactivated".
Event 3. Fire at target - Activate when [istargettingsgreen] is at 1 while [canfiresgreen] is at 1. Set [canfiresgreen] to 0 and fire the turret that has the sgreen at [targetsgreen].
Event 4. Firing delay - Activate when [delaysgreen] is at 0 while [canfiresgreen] is at 0. Set [delaysgreen] to 1. Wait for 45 (delay of the sgreen) seconds. Set [delaysgreen] to 0 and set [canfiresgreen] to 1.
Event 5. Target destroyed - Activate when [targetsgreen] is destroyed. Set [istargettingsgreen] to 0. Message to player "Small beam cannon target terminated - deactivating small beam cannon".
This would make it so that when you hit a key, the beam will automatically fire at your current target, and keep firing at that target until it is destroyed, or when you deactivate it. When you want to quickly switch targets, you need to double-tap the key (but not too quickly!).
Obviously, turrets and AAA beams would be treated differently. They would be taken usually in groups, sizes depending on how many the ship has. Also, turrets would be unlocked when not set to target anything in particular; their AI would make them shoot at random things automatically.
You see, it is possible, Pnakotus.
I wish I could ATM. As soon as I get a new Windows OS machine, I will whip out a test mission for you guys.