[Script] Turrets: selective attack V.1.3

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

Armankessilon
Posts: 33
Joined: Sat, 17. Jan 09, 10:49

[Script] Turrets: selective attack V.1.3

Post by Armankessilon » Mon, 9. Feb 09, 19:33

Turrets: selective attack V.1.3

Description:
This script will add four new turret commands:
-Defend from fighters (turret will respond only on fighter's and missile's attacks)
-Defend from big ships (turret will respond only on big ship's and missile's attacks)
-Attack fighters (turret will attack only enemy fighters)
-Attack big ships (turret will attack only enemy big ships)

Setup:
Unpack and copy all files to game folder.
Compatibility:
1.4 or higher

Language supplements:
-english
-russian

Used resources:
Commands:
-COMMAND_TYPE_TURRET_25
-COMMAND_TYPE_TURRET_26
-COMMAND_TYPE_TURRET_27
-COMMAND_TYPE_TURRET_28

Lang. files:
-4224-L007
-4224-L044

History:
V.1.3:
-english supplement
V.1.2:
-modified to X3: Terran Conflict
V.1.1:
-Attack fighters (turret will attack only enemy fighters)
-Attack big ships (turret will attack only enemy big ships)

Author: Yevgeniy Tumanov a.k.a Armankessilon

Download Link

fud
Posts: 6989
Joined: Wed, 25. Jan 06, 15:26

Post by fud » Mon, 9. Feb 09, 19:48

Nice.

I've always thought there should be more flexibility with the turret commands.

Definitely going to check this one out.

User avatar
ttl
Posts: 537
Joined: Sun, 6. Feb 05, 14:04

Post by ttl » Tue, 10. Feb 09, 01:35

So, allowing to use separate turrets for anti-capital and anti-fighter work?
Simple(ish) and more conservative option for the beast that is MARS.

I like it. :)

One suggestion, though I'm not even sure if it's in already: Make the "attack capital ships" command always prioritize the current target of the ship, if that target is a capital ship. You don't want your ship(s) to spread their fire among targets, if there's to choose from.

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

Post by s9ilent » Tue, 10. Feb 09, 01:41

I haven't looked at your script yet, but just a quick suggestions.

For anti fighter, the problem with fighters is the stock scripts don't target the best ship. (Eg like Gazz's example says, they shoot at that m5 flying wildly at 2k range, instead of the m3 at point blank)

You could improve anti-fighter turret scripts if you incrementally search for enemy fighters
(Search m3, enenmy nearest, then m4, same flags, etc m5, oh wait.. m8 first.. right new tc classes :S)

Also to prevent it firing at a target to far away, just make it re-search for a target after firing like 10 shots or so. (Where it uses the same search patterns as above)

Armankessilon
Posts: 33
Joined: Sat, 17. Jan 09, 10:49

Post by Armankessilon » Tue, 10. Feb 09, 11:27

All commands based on standart turret commands. If turret see big ship, it will attack him (if Attack Big Ship). No target selection.
Maybe, later i will add another commands :wink:

User avatar
Gazz
Posts: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Mon, 23. Mar 09, 20:47

s9ilent wrote:You could improve anti-fighter turret scripts if you incrementally search for enemy fighters
(Search m3, enenmy nearest, then m4, same flags, etc m5, oh wait.. m8 first.. right new tc classes :S)

Also to prevent it firing at a target to far away, just make it re-search for a target after firing like 10 shots or so. (Where it uses the same search patterns as above)
This script is all about simplicity and not being a resource hog. So alas, you can't spoil it with complicated schemes, evaluating targets, checking a gazillion conditions.

Something simple would be the target's speed.
On an attack run fighters usually slow down well below top speed but while evading, they go full throttle.
So the simplest way to find out if fighter X is a good target is to compare current and top speed.

Or at least - keep firing at this fighter (as a stock script would) until it speeds up and does it's sommersaults.

It may not be ideal but it would be a simple and quick way to make a good/bad target decision. Just 2 numbers to judge the general intention of a fighter. And it's not cheating like trying to peek at what scripts/actions it is running or the likes. MARS wouldn't do that, either. =P
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

User avatar
Seathal
Posts: 843
Joined: Thu, 5. Jun 08, 23:03

Post by Seathal » Mon, 23. Mar 09, 21:46

Looking good, very good... but instead of "Attack only fighters/capital ships" couldn't you also add "Priorize fighters/capital ships voer other objectives, but still attack the opposite if there's no other best target"? And can't you add the missile defense to the "attack target" ones or is it already included? Is an M6 considered a fighter or a capital?

