[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
TheRealBix
Posts: 400
Joined: Thu, 2. Jul 09, 14:34
x4

Post by TheRealBix » Fri, 28. Nov 14, 00:33

Hi there :)
I have some questions for pro coders !

Is there a way to add new wares to the game without requiring a reboot or altering savefiles ?

To fill traders I need to use setup.xml, but it is only used at the game start right ?

that's all for the moment :P

Edit : I've seen a bunch of lines that, I supposed, update the warelist of the NPC for a newer version :

Code: Select all

      <patch sinceversion="2" state="complete">
        <do_if value="$actor.type == entitytype.armsdealer">
          <include_actions ref="md.Setup.SetArmsDealerWares" />
          <set_value name="$TraderDefinition" list="md.$ArmsDealerLists" />
          <clear_list list="$WareList"/>
          <do_all exact="$TraderDefinition.count" counter="$i">
            <add_inventory entity="$actor" ware="$TraderDefinition.{$i}.{1}" min="$TraderDefinition.{$i}.{2}" max="$TraderDefinition.{$i}.{3}" chance="$TraderDefinition.{$i}.{4}" />
            <set_value name="$Price" min="$TraderDefinition.{$i}.{1}.minprice" max="$TraderDefinition.{$i}.{1}.maxprice" />
            <append_to_list name="$WareList" exact="[$TraderDefinition.{$i}.{1}.id, $Price]"/>
          </do_all>
          <remove_value name="$TraderDefinition" />
          <remove_value name="$Price" />
        </do_if>
      </patch>
Is it possible to do the same at the first loaded game with the mod, or the "patch" command is very specific ? (I don't think it's a good idea to reset warelists at each load)

gundamwarcraft
Posts: 10
Joined: Tue, 24. Jun 14, 13:12

Post by gundamwarcraft » Sun, 14. Dec 14, 20:13

ok. im new to this thing. so, how do i extract a mod that was in .dat format? i try to use XRCatTool but it only detect game core file. not the mod that was save in dat format

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

Post by UniTrader » Sun, 14. Dec 14, 20:39

do you mean the official tool from EGO? this works for me fine for both core Files and Mod Files. if its a 3rd party application - no idea, i dont use them since the official program has both, a command line/script interface and a GUI interface

and also note that you need both the .cat and the .dat - either of them alone is useless ;)
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 ;)

gundamwarcraft
Posts: 10
Joined: Tue, 24. Jun 14, 13:12

Post by gundamwarcraft » Sun, 14. Dec 14, 21:05

i want a tool to extract a dat file from a mod. not core files. i have try XRCatTool but that program only detect and extract core files.
any idea which should i use?
i have also try to use steam wokshop tools but for some reason, i was unable to download the workshop tools

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

Post by UniTrader » Sun, 14. Dec 14, 21:38

as i said before [url=steam://install/282160]this here[/url] works fine for me. there is another prgram out there with exactly the same name, but afaik it is restricted to the core files. cannt tell since i never used it.
you will find this Program next to the X Rebirth Folder in a folder called X Rebirth Tools, but the XRCatToolGUI.exe should be saaoicated with .cat files already, so no need to locate it if you just want to extract a single cat/dat ;) (if you want to extract all the core files i would recommend using a script/patch file though - once written it required just a double-click to update all extracted files)
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
alexalsp
Posts: 1823
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp » Mon, 15. Dec 14, 00:54

Please, please, please, please help.

There is code.

Code: Select all

<mdscript name="Setup" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
  <cues>
    <cue name="Start" version="12">
      <actions>
  
        <set_value name="md.$EngineUpgradetraderLists" exact="
            [
                [
                    [ware.upg_pla_engine_bal_mk1, 1, 1, 100],
                    [ware.upg_pla_engine_spe_mk2, 1, 1, 80],
                    [ware.upg_pla_engine_man_mk2, 1, 1, 80],
                    [ware.upg_pla_engine_spe_mk3, 1, 1, 60],
                    [ware.upg_pla_engine_bal_mk3, 1, 1, 60],
                    [ware.upg_pla_engine_man_mk3, 1, 1, 60],
                    [ware.upg_pla_engine_spe_mk4, 1, 1, 40],
                    [ware.upg_pla_engine_bal_mk4, 1, 1, 40],
                    [ware.upg_pla_engine_man_mk4, 1, 1, 40],
                    [ware.upg_pla_engine_spe_mk5, 0, 0, 0],
                    [ware.upg_pla_engine_bal_mk5, 0, 0, 0],
                    [ware.upg_pla_engine_man_mk5, 0, 0, 0]
                ]
            ]
        "/>

I want to replace only three lines

Code: Select all

 
                    [ware.upg_pla_engine_spe_mk5, 1, 1, 100],
                    [ware.upg_pla_engine_bal_mk5, 1, 1, 100],
                    [ware.upg_pla_engine_man_mk5, 1, 1, 100]

