• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Help, I don't know why I'm getting duplicate items in crafting menu.

Noisy Pants

Refugee
I changed how much materials required and how much would be produced then put it in the mod folder. It works but I have two craft options for bullet tips.

Code:
<set xpath="/recipes/recipe[@name='resourceBulletTip']/@count">50
<!--<recipe name="resourceBulletTip" count="1" craft_area="forge" craft_tool="toolAndDieSet" material_based="true" tags="learnable">-->
<ingredient name="unit_lead" count="2"/>
<ingredient name="unit_clay" count="1"/>
</set>
Code:
<remove xpath="/recipes/recipe[@name='resourceBulletTip']"></remove>
	<append xpath="/recipes">

		<recipe name="resourceBulletTip" count="100" craft_area="forge" craft_tool="toolAndDieSet" material_based="true" tags="learnable">
			<ingredient name="unit_lead" count="1"/>
			<ingredient name="unit_clay" count="1"/>
		</recipe>

	</append>
 
Last edited by a moderator:
This alone works:

Code:
 <remove xpath="/recipes/recipe[@name='resourceBulletTip']"></remove>
 <append xpath="/recipes">

   <recipe name="resourceBulletTip" count="100" craft_area="forge" craft_tool="toolAndDieSet" material_based="true" tags="learnable">
     <ingredient name="unit_lead" count="1"/>
     <ingredient name="unit_clay" count="1"/>
   </recipe>

 </append>
Or this alone:

Code:
 <set xpath="/recipes/recipe[@name='resourceBulletTip']/@count">100</set>
 <set xpath="/recipes/recipe[@name='resourceBulletTip']/ingredient[@name='unit_lead']/@count">1</set>
 
Last edited by a moderator:
I see you've already asked here: https://7daystodie.com/forums/showthread.php?121531-How-to-make-a-mod-to-remove-an-item

Beware, it's considered bad practice to post duplicates on a forum. :)

From the other post, I see that the problem comes when you put it all together.

Code:
<config>
 <set xpath="/recipes/recipe[@name='resourceBulletTip']/@count">100</set>
 <set xpath="/recipes/recipe[@name='resourceBulletTip']/ingredient[@name='unit_lead']/@count">1</set>
</config>
 
I see you've already asked here: https://7daystodie.com/forums/showthread.php?121531-How-to-make-a-mod-to-remove-an-itemBeware, it's considered bad practice to post duplicates on a forum. :)

From the other post, I see that the problem comes when you put it all together.

Code:
<config>
 <set xpath="/recipes/recipe[@name='resourceBulletTip']/@count">100</set>
 <set xpath="/recipes/recipe[@name='resourceBulletTip']/ingredient[@name='unit_lead']/@count">1</set>
</config>
My apologies, I thought if I restated the question in a different manner I would get a different answer. As of now, I think the problem lies within all my mods possibly conflicting. I'm beyond angry frustrated and miffed.

 
I think your problem is with the use of "set" and "append".

1. "set" allows you to change a single value, like this:

Code:
<config>
 <set xpath="/recipes/recipe[@name='resourceBulletTip']/ingredient[@name='unit_lead']/@count">1</set>
</config>
or to change the content of the whole node, like this:

Code:
 <set xpath="/recipes/recipe[@name='resourceBulletTip']">
     <ingredient name="unit_lead" count="1"/>
     <ingredient name="unit_clay" count="1"/>
 </set>
However, you can't do both at once like you tried here:

Code:
[...]	
	<set xpath="/recipes/recipe[@name='resourceBulletTip']/@count">2
		<!--<recipe name="resourceBulletTip" count="1" craft_area="forge" craft_tool="toolAndDieSet" material_based="true" tags="learnable">-->
		<ingredient name="unit_lead" count="1"/>
		<ingredient name="unit_clay" count="1"/>
	</set		
	[...]
And there's a typo: the first "</set" needs a closing angled bracket: >

The correct way to do it would be:

Code:
[...]
  <set xpath="/recipes/recipe[@name='resourceBulletTip']/@count">100</set>
  <set xpath="/recipes/recipe[@name='resourceBulletTip']">
     <ingredient name="unit_lead" count="1"/>
     <ingredient name="unit_clay" count="1"/>
 </set>		
[...]
Or easier:

Code:
<config>
 <set xpath="/recipes/recipe[@name='resourceBulletTip']/@count">100</set>
 <set xpath="/recipes/recipe[@name='resourceBulletTip']/ingredient[@name='unit_lead']/@count">1</set>
</config>
2. "append" allows you to add something to a node, like this:

Code:
<config>
<append xpath="/recipes">	
	<recipe name="resourceBulletTips" count="100" craft_area="forge" craft_tool="toolAndDieSet" material_based="true" tags="learnable">
		<ingredient name="unit_lead" count="1"/>
		<ingredient name="unit_clay" count="1"/>
	</recipe>	
</append>
</config>
But this would add another recipe to the list, like you saw.

3. "remove" allows you to remove a whole node, like this:

Code:
<remove xpath="/recipes/recipe[@name='resourceBulletTip']"></remove>
 
I tried this and no go, here is the code:
Code:
<config>
	<append xpath="/recipes">

		<set xpath="/recipes/recipe[@name='resourceBulletTip']/@count">2
			<!--<recipe name="resourceBulletTip" count="1" craft_area="forge" craft_tool="toolAndDieSet" material_based="true" tags="learnable">-->
			<ingredient name="unit_lead" count="1"/>
			<ingredient name="unit_clay" count="1"/>
		</set

		<recipe name="ammo44MagnumBullet" count="1" craft_area="workbench" tags="learnable">
			<ingredient name="resourceBulletTip" count="1"/>
			<ingredient name="resourceGunPowder" count="1"/>
			<ingredient name="resourceBulletCasing" count="1"/>
		</recipe>
		[...]	
	</append>
</config>
[/CODE]
View attachment 28820

Furthermore, you can't put a "set" node into an "append" node, the correct way to do both in the same file would be:

Code:
<config>
  <set xpath="/recipes/recipe[@name='resourceBulletTip']/@count">100</set>
  <set xpath="/recipes/recipe[@name='resourceBulletTip']/ingredient[@name='unit_lead']/@count">1</set>
  <append xpath="/recipes">	
    <recipe name="ammo44MagnumBullet" count="1" craft_area="workbench" tags="learnable">
      <ingredient name="resourceBulletTip" count="1"/>
      <ingredient name="resourceGunPowder" count="1"/>
      <ingredient name="resourceBulletCasing" count="1"/>
    </recipe>
    [...]	
  </append>
</config>
I hope this helps.
 
Furthermore, you can't put a "set" node into an "append" node, the correct way to do both in the same file would be:
Code:
<config>
  <set xpath="/recipes/recipe[@name='resourceBulletTip']/@count">100</set>
  <set xpath="/recipes/recipe[@name='resourceBulletTip']/ingredient[@name='unit_lead']/@count">1</set>
  <append xpath="/recipes">	
    <recipe name="ammo44MagnumBullet" count="1" craft_area="workbench" tags="learnable">
      <ingredient name="resourceBulletTip" count="1"/>
      <ingredient name="resourceGunPowder" count="1"/>
      <ingredient name="resourceBulletCasing" count="1"/>
    </recipe>
    [...]	
  </append>
</config>
[/CODE]

I hope this helps.

thank you very much, i followed your advice and everything worked; modding 7DtD is difficult for me, i'm learning through videos, google searches and mostly this forum.
 
It is a pain sometimes. We're all learning. :)

Could always join Gup's discord as well. Plenty of people to answer questions you may have. :)

 
Back
Top