[TUTORIAL] X Rebirth - Modding Guide

The place to discuss scripting and game modifications for X Rebirth.

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

kMotion
Posts: 19
Joined: Thu, 9. Apr 15, 16:29
xr

Post by kMotion » Sun, 26. Apr 15, 11:27

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?

User avatar
wysiwyg
Posts: 585
Joined: Thu, 26. Feb 04, 00:08
x4

Post by wysiwyg » Sun, 26. Apr 15, 12:21

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?
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.

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 :)

insaneno
Posts: 2
Joined: Mon, 17. Nov 14, 19:16

Post by insaneno » Tue, 20. Oct 15, 16:39

I was just curious, how do i add ships to build list? i want to add reaver fighters to build list but cant find anywhere how to do it?

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Tue, 20. Oct 15, 18:04

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:

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>
(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..
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 ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

insaneno
Posts: 2
Joined: Mon, 17. Nov 14, 19:16

Post by insaneno » Thu, 22. Oct 15, 02:39

I cant seem to get it to work no matter which way I set it up, there just not showing up in the build tree. can you show me how to do it with multiple additions?

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Thu, 22. Oct 15, 04:13

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:

Code: Select all

shp_m_canteran_01
to the production queue of

Code: Select all

struct_econ_prod_shipm_macro.xml
like this:

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>
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:

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>
in something like:

\extensions\YOUR_MOD\md\your_mod_init.xml

Anubitus
Posts: 693
Joined: Fri, 21. Jan 05, 00:44
x4

Post by Anubitus » Fri, 8. Apr 16, 04:38

hey guys, how can i create custom .ogg sound files for x rebirth..? i tried using Audacity -> exporting as .wav and then converting it to .ogg with FlicFlac audioconverter but the sounds sound distorted and deep/low..

Browser_ice
Posts: 485
Joined: Sun, 5. Feb 06, 17:15
x4

Post by Browser_ice » Sat, 30. Jul 16, 22:03

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 ???
Steam X-Superbox, XR, playing X4
WIndows-10
Intel I7-3770
16Gb Memory
Nvgidia GTX-1060

User avatar
Observe
Posts: 5079
Joined: Fri, 30. Dec 05, 17:47
xr

Post by Observe » Sat, 17. Dec 16, 19:27

Hello. File and image links are now updated. I apologize for not doing a better job of maintaining this thread. My internet access is infrequent and I am unable to answer questions, but hopefully the tutorial will make better sense with the accompanying images etc.

Thanks.

User avatar
Herman2000
Posts: 42
Joined: Sat, 24. Aug 13, 22:20
x4

Re: [TUTORIAL] X Rebirth - Modding Guide

Post by Herman2000 » Sat, 21. Sep 19, 07:48

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.

mcsaba
Posts: 1
Joined: Wed, 11. Mar 09, 09:24
x4

Re: [TUTORIAL] X Rebirth - Modding Guide

Post by mcsaba » Tue, 13. Apr 21, 16:53

Hi,

Anybody could update links of images and example mod in the guide?
Or somebody could share the example mod with me?

Thank you :)

danadi712
Posts: 45
Joined: Sun, 1. Feb 15, 19:07

Re: [TUTORIAL] X Rebirth - Modding Guide

Post by danadi712 » Tue, 5. Apr 22, 15:13

Has anyone an ideea on how to change cargo capacity on ships?
I am interested on medium and capital trade ships

User avatar
alexalsp
Posts: 1820
Joined: Fri, 18. Jul 14, 05:28
x4

Re: [TUTORIAL] X Rebirth - Modding Guide

Post by alexalsp » Tue, 5. Apr 22, 19:06

danadi712 wrote:
Tue, 5. Apr 22, 15:13
Has anyone an ideea on how to change cargo capacity on ships?
I am interested on medium and capital trade ships

assets\props\StorageModules\macros\

cargobay_ship_*_container_*_macro

danadi712
Posts: 45
Joined: Sun, 1. Feb 15, 19:07

Re: [TUTORIAL] X Rebirth - Modding Guide

Post by danadi712 » Thu, 7. Apr 22, 21:44

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?

User avatar
alexalsp
Posts: 1820
Joined: Fri, 18. Jul 14, 05:28
x4

Re: [TUTORIAL] X Rebirth - Modding Guide

Post by alexalsp » Fri, 8. Apr 22, 10:02

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.

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>
This is the desired storage.

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>

danadi712
Posts: 45
Joined: Sun, 1. Feb 15, 19:07

Re: [TUTORIAL] X Rebirth - Modding Guide

Post by danadi712 » Fri, 8. Apr 22, 13:37

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>

User avatar
alexalsp
Posts: 1820
Joined: Fri, 18. Jul 14, 05:28
x4

Re: [TUTORIAL] X Rebirth - Modding Guide

Post by alexalsp » Fri, 8. Apr 22, 14:32

danadi712 wrote:
Fri, 8. Apr 22, 13:37
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>
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
The file should contain only this code. 600 can be changed to your own value.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?> 
<diff>
 <replace sel="//properties/cargo/@max">600</replace> 
</diff>
the path to the file must be saved.

Remember, this change will apply to all ships with this cargo hold.

danadi712
Posts: 45
Joined: Sun, 1. Feb 15, 19:07

Re: [TUTORIAL] X Rebirth - Modding Guide

Post by danadi712 » Fri, 8. Apr 22, 15:29

Thank you alex.
Is working.
Even on save game.

Post Reply

Return to “X Rebirth - Scripts and Modding”