Jump to content

How do I hide or blacklist certain recipes or Items from the game?


Recommended Posts

15 hours ago, LastTugBoat243 said:

I want to make a mod that adds a new recipe for an already existing item in the game. But I want to hide the current one first. How would I go about doing that?

 

If you are just changing the ingredients couldn't you just change the ones in the recipe. For example for shotgun shells...

 

<recipe name="ammoShotgunShell" count="1" craft_area="workbench" tags="workbenchCrafting">
    <ingredient name="resourceBuckshot" count="1"/>
    <ingredient name="resourceGunPowder" count="4"/>
    <ingredient name="resourcePaper" count="1"/>
</recipe>


<recipe name="ammoShotgunShell" count="1" craft_area="workbench" tags="workbenchCrafting">
    <ingredient name="resourceAnimalFat" count="3"/>
    <ingredient name="resourceScrapPolymers" count="2"/>
    <ingredient name="resourceFeather" count="1"/>
</recipe>

 

 

I am not sure how to do the xpath thing to change it without actually changing in in the recipes.xml file but am sure someone could help you.

Link to comment
Share on other sites

1 hour ago, Gamida said:

I am not sure how to do the xpath thing to change it without actually changing in in the recipes.xml file but am sure someone could help you.

 

What I have done in the past (using your example of the shotgun shell):


 

<append xpath="//recipe[@name='ammoShotgunShell']/ingredient[@name='resourcePaper']">
    <ingredient name="resourceAnimalFat" count="3"/>
    <ingredient name="resourceScrapPolymers" count="2"/>
    <ingredient name="resourceFeather" count="1"/>
</append>

<remove xpath="//recipe[@name='ammoShotgunShell']/ingredient[@name='resourcePaper']"/>
<remove xpath="//recipe[@name='ammoShotgunShell']/ingredient[@name='resourceBuckshot']"/>
<remove xpath="//recipe[@name='ammoShotgunShell']/ingredient[@name='resourceGunPowder']"/>

 

I would add the items to the existing recipe (adding after resourcePaper) and then remove the old items I want to remove.

Edited by BFT2020
Removed added spacing in code (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Another way is to merely use "set" to change the values - as part of a Mod, and using only three lines in a recipes.xml:

<set xpath="/recipes/recipe[@name='ammoShotgunShell']/ingredient[@name='resourceBuckshot']/@name">resourceScrapPolymers</set>
<set xpath="/recipes/recipe[@name='ammoShotgunShell']/ingredient[@name='resourceGunPowder']/@name">resourceFeather</set>
<set xpath="/recipes/recipe[@name='ammoShotgunShell']/ingredient[@name='resourcePaper']/@name">resourceAnimalFat</set>

Looking at the the "Saves\(World)\ConfigsDump\recipes.xml" file - it will show the actual code as it has worked during the last load:

<recipe name="ammoShotgunShell" count="1" craft_area="AmmoWeaponWorkBench" tags="workbenchCrafting"><!--Attribute "craft_area" replaced by: "Red22"-->
    <ingredient name="resourceScrapPolymers" count="1"><!--Attribute "name" replaced by: "Red22"--></ingredient>
    <ingredient name="resourceFeather" count="4"><!--Attribute "name" replaced by: "Red22"--></ingredient>
    <ingredient name="resourceAnimalFat" count="1"><!--Attribute "name" replaced by: "Red22"--></ingredient>
</recipe>


(Red22 is just the name of my own mod).
I'm not sure quite what you mean, or are trying to achieve by "hiding" the (games?) original code, as any removing of the (modname)\Config\recipe.xml, from the game will simply cause the game to load its own default recipes.xml - which doesn't - or shouldn't - get modified by your mod.  
 

Edited by paulj_3
clarity. (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...