[HOWTO] Extract data from game - purchasable ships?

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

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

User avatar
Kosh_Naranek
Posts: 17
Joined: Wed, 7. Jan 04, 07:06
x4

[HOWTO] Extract data from game - purchasable ships?

Post by Kosh_Naranek »

I’m looking to extract information from the game from a stand-alone tool that I am making regarding where I can buy certain ships or where I can buy certain guns because I keep forgetting where I find things. The information would be extracted from the game regardless of whether it is running or not and so it won't be a typical mod running scripts in-game.

The problem is I can’t figure how either in the game save file or the various .dat files describe this. My program is currently able to load everything under "/savegame/universe/component[@class='galaxy']" and parts of 08.dat and 09.dat that I am interested in.

I know for example just playing the game that "Peregrine Vanguard" {20101,20302} is available from TEL Teladi Wharf (QGS-786) {20102,1341} in Profit Centre Alpha.

Code: Select all

<component class="station" macro="station_gen_factory_base_01_macro" connection="space" code="QGS-786" owner="teladi" knownto="player" 
         basename="{20102,1341}" level="1" id="[0x1a9c1]">
Looking up {20102,1341} confirmed “Teladi Wharf” in 09.dat. So far so good. Though I could find station_gen_factory_base_01_macro in 08.dat it didn't seem to contain anything along the lines of what a particular station makes.

Scanning 08.dat "macros" resulted in:

Code: Select all

<ware id=”ship_tel_m_bomber_01_a_macro”>  
...and

Code: Select all

<plan id="tel_wharf" …> 
(but it seems to describe parts).

Searching for “ship_tel_m_bomber_01_a_macro” had hits but how they tie back to stations is a mystery for me.

I kicked off a build of a ship then quickly saved and examined the savegame file and though I could see it appear as a child in <component class=”station”> but marked as under construction, it just showed the usual ship_tel_m_bomber_01_a_macro macro.

Any help would be greatly appreciated.

Thanks!
User avatar
Kosh_Naranek
Posts: 17
Joined: Wed, 7. Jan 04, 07:06
x4

Re: [HOWTO] Extract data from game - purchasable ships?

Post by Kosh_Naranek »

I think I worked it out
balogt
Posts: 773
Joined: Thu, 18. Dec 03, 09:00
x3

Re: [HOWTO] Extract data from game - purchasable ships?

Post by balogt »

For ships of one type ie. Vanguard they spawn at ministry faction warf vs the sentinals at the teladi faction warf. The other 2 races work the same way. Holy order and paranid arhon and antigony factions.
Now to add the resupply ships to all factions witjin that race i used the / add feature and made a quick little mod folder for those and other not normallt available ships. I am also using a custom x3 universe map that another modder has up in a post. With some custom work iv been adding as well.
Let me know if you need a copy of the add code.
User avatar
Kosh_Naranek
Posts: 17
Joined: Wed, 7. Jan 04, 07:06
x4

Re: [HOWTO] Extract data from game - purchasable ships?

Post by Kosh_Naranek »

balogt wrote: Wed, 26. Dec 18, 00:53 For ships of one type ie. Vanguard they spawn at ministry faction warf vs the sentinals at the teladi faction warf. The other 2 races work the same way. Holy order and paranid arhon and antigony factions.
Now to add the resupply ships to all factions witjin that race i used the / add feature and made a quick little mod folder for those and other not normallt available ships.
Thanks man. I can't use mod scripts though. I had worked it out by processing 08.dat (or if you have the files unpacked it will be wares.xml. The problem I had was working from the station end and trying to find relationships. It doesn't work that ware. All ships and equipment are wares which may or may not list restrictions. It is the restriction together with the ware owner that ties it back to the station. :)
aftokinito
Posts: 229
Joined: Sun, 30. Mar 08, 17:29
x4

Re: [HOWTO] Extract data from game - purchasable ships?

Post by aftokinito »

The only file you need is wares.xml.
Ships are available for purchase for the factions that own the ware that have at least one restriction.
So basically, traverse the wares.xml file and look for "ware" tags with the "tag" attribute containing "ship" that have a "restriction" tag as child node. You can then grab the content of the "owner" child tags to know where will the ship be available.

Return to “X4: Foundations - Scripts and Modding”