[TUTORIAL] X Rebirth - Modding Guide
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
There is a sticky above called [Index] X Rebirth Tools, Tutorials and Resources The Mission Director Guide by Egosoft is a very good starting point to understand syntax and semantics of the modding language.kMotion wrote:Thanks for all, interesting XML modding. How can I create an array? How can I found a random field from array? How can I save a variable param in string, how can I use that string parameters? Where I can read about all of this? Maybe you know useful posts on this forum or another sites?
The documentation for the game is here and inside the game files themselves. Arrays are called lists in XR modding, you also have hashed lists called tables that are used in both MD/AI scripting and Lua (User Interface, UI) scripting.
Study other modders' work! The game has only been around for a year and a bit so there is no easy casual formula for modding it. You must study what is there and understand it if you want to write mods.
Wysi
![Smile :)](./images/smilies/icon_smile.gif)
look into the Production Modules of the respective Stations for small ships, you can find them in
assets\structures\Economy\production\macros
as one of these files:
struct_econ_prod_shipm_macro.xml
struct_econ_prod_shipm_dv_macro.xml
struct_econ_prod_shipm_dv_macro.xml
struct_econ_prod_ships_macro.xml
struct_econ_prod_ships_dv_macro.xml
struct_econ_prod_ships_dv_macro.xml
adding a new Product to the production queue should do the trick:
(put this into a file with the same Name and Path as the Vanilla file you want to change, but inside your Extension, not in the game root)
in the optimum case the add should be enough because it makes adding Ships from multiple mods for production trivial, but i think the first (replace) is also needed..
assets\structures\Economy\production\macros
as one of these files:
struct_econ_prod_shipm_macro.xml
struct_econ_prod_shipm_dv_macro.xml
struct_econ_prod_shipm_dv_macro.xml
struct_econ_prod_ships_macro.xml
struct_econ_prod_ships_dv_macro.xml
struct_econ_prod_ships_dv_macro.xml
adding a new Product to the production queue should do the trick:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<diff>
<replace sel="//production/@wares">shp_m_ore_transporter shp_m_ice_collector shp_m_crystal_collector shp_m_container_transporter shp_m_energy_transporter shp_m_liquid_transporter shp_m_ions_collector shp_m_hydrogen_collector ANDYOURNEWPRODUCT</replace>
<add sel="//production/queue">
<item ware="ANDYOURNEWPRODUCT" />
</add>
</diff>
in the optimum case the add should be enough because it makes adding Ships from multiple mods for production trivial, but i think the first (replace) is also needed..
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter![Wink ;)](./images/smilies/icon_wink.gif)
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help![Wink ;)](./images/smilies/icon_wink.gif)
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
![Wink ;)](./images/smilies/icon_wink.gif)
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
![Wink ;)](./images/smilies/icon_wink.gif)
Can't remember for certain, but I seem to remember that you'll have to either start a new game or patch existing shipyards in a running game in addition to the changes UniTrader mentioned.
So, for example, to add the Katana to Albion m-ship shipyards, you'll need to add:
to the production queue of
like this:
This should be in:
\extensions\YOUR_MOD\assets\structures\Economy\production\macros\struct_econ_prod_shipm_macro.xml
Then, to patch the shipyards for existing saves, something like:
in something like:
\extensions\YOUR_MOD\md\your_mod_init.xml
So, for example, to add the Katana to Albion m-ship shipyards, you'll need to add:
Code: Select all
shp_m_canteran_01
Code: Select all
struct_econ_prod_shipm_macro.xml
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<diff>
<replace sel="//production/@wares">shp_m_ore_transporter shp_m_ice_collector shp_m_crystal_collector shp_m_container_transporter shp_m_energy_transporter shp_m_liquid_transporter shp_m_ions_collector shp_m_hydrogen_collector shp_m_canteran_01</replace>
<add sel="//production/queue">
<item ware="shp_m_canteran_01"/>
</add>
</diff>
\extensions\YOUR_MOD\assets\structures\Economy\production\macros\struct_econ_prod_shipm_macro.xml
Then, to patch the shipyards for existing saves, something like:
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1" ?>
<mdscript name="Your_Mod_Init">
<cues>
<cue name="Your_Mod_Patch_Shipyards">
<conditions>
<event_game_loaded />
</conditions>
<actions>
<patch_macros macro="macro.struct_econ_prod_shipm_macro"/>
</actions>
</cue>
</cues>
</mdscript>
\extensions\YOUR_MOD\md\your_mod_init.xml
-
- Posts: 485
- Joined: Sun, 5. Feb 06, 17:15
Started to check out this thread and I am starting to see some dead links.
osr_universe.rar (think anything in read is a dead link)
5. Example mod extension developed for this guide (download here)
http://xrebirth.nexusmods.com/mods/28/? (none existing on Nexus)
Also all images using http://www.worldwidemods.com are dead. Domain no longer existing.
Also, the last update is from 2014 ? Is it even still 100% compatible with XRebirth 4.* ?
Rarely any recent replies done also .....
Most XML examples are based on the RAR file above and are not fully displayed. So without this file, someone cannot really advance.
Is this thread still good enough for someone to start creating a MOD without having to go through all the 16 pages ???
osr_universe.rar (think anything in read is a dead link)
5. Example mod extension developed for this guide (download here)
http://xrebirth.nexusmods.com/mods/28/? (none existing on Nexus)
Also all images using http://www.worldwidemods.com are dead. Domain no longer existing.
Also, the last update is from 2014 ? Is it even still 100% compatible with XRebirth 4.* ?
Rarely any recent replies done also .....
Most XML examples are based on the RAR file above and are not fully displayed. So without this file, someone cannot really advance.
Is this thread still good enough for someone to start creating a MOD without having to go through all the 16 pages ???
Steam X-Superbox, XR, playing X4
WIndows-10
Intel I7-3770
16Gb Memory
Nvgidia GTX-1060
WIndows-10
Intel I7-3770
16Gb Memory
Nvgidia GTX-1060
- Herman2000
- Posts: 42
- Joined: Sat, 24. Aug 13, 22:20
Re: [TUTORIAL] X Rebirth - Modding Guide
So, seeing as this excellently-written guide is linked in the stickied thread, it might be prudent (in spite of the thread's age) to point out that the example files are, once again not available, and that no archive page in the universe seems to have them stored, either. =\ Bummer, I'd really like to have a look at some of the stuff.
EDIT: Derp. I guess I can just as well reference from the finalized mod. Still, thought it'd be prudent to point out.
EDIT: Derp. I guess I can just as well reference from the finalized mod. Still, thought it'd be prudent to point out.
Re: [TUTORIAL] X Rebirth - Modding Guide
Hi,
Anybody could update links of images and example mod in the guide?
Or somebody could share the example mod with me?
Thank you![Smile :)](./images/smilies/icon_smile.gif)
Anybody could update links of images and example mod in the guide?
Or somebody could share the example mod with me?
Thank you
![Smile :)](./images/smilies/icon_smile.gif)
Re: [TUTORIAL] X Rebirth - Modding Guide
Has anyone an ideea on how to change cargo capacity on ships?
I am interested on medium and capital trade ships
I am interested on medium and capital trade ships
Re: [TUTORIAL] X Rebirth - Modding Guide
I unpacked 09.cat and i find those macros
I create a folder SHIPS with structure SHIPS\assets\props\StorageModules\macros
in folder macros i change in file cargobay_ship_m_bulk_01_macro.xml
<cargo max="18000" tags="bulk" />
to
<cargo max="600" tags="bulk" />
From my understanding this is for GIGURUM BULK type M class ship
I put folder SHIPS in folder EXTENSIONS
New GAME
Nothing changes
What is the problem?
I create a folder SHIPS with structure SHIPS\assets\props\StorageModules\macros
in folder macros i change in file cargobay_ship_m_bulk_01_macro.xml
<cargo max="18000" tags="bulk" />
to
<cargo max="600" tags="bulk" />
From my understanding this is for GIGURUM BULK type M class ship
I put folder SHIPS in folder EXTENSIONS
New GAME
Nothing changes
What is the problem?
Re: [TUTORIAL] X Rebirth - Modding Guide
Show the file code.
This cargo hold can be used for different ships. You need to open the Gigurum ship file and see what cargo bays are connected to it.
This is the desired storage.
This cargo hold can be used for different ships. You need to open the Gigurum ship file and see what cargo bays are connected to it.
Code: Select all
assets\units\size_*\Macros\
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<!--Exported by: Michael (192.168.3.145) at 18.07.2014_10-54-03-->
<macros>
<macro name="units_size_m_weapontech_transporter_macro" class="ship_m" alias="units_size_m_container_transporter_5_macro">
<component ref="units_size_m_weapontech_transporter" />
<properties>
<identification name="{20101,2801}" basename="{20101,2803}" description="{20101,2802}" variation="{20106,2101}" mapicon="shipicon_freighter_m" />
<hull max="55000" />
<effects>
<explosion ref="explosion_m_02" />
</effects>
<purpose primary="trade" />
</properties>
<connections>
<connection ref="connection_cockpit01">
<macro ref="cockpit_bridge_size_m_macro" connection="Connection01" />
</connection>
<connection ref="connection_engine01">
<macro ref="engine_size_s_02_macro" connection="connection_component01" />
</connection>
<connection ref="connection_engine02">
<macro ref="engine_size_s_02_macro" connection="connection_component01" />
</connection>
<connection ref="connection_radar01">
<macro ref="radar_ship_m_freighter_01_macro" connection="ship" />
</connection>
<connection ref="connection_shieldgen01">
<macro ref="shieldgenerator_ship_m_03_macro" connection="Connection01" />
</connection>
<connection ref="connection_storage01">
<macro ref="storage_ship_m_container_01_macro" connection="ShipConnection" />
</connection>
</connections>
</macro>
</macros>
Code: Select all
storage_ship_m_container_01_macro
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<!--Exported by: Michael (192.168.3.144) at 03.03.2015_16-52-12-->
<macros>
<macro name="storage_ship_m_container_01_macro" class="storage">
<component ref="generic_storage" />
<properties>
<identification name="{20109,401}" />
<hull integrated="1" />
</properties>
<connections>
<connection ref="cargo">
<macro ref="cargobay_ship_m_container_01_macro" connection="StorageConnection" />
</connection>
</connections>
</macro>
</macros>
Code: Select all
cargobay_ship_m_container_01_macro
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<!--Exported by: Michael (192.168.3.144) at 03.03.2015_16-53-20-->
<macros>
<macro name="cargobay_ship_m_container_01_macro" class="cargobay">
<component ref="generic_cargobay" />
<properties>
<cargo max="12000" tags="container" />
<hull integrated="1" />
</properties>
</macro>
</macros>
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<diff>
<replace sel="//properties/cargo/@max">600</replace>
</diff>
Re: [TUTORIAL] X Rebirth - Modding Guide
Thank you alexalsp.
But i didnt understand in what file and where to put this code
<?xml version="1.0" encoding="UTF-8" ?>
<diff>
<replace sel="//properties/cargo/@max">600</replace>
</diff>
But i didnt understand in what file and where to put this code
<?xml version="1.0" encoding="UTF-8" ?>
<diff>
<replace sel="//properties/cargo/@max">600</replace>
</diff>
Re: [TUTORIAL] X Rebirth - Modding Guide
the code is inserted into the same file but in a mod.
Code: Select all
cargobay_ship_m_container_01_macro.xml
Code: Select all
mod\assets\props\StorageModules\macros\cargobay_ship_m_container_01_macro.xml
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<diff>
<replace sel="//properties/cargo/@max">600</replace>
</diff>
Remember, this change will apply to all ships with this cargo hold.
Re: [TUTORIAL] X Rebirth - Modding Guide
Thank you alex.
Is working.
Even on save game.
Is working.
Even on save game.