• Mods are now organized as resources. Use the Mods link above to browse for or submit a mod, tool, or prefab.

    The TFP Official Modding Forum Policy establishes the rules and guidelines for mod creators and mod users.

need help with making a new forge

hi guys im trying to make a new forge for gold and silver have the items and recipes I know I need too add them to the forge. is there anything else I need to do? thank you all for the help.

 
I will take a crack at helping

if you are using the resourceSilverNugget in items.xml

in materials.xml you need to add to the MresourceSilverNugget

Code:
<property name="forge_category" value="silver"/>
And then you need to add a material id for the gold as the item resourceGoldNugget does not have a MresourceGoldNugget in materials.xml

look at how the code for the silvernugget differs from the goldnugget.

Then in items.xml you need to make the unit version of the silver and gold that is defined in the forge_category

Code:
<item name="unit_silver">
   <property name="Extends" value="unit_iron"/>
   <property name="CustomIcon" value="resourceSilverNugget"/>
   <property name="Material" value="MresourceSilverNugget "/>
   <property name="CreativeMode" value="None" />
</item>

<item name="unit_gold">
   <property name="Extends" value="unit_iron"/>
   <property name="CustomIcon" value="resourceGoldNugget"/>
   <property name="Material" value="MresourceGoldNugget"/>
   <property name="CreativeMode" value="None" />
</item>
then you need to make the forge itself be able to have those values added in the windows.xml

Code:
<window name="windowSForgeInput" width="228" height="204" panel="Right" controller="WorkstationMaterialInputWindow" materials_accepted="iron,brass,lead,clay,silver,gold" valid_materials_color="[green]" invalid_materials_color="[red]" cursor_area="true" >
You will have to figure out if there needs to be a change to the height attribute in that line and possibly in the <rect name="content2" line, as I have not tested changing the forge values yet but have been wanting to. Let me know if this helps.

 
I will take a crack at helping
if you are using the resourceSilverNugget in items.xml

in materials.xml you need to add to the MresourceSilverNugget

Code:
<property name="forge_category" value="silver"/>
And then you need to add a material id for the gold as the item resourceGoldNugget does not have a MresourceGoldNugget in materials.xml

look at how the code for the silvernugget differs from the goldnugget.

Then in items.xml you need to make the unit version of the silver and gold that is defined in the forge_category

Code:
<item name="unit_silver">
   <property name="Extends" value="unit_iron"/>
   <property name="CustomIcon" value="resourceSilverNugget"/>
   <property name="Material" value="MresourceSilverNugget "/>
   <property name="CreativeMode" value="None" />
</item>

<item name="unit_gold">
   <property name="Extends" value="unit_iron"/>
   <property name="CustomIcon" value="resourceGoldNugget"/>
   <property name="Material" value="MresourceGoldNugget"/>
   <property name="CreativeMode" value="None" />
</item>
then you need to make the forge itself be able to have those values added in the windows.xml

Code:
<window name="windowSForgeInput" width="228" height="204" panel="Right" controller="WorkstationMaterialInputWindow" materials_accepted="iron,brass,lead,clay,silver,gold" valid_materials_color="[green]" invalid_materials_color="[red]" cursor_area="true" >
You will have to figure out if there needs to be a change to the height attribute in that line and possibly in the <rect name="content2" line, as I have not tested changing the forge values yet but have been wanting to. Let me know if this helps.
do I need to make a new workstation for the new forge so it can have its own recipes? thank you.

 
You need this property added to your workstation in blocks

Code:
    <property class="Workstation">
       <property name="CraftingAreaRecipes" value="YOURNEWFORGE"/>
Then in recipes add as many recipes as you want, just make sure to add craft_area="YOURNEWFORGE" to each one. Replace YOURNEWFORGE with your forge name of course.

Example

Code:
<recipe name="resourceClayLump" count="1" craft_area="YOURNEWFORGE" material_based="true" craft_time="1" craft_exp_gain="0" always_unlocked="true">
   <ingredient name="unit_clay" count="5"/>
</recipe>
 
hay guys could someone help me with this xpath

<append xpath="/materials/material[@id=MresourceSilverNugget]/property[@name=surface_category]">

<property name="forge_category" value="Silver" />

</append>

im trying to add this to MresourceSilverNugget .

thanks all

 
If you are just adding a property for forge_category with the value Silver to MresourceSilverNugget then

Code:
<append xpath="/materials/material[@id='MresourceSilverNugget']">
<property name="forge_category" value="Silver" />
</append>
Append is basically just adding the extra code line to that particular block of code.

Assuming you know this but just incase you dont and for other folks .... to check your change has applied you can check by typing in exportcurrentconfigs into console and going to the save location shown in the dialogue



For my example the path is

C:\Users\Ragsy\AppData\Roaming\7DaysToDie\Saves\Seciza County\Ragsy Modded Servers\Configs

you should see this when you check the modified xml .

Code:
<material id="MresourceSilverNugget">
<property name="damage_category" value="metal" />
<property name="surface_category" value="metal" />
<property name="Experience" value="160" />

<property name="forge_category" value="Silver"><!--Element appended by: "Ragsy_Test_Silver"--></property>
</material>
 
