Page 1 of 9

[Script]RS.Turret Defence

Posted: Wed, 15. Mar 06, 00:05
by Red Spot
New script .. new topic .... :roll:


This 'project' I actually started for 2 reasons;
-wanted to see if I could improve to NPCs turrets
-get some 'knowhow' on how to make someting similair for the player


well I found out the use of turrets is something really balanced ..
a few shots to many and your out of energy ..
a couple to few and you die with energy at max level ......

anyway to not bother you with boring details ...
I believe I made a rather good and balanced ..
but above all *fast* turret command ...

expect my scripts to make use of this ..... :twisted:

the end result is that it isnt *better* ..
it just does it different ... and fast ..
and to my taste its much fun .... :D
-RS.Turret Defence-



This script combines energy managment, target tracking and weapon switching.
And makes a turret have a bit more of a bite than it now does.
This will not improve the turrets ability to hit something.


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'.


There are 2 ways of using this command on your turrets.
Set the missile fire probability over 80% and the turret doesnt care about 'friendly fire',
set it at 80% or lower and it will keep an eye on what weapon to use.
Do note; the turret finds itself more important than any 'friendly',
if it has the choice of no weapon or an aera-effect weapon, than it will pick the area-effect weapon.


Mass Drivers are a 'special' among 'the specials'.
If a ships energy is low, or the target is a missile, M4, M5 or Drone,
the turret will *always* try switching to Mass Drivers.
If it has energy or the target is a missile it will fire with or without Mass Drivers.
If energy is low and the target is in Mass Driver fire-range, you can watch the ships hull go down ...
It will NOT try swiching to Mass Drivers when fighting larger ships if it still has energy,
it would simply waste ammo wich could be needed an other time.


The turret will first of all give priority to an incoming missile,
than to a possible enemy the player has targeted,
after that it will look for a 'targeted enemy'.
This means it will see if any other turret is tracking a target and will check if it can 'combine fire'.
After that it will see if the ship has an attacker, attack target or if there is any other enemy near the ship.


If an enemy has been found the turret will always start tracking it,
but when the target gets in firingrange the turret will have a very small 'delay'.
This delay will make sure less energy is wasted on 'long range fire' where it could be more effective in closer range.


The overall result of this command is that a turret will fire sooner (yep .. even with a delay its firing before others),
it will fire with the *best* weapon it has to use (it will switch weapons between shots if needed),
it will drain energy at a pretty good pass, but will never let it go 'critical' while shields and hull are up.


When equipping a ship equip it like the following to get maximum result;
when you equip a ship that has lets say 8 guns in each turret than dont give it 12 of a weapon.
Give it 8, 16, 24 or 32, anything with steps of 8 will have the *best* result.
For a ship like an M2, designed for heavy duty combat,
I'd advise to equip about 16 units of each weapontype it can install.
(I'd forget the Flak as it simply drains a lot of energy)
And give it maximum weapons for each turret.

A couple of weapons no ships should leave home without are;
the PBE's and Mass Drivers, make sure your ship has them, they are life-savers ..


This script will replace the "Turret attack enemies" command.
When you install this than when you use the "Turret attack enemies" command you will use this script.
to install just copy or move the files found in the 'scripts' folder to your 'X3 scripts' folder ...
NO new command will show .. it will replace the 'current' turret attack enemies command ...


get it here;
http://www.geocities.com/g5_11/X3/RS.Tu ... ev3.15.zip


G

Posted: Wed, 15. Mar 06, 00:37
by alphalvr
i hope it 1.4 compatible....use your psycic powers :D

i think i may have misunderstood you last time we spke.

when you say npc this time it looks like you refer to player ships (ie my ships or wingmen) so sorry to ask again but to clarify....do enemy npc ships use it as well?

Posted: Wed, 15. Mar 06, 00:39
by Red Spot
I dont see any reason why it would not be ...

afaik the way I did it you can actually have a 'weapon-rebalance' without upsetting the script ... :)
(as long as MDs stay MDs ...)


G

Posted: Wed, 15. Mar 06, 01:46
by Heretic666
Does this script require any input from the player or is it automatically running in the background?

Because I get no new commands when I go to my ship menus..

Posted: Wed, 15. Mar 06, 02:08
by alphalvr
Heretic666 wrote:Does this script require any input from the player or is it automatically running in the background?

Because I get no new commands when I go to my ship menus..
there are no new commands, it explains better in the readme but ive checked it and it covers what you have asked :)

you use your normal turret commands and the missile use %

Posted: Wed, 15. Mar 06, 02:11
by Heretic666
Aha!

Curse my non-reading...ness... :oops:

Thanks for that..

It also says that at the bottom of the original post
This script will replace the "Turret attack enemies" command.
When you install this than when you use the "Turret attack enemies" command you will use this script.
Do'h! :lol:

That makes it a lot easier to use..1 more question..will this work in any ship?

Posted: Wed, 15. Mar 06, 12:07
by Red Spot
yep it req. player input .. the player has to make sure to equip the ship ..
thats enough input ...;)


this script is 'just' for the player ...
it does NOT change the turretcommands for your every day NPC
(only the NPCs in 'my scripts' will be using the same commands)

and no it does not work on any ship ..
ever seen an M5 with a turret ?!? .... :roll:



G

Posted: Wed, 15. Mar 06, 12:31
by Heretic666
Ok great thanks for that using it already :D

Posted: Wed, 15. Mar 06, 14:34
by Red Spot
just to have it said ...

v1.4 compatibillity .... :thumb_up:



