[QUESTION] Change flight behaviors

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

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

Post Reply
Rovor
Posts: 3
Joined: Sun, 17. Apr 22, 14:01

[QUESTION] Change flight behaviors

Post by Rovor » Fri, 29. Apr 22, 22:48

Hi there!

I'm totally new to X modding and I want to create mod that changes bombers attack scripts.
As I understood - it should be some standard flight behaviors for the ships that they use depending on situation.

To proceed I do really need to know the exact values of it. Could anyone help me to determine where is these behaviors are located?
I've already tried to seek through aiscripts/libraries/aiscripts.xsd/script_properties.

Thanks in advance!

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [QUESTION] Change flight behaviors

Post by euclid » Sun, 1. May 22, 19:41

Rovor wrote:
Fri, 29. Apr 22, 22:48
...............
I've already tried to seek through .... libraries/aiscripts.xsd
...............
That's all there is imho; check lines 73-102 (ish).

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

kuertee
EGOSOFT
EGOSOFT
Posts: 789
Joined: Sun, 14. Dec 03, 13:05
x4

Re: [QUESTION] Change flight behaviors

Post by kuertee » Mon, 2. May 22, 08:00

1. Extract the files required. If I remember, game data file 8 contains the game logic (Mission Director files, MD) and AI scripts.
2. Open one of the aiscripts and try to discern its logic. Aiscripts run sequentially down the file. Jumps are handled with “go to label”. Interrupt handlers (e.g. event object was attacked) stops the logic to execute the actions for that interrupt (e.g. fight or flee after was attacked event). When studying the files, ignore the patch nodes. They are version changes to the file - allowing updates to the files on the file without destroying the player’s game.
3. I recommend an IDE that pretty prints XML scripts. Eg. Allows collapse and expand of nodes.
4. Check docs for things that are unknown to you. These docs would be: aiscripts.xsd, common.xsd, scriptproperties.html. I open these as raw files. But they can be installed on a personal web server to view them properly.
5. If the XML script format confuses you, consider that it’s just syntax and not logic. You should be able to look through it (like with other languages) to see beyond the format. There are advantages in this format. The only disadvantage is that people complain about it. 🤣 Programmers should be able to see past the syntax to the logic beyond.
6. Learn how to patch the xml files.
7. Downloading a mod to learn it to learn X4 modding cannot be overstated.
Mods: RPG: Reputations and Professions, Social Standings and Citizenships, Crime has Consequences, Alternatives to Death. Missions/NPCs: Emergent Missions, NPC Reactions, Mod Parts Trader, High-sec Rooms are Locked, Hacking Outcomes, More Generic Missions, Waypoint Fields for Deployment. Others: Auto-cam, Friendly Fire Tweaks, Teleport From Transporter Room, Wear and Tear. QoL: Trade Analytics, Loot Mining, Ship Scanner, Signal Leak Hunter, Station Scanner, Surface Element Targeting, etc.

Rovor
Posts: 3
Joined: Sun, 17. Apr 22, 14:01

Re: [QUESTION] Change flight behaviors

Post by Rovor » Thu, 5. May 22, 08:48

euclid wrote:
Sun, 1. May 22, 19:41

That's all there is imho; check lines 73-102 (ish).

Cheers Euclid
Thank you, but it just enumeration. My question is about exact ai rules for each behavior.
As I investigated it may be stored directly in game engine.
kuertee wrote:
Mon, 2. May 22, 08:00
7. Downloading a mod to learn it to learn X4 modding cannot be overstated.
Thanks a lot, kuertee, I've already use your mode as reference. :wink:
For now I'm trying to add another button to UI to make easier script calling. Like "Missile Attack" after "Coordinate Attack".

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [QUESTION] Change flight behaviors

Post by euclid » Thu, 5. May 22, 12:47

Rovor wrote:
Thu, 5. May 22, 08:48
........
As I investigated it may be stored directly in game engine.
.......
Hardcoded indeed, no script would be fast enough to perform actions like dogfight.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Post Reply

Return to “X4: Foundations - Scripts and Modding”