[Mod Help] Changing ware consumption

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

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

Revenant342
Posts: 225
Joined: Thu, 21. Nov 13, 03:22
x4

[Mod Help] Changing ware consumption

Post by Revenant342 »

Hey all, looking to make a simple mod to reduce the Space Fuel cost in Plate Foundries from 1,600/hr to 160/hr because I think that's WAY more reasonable. Anyone know how to do that?
Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Post by Vim Razz »

Sure. The production values are determined in the in the \\libraries\wares.xml file. Searching for id="reinforced locates the reinforced metal plating entry (starting at line 1789), then looking through it we see that space fuel is set as a secondary ware with a consumption rate of 400(!!!) units per production cycle.

Replacing a single value (the amount) in the expression goes something like:
edit: This code example contains an error (unspecified production branch). See my next comment for explanation.

Code: Select all

<replace sel="//ware[@id='reinforcedmetalplating']/production/secondary/ware[@ware='spacefuel']/@amount">40</replace>
And while you're playing around in there, removing Medical Supplies from the primary resource list and adding it into the secondary list is an option, too:
edit: This code example contains errors (unspecified production branches). See my next comment for explanation.

Code: Select all

	<!--	remove medical supplies as primary resource	-->
<remove sel="//ware[@id='reinforcedmetalplating']/production/primary/ware[@ware='medicalsupplies']"/>

	<!--	add medical supplies as secondary resource	-->
<add sel="//ware[@id='reinforcedmetalplating']/production/secondary">
	<ware ware="medicalsupplies" amount="40" />
</add>
(Medical Supplies are secondary wares in literally every other production process, so I'm guessing that this and the 400 Space Fuel consumption per cycle were not intended....)

I'm not sure that changing factory production rates applies to facilities already built, though. It may or may not only work for new factories or a new game start.
Last edited by Vim Razz on Tue, 16. Sep 14, 16:54, edited 1 time in total.
Revenant342
Posts: 225
Joined: Thu, 21. Nov 13, 03:22
x4

Post by Revenant342 »

Thanks! I thought the same thing, unless X Universe metalworkers are supposed to be paralytically smashed all the time...

If if doesn't work for existing factories, would the ones already there have a similar line in my save file I could modify?
Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Post by Vim Razz »

Possibly? I trash my saves with reckless abandon, so I haven't actually tried modifying production with an ongoing game.

I just remember something being said about production settings of finished modules being stored in the save, way back during discussions about tweaking the IURV from the plot.



edit -- also -- whoops! I forgot to account for the multiple production methods in the lines of code above. Both "default" and "omicron" recipes need editing. Since "production" on it's own doesn't uniquely identify a branch, what I typed earlier wont work... :oops:

So, two entries are needed, one for each production type:

Code: Select all

<replace sel="//ware[@id='reinforcedmetalplating']/production[@method='default']/secondary/ware[@ware='spacefuel']/@amount">40</replace>

<replace sel="//ware[@id='reinforcedmetalplating']/production[@method='omicron']/secondary/ware[@ware='spacefuel']/@amount">30</replace>
And similarly, medical supplies would need to be added/removed for each production type specifically.
Revenat342
Posts: 167
Joined: Mon, 8. Mar 10, 04:30
x3tc

Post by Revenat342 »

Hmmm... tried making a new extension with that (never done before, but it showed up properly in my extensions!). Existing modules were unaffected. Made a new construction shop to test and it still has the same requirements (40 Med primary, 1600 Spacefuel secondary), but both wares are in red. Any idea what I did wrong?
Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Post by Vim Razz »

can we see the file? It's hard to guess at random.

It should be short enough that you can just paste the contents into a post.
bm01
Posts: 421
Joined: Wed, 22. Jul 09, 22:31
x4

Post by bm01 »

I've never tried to "mod" any X game until now and I don't know much about xml, but it worked, so I'm pretty proud of me :p Though it was mostly copy-pasta.

http://i.imgur.com/gHuLdAW.jpg

Revenat342, I suppose you forgot the <diff> thing, it seems... Well, necessary.
Also it may be obvious but this should be in extensions/whatever/libraries/wares.xml.

Code: Select all

<diff>
  <replace sel="//ware[@id='reinforcedmetalplating']/production[@method='default']/secondary/ware[@ware='spacefuel']/@amount">40</replace>
  <replace sel="//ware[@id='reinforcedmetalplating']/production[@method='omicron']/secondary/ware[@ware='spacefuel']/@amount">30</replace>
  <remove sel="//ware[@id='reinforcedmetalplating']/production[@method='default']/primary/ware[@ware='medicalsupplies']"/>
  <remove sel="//ware[@id='reinforcedmetalplating']/production[@method='omicron']/primary/ware[@ware='medicalsupplies']"/>
  <add sel="//ware[@id='reinforcedmetalplating']/production[@method='default']/secondary">
     <ware ware="medicalsupplies" amount="40" />
  </add>
  <add sel="//ware[@id='reinforcedmetalplating']/production[@method='omicron']/secondary">
    <ware ware="medicalsupplies" amount="40" />
  </add>
</diff>
I suppose it could be done with less lines (is there really no way to modify both "default" and "omicron" at the same time?), but whatever.
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

bm01 wrote:I suppose it could be done with less lines (is there really no way to modify both "default" and "omicron" at the same time?), but whatever.
Nope, XR doesnt support the inofficial msel extension currently.. your diff file is as short as it can get ;) (a bit shorter is possible, but it would sacrifice clarity)
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 ;)
Revenat342
Posts: 167
Joined: Mon, 8. Mar 10, 04:30
x3tc

