![Smile :-)](./images/smilies/icon_smile.gif)
Scripting and modding X4: Foundations is not that different from X Rebirth. So most of the information required for scripting and modding you can find there. In particular check the MD/Scripting basics. However, here a few things that you may find useful:
Unpacking the Game Files
The Catalog Tool from X Rebirth also works for X4: Foundations. You can download it here. Place it into the X4 root directory (i.e. where the X4.exe is located). To extract the files from the catalogues it is recommended to make a bat file (saved in the same root directory) for example unpack.bat that could look something like this:
Code: Select all
E:
cd "Games\Steam\SteamApps\common\X4 Foundations"
XRCatTool.exe -in 01.cat -in 02.cat -in 03.cat -in 04.cat -in 05.cat -in 06.cat -in 07.cat -in 08.cat -in 09.cat -out "E:\Games\Steam\SteamApps\common\X4 Foundations\unpacked"
pause
Useful Tools
In order to find certain entries is the game files there are various unofficial helper programs available. Personally I like AstroGreb which you can download here. To create or edit MD or XML scripts you need a suitable editor. Quite popular is Notepad++ although I prefer Visual Studio Express.
Mission Director(MD) and XML Script Commands
Once you have unpacked the game files you will find several with suffix xsd (check the folders libraries, md and scripts). All MD and XML commands are defined here. In addition there is a file scriptproperties.html (in the main root of your "unpacked" folder) that contains a list of all expression definded in the xsd files. If you are looking for examples on how to use a specific command then use AstroGrep to search the md or scripts folder for all files containing that command. And of course there is the X4 Manual for general information.
If you have trouble to open the scriptproperties.htlm file with your browser then please check the solution by jan posted in this thread.
Activate Mods in your Game
Suppose you have created a mod then you need to create a folder named extensions in the X4: Foundations root directory. Please note, there have been reports that an
extensions folder in the X4 main root directory does not activate any mods. Due to a current info from the developers the original idea was to place the extensions folder into
the X4 document folder. So please try that if you have trouble with starting mods from the main root folder. In any case you
are strongly advised to backup your saved games.
In the extensions folder create another folder for your mod. For example:
extensions > PlayerJump
In your mod folder you should create a content.xml which should look like this, for example:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<content id="PJ" name="PlayerJump" description="Player Ship can Jump to a Target via Autopilot" author="Euclid" version="0.1" date="2018-15-09" save="0" enabled="1">
<text language="44" name="PlayerJump" description="Player ship can jump via autopilot to a selected target" author="Euclid" />
<text language="49" name="PlayerJump" description="Das Spielershiff benutz einen Hyperraumantrieb der durch den Autopiloten zu einem gewaehlten Ziel ausgeloest wird" author="Euclid" />
</content>
extensions > PlayerJump > content.xml, md > EuclidsPlayerJump.xml
Now all you need is to start you game. You can check the in-game settings "extensions" to confirm that the mod "PJ" is active.
For Linux users: Please check this thread for specifics on how to install mods.
Cheers Euclid