[Script] Point Defence. An advance turret defence script

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

[Script] Point Defence. An advance turret defence script

Post by s9ilent »

This script is your basic turret script, with several changes improvements. In short summary: It only shoots missiles and fighters, it works better then the current missile defence, and it is able to use fast firing weapons more effectively.




Last Updated
18/07/2008 - Improved the missile detection loops

Download link
Click here to download

This uses tfile 7142, and turret command 31 (And the associated command text entries)

Major differences/improvements


Targeting
Scans *all* missiles currently targeting ship, rather then just the nearest.
Only fires on "Little ships" (M3-5's, TS's and TP's). Has an enforced maximum possible targets to prevent lag.

Anti Missile handling
Unlike the existing missile defence script, where it would stop working when an incoming missile was out of firing range (More specifically, it will stay locked onto the nearest missile until it ceased to exist or moved into range), this script will keep cycling through all missiles until it finds something it can shoot at, and if it can't it then cycles through up to 20 targets.

Fire Handling
Rather then most turret scripts where it would turn, shoot, turn shoot, this script turns, shoots 3 times, and turns again, allowing the turret to achieve a faster firing rate. However, if your turret uses slow firing weapons, you will find that it will miss alot as it will still fire the predefined 3 times, but the target will no longer be where the turret is aiming at.
Another feature is that it fires a maximum of 15 volleys (of bursts of 3) at a target, then it will try to find a closer target. This is to try and maximise hit probability and fire rate.



My thoughts on the script
:) Firstly, I would assume that it would consume a bit more computing power then your basic script.
:) The max targets is now at something insane like 150, this is because I found that you could overwhelm the previous max with a multiple swarm missiles.

Coming Soon
I'm integrating customization over the size of bursts and volleys with the console system that I'm currently writing. I'm also going to change the max # of targets to have a max# missiles, and max# targets.
Last edited by s9ilent on Thu, 17. Jul 08, 16:25, edited 10 times in total.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Bump, new and improved
fud
Posts: 9837
Joined: Wed, 25. Jan 06, 14:26
x3

Post by fud »

Nice.
xxbluedragonxx
Posts: 375
Joined: Wed, 29. Aug 07, 13:08

Post by xxbluedragonxx »

I like this idea. It makes much more sense to try to shoot a few times then turn. Instead of shoot one time. Turn. Shoot another time. Turn. This is how it should be!
Wraith
Posts: 282
Joined: Fri, 30. May 03, 21:07
x3ap

Post by Wraith »

This sounds really handy. Is there any chance you can package it up in an .spk file for those of us without the confidence to start changing things in the script editor?
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

I would if I could, but truth be told, I don't actually know how to use .spk's. Give me a while to work it out, then Ill see if I can put it up somewhere. Hrm... how about just a simple extract all zip? (I can add self setting up scripts and all so there is no fiddling around)
xxbluedragonxx
Posts: 375
Joined: Wed, 29. Aug 07, 13:08

Post by xxbluedragonxx »

It is very easy. Just use Cycrow's Plugin Manager and the "Packager" program. Create a new spk and add the script into it. Fill in some details like author and version/description. Save it! All done!

For optional extra step you can use Doubleshadow's Modmanager to compress the script first into a .pck file then add it to the package but that isn't necessary.

But be careful to make a copy of your script file and put it in some other folder first because if you Uninstall the .spk it will remove the file it added to the "scripts" folder and if you didn't compress it, it will remove the .xml file you added! I hope that makes sense :)

Don't forget to add setup.xxxxxxx script file as well to start your script and add anything else you need to get it working.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Hrm.. so essentially I pack everything into the .spk, that I would into the zip? (The script, the setup/register script, and the relevant text file)
User avatar
Sandalpocalypse
Posts: 4447
Joined: Tue, 2. Dec 03, 22:28
x4

Post by Sandalpocalypse »

Yes its pretty straightforward. Just make sure to tell the packager what type of file you are adding in.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Ok, I've just posted the download link at the very top of the page in the original post

