[Mod] Smarter turrets

The place to discuss scripting and game modifications for X4: Foundations.

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

Post Reply
rusky
Posts: 450
Joined: Sun, 4. Jan 09, 17:17
x4

[Mod] Smarter turrets

Post by rusky » Wed, 1. Sep 21, 03:40

Warning: This will probably not work properly/at all if not on version 4.1 Beta 7 of the game.

Change turret modes to be priority based instead of single conditions.
Priorities are:
Attack capital ships = L/XL ships > any target
Attack fighters = S/M ships > any target
Defend (defensive PD) = Missiles > target attackers
Missile defense (offensive PD) = Missiles > Fighters > any target


Manual download:
https://drive.google.com/file/d/1N8e2dd ... sp=sharing

On Steam:
https://steamcommunity.com/sharedfiles/ ... 2590504748

Changelog:
  • version 3: Improved target selection and responsiveness when player is controlling the ship. Should feel much better now when player is flying.
  • version 4: Improved target selection some more. Renamed defence and missile defence to better reflect new functionality.
Was poking through the various scripts and came across the code that selects targets for turrets. A bit of experimentation later, I was able to coerce it to use some basic priorities instead of the vanilla strict one thing at a time approach.

Note, this is still subject to some target switching limitations in X4, in particular that I noticed:

* refreshing targets takes between 0.5s - 65s depending on pilot skill. If someone just shot a missile 100m behind you and Jonny Newguy the 1 star pilot is in command, he's probably not going to react to it.
* if you set a medium turret on a large ship to attack capital ships and you're in range of the large ship with your large guns, your medium turret will just sit there and not shoot at other, closer targets, because there's a capital ship it wants to shoot at.
Last edited by rusky on Thu, 2. Sep 21, 23:11, edited 4 times in total.

Falcrack
Posts: 4911
Joined: Wed, 29. Jul 09, 00:46
x4

Re: [Mod] Smarter turrets

Post by Falcrack » Wed, 1. Sep 21, 05:03

For "Attack capital ships", does that include station modules? Does it also mean that if no capital ship is around, it will attack any target, including fighters?

rusky
Posts: 450
Joined: Sun, 4. Jan 09, 17:17
x4

Re: [Mod] Smarter turrets

Post by rusky » Wed, 1. Sep 21, 10:27

Yes and yes.

Just note that if there is a capital ship in the ships engagement range (which I think is defined by its longest range weapon equipped), turrets set to attack capitals will not shoot at fighters in range because they will be trying to attack the capital ship, even if a specific turret can't:

E.G: You have 2 large turrets, left and right of your ship, set to attack capitals.

A corvette appears: the turrets will now target the corvette.

A destroyer appears to the right of your ship: both turrets will now stop shooting at the corvette as there is a capital ship in the ship's target list.

Ideally, only the turret that can engage the target should do so of course (so in the above example, only the right turret should switch to the destroyer, the left turret should continue to fire at the corvette). I might try and see if I can get it to do that but it does not at the moment.

Falcrack
Posts: 4911
Joined: Wed, 29. Jul 09, 00:46
x4

Re: [Mod] Smarter turrets

Post by Falcrack » Thu, 2. Sep 21, 06:00

This seems to work pretty good so far. At least turrets set on Missile Defense seem to actively shoot non-missiles. But I have yet to see a situation where enemies are firing missiles at me.

Perhaps some of the names of the turret settings could be changed to clarify their function?

Missile Defense could be renamed to "Missile/Attack", to reflect the fact that it will prioritize missiles, but if none are around, if does an attack command.

Defense could be changed to "Missile/Defense", so that it is clear that this is a defensive setting only.

rusky
Posts: 450
Joined: Sun, 4. Jan 09, 17:17
x4

Re: [Mod] Smarter turrets

Post by rusky » Thu, 2. Sep 21, 23:10

I've further improved target acquisition for player ships (npc ships don't use turret commands).
Also updated the description for defense and missile defense to better reflect what they do now.

User avatar
Liath
Posts: 185
Joined: Sun, 25. Dec 05, 08:16
x4

Re: [Mod] Smarter turrets

Post by Liath » Fri, 14. Apr 23, 23:12

Where'd you go, my man? This is the only turret mod I've seen.
Sorry!
An error was encountered while processing your request:

There was a problem accessing the item. Please try again.


Here's a link to the Steam Community home page.
If I seem super-critical lately, it's due to having played X2 and X3, which were awesome games. X:R's release was a hard fail, however there *were* improvements, especially with stations, capitals, and capturing/boarding. X4 right now feels like the best parts of X2/3 and Rebirth all got thrown out the friggin window. I'm honestly hopeful that X4 will turn out awesome, but I'm already hugely disappointed in ES as I have seen them do better and really expect more from them.

Scoob
Posts: 9920
Joined: Thu, 27. Feb 03, 22:28
x4

Re: [Mod] Smarter turrets

Post by Scoob » Tue, 13. Jun 23, 01:18

Liath wrote:
Fri, 14. Apr 23, 23:12
Where'd you go, my man? This is the only turret mod I've seen.
Just found this thread while searching for any mods that improve turret flexibility, this one seems to meet the requirements. I've downloaded it, but yet to try it.

Note: when v6.0 launched I had situations where ships with turrets set to "Missile Defence" WOULD shoot other targets if no missiles present. However, that appeared to be a bug. I'd boarded some ships, and I can only assume that their improved targetting abilities - ships of other Factions can be seen shooting missiles AND other ships with the same turret, albeit rarely - had "stuck" with the ship once it was mine. Needless to say, Missile Defence still just does Missile Defence in v6.0, but it's much better at it.

Having the ability for a turret to target Missiles first then other stuff, would be huge... so I'm gonna try this.

RPINerd
Posts: 54
Joined: Fri, 8. Mar 19, 20:21
x4

Re: [Mod] Smarter turrets

Post by RPINerd » Tue, 13. Jun 23, 17:40

I'm kind of suprised that this cascading priority system is not just how the game works in vanilla..

I've downloaded the gdrive one to take a look and see if it conflicts in any ways with all the updates that have happened since this post first was made

Scoob
Posts: 9920
Joined: Thu, 27. Feb 03, 22:28
x4

Re: [Mod] Smarter turrets

Post by Scoob » Wed, 14. Jun 23, 00:04

RPINerd wrote:
Tue, 13. Jun 23, 17:40
I'm kind of suprised that this cascading priority system is not just how the game works in vanilla..

I've downloaded the gdrive one to take a look and see if it conflicts in any ways with all the updates that have happened since this post first was made
Indeed. When the game launched, myself and others commented on this. I liked the "custom" options we had in X3, allowing us to set our own priorities from the basic set of options. Worked great and I'd LOVE to see something similar in X4 one day. The game can obviously do it, so I don't quite understand why it's not become a standard feature.

For me, the KEY thing is having turrets set to Missile Defence also able to do something else when there are no missiles. As I run a modified game (VRO and others) missiles are DEADLY to Capital ships, so having at least some M-Class turrets set to Missile Defence - ideally using a beam weapon - is essential. Losing DPS vs. Fighters and Defence Drones as those turrets only shoot missiles is a pain.

Post Reply

Return to “X4: Foundations - Scripts and Modding”