I've been hopeing for someone to do a simplified MARS script, less resource intensive and complicated, just with some good and valid turret commands like the ones mentioned. ALthough it was great, the MARS system of keeping all your weapons in the cargo and distributeing them automaticlly felt a bit forced, I'd like them to stay all the time in place and be just abit mroe selective (for example, PPC/PSPs not trying to hit a buzzing M5 when there's a frigate and a carrier in range...).

User avatar
Gazz
Posts: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Mon, 23. Mar 09, 23:18

Seathal wrote:ALthough it was great, the MARS system of keeping all your weapons in the cargo and distributeing them automaticlly felt a bit forced, I'd like them to stay all the time in place and be just abit mroe selective
That wasn't my idea, really. It's what all AI ships have been doing ever since Reunion, possibly longer.
It's just... the X3 way.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

User avatar
Seathal
Posts: 843
Joined: Thu, 5. Jun 08, 23:03

Post by Seathal » Tue, 24. Mar 09, 16:34

Gazz wrote:
Seathal wrote:ALthough it was great, the MARS system of keeping all your weapons in the cargo and distributeing them automaticlly felt a bit forced, I'd like them to stay all the time in place and be just abit mroe selective
That wasn't my idea, really. It's what all AI ships have been doing ever since Reunion, possibly longer.
It's just... the X3 way.
Yes I understand that, but I can't imagine the way MARS works in a "real" situation, where those _huge_ cannons switch ina second and adapt to the enemy moves. If MARS didn't have that feature I'd be using it all the time!

Don't get me wrong, the selection of targets, missile interception, priorities of blanks and the increased speed and aiming are great and I had so much fun with MARS in earlier saves.

Armankessilon
Posts: 33
Joined: Sat, 17. Jan 09, 10:49

Post by Armankessilon » Thu, 26. Mar 09, 20:33

Seathal wrote:couldn't you also add "Priorize fighters/capital ships voer other objectives, but still attack the opposite if there's no other best target"
Well, actually there was the point - to ignore wrong targets, and stay off the trouble.
Maybe i will do what you're asking, but it will be separate script.
Seathal wrote: And can't you add the missile defense to the "attack target" ones or is it already included?
Got in my to do list ;)
Seathal wrote: Is an M6 considered a fighter or a capital?
As capital. You think it should be considered as fighter?

User avatar
MegaJohnny
Posts: 1921
Joined: Wed, 4. Jun 08, 22:30

Post by MegaJohnny » Thu, 26. Mar 09, 20:59

Armankessilon wrote: As capital. You think it should be considered as fighter?
I wouldn't say so personally but on the other hand if an anti-capital turret starts shooting at a corvette, esp. a fact one, you'll probably still miss a lot.

Oh by the way I love you.

These commands should have been in TC to begin with.

User avatar
Seathal
Posts: 843
Joined: Thu, 5. Jun 08, 23:03

Post by Seathal » Fri, 27. Mar 09, 17:50

Seathal wrote: Is an M6 considered a fighter or a capital?
As capital. You think it should be considered as fighter?[/quote]

That's the thing, it's inbetween, in TC it cannot be considered a true capital ship anymore but neither a fighter... For example. The Terran SSC can finish up a corvette easly, but other flak guns have more trouble, also as MegaJohnny commented, some anti-cap weapons miss a lot with corvettes (When ina Terran capital ship you actually kill more corvettes with your flaks than with your anti-cap lasers)... that's why I asked.

Still an excellent script :P

User avatar
Gazz
Posts: 12423
Joined: Fri, 13. Jan 06, 17:39

Post by Gazz » Fri, 27. Mar 09, 18:03

Armankessilon wrote:As capital. You think it should be considered as fighter?
The Xenon P has more of a fighter. Trying to hit it with PPC at close range is quite futile.

You could try using Huge Ship instead of Big Ship for "capital" target selection, which would only be TL + M1/2/7.
The M6 would then be lumped in with the fighters and targeted with all the mid range weaponry like ISR, MAM and whatnot.

Or something like:
Cap ship: if no closest Huge Ship found, look for closest Big Ship
Fighter: closest (not huge) ship

Object class is the only thing that is usable in quick searches so you'll have to work with that.

But no matter how you do it, some will complain.
Luckily it's your script so it's either your way or... your way. =P
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Hieronymos
Posts: 829
Joined: Fri, 30. Dec 05, 23:14

Post by Hieronymos » Thu, 16. Apr 09, 03:40

Another interesting and useful turret script.

Perhaps the next logical development would be a "Point Defense" script for corvette and smaller frigate turrets, that would just target missles and fighters using best weapon available.
Image

User avatar
Spectre01
Posts: 443
Joined: Tue, 23. Dec 08, 11:15

Post by Spectre01 » Mon, 20. Apr 09, 21:18

Can you add another line in the script that force the turret to reselect a target every 3 seconds? I find that once a turret is "locked" on a target, until the target is destoryed, it will not fire at others, even the first target is out of range, and there's another one within range. The turret just ingnore the closest enemy, and waiting for its first target get in its range again.

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”