Station Turret AI?

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

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

Post Reply
AngryDome
Posts: 4
Joined: Mon, 17. Jun 19, 00:39
x4

Station Turret AI?

Post by AngryDome » Wed, 19. Jun 19, 10:32

Greetings!

I've been looking through the game's files and playing around with numbers etc to get an idea of which does what, but I'm not 100% sure I'm on the right track for what I'm trying to achieve.

In essence, I want station turrets (both player controlled and NPC controlled) to have their turrets set to automatically attack all nearby enemies, and include all ship classes (xs -> xl) in their targetting.

Would anyone be able to point me towards the right files to edit in order to achieve this, if it is possible?

Cheers!

j.harshaw
EGOSOFT
EGOSOFT
Posts: 1881
Joined: Mon, 23. Nov 15, 18:02

Re: Station Turret AI?

Post by j.harshaw » Wed, 19. Jun 19, 12:34

fight.attack.object.station has the target acquisition and selection logic for station turrets.

AngryDome
Posts: 4
Joined: Mon, 17. Jun 19, 00:39
x4

Re: Station Turret AI?

Post by AngryDome » Wed, 19. Jun 19, 13:56

j.harshaw wrote:
Wed, 19. Jun 19, 12:34
fight.attack.object.station has the target acquisition and selection logic for station turrets.
I'd found that much out myself, although I do thank you for confirming for me. :)

I don't quite know what to change though. I've had a fiddle here and there and made it in to an extension that the game picks up, but I am yet to notice anything working differently. :?

j.harshaw
EGOSOFT
EGOSOFT
Posts: 1881
Joined: Mon, 23. Nov 15, 18:02

Re: Station Turret AI?

Post by j.harshaw » Wed, 19. Jun 19, 14:20

AngryDome wrote:
Wed, 19. Jun 19, 10:32
to have their turrets set to automatically attack all nearby enemies
<set_value name="$weapons_all" exact="this.ship.turrets.operational.list" />
<do_all exact="$weapons_all.count" counter="$i">
<set_weapon_mode weapon="$weapons_all.{$i}" weaponmode="weaponmode.attackenemies"/>
</do_all>
<remove_value name="$weapons_all" />

they are already mostly set to attackenemies. just missile turrets are set to defend to conserve ammo and mitigate stations shooting everything with overwhelming force.
AngryDome wrote:
Wed, 19. Jun 19, 10:32
and include all ship classes (xs -> xl) in their targetting.
look for:

<find_gravidar_contact groupname="$enemies"

there should be two instances.

remove

class="[class.ship_l,class.ship_xl]"

from

<match maybeattackedby="this.station" class="[class.ship_l,class.ship_xl]" comment="only select l/xl objects" />

in that node.

please be aware that including XS ships means that the station is very likely to hit itself when trying to shoot criminal mass traffic ships.

AngryDome
Posts: 4
Joined: Mon, 17. Jun 19, 00:39
x4

Re: Station Turret AI?

Post by AngryDome » Wed, 19. Jun 19, 15:45

See that's what I thought! I made similar changes, but it seemed like it didn't do anything. I'll make those exact changes and have a squiz. Thanks!

swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Re: Station Turret AI?

Post by swatti » Thu, 27. Jun 19, 15:45

Despite multiple patches and several re-starts, with mods and without my station turrets will NOT fire at enemies UNTILL fired at.

Post Reply

Return to “X4: Foundations - Scripts and Modding”