(If by chance anyone downloaded it before the 26th, I suggest re-downloading it, I've tweaked it a bit since then)
x0ne
Posts: 173
Joined: Sun, 9. Apr 06, 21:49
x3tc

Re: [Script] Point Defence. An advance turret defence script

Post by x0ne »

s9ilent wrote:if your turret uses slow firing weapons, you will find that it will miss alot as it will still fire the predefined 3 times, but the target will no longer be where the turret is aiming at.
You'll be pleased to learn that the three shots your script fires will always be on target. The "fire lasers on target <target> using turret <turretid>" command aims projectiles at the target irrespective of where the turret is actually pointing.

The command that moves the turrets (turn turret <turretid> to target <target>) is purely there to animate it and return signals to the SE (like FLRET_FIREFREE) about its move state. It's primarily used to prevent weapons from being fired at targets they couldn't possibly track (PPCs at a close range M5 for instance), thus making them realistic.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Whoops, your right, (I thought it would have some kind of firing cone limit like FS Mk2's laser auto aim). But in any case, what you said brought to my attention a possible bug (Where a ship could fly out of turret range during the burst fire loop). In any case, its now been resolved. And its been re-uploaded
Jasper Carrot
Posts: 168
Joined: Mon, 15. Dec 03, 01:04
x3tc

Post by Jasper Carrot »

Hi s9lient.

Just wondering if it would be possable to do something like this with your script? http://forum.egosoft.com/viewtopic.php?t=193216
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Yes I could, but I just want to clear up a few questions as to exactly what you want me to make before I do it.

Firstly, I'm assuming you want this to run on all AI ships as well? (Which would actually require me to write another AL script that makes all AI ships running stock X3 turret scripts to switch over to the new one)

Secondly, is there any specific restriction on the target? (Eg cappies only, as opposed to the current small ships/missiles). And should incoming missiles be targeted either?

Thirdly, should firing increasing as the ships are closer to each other?




Issues about your proposal
By firing in bursts, you would be reducing your maximum damage ability (As I can't speed on the fire rate during the burst, but rather in the cool down phase it'll just be wasting time, time which could be better spent shooting). If this was designed for capitol ship engagements, then this presents a more serious issue, as it all seems to be about who ever can put the most blasts out there.
A similar problem presents it self in the alternating turret scheme.
And then there is also the issue of the fire rate. If your firing something like a GPPC, it'll take a while to shoot a burst of 4-5, and by limiting the fire rate with burst/alternating turrets, it wouldn't really crate the Battlestar affect.

And finally just to clear things up, when you say alternating turrets, do you mean like fire port side, fire bow side, port, bow port bow; or do you mean fire port turret 1, fire port turret 2, fire port turret 3, repeat?


Pretty much in summary, this script would be... somewhat ... questionable tactically (As cappies never actually seem to run out of laser energy unless your firing almost all your turret at the same time, which would require you to be surrounded), and would only serve to restrict your damage potential.
Jasper Carrot
Posts: 168
Joined: Mon, 15. Dec 03, 01:04
x3tc

Post by Jasper Carrot »

Thanks for the quick reply s9ilent.

1st: Yes I would want this to run on AI ships as well. XTM compatable??

2nd: No, no specific restriction on target. Anything and everything :)

3rd: That is a great idea!!!

Issues: By firing in burst yes you would reduce your overall max damage BUT it would also draw out cap ship combat MAYBE making things more interesting. This is one of my issues with X3, Cap ship combat is over and done with way too quickly!!

Yes alternating turrents, as you put it: burst fire port turret 1, burst fire port turret 2, burst fire port turret 3 etc. However some ships like the M0's from XTM have huge numbers of turrets so by the time Turret 1 is ready to fire again it would be firing in unision with say turrent 4

Being somewhat questionable tactically depends on ones point of view. It could open up more tactical use. EG: Have a destroyer as your main antagonist while ordering a frigate to come in at a different angle to engage. A script like this would perhaps give time to issue such flanking orders during combat.

What gave me the idea was Star Wars. The cap ships seem to fire and then pause breifly, whether this could be considered as the turrents reaquiring their target before firing again is a possibility. Yes I know you see constant fire at times such as when the A wing rams the bridge of the SSD in Return of the Jedi but when the Nebulon B frigate engages an SD the fire is not constant nor is it constant in the opening scene of Revenge of the Sith, many ships fire fire fire pause and fire again.

Did I leave anything out?? :)
xxbluedragonxx
Posts: 375
Joined: Wed, 29. Aug 07, 13:08

Post by xxbluedragonxx »

Just a thought but if there is the change to make all turrets on all ships use burst fire then it would equalise out? So it won't be unbalancing anything? Because they all fire in bursts...

Personally I don't agree with the idea of turrets firing in sequence. It is more logical that they would shoot as soon as they have "reloaded" after their burst of fire. So each turret fires a burst. Waits a bit while it "reloads". Then it shoots another burst. It doesn't make much sense why a turret that is ready to shoot would be waiting on another turret? Especially since turrets can have different rates of fire and reload time.
ShadowDragon8685
Posts: 185
Joined: Mon, 7. Aug 06, 21:40
x4

Post by ShadowDragon8685 »

This looks like just what I need.

See, I got my hands on an Argon Military Centaur Mk. III Vanguard (Don't ask how), but the turrets' performance in defending my ship has been... Less than spectacular. I gave them all a concussion generator and a mass driver for petes' sake, and fly into a group of Yaki fighters.

One would think that that would be hell on wheels for fighters, but no. I very rarely see so much as one turret fire, and when it does, it never hits a damn thing. The small swarm of balls-stock Discoverers is more deadly to the Yaki than my "point defense" turrets.

And then some Yaki targeted my Centaur with a missile, I coulden't change my turrets to missile defense fast enough, and whatever it was blew up my ship in one hit. :(
ShadowDragon8685
Posts: 185
Joined: Mon, 7. Aug 06, 21:40
x4

Post by ShadowDragon8685 »

Ooookay, and now we have a new problem:

When I try to install your script using Cycrow's, it gives me the error message:

"Unable to uncompress the file: T/447142.xml"
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Ok, I re-packed it and it does extract, so it should work now (sorry about before, I updated it but didn't check the spk)
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

In reply to xxbluedragonxx 2nd last post, ships would just fire when they are ready, but it might be favourable to not fire every single gun at the exact same time, as it would cause a huge power drain, followed by no drain repeat, would could present several practical issues if the ship where real





In reply to Jasper
*Final Edit* In short summary:
Does the new script work, yes
Does it do what you want it to, no
Will it ever do what you want it to? Possibly, if you cap the fire rate on every ship to about 1/10 of what it is now, and with an even messier script, and no I'm not going to write it (simply because of how much you have to cap the fire rate by)
Is the script useful? No, the game already does what the script does (to an extent)

Return to “X³: Reunion - Scripts and Modding”