[TUTORIAL] X Rebirth - Modding Guide

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

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

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

Post by Observe » Sun, 17. Nov 13, 22:21

Without having giving this a lot of thought (therefore prone to error), it occurs to me you probably want to work with sectors.xml instead of zonehighways. I would look at creating a replacement sectors.xml contained within your mod maps folder using <diff> root with <replace sel.../> . You will see example usage of that in my mod file accompanying the guide.

Basically, you can replace everything below <macros> with a new version having removal of zonehighways connections. Keep in mind, these files are likely to undergo changes as Egosoft optimizes and evolves the game. As such, you would have to keep an eye on updates. But then, that's kind of par for the course in modding as you know.

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

Post by UniTrader » Sun, 17. Nov 13, 22:56

for those who want to just tinker with the game a hint: copy the xml you want to edit in the same folder where it belongs in the root folder of the game and change the file ending to pck - this gives it priority over xml ;) for some reason patch xmls are required for use in the extensions-folder as i found out today, so for tinkering with the game i think its the best to extract the game files in the root folder and work with a pck copy of the files you want to change. so you can try it outttt and KNOW that YOUR files are used, and when you are done you can compare it with the original xml file and make an extension from it ;)
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 ;)

Realspace
Posts: 1372
Joined: Wed, 15. Nov 06, 10:21
x4

what about the <remove>?

Post by Realspace » Sun, 17. Nov 13, 22:57

Observe wrote:Without having giving this a lot of thought (therefore prone to error), it occurs to me you probably want to work with sectors.xml instead of zonehighways. I would look at creating a replacement sectors.xml contained within your mod maps folder using <diff> root with <replace sel.../> . You will see example usage of that in my mod file accompanying the guide.

Basically, you can replace everything below <macros> with a new version having removal of zonehighways connections. Keep in mind, these files are likely to undergo changes as Egosoft optimizes and evolves the game. As such, you would have to keep an eye on updates. But then, that's kind of par for the course in modding as you know.
Can't I use the remove function? such as

Code: Select all

<diff>
	<!-- Lane Abolition --> 
<remove sel="/macros/macro[@name='Highway01Sector01_macro']/connections"> 
<macro name="Highway01Sector01_macro" class="highway">
     </remove> 
</diff> 
Well at least this was my attempt with the zonehighways.xml but even changing it with a blank file did not change anything in the game, I'll try with sectors
UniTrader wrote:for those who want to just tinker with the game a hint: copy the xml you want to edit in the same folder where it belongs in the root folder of the game and change the file ending to pck - this gives it priority over xml ;) for some reason patch xmls are required for use in the extensions-folder as i found out today, so for tinkering with the game i think its the best to extract the game files in the root folder and work with a pck copy of the files you want to change. so you can try it outttt and KNOW that YOUR files are used, and when you are done you can compare it with the original xml file and make an extension from it ;)
Thanks for the info UniTrader, you mean for example if I put the zonehighways.xml of my own in the "MAINROOT/maps/XU_ep1_universe" folder instead of "MAINROOT/extensions/mapsXU_ep1_universe" it will have the priority over the same file contained inside the DAT? Do I simply rename it to .pck (no compression?)?

EDIT
@UniTrader Yes it worked, mean I added the folowing:

MAINROOT/maps/XU_ep1_universe/zonehighways.pck

...this one being just a blank xml file renamed to pck. Lanes are gone all over the game, don't know if it affects other parts but should not, zones and jobs are independent from highways. Only I suppose this way you must start a new game, I'd like to be able to implement a file for the /extensions folder instead
Last edited by Realspace on Sun, 17. Nov 13, 23:24, edited 1 time in total.

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

Re: what about the <remove>?

Post by UniTrader » Sun, 17. Nov 13, 23:23