how to do it.

Thank you, thank you, thank you.

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

Post by UniTrader » Mon, 15. Dec 14, 02:03

in this case you may be more succesful by setting the Values again.. Tamina asked me something similar lately, will try to adapt it in my head: (logic behind this is tricky, especially the first approach.. if it works dont ask how :D )

Code: Select all

<diff>
<add sel='set_value[@name="md.$EngineUpgradetraderLists"]' pos="after" >
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{md.$EngineUpgradetraderLists.{1}.{1}.indexof.{[ware.upg_pla_engine_spe_mk5, 0, 0, 0]}}.{2}" exact="1" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{md.$EngineUpgradetraderLists.{1}.{1}.indexof.{[ware.upg_pla_engine_spe_mk5, 1, 0, 0]}}.{3}" exact="1" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{md.$EngineUpgradetraderLists.{1}.{1}.indexof.{[ware.upg_pla_engine_spe_mk5, 1, 1, 0]}}.{4}" exact="100" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{md.$EngineUpgradetraderLists.{1}.{1}.indexof.{[ware.upg_pla_engine_bal_mk5, 0, 0, 0]}}.{2}" exact="1" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{md.$EngineUpgradetraderLists.{1}.{1}.indexof.{[ware.upg_pla_engine_bal_mk5, 1, 0, 0]}}.{3}" exact="1" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{md.$EngineUpgradetraderLists.{1}.{1}.indexof.{[ware.upg_pla_engine_bal_mk5, 1, 1, 0]}}.{4}" exact="100" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{md.$EngineUpgradetraderLists.{1}.{1}.indexof.{[ware.upg_pla_engine_man_mk5, 0, 0, 0]}}.{2}" exact="1" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{md.$EngineUpgradetraderLists.{1}.{1}.indexof.{[ware.upg_pla_engine_man_mk5, 1, 0, 0]}}.{3}" exact="1" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{md.$EngineUpgradetraderLists.{1}.{1}.indexof.{[ware.upg_pla_engine_man_mk5, 1, 1, 0]}}.{4}" exact="100" />
</add>
</diff>
other, less dynamic approach if first doesnt work: (uses static index numbers instead of searching the list for the items which you want to change)

Code: Select all

<diff>
<add sel='set_value[@name="md.$EngineUpgradetraderLists"]' pos="after" >
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{10}.{2}" exact="1" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{10}.{3}" exact="1" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{10}.{4}" exact="100" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{11}.{2}" exact="1" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{11}.{3}" exact="1" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{11}.{4}" exact="100" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{12}.{2}" exact="1" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{12}.{3}" exact="1" />
<set_value name="md.$EngineUpgradetraderLists.{1}.{1}.{12}.{4}" exact="100" />
</add>
</diff>
basically this changes the nested Lists right after they are created - not directly what you asked, but it has the same effect ;)

note that modifying this file directly will only change things in a new game since this Script is only executed at this moment once. If you want it to work in an existing Game you have to write a new MDScript which is executed after the Setup.xml finished (just put the things i did in the <add/> node inside the <actions/> node of your new MDScript and find some apporiate <conditions/> for it to trigger after the Setup.xml finished ;)
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
alexalsp
Posts: 1823
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp » Mon, 15. Dec 14, 04:05

Doesn't work. Different ways I tried. Probably easier to replace. ))

MDScript is difficult for me .

I have created a mod Repair Laser . In the new game mod works, but in the old game doesn't work. How to write MDScript to mod don't know.
http://steamcommunity.com/sharedfiles/f ... earchtext=

Maybe if you is not difficult, and you have time , you can write MDScript for mod.

Sorry for my English.

Exavier724
Posts: 118
Joined: Fri, 12. Dec 03, 02:13
x2

Post by Exavier724 » Mon, 29. Dec 14, 22:54

Quick question... Does anyone have the "5. Example mod extension developed for this guide (download here)" that was created for the guide in the original post?

Seems i get a file not found error like it has been deleted from nexusmods

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

Post by Observe » Tue, 30. Dec 14, 00:55

Exavier724 wrote:Quick question... Does anyone have the "5. Example mod extension developed for this guide (download here)" that was created for the guide in the original post?

Seems i get a file not found error like it has been deleted from nexusmods
The "Example Mod" is available on Steam in two different versions: "Transcend - With Highways" and "Transcend - No Highways". The mod has evolved since this tutorial was written, but all the same code references (and more) still exist. The forum discussion thread is here and the Steam download is here.

Thanks.

Exavier724
Posts: 118
Joined: Fri, 12. Dec 03, 02:13
x2

Post by Exavier724 » Tue, 30. Dec 14, 16:19

Observe wrote:
Exavier724 wrote:Quick question... Does anyone have the "5. Example mod extension developed for this guide (download here)" that was created for the guide in the original post?

