Hey everyone,
disclaimer: I've made mods before and just do this for fun, but I'm stumped on how to get this to work and need some advice!
I'm working on a mod that modifies the wares.xml file. I've successfully edited the resources needed to build modules and even created a custom build method. However, I'm having trouble changing the required resources for certain items to make scrap more versatile. I want to make it so that scrap can be turned into more than just Claytronics and Hull Parts.
I know there's a "recycle" build method in the default wares.xml that mentions "nonplayer", so I'm not sure if that is the one I'm after or not. I've been trying to adjust it through the ego_dlc_pirate/wares.xml file, but i can't seem to find the recipes for it which make me think it is in that default wares.xml file. Here’s an example of my current setup to test if the modifications are being applied, but it doesn’t seem to take effect:
<add sel="/wares/ware[@id='HullParts']">
<production time="10" amount="300" method="zeno" name="{20206,201}">
<primary>
<ware ware="energycells" amount="60" />
</primary>
<effects>
<effect type="work" product="0.37" />
</effects>
</production>
<icon active="ware_HullParts" video="ware_HullParts_macro" />
</add>
it still seems that it doesn't want to just use energy cells so I'm stumped
What I've Tried So Far:
*I'm not sure that the "nonplayer" restriction means that it won't work for that anyways but i can't get the above example to work.
Editing ego_dlc_pirate/wares.xml, but I’m not sure if another file might be overriding it.
Checking for any dependencies in other XML files (like macros.xml or components.xml) to see if they might need adjusting.
If anyone has experience with enabling different recycling outputs for scrap, could you point me in the right direction? Any advice on getting the game to recognize my modified entries would be greatly appreciated!
Questions:
*do i need to edit a different file to get the result I'm looking for?
*do i need to make a new module like in the "10x modules" mod and if that the case how do i edit those files in "\assets\fx\gui\textures\stationmodules" the ones that have the .gz at the end?
Thanks in advance!
Help Needed: Modding wares.xml for New Scrap Recycling Options
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 2
- Joined: Sat, 9. Mar 24, 22:31
-
- Posts: 135
- Joined: Sat, 3. Jul 10, 23:23
Re: Help Needed: Modding wares.xml for New Scrap Recycling Options
Hi dreadnought,
First things first:
You always want to change the X4 Foundations\libraries\wares.xml. Every dlc and every mod does this, if it changes the wares.xml (additional stuff or stuff to change). So it only depends on the dlcs and mods, which should change the wares.xml before your mod. This is defined with dependencies in the
content.xml in your mod (I will call your mod "your_fancy_mod".
-> The dlcs "Tides of Avarice" and "Kingdom End" and the mod "SirNukes Mod Support APIs" are loaded first. So not only their wares.xml, if they have one. Also, every other file of them.
In this case, "Tides of Avarice" needs to be installed/activated (optional="false"). "Kingdom End" and the mod "SirNukes Mod Support APIs" are not necessary (optional="true"). But if they exist, they would be loaded first.
And, to be sure, we are talking about Scrap Metal and not Raw Scrap, right?.
So, my question is: do you want the existing Scrap Recycler modules to produce more than Claytronics and Hull Parts? Or do you want to create a new module, which produces more than Claytronics and Hull Parts out of Scrap Metal?
In both cases, the additional ware(s) need(s) a new production with another production method, defined in the wares.xml.
We can reuse the existing "recycling" method or your new method. I would use the "recycling" method, as it is intended for exactly this case.
Let's say, we also want to produce graphene.
Your wares.xml in your_fancy_mod\libraries would look like:
And now, back to my question.
Case one, changing the production of the Scrap Recyclers.
Case two, creating a new module:
You need:
Best regards
sprIder
First things first:
You always want to change the X4 Foundations\libraries\wares.xml. Every dlc and every mod does this, if it changes the wares.xml (additional stuff or stuff to change). So it only depends on the dlcs and mods, which should change the wares.xml before your mod. This is defined with dependencies in the
content.xml in your mod (I will call your mod "your_fancy_mod".
Code: Select all
<dependency name="Tides of Avarice" id="ego_dlc_pirate" optional="false" />
<dependency name="Kingdom End" id="ego_dlc_boron" optional="true" />
<dependency name="SirNukes Mod Support APIs" id="ws_2042901274" optional="true"/>
In this case, "Tides of Avarice" needs to be installed/activated (optional="false"). "Kingdom End" and the mod "SirNukes Mod Support APIs" are not necessary (optional="true"). But if they exist, they would be loaded first.
And, to be sure, we are talking about Scrap Metal and not Raw Scrap, right?.
So, my question is: do you want the existing Scrap Recycler modules to produce more than Claytronics and Hull Parts? Or do you want to create a new module, which produces more than Claytronics and Hull Parts out of Scrap Metal?
In both cases, the additional ware(s) need(s) a new production with another production method, defined in the wares.xml.
We can reuse the existing "recycling" method or your new method. I would use the "recycling" method, as it is intended for exactly this case.
Let's say, we also want to produce graphene.
Your wares.xml in your_fancy_mod\libraries would look like:
Code: Select all
<diff>
<add sel="//ware[@id='graphene']">
<production time="300" amount="200" method="recycling" name="{20206,1101}" tags="noplayerbuild recycling">
<primary>
<ware ware="energycells" amount="3500"/>
<ware ware="scrapmetal" amount="75"/>
</primary>
<effects>
<effect type="work" product="0.37"/>
</effects>
</production>
</add>
</diff>
Case one, changing the production of the Scrap Recyclers.
- Copy the "prod_gen_scrap_recycler_macro.xml" from \assets\structures\production\macros to your_fancy_mod\assets\structures\production\macros
- replace the code with the following (or comment it out and add):
Code: Select all
<diff> <replace sel="//production/@wares">claytronics hullparts graphene</replace> <add sel="//production/queue"> <item ware="graphene" method="recycling"/> </add> </diff>
- If you want to do the same, copy the "prod_ter_scrap_recycler_macro.xml" from \extensions\ego_dlc_terran\assets\structures\production\macros to your_fancy_mod\extensions\ego_dlc_terran\assets\structures\production\macros
- change the code.
Code: Select all
<diff> <replace sel="//production/@wares">computronicsubstrate siliconcarbide graphene</replace> <add sel="//production/queue"> <item ware="graphene" method="recycling"/> </add> </diff>
Case two, creating a new module:
You need:
- A name and description, written down in a t-file
- A module model. Easiest way: reuse something existing and rename it.
- The macro file of this module, which will also define the produced products
- A new entry in the wares.xml for this module
- Additional entries for at least the macro file, maybe the component file of the module, in the macros.xml and components.xml in your_fancy_mod\index
- Your already mentioned file in your_fancy_mod\assets\fx\gui\textures\stationmodules
- We reuse the "prod_gen_scrap_recycler_macro.xml" from \assets\structures\production\macros and copy it to your_fancy_mod\assets\structures\production\macros
- rename it, e.g. prod_gen_scrap_recycler_new_macro.xml. Open it and change the macro name value to the new file name.
- Change name and description to the text from your t-file.
- add or change the production wares and queues in this macro file. Maybe also other values.
- Create an entry in the wares.xml. Just copy and paste from the original entry and change some values as you like. The important parts are the id and the component ref, in this case
(this can be something else)
Code: Select all
<ware id="module_gen_prod_scrap_recycler_new"
(this refers right to the macro entry name below)Code: Select all
<component ref="prod_gen_scrap_recycler_new_macro" />
- create a macros.xml in your_fancy_mod\index. With this, you tell the game where to find the macro called "prod_gen_scrap_recycler_new_macro".
Code: Select all
<?xml version="1.0" encoding="utf-8"?> <index> <entry name="prod_gen_scrap_recycler_new_macro" value="extensions\your_fancy_mod\assets\structures\production\macros\prod_gen_scrap_recycler_new_macro"/> </index>
- Copy the prod_gen_scrap_recycler_macro.gz file from \assets\fx\gui\textures\stationmodules to your_fancy_mod\assets\fx\gui\textures\stationmodules and rename it to prod_gen_scrap_recycler_new_macro.gz. If you want to change the picture:
unpack it (e.g. with 7zip), change the empty file ending to ".dds", open it with gimp or paint.net or whatever and change it. Save and repack the file to the .gz format. At the end, the name has to be prod_gen_scrap_recycler_new_macro.gz again.
Best regards
sprIder
-
- Posts: 2
- Joined: Sat, 9. Mar 24, 22:31
Re: Help Needed: Modding wares.xml for New Scrap Recycling Options
thank very much spider!
your explanation has helped me understand the me problem lot more.
1) so i need to edit all the all the items in the production folder
2) importing dependency
I'm toying around with a new build method so i have a template for future projects and using this as a way to understand the structure of the games files. in my final version i will change it to the closed loop version (though it might break the balance of the game if the AI use it) and offer one with the build method as player only thing.
A final question do you know what files i need for defining methods? I've gotten away by naming the method something close to another method like "xeno" to "zeno" and for some reason that works. other mod I've looked at for reference don't seem to reference it in other files other than the T folder(I've heard that it might be something to do with the cache in "\Documents\Egosoft\X4\427237594" that might be messing with my testing, ill delete it and try testing some more)>(if its that than just ignore this)
i have a lot of work and testing to do, and thank you very much.
if your ok with me crediting you and if i ever get this mod out, how would you like to be credited?
this will probably end up on the steam workshop and maybe nexus.
your explanation has helped me understand the me problem lot more.
1) so i need to edit all the all the items in the production folder
2) importing dependency
I'm toying around with a new build method so i have a template for future projects and using this as a way to understand the structure of the games files. in my final version i will change it to the closed loop version (though it might break the balance of the game if the AI use it) and offer one with the build method as player only thing.
A final question do you know what files i need for defining methods? I've gotten away by naming the method something close to another method like "xeno" to "zeno" and for some reason that works. other mod I've looked at for reference don't seem to reference it in other files other than the T folder(I've heard that it might be something to do with the cache in "\Documents\Egosoft\X4\427237594" that might be messing with my testing, ill delete it and try testing some more)>(if its that than just ignore this)
i have a lot of work and testing to do, and thank you very much.
if your ok with me crediting you and if i ever get this mod out, how would you like to be credited?
this will probably end up on the steam workshop and maybe nexus.
-
- Posts: 135
- Joined: Sat, 3. Jul 10, 23:23
Re: Help Needed: Modding wares.xml for New Scrap Recycling Options
Changes to the vanilla modules will of course affect the AI and their stations. If such modified modules should only be available to the player, you must create new modules as described and then have them sold as blueprints by the factions, for example. This can be done by specifying the factions in the wares.xml file for the modules. You may want to take a look at my Mining Stations Mod for some impressions: viewtopic.php?t=442525
bad:
better:
(English) t-file, as an example. (The page id and t ids (text id) have to be unique as well. You can use the same page id for all your mods, but you have to use different t ids, or they will override themselves:
wares.xml:
Now your method would be named "Additional Scrap Cycle".
If you really want: just something like "Thanks to sprIder" or "Credits to: sprIder, help @ Egosoft forum". Whatever.
You need at least the wares.xml with an entry for this new method. The name can be hard-coded (bad) or can be defined via a t-file (good). T-files They allow translations of all texts. The new / additional method id has to be unique. Seen overall on the game and other mods. Otherwise, the methods can get in each other's way.Dreadnought1340 wrote: ↑Wed, 13. Nov 24, 05:14 A final question do you know what files i need for defining methods?
bad:
Code: Select all
<add sel="/wares/production">
<method id="zeno" name="Additional Scrap Cycle"/>
</add>
(English) t-file, as an example. (The page id and t ids (text id) have to be unique as well. You can use the same page id for all your mods, but you have to use different t ids, or they will override themselves:
Code: Select all
<diff>
<add sel="/language">
<page id="599532" title="fancy_scrap_stations" descr="L" voice="no">
<t id="100">Additional Scrap Cycle</t>
</page>
</add>
</diff>
Code: Select all
<add sel="/wares/production">
<method id="zeno" name="{599532,100}"/>
</add>
I would be very pleased, but it's really not necessary.Dreadnought1340 wrote: ↑Wed, 13. Nov 24, 05:14 if your ok with me crediting you and if i ever get this mod out, how would you like to be credited?
If you really want: just something like "Thanks to sprIder" or "Credits to: sprIder, help @ Egosoft forum". Whatever.