Realspace wrote:
UniTrader wrote:for those who want to just tinker with the game a hint: copy the xml you want to edit in the same folder where it belongs in the root folder of the game and change the file ending to pck - this gives it priority over xml ;) for some reason patch xmls are required for use in the extensions-folder as i found out today, so for tinkering with the game i think its the best to extract the game files in the root folder and work with a pck copy of the files you want to change. so you can try it outttt and KNOW that YOUR files are used, and when you are done you can compare it with the original xml file and make an extension from it ;)
Thanks for the info UniTrader, you mean for example if I put the zonehighways.xml of my own in the "MAINROOT/maps/XU_ep1_universe" folder instead of "MAINROOT/extensions/maps/XU_ep1_universe" it will have the priority over the same file contained inside the DAT? Do I simply rename it to .pck (no compression?)?
Yes, simply change the xml ending to pck;)
but i found your mistake: you are missing a mod folder for your project inside the extensions-folder ;) and optimally a content.xml ;) here an example from my files for what should be inside:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<content id="FuelCellPatch" name="Fuel Cell Patch" description="makes Fuel Cell Offers available" author="UniTrader" date="2013-11-16" version="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="content.xsd">
	<text language="49" name="Sprungzellenpatch" description="macht die Angebote für Sprungzellen verfügbar" author="UniTrader" /> 
</content>
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 ;)

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

Post by Observe » Sun, 17. Nov 13, 23:24

UniTrader wrote:for those who want to just tinker with the game a hint: copy the xml you want to edit in the same folder where it belongs in the root folder of the game and change the file ending to pck - this gives it priority over xml
Another way is to use -prefersinglefiles in your startup properties. That way, your external files will take priority over the internal (cat/dat) versions. I usually extract all the game files, tinker with the ones I am interested in, and then make the mod patch once I know what I'm doing. :)

Realspace
Posts: 1372
Joined: Wed, 15. Nov 06, 10:21
x4

Re: what about the <remove>?

Post by Realspace » Sun, 17. Nov 13, 23:27

UniTrader wrote:
Realspace wrote:
UniTrader wrote:for those who want to just tinker with the game a hint: copy the xml you want to edit in the same folder where it belongs in the root folder of the game and change the file ending to pck - this gives it priority over xml ;) for some reason patch xmls are required for use in the extensions-folder as i found out today, so for tinkering with the game i think its the best to extract the game files in the root folder and work with a pck copy of the files you want to change. so you can try it outttt and KNOW that YOUR files are used, and when you are done you can compare it with the original xml file and make an extension from it ;)
Thanks for the info UniTrader, you mean for example if I put the zonehighways.xml of my own in the "MAINROOT/maps/XU_ep1_universe" folder instead of "MAINROOT/extensions/maps/XU_ep1_universe" it will have the priority over the same file contained inside the DAT? Do I simply rename it to .pck (no compression?)?
Yes, simply change the xml ending to pck;)
but i found your mistake: you are missing a mod folder for your project inside the extensions-folder ;) and optimally a content.xml ;) here an example from my files for what should be inside:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<content id="FuelCellPatch" name="Fuel Cell Patch" description="makes Fuel Cell Offers available" author="UniTrader" date="2013-11-16" version="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="content.xsd">
	<text language="49" name="Sprungzellenpatch" description="macht die Angebote für Sprungzellen verfügbar" author="UniTrader" /> 
</content>
thanks sorry I wrote wrong, of course it was MAINROOT/extensions/MYMOD/maps/..

it worked anyway, the .pck file put int the main root/maps/etc, all lanes are gone now!!

I don't know if it affects other parts but should not, zones and jobs are independent from highways. Only I suppose this way you must start a new game, I'd like to be able to implement a file for the /extensions folder instead

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

Post by UniTrader » Sun, 17. Nov 13, 23:38

Observe wrote:
UniTrader wrote:for those who want to just tinker with the game a hint: copy the xml you want to edit in the same folder where it belongs in the root folder of the game and change the file ending to pck - this gives it priority over xml
Another way is to use -prefersinglefiles in your startup properties. That way, your external files will take priority over the internal (cat/dat) versions. I usually extract all the game files, tinker with the ones I am interested in, and then make the mod patch once I know what I'm doing. :)
thx for that hint, could be useful :) but i think i still prefer my way because with this method you always know which files you tinkered with and you always have the original file as reference
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 ;)

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

Post by Observe » Sun, 17. Nov 13, 23:41

UniTrader wrote:thx for that hint, could be useful :) but i think i still prefer my way because with this method you always know which files you tinkered with and you always have the original file as reference
Good point. :)

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