Last edited by a moderator:
If you are just adding a property for forge_category with the value Silver to MresourceSilverNugget then


Code:
<append xpath="/materials/material[@id='MresourceSilverNugget']">
<property name="forge_category" value="Silver" />
</append>
Append is basically just adding the extra code line to that particular block of code.

Assuming you know this but just incase you dont and for other folks .... to check your change has applied you can check by typing in exportcurrentconfigs into console and going to the save location shown in the dialogue



For my example the path is

C:\Users\Ragsy\AppData\Roaming\7DaysToDie\Saves\Seciza County\Ragsy Modded Servers\Configs

you should see this when you check the modified xml .

Code:
<material id="MresourceSilverNugget">
<property name="damage_category" value="metal" />
<property name="surface_category" value="metal" />
<property name="Experience" value="160" />

<property name="forge_category" value="Silver"><!--Element appended by: "Ragsy_Test_Silver"--></property>
</material>
does it matter if the code is at the top or bottom? I had it at the top and it will not work.

 
It should not matter where the append is, make sure this append is not already within another append.

You might try this which is almost the same way that Ragsy posted above.

Code:
<insertAfter xpath="/materials/material[@id='MresourceSilverNugget']">
<property name="forge_category" value="Silver" />
</insertAfter>
 
It should not matter where the append is, make sure this append is not already within another append.
You might try this which is almost the same way that Ragsy posted above.

Code:
<insertAfter xpath="/materials/material[@id='MresourceSilverNugget']">
<property name="forge_category" value="Silver" />
</insertAfter>
I had tried that it was the first one I used. it wouldn't work either.

ill keep looking thanks anyway.

 
so this is what I get when I start the game

ERR XML loader: Loading and parsing 'items.xml' failed

2019-04-23T22:44:32 160.051 EXC Attribute 'material' 'MresourceSilverNugget ' refers to not existing material in item 'unit_silver'

Exception: Attribute 'material' 'MresourceSilverNugget ' refers to not existing material in item 'unit_silver'

at ItemClassesFromXml.parseItem (System.Xml.XmlElement _node) [0x00000] in <filename unknown>:0

at ItemClassesFromXml.CreateItems (.XmlFile _xmlFile) [0x00000] in <filename unknown>:0

at WorldStaticData.LoadItems (.XmlFile _xmlFile) [0x00000] in <filename unknown>:0

at WorldStaticData+<loadSingleXml>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0

I get it with insertAfter or append. not sure how to fix it. I've tried deferent stuff but to no avail .

 
Last edited by a moderator:
I don't have a look into the files at the moment, but i think you need to define "unit_silver" as a material somewhere else apart form items.xml file. Perhaps it's in materials.xml or some place other, maybe recipes.xml. I will be able to check that in a few hours. I remember seeing various "units" defined apart from item.xml file when i was checking the files some time ago.

 
I will make a new reply for this to be shown.

There are quite a few consideration and things to link together, i hope i will be able to get all of this clear on how to put it together. I will be referencing what other people have already posted with additional connections shown on what is needed.

1. In items.xml we have a definition of a unit of measurement for the resource to add:

Code:
<item name="unit_silver">
<property name="Extends" value="unit_iron"/>
<property name="CustomIcon" value="resourceSilverNugget"/>
<property name="Material" value="MresourceSilverNugget "/>
<property name="CreativeMode" value="None"/>
</item>
2. Also in items.xml we have a definition of the resource itself, something we have in inventory i presume. No change here to what we currently have, unless you want to change the stack number or something:

Code:
<item name="resourceSilverNugget">
<property name="HoldType" value="45"/>
<property name="Meshfile" value="Items/Misc/sackPrefab"/>
<property name="DropMeshfile" value="Items/Misc/sack_droppedPrefab"/>
<property name="Material" value="MresourceSilverNugget"/>
<property name="Stacknumber" value="250"/> <!-- STK loot -->
<property name="EconomicValue" value="250"/>
<property name="CraftingIngredientTime" value="15"/>
<property name="Group" value="Resources"/>
<property name="DescriptionKey" value="rareOresGroupDesc"/>
</item>
3. In materials.xml we have the definition of the resource itself and we only add "forge_category" entry as seen below:

Code:
<material id="MresourceSilverNugget">
<property name="damage_category" value="metal"/>
<property name="surface_category" value="metal"/>
<property name="forge_category" value="silver"/>
<property name="Experience" value="2"/>
</material>
4. Additional forge code in blocks.xml, inherited from the original forge, with the important properties substituted:

Code:
<block name="NEWFORGE">
<property name="Extends" value="forge" param1="DescriptionKey,CraftSound,CraftCompleteSound"/>
<property class="Workstation">
	<property name="CraftingAreaRecipes" value="YOURNEWFORGE"/>
	<property name="Modules" value="tools,output,fuel,material_input"/>
	<property name="InputMaterials" value="silver,gold"/>
</property>
</block>
You could first update the files manually and open the game to see if everything works. Afterwards make update scripts for xpath for your modlet. Surely you may be missing one update or something.

 
Back
Top