[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: 584
Joined: Thu, 26. Feb 04, 01: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, 20: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: 13928
Joined: Sun, 20. Nov 05, 23: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, 20: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: 2962
Joined: Tue, 18. Nov 14, 17: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: 688
Joined: Fri, 21. Jan 05, 01: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: 371
Joined: Sun, 5. Feb 06, 18: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-7
Intel I7-3770
16Gb Memory
Nvgidia GTX-1060

User avatar
Observe
Posts: 2859
Joined: Fri, 30. Dec 05, 18:47
xr

Post by Observe » Sat, 17. Dec 16, 20: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.

Herman2000
Posts: 16
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.

Post Reply

Return to “X Rebirth - Scripts and Modding”