Post by Revenat342 »

This is what I have:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>

<diff>
	   <!--   remove medical supplies as primary resource   -->
<remove sel="//ware[@id='reinforcedmetalplating']/production/primary/ware[@ware='medicalsupplies']"/>

   <!--   add medical supplies as secondary resource   -->
<add sel="//ware[@id='reinforcedmetalplating']/production/secondary">
   <ware ware="medicalsupplies" amount="40" />
</add>

<replace sel="//ware[@id='reinforcedmetalplating']/production[@method='default']/secondary/ware[@ware='spacefuel']/@amount">40</replace>

<replace sel="//ware[@id='reinforcedmetalplating']/production[@method='omicron']/secondary/ware[@ware='spacefuel']/@amount">40</replace>

</diff>
I have it in a DAT file in /extensions/constructionyardfix, because all my other mods just have a single ext_01.dat with no sub-folders. Is this correct?

*EDIT* Never mind! Made a fresh XML file in extensions/cyfix/libraries/wares.xml. Worked on all my existing stations, too. Only odd thing is that the spacefuel and medical supplies requirements are in red on the new station I test-built, though they both have the numbers I want and are both secondary resources. Any idea what this means, if anything? The existing stations are white as normal.

*RE-EDIT* Haha, never mind again. Red just meant they were illegal in PMC space where I built my test station... just like it said at the top of the screen.... stupid me. Momma always said I gon' be somebody.

So, seems like everything is working great! Thanks, everyone!
Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Post by Vim Razz »

Congratulations on getting it to work despite my not-very-complete explanations! :D

The .cat/.dat files you see in a lot of mods now are compressed directory structures packaged with the Rebirth Tools utility. I don't know if there's any real benefit to doing it that way other than, you know, having it look cool.
Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp »

This sounds like a great idea.

For the noobs amongst us, do we do the following?

1. Create directories called /constructionyardfix/libraries in extensions/
2. Paste the code into Notepad
3. Save the doc as wares.xml (instead of .txt)
4. Pop the wares.xml in to /libraries
bm01
Posts: 421
Joined: Wed, 22. Jul 09, 22:31
x4

Post by bm01 »

You also need a content.xml, which gives some details to X Rebirth. I made a dummy one personally. Here's my folder: http://s000.tinyupload.com/index.php?fi ... 8730728984

I forgot to remove something though. You can delete the assets folder, it's a fix for 2.5 beta 7 and is completely unrelated to this topic. It fixes the ship types of light and heavy sul (trader for both instead of fighter). I don't know if it affects anything else than the encyclopedia entries (that's what I'm trying to find out).
Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp »

Cool, thanks very much.

When I read about that trader / fighter thing yesterday, I wondered whether they might have made the Rahanas and Lyranea first then duplicated their files for their fighting counterparts. It will be interesting to see how that pans out.
bm01
Posts: 421
Joined: Wed, 22. Jul 09, 22:31
x4

Post by bm01 »

Hmm I wonder, do you think it's intended that Spaceweed requires Spacefuel as a primary resource?

Edit: Well since the Aspiring Merchant starts near a distillery and with some Spacefuel in his station, I guess it's intended... I don't get the logic behind this though :p
User avatar
YorrickVander
Posts: 2774
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

If the staff are drunk enough they might not smoke all the weed?
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

Return to “X Rebirth - Scripts and Modding”