Seems i get a file not found error like it has been deleted from nexusmods
The "Example Mod" is available on Steam in two different versions: "Transcend - With Highways" and "Transcend - No Highways". The mod has evolved since this tutorial was written, but all the same code references (and more) still exist. The forum discussion thread is here and the Steam download is here.

Thanks.
Thanks :)
Decided to see if i could sit down and make a single sector playground system for empire building. Just a gate to each cluster, a couple of NPC stations, guard fleets for the gate areas (depending on where the gate leads), and alot of player build space.

So far the thing is functional except for Quotas, Jobs, & Gate Locks (if used during the campaign). :P

EDIT: This is trickier than I thought it was going to be... Though just a cpl tweaks to my highways and I think I got it working. Gates even open properly based on campaign progression :)

Wonder if I should put it up on workshop for ppl who want a crossroads empire building area. Especially now that we have galaxy trader mods.

Still can't seem to get a background other than Albion though. even when I changed all the fields I could find for it.

Sanyokbig
Posts: 31
Joined: Fri, 6. Apr 12, 13:01
x4

Post by Sanyokbig » Thu, 1. Jan 15, 22:19

Hi. Is there any list of all commands describing what they do and what parameters have?

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

Post by UniTrader » Thu, 1. Jan 15, 22:22

what commands you you mean? aiscripts? md? Ingame-commandline?
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 ;)

Sanyokbig
Posts: 31
Joined: Fri, 6. Apr 12, 13:01
x4

Post by Sanyokbig » Thu, 1. Jan 15, 23:15

XML ones. Trying to work with aiscripts. But without command reference like in Arma for example it's kinda hard

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

Post by UniTrader » Thu, 1. Jan 15, 23:23

libraries/aiscripts.xsd and libraries/common.xsd provide all available Commands (best to use them with an autocompleting xml editor like xmlcopyedit; just extract both files and link the aiscripts.xsd like its done in all other script files and autocomplete should work), and if you have trouble with the expressions look into the scriptproperties.html ;)
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 ;)

Sanyokbig
Posts: 31
Joined: Fri, 6. Apr 12, 13:01
x4

Post by Sanyokbig » Thu, 1. Jan 15, 23:57

Thanks, it became a little clearer now

can .xsd files be opened so i can see documentation in formatted view without .xml tags?

About linking, never done it. Should i place them in one folder and define .xsd in header via xsi:noNamespaceSchemaLocation="aiscripts.xsd" or it's fine if .xsd is in one folder and .xml in another like in game catalogs?

And for the scriptproperties.html, where can i find it? :)

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

Post by UniTrader » Fri, 2. Jan 15, 00:51

not sure if there is some xsl file which formats this Info nicely, but i think this may be useful:
http://stackoverflow.com/a/2176503

scriptproperties.html is in the root directory when you extracted your files, but requires some files in the libraries folder to work properly - i would recommend extracting all Game files in a sub-directroy of the Game folder to allow easy access to all files, i have written a short script for that a while ago:

Code: Select all

mkdir "..\X Rebirth\XR_extracted"
XRcatTool.exe -in "..\X Rebirth\01.cat" "..\X Rebirth\02.cat" "..\X Rebirth\03.cat" "..\X Rebirth\04.cat" "..\X Rebirth\05.cat" "..\X Rebirth\06.cat" "..\X Rebirth\07.cat" "..\X Rebirth\08.cat" "..\X Rebirth\09.cat" -out "..\X Rebirth\XR_extracted"
simply put it right next to the XRCatTool.exe from EGO and let it do its magic™ ^^
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 ;)

Exavier724
Posts: 118
Joined: Fri, 12. Dec 03, 02:13
x2

Post by Exavier724 » Fri, 2. Jan 15, 09:39

Is there a way trigger an auto explore on a sector? So that when the game start it reveals the zones, highways, and static objects (stations) as if you had flown there.

Trying to get zones & highways to line up but its a pain having to start a new game (gates don't seem to move otherwise) and fly around discovering everything every time.

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

Post by UniTrader » Fri, 2. Jan 15, 14:22

<set_known/> for any object you might be interested. just use some <find_.../> commands vague enough to returnn all shipe/zones/sectors/stations and then <do_all/>
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 ;)

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

Post by UniTrader » Wed, 7. Jan 15, 02:07

i think its something like
[ 'shieldgenerator' , 100 , 'turret_small_mg' , 100 , 'turret_medium_pe' , 100 ]
similiar to the buildplanlist (numbers here probably define the percentage of installed upgrades since thats how its done with the Upgrade Commands )

if you want to be sure modify the NPC_Architect.xml with

Code: Select all

<add sel="//do_elseif[@value="event.param == &apos;cArch_buildermacrosResult&apos;"]" pos="prepend">
<debug_text text="event.param2.{3}" filter="general" />
</add>
and order some stations with upgrades - expected Format for this list should then appear in the debuglog
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 ;)

Post Reply

Return to “X Rebirth - Scripts and Modding”