Post by Observe » Mon, 18. Nov 13, 01:32

I have decided to place the mod accompanying this guide on Nexus. It is now available here. OP download links reflect this change.

Realspace
Posts: 1372
Joined: Wed, 15. Nov 06, 10:21
x4

Index/macros.xml

Post by Realspace » Mon, 18. Nov 13, 05:32

How to use the files included in the Index? If I want to change a single entry.
I found the ref to the zonehighways.xml so changing it to my mod's URL can do remove the lanes since the file in my mod is a blank one.

so I changed it into
<entry name="highway*" value="extensions/MYMOD/maps\XU_ep1_universe\zonehighways"/>

but had to copy/pase the entire macros.xml and change thi single entry, can't I just use the patch method? Only..how is the syntax for Index/macros ?

MutantDwarf
Posts: 711
Joined: Tue, 20. Jun 06, 02:29
x4

Post by MutantDwarf » Mon, 18. Nov 13, 07:51

Does anyone know if it's possible to mod the player interaction menu at all? For example, adding an option to docks, such as 'comm'? I'm not sure where that stuff is defined; I'd imagine it's one of the compiled LUA files, but I don't see any that'd fit with the interaction menu.

Meh. It's not like we can edit them now, anyways, since those LUA files are in a non-standard format. The hex looks pretty similar to LUA 5.1, but with an almost completely different header, and even if you change that header to the standard LUA one it doesn't decompile. It may just be that I need to select different options in the header than the default ones, but I'm still highly sadfaced about it - editing those UI files would probably be a treasure trove of editing goodness.

User avatar
enenra
Posts: 7150
Joined: Fri, 8. Apr 05, 19:09
x4

Post by enenra » Mon, 18. Nov 13, 10:53

MutantDwarf wrote:Does anyone know if it's possible to mod the player interaction menu at all? For example, adding an option to docks, such as 'comm'? I'm not sure where that stuff is defined; I'd imagine it's one of the compiled LUA files, but I don't see any that'd fit with the interaction menu.

Meh. It's not like we can edit them now, anyways, since those LUA files are in a non-standard format. The hex looks pretty similar to LUA 5.1, but with an almost completely different header, and even if you change that header to the standard LUA one it doesn't decompile. It may just be that I need to select different options in the header than the default ones, but I'm still highly sadfaced about it - editing those UI files would probably be a treasure trove of editing goodness.
This keeps within the UI but changes some of the elements in it:
http://forum.egosoft.com/viewtopic.php?t=349949

(no need to change LUA in this case, but of course it's kinda limited)

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

Post by UniTrader » Mon, 18. Nov 13, 11:09

he modified the "Main Menu" ring at the bottom for that, which is used for NPC interaction and so on.. not the optimal solution, but the currently best which can be done. (ths menu is btw completely coded in MD, so its easy to change)
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 ;)

Realspace
Posts: 1372
Joined: Wed, 15. Nov 06, 10:21
x4

macros.xml

Post by Realspace » Mon, 18. Nov 13, 13:20

Observe...be patient with me...all this xml root is so confusing... :roll:
if I see correcty by your mod, the files inside INDEX MACROS.XML and COMPONENTS.XML DON'T need the patch method? I want to chenge the reference to these objects so to use my booster, here it is

Code: Select all

<index>
	<!-- <entry name="*" value="assets\entry"/>-->

	<entry name="highway*" value="extensions\RS_NoLanes\maps\XU_ep1_universe\zonehighways"/>

	<entry name="enginebooster_player_01_macro" value="extensions\RS_NoLanes\assets\props\EngineSystems\macros\enginebooster_player_01_macro"/>

	<entry name="radar_ship_s_player_01_macro" value="extensions\RS_stars\assets\props\surfaceelements\macros\radar_ship_s_player_01_macro"/>

</index>
Already tested, it works if a put the full macros.xml in my mod and change only these 3, can I simply add a macros.xml in my mod containing ONLY the 3 entries I need?[/b]

Realspace
Posts: 1372
Joined: Wed, 15. Nov 06, 10:21
x4

macros.xml

Post by Realspace » Mon, 18. Nov 13, 13:22

