[Help] I am being dumb - need help changing stats on a ship

The place to discuss scripting and game modifications for X4: Foundations.

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

tuman78
Posts: 98
Joined: Thu, 4. Dec 08, 12:46
x4

[Help] I am being dumb - need help changing stats on a ship

Post by tuman78 »

I am trying to simply increase the number of crew that can be transported by one of the courier ships, so it can be used to transport a lot marines between ships, between boarding ops. I thought I knew what I was doing as I have done this already for the Cerberus with no issues.

I have my mod in the right place with all the right files etc, no typeos. When I start the game I can see my mod listed in the Extensions menu with the correct data but the new ship crew value is not being used. I have tried making changes to other values i.e.missile storage to see what happens and again no changes. Its like my modified ship file is being ignored. Is there any kind of log etc where I can see what the game is doing with the modified file?

I am sure that the issue is something small and obvious, I just can't see it.
Some people are like slinkies, utterly useless but they bring a smile to your face when pushed down the stairs
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Help] I am being dumb - need help changing stats on a ship

Post by UniTrader »

i am pretty sure you attemt to "replace" the files you want to change, but xml modding in XR/X4 does not work that way*. rather you write an xml diff file and describe the changes.

Example of such a file is this (taken from an XR mod of mine):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<diff>
<!-- Make Fuelcells transportable with Energy Storage so Energy Transports can aquire Fuel for the Station Ships to use -->
  <replace sel="//cargo/@tags">fuel energy</replace>
</diff>
It first looks for all <cargo> nodes in the file and then addresses a tags="" attribute in them and changes its value to "fuel energy" rather than the original "energy"


If you want an example/explaination for your case just provide the content of the original file here and describe what you want to change ;) will then give a more thourough explaination, because my example above it pretty bad for this.



*it may work randomly, because mod files written in such a way are merged together. but this adds a random factor which file is merged first
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 ;)
StormLightning
Posts: 21
Joined: Tue, 25. Dec 18, 12:26

Re: [Help] I am being dumb - need help changing stats on a ship

Post by StormLightning »

What you need is this code :-

Code: Select all

<diff>
    <replace sel="//macros/macro/properties/people/@capacity">4</replace>
</diff>
Substitute 4 for the number of crew you want, say 20 or 40 or whatever.

Just make a text file using <your-ship-ident>.xml and put it in the appropriate subfolder in your /extensions folder. You will need to make the correct path - ../assets/units/size_[?]/macros
Btw, you need a content.xml file in the main mod folder to make this work. Maybe you have the code correct but don't have a content.xml file?
tuman78
Posts: 98
Joined: Thu, 4. Dec 08, 12:46
x4

Re: [Help] I am being dumb - need help changing stats on a ship

Post by tuman78 »

Thanks both! The diff file worked. Apparently I didn't know what I was doing after all ... :oops:
Some people are like slinkies, utterly useless but they bring a smile to your face when pushed down the stairs

Return to “X4: Foundations - Scripts and Modding”