I have a few thoughts, which could lead to an improvement of your script.
Red Spot wrote:...
This script tries to keep the ships energy level up,
but as shields and/or hull might go down energy becomes less of a priority.
When the ships energy is low it will start firing in 'pulses',
meaning it will fire a few shots at a time making sure the energy level isnt going 'critical'.
1.) Why do you link laser energy with a ship's hull and shields?
Once a best weapon for a target has been selected all energy should be made available for this weapon so it can destroy the target.
It is that target that lowers your shields and hull and therefore you want to destroy it (at any time and at any cost).
The only waste of energy that can occur here is through misses. The misses however stand in a close relation to a target's distance (as well its size and acceleration). So energy saving should only be linked with i.e. a target's distance.
You
must allow the ship to run low on energy at some point in time since it is a scenario, which
can occur (i.e. when there are
too many enemies). Any other greediness for energy will "fire back" on you if it is not meant to avoid misses. Ponder about this for a second.
... Set the missile fire probability over 80% and the turret doesnt care about 'friendly fire',
2.) Why the link between missile fire probability and a turret to determine if a player allows for friendly fire?
I would avoid this alltogether and leave it to the player to remove any of the dangerous weapons from his ship prior to using your turret script. Placing such a weapon in a cargo bay will then be seen by the player similiar to mounting it.
The missile fire probability should really only be used together with missiles. This then will avoid conflicts with your script and others, perhaps a missile script.
Mass Drivers are a 'special' among 'the specials'. ...
it would simply waste ammo wich could be needed an other time.
3.) The use of mass drivers is IMHO not well explained ...
Last things first ... the amount of ammo is a factor, which has to be taken care of by the player at all time. Adding logic that takes care of this just partially, but not fully (and probably never can) might not be in the interest of all players. Again, running out of ammo is a scenario, which
can occur. Saving ammo while a target suggests a mass driver is best applied with it could again back fire. Ships can hold rather large ammounts of ammo for this weapon and - from my point of view - usually do not run out of it too quickly. But, I have not fully understood your description of the logic on when it is being mounted ...
This means it will see if any other turret is tracking a target and will check if it can 'combine fire'.
4.) Does this happen for any type of target? What are the conditions for a "can combine turrets"?
I.e.: Will an M2 point with up to 3 turrets (<=> 24 weapons) at an M5 while there is just 1 ISE but lots of PIKs available??
This delay will make sure less energy is wasted on 'long range fire' where it could be more effective in closer range.
See 1.)
it will drain energy at a pretty good pass, but will never let it go 'critical' while shields and hull are up.
Not to repeat myself, but experience is that
as soon as shields and hull go down, the ship
should have turned all available energy into fire power and that this power should be on the way to the target that is causing my shields and hull to go down.
Sven