Observe...be patient with me...all this xml root is so confusing... :roll:
if I see correcty by your mod, the files inside INDEX MACROS.XML and COMPONENTS.XML DON'T need the patch method? I want to chenge the reference to these objects so to use my booster, here it is

Code: Select all

<index>
	<!-- <entry name="*" value="assets\entry"/>-->

	<entry name="highway*" value="extensions\RS_NoLanes\maps\XU_ep1_universe\zonehighways"/>

	<entry name="enginebooster_player_01_macro" value="extensions\RS_NoLanes\assets\props\EngineSystems\macros\enginebooster_player_01_macro"/>

	<entry name="radar_ship_s_player_01_macro" value="extensions\RS_stars\assets\props\surfaceelements\macros\radar_ship_s_player_01_macro"/>

</index>
Already tested, it works if a put the full macros.xml in my mod and change only these 3, can I simply add a macros.xml in my mod containing ONLY the 3 entries I need?[/b]

Realspace
Posts: 1372
Joined: Wed, 15. Nov 06, 10:21
x4

macros.xml

Post by Realspace » Mon, 18. Nov 13, 13:22

Observe...be patient with me...all this xml root is so confusing... :roll:
if I see correcty by your mod, the files inside INDEX MACROS.XML and COMPONENTS.XML DON'T need the patch method? I want to chenge the reference to these objects so to use my booster, here it is

Code: Select all

<index>
	<!-- <entry name="*" value="assets\entry"/>-->

	<entry name="highway*" value="extensions\RS_NoLanes\maps\XU_ep1_universe\zonehighways"/>

	<entry name="enginebooster_player_01_macro" value="extensions\RS_NoLanes\assets\props\EngineSystems\macros\enginebooster_player_01_macro"/>

	<entry name="radar_ship_s_player_01_macro" value="extensions\RS_stars\assets\props\surfaceelements\macros\radar_ship_s_player_01_macro"/>

</index>
Already tested, it works if a put the full macros.xml in my mod and change only these 3, can I simply add a macros.xml in my mod containing ONLY the 3 entries I need?[/b]

felrasha
Posts: 37
Joined: Mon, 18. Nov 13, 14:55

Post by felrasha » Mon, 18. Nov 13, 15:02

How do I enable and see debug-logging in this game?

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

Re: macros.xml

Post by Observe » Mon, 18. Nov 13, 17:57

Realspace wrote:...can I simply add a macros.xml in my mod containing ONLY the 3 entries I need?[/b]
If you want to add new unique entries in the root node, you can do as you suggest - include macros.xml in your mod containing only the 3 new entries. This will effectively merge your new entry with the existing file; with your items being at the end of the list (in memory).

However, if you are changing some existing entry, or adding something to a sub-node, you must use the patch method. I know this can be very confusing. The best thing is to do what you are doing - experiment as you wrap your head around it. :)

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

Post by Observe » Mon, 18. Nov 13, 18:13

@Realspace: Considering you are removing the local highways, one thing you may want to do is include some MD code to reveal zones at long distance so you can better navigate. I can help you with that if you decide to go that way.

Realspace
Posts: 1372
Joined: Wed, 15. Nov 06, 10:21
x4

Post by Realspace » Mon, 18. Nov 13, 18:32

Observe wrote:@Realspace: Considering you are removing the local highways, one thing you may want to do is include some MD code to reveal zones at long distance so you can better navigate. I can help you with that if you decide to go that way.
That would be great! Yes I'm going in that direction and I changed the booster so you can use it to move around at high speed, increased the radar range...well, you can see the mod http://forum.egosoft.com/viewtopic.php?t=350673

Now the issues are
1) Will ALL the ships use the booster to travel once you remove the highways? Capitalships and bigger freighters already do it regarderless so removing the lanes has no effect for them, I checked the engine_booster macros and the NPC ships use a booster that has not the limitations of player's booster (which I removed anyway with the mod).
2) How can player find locations (Radar already augmented)? Your solution seems better

About the macros, as in the code I wrote, those entries are PATCH becouse they already exist only I make them direct to my mod. It is working though, but a patch method would be better. Wolud you please write a string for one entry? I can't do it if it is not one of the example of your tutorial, don't know what to do.

Post Reply

Return to “X Rebirth - Scripts and Modding”