G

Posted: Sat, 18. Mar 06, 17:38
by Deta7
Looks nice, sounds nice downloading now ;) - thanx for sharing

Posted: Wed, 22. Mar 06, 05:00
by SkyLeach
Popping this in to try it on my Titan

Posted: Wed, 22. Mar 06, 14:46
by gray1107
First of all great script! Just a quick question:

This script swaps weapons between cargo and turrets yes? I know you can do this manually but it's almost cheating IMHO.

Have you considered having each turret only fire weapons that are installed? Say half of the weapons in a particular turret are anti-capship this would certainly fix the energy drain problem and over time could still deal a comparable amount of damage since the energy drains slower.

I think it would also add an extra level of depth aswell, so you could have more say in the way your turrets operate. For instance do you assign 1 mass driver to all turrets or maybe 2 to your left and right turrets?

By the way I will be installing this script either way, my only problem is finding all the extra weapons! :D

Posted: Wed, 22. Mar 06, 15:09
by Red Spot
I can do that ... and it would mean;
-you lozing each and every cap. ship battle you start
-wasting ammo and energy with each and every shot
(as the turret will fire when the biggest gun is in range .. and all the smaller guns just drain energy and ammo for .. ehmm .. the light show ?!?)



as it is the NPCs cap. ships already switch weapons
the only one left out is the player ..

also note that I've been tweaking and testing this for about 2 weeks before I was 'happy' with it ..
and I can assure you that its not a 'cheat' ...

as I've said in the first post ... this script is not *better* ..
it just works diff. .. it puts its prio. diff. than ES' 'advanced turret script' ...
the end result is *about* the same ...

imo you could call this aegis for X3 without the 'taking it to the max' bit ..
(as in going over the top .. and as end result being a cheat)
ooohh .. and its not even half as demanding as aegis for X2 was/is ..



G

Posted: Wed, 22. Mar 06, 17:16
by Zipholm
Hej Red Spot,

Thanks for yet another great script.

Is there any way of making a similar script for non-turret weapons (Front lasers on smaller fighters)?

It's not for my personal ship, but for my wingmen. I would like them to switch between HEPTs and PACs, depending on their target. I don't believe that such a script exists currently.

Regards,
Zip

Posted: Wed, 22. Mar 06, 17:41
by gray1107
Red Spot wrote:I can do that ... and it would mean;
-you lozing each and every cap. ship battle you start
-wasting ammo and energy with each and every shot
(as the turret will fire when the biggest gun is in range .. and all the smaller guns just drain energy and ammo for .. ehmm .. the light show ?!?)
Ah I was thinking of weapons groups, but it's all good especially since
Red Spot wrote:as it is the NPCs cap. ships already switch weapons
the only one left out is the player ..
:o

... Anyway top work!

Posted: Wed, 22. Mar 06, 18:25
by Red Spot
Gray ...


I can tell you a lot a mumbojumbo and more 'scripting crap' .... :roll:

but I'll keep it simple ..
there a 2 ways you can work with turrets ..
the 'old' X2 aproach (and come up short .....)
the 'new' X3 aproach (and keep your script 'easygoing')

I stick with the 'new' X3 aproach ..
and that doesnt allow for 'grouping' ..
the fact that MDs get used as a 'special-special weapon' is because I basicly override the weapons used in the turret .. (as in force it to use MDs at that point) ..
and this can work only with MDs (at least efficiently) cause they use no energy .. doing it the 'manual/X2' way on any other weapon ..
and the script will be far less effective ...
and drain twice the energy .. being an x times more demanding script ...
(my previous turret script used the X2 way .. and came up short ... big time ... this is *about* the same (well the idea is ..:D) ..
but does it the X3 way...and imo isnt coming up short ...:))


======================
Zip-file ... ehhmm .. Zipholm .....


Been thinking about something like that
(in fact I had something like that for MDs)

but it simply isnt fair to the NPC ..
imo I actually tought about it as a cheat in the end ..
(the reason it no longer exists)

anyway when you equip a ship 'allround' it will work very well ..
(equipping a Nova with 6 Hepts is imo just as good as sending it into a Xenon-sector without weapons ... it prob. will only hit air before running out of energy ...give it 3/4 Hepts, 2 Pacs and 2 MDs ... and see what your puppy can do by itself (at least in respect to what the NPC ones are capable of doing)
the Hepts will take down larger ships
and the Pacs and MDs are to quickly remove M4/M5s and to be able to fire when out of energy)



G

Posted: Wed, 22. Mar 06, 19:46
by bruce7174
RS where does one put your files? in the script file? ....newbie here needs all the help he can get. :D

Posted: Wed, 22. Mar 06, 20:06
by Zipholm
Yeah, already doing something similar, but it couldn't hurt to ask for the improvement. Hadn't even thought of it as "cheating", until you completely spoiled it for me :wink:

Posted: Thu, 23. Mar 06, 11:50
by bruce7174
RS where does one put your files? in the script file? ....newbie here needs all the help he can get.



OK OK I realise your all very busy - but this is what I've done - unzipped the xlm files from Red spot and dropped them into the 'script' dir.

is this correct????

Do I need to do anything else???

Come on guys throw me a crumb

Posted: Thu, 23. Mar 06, 12:21
by qtv
as it is the NPCs cap. ships already switch weapons
the only one left out is the player ..
NPC caps ships switch weapons! Then we should too! This has just become a must have for equal play....when I finish the plot...

DonBruce - check out the stickies at the top of the mod forum.