[REQUEST] Prevent AI attacking build storage

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

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

cole2839
Posts: 108
Joined: Tue, 4. Dec 18, 01:43
x4

[REQUEST] Prevent AI attacking build storage

Post by cole2839 »

Can someone make a mode to prevent the AI pilots from attacking build storage for stations? It is super annoying that they seem to prefer to attack the Xenon station build storage over almost any other target. They stay there shooting it forever instead of doing their partrols or default behaviours. It is even a challenge to draw them away from it.

I would appreciate it, thanks.
cole2839
Posts: 108
Joined: Tue, 4. Dec 18, 01:43
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by cole2839 »

I figured out how to make a mod to fix this. I found the fix in the Foundation of Conquest and War V. 1.25 mod and extracted just this change out to a separate mod. I put it on Nexus. Credit goes to authors of the FOCW mod.

Destroy Build Storage
https://www.nexusmods.com/x4foundations ... escription
Kayser99
Posts: 23
Joined: Mon, 20. May 13, 13:18
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by Kayser99 »

cole2839 wrote: Mon, 24. Dec 18, 21:43 I figured out how to make a mod to fix this. I found the fix in the Foundation of Conquest and War V. 1.25 mod and extracted just this change out to a separate mod. I put it on Nexus. Credit goes to authors of the FOCW mod.

Destroy Build Storage
https://www.nexusmods.com/x4foundations ... escription
But that then gives a modified tag right?
cole2839
Posts: 108
Joined: Tue, 4. Dec 18, 01:43
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by cole2839 »

Any mod does yes. I took that mod down because it causes other bugs. Not sure which bug is worse though, LOL. This indestructible build storage is pretty game breaking.
Requiemfang
Posts: 3206
Joined: Thu, 16. Jul 09, 12:24
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by Requiemfang »

cole2839 wrote: Fri, 28. Dec 18, 02:46 Any mod does yes. I took that mod down because it causes other bugs. Not sure which bug is worse though, LOL. This indestructible build storage is pretty game breaking.
Not as bad as causing crashes.
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by 7ate9tin11s »

Note to self, add a invincibility check to Aggressive AI targeting routines so anything invincible is just ignored.

Will have to test it, but maybe tomorrow it will be released :D
User avatar
Matterom
Posts: 424
Joined: Thu, 20. Aug 09, 08:17
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by Matterom »

i was working on this yesterday, Apparently ships are already supposed to ignore the build storage objects and invulnerable objects like wrecks and certain stations. i'm still diagnosing the reasons why this is bypassed
My Mods:
Sector Administration: A Tax Mod
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by 7ate9tin11s »

Matterom wrote: Fri, 28. Dec 18, 03:57 i was working on this yesterday, Apparently ships are already supposed to ignore the build storage objects and invulnerable objects like wrecks and certain stations. i'm still diagnosing the reasons why this is bypassed
Hmm, while I can easily use find_XXXX to locate invulnerable things, I am having no luck finding a simple property on something I already have to see if it is invulnerable (i.e. $target.isinvulnerable). Do you happen to know the right syntax to determine if an object is invulnerable...I'm probably just too tired and missing it :oops:

In any case, right now I can prevent adding invulnerable things to the attack targets unless they are attacking the ship, should take care of most all situations...unless build storage has guns on it :gruebel:
Requiemfang
Posts: 3206
Joined: Thu, 16. Jul 09, 12:24
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by Requiemfang »

7ate9tin11s wrote: Fri, 28. Dec 18, 05:44
Matterom wrote: Fri, 28. Dec 18, 03:57 i was working on this yesterday, Apparently ships are already supposed to ignore the build storage objects and invulnerable objects like wrecks and certain stations. i'm still diagnosing the reasons why this is bypassed
Hmm, while I can easily use find_XXXX to locate invulnerable things, I am having no luck finding a simple property on something I already have to see if it is invulnerable (i.e. $target.isinvulnerable). Do you happen to know the right syntax to determine if an object is invulnerable...I'm probably just too tired and missing it :oops:

In any case, right now I can prevent adding invulnerable things to the attack targets unless they are attacking the ship, should take care of most all situations...unless build storage has guns on it :gruebel:
What if the ships only target the guns on the build storage and once destroyed they move on after the turrets are gone, would that be a good work-around... assuming of course if it can be done?
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by 7ate9tin11s »

Requiemfang wrote: Fri, 28. Dec 18, 05:56 What if the ships only target the guns on the build storage and once destroyed they move on after the turrets are gone, would that be a good work-around... assuming of course if it can be done?
At a glance build storage does not have any guns or shields (which would be a bit unfair for an invulnerable object anyways). So I think I can work out a solution.
User avatar
Matterom
Posts: 424
Joined: Thu, 20. Aug 09, 08:17
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by Matterom »

7ate9tin11s wrote: Fri, 28. Dec 18, 05:44
Matterom wrote: Fri, 28. Dec 18, 03:57 i was working on this yesterday, Apparently ships are already supposed to ignore the build storage objects and invulnerable objects like wrecks and certain stations. i'm still diagnosing the reasons why this is bypassed
Hmm, while I can easily use find_XXXX to locate invulnerable things, I am having no luck finding a simple property on something I already have to see if it is invulnerable (i.e. $target.isinvulnerable). Do you happen to know the right syntax to determine if an object is invulnerable...I'm probably just too tired and missing it :oops:

In any case, right now I can prevent adding invulnerable things to the attack targets unless they are attacking the ship, should take care of most all situations...unless build storage has guns on it :gruebel:
There is no property for it, i temporarily got around the issue by adding:
<do_if value="$primarytarget.isoperational and not ($primarytarget.isclass.[class.buildstorage])">
--------------------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

to the lib.target.selection, it was not a good fix but it did stop them from needlessly attacking it. Currently i'm looking for a good way to clean up build storages without stations or plots. so i need to find a good way to detect one that's part of a building station(so that doesn't get cleaned up). And then also figure out how to block new stations before they're built.

Something up the chain there is finding buildstorages to attack and it's taking me a while to find what it is, because everything after that will check for buildstorage and invulnerability

Invulnerability is a statement found by way of the <find/> tag. eg: <find_object_component name="$component" object="$object" indestructible="false" invulnerable="false"/>
My Mods:
Sector Administration: A Tax Mod
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by 7ate9tin11s »

Matterom wrote: Fri, 28. Dec 18, 07:50 There is no property for it, i temporarily got around the issue by adding:
<do_if value="$primarytarget.isoperational and not ($primarytarget.isclass.[class.buildstorage])">
--------------------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

to the lib.target.selection, it was not a good fix but it did stop them from needlessly attacking it. Currently i'm looking for a good way to clean up build storages without stations or plots. so i need to find a good way to detect one that's part of a building station(so that doesn't get cleaned up). And then also figure out how to block new stations before they're built.

Something up the chain there is finding buildstorages to attack and it's taking me a while to find what it is, because everything after that will check for buildstorage and invulnerability

Invulnerability is a statement found by way of the <find/> tag. eg: <find_object_component name="$component" object="$object" indestructible="false" invulnerable="false"/>
Likely the find_gravidar_contact search for enemies also needs the flags or it would find a lone buildstorage and add it to the target list.
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by 7ate9tin11s »

cole2839 wrote: Mon, 24. Dec 18, 15:28 Can someone make a mode to prevent the AI pilots from attacking build storage for stations? It is super annoying that they seem to prefer to attack the Xenon station build storage over almost any other target. They stay there shooting it forever instead of doing their partrols or default behaviours. It is even a challenge to draw them away from it.

I would appreciate it, thanks.
I think I have it covered in AggressiveAI now. Please give it a shot. :D
7ate9tin11s wrote: Fri, 28. Dec 18, 19:30 Aggressive AI Version 1.1 Released
  • Combat AI should no longer target invulnerable objects unless specifically told to by the player
  • Deployables now category in case someone decides to mod in new deployable wares
  • Reduced chances of using deployables, but pilots will still panic at low hull and throw everything at you in an attempt to live
  • Minor OOS damage calculation fixes now that drones are usable and killable OOS
  • Tossed in an optional CAT/DAT version for users of legacy operating systems
Download
https://www.nexusmods.com/x4foundations/mods/206/
cole2839
Posts: 108
Joined: Tue, 4. Dec 18, 01:43
x4

Re: [REQUEST] Prevent AI attacking build storage

Post by cole2839 »

7ate9tin11s wrote: Fri, 28. Dec 18, 19:48
cole2839 wrote: Mon, 24. Dec 18, 15:28 Can someone make a mode to prevent the AI pilots from attacking build storage for stations? It is super annoying that they seem to prefer to attack the Xenon station build storage over almost any other target. They stay there shooting it forever instead of doing their partrols or default behaviours. It is even a challenge to draw them away from it.

I would appreciate it, thanks.
I think I have it covered in AggressiveAI now. Please give it a shot. :D
7ate9tin11s wrote: Fri, 28. Dec 18, 19:30 Aggressive AI Version 1.1 Released
  • Combat AI should no longer target invulnerable objects unless specifically told to by the player
  • Deployables now category in case someone decides to mod in new deployable wares
  • Reduced chances of using deployables, but pilots will still panic at low hull and throw everything at you in an attempt to live
  • Minor OOS damage calculation fixes now that drones are usable and killable OOS
  • Tossed in an optional CAT/DAT version for users of legacy operating systems
Download
https://www.nexusmods.com/x4foundations/mods/206/

Nice dude. Thanks !!!

Return to “X4: Foundations - Scripts and Modding”