7 Days to Die

7 Days to Die

View Stats:
Alpha 17 XPATH Modding details released.
Alpha 17 XPATH Modding details released and sphereii gives the scoop.
Detailed explanation of writing mods for A17 and going forward.
https://7daystodie.com/forums/showthread.php?93816-XPath-Modding-Explanation-Thread
Last edited by Red Eagle LXIX; Nov 15, 2018 @ 5:11pm
< >
Showing 1-15 of 16 comments
Red Eagle LXIX Nov 15, 2018 @ 3:47pm 
Originally posted by Nightchills:
Originally posted by Red Eagle LXIX:
Details about XPATH mod ding of 7DTD:
https://7daystodie.com/forums/showthread.php?93816-XPath-Modding-Explanation-Thread

Correct me here if i'm wrong. If I am reading and understanding this correctly, I can make a xml file with edits the xpath will then use that file and virtuly over write the base xml entry.

<recipe name="clubSpiked" count="1">
<ingredient name="nail" count="10"/> <!-- Changed from "forgedIron" Count 10 -->
<ingredient name="clubWood" count="1"/> <!-- Changed from "wood" Count 10 -->
</recipe>

so ths would be my file in the mods folder that would load after the recipes.xml effectly over writing "clubSpiked"
There are a couple of way to accomplish such a replacement. The fastest would be to just replace the whole recipe:
Your file would have to look something like this if I understand correctly:
/MODS/MyNewClubRecipeMod/modinfo.xml
<?xml version="1.0" encoding="UTF-8" ?> <xml> <ModInfo> <Name value="MyNewClubRecipeMod" /> <Description value="Changes the Spiked club recipe to use a woodClub and nails instead of forgedIron and wood" /> <Author value="Nightchills" /> <Version value="1.0" /> <Website value="http://7daystodie.com" /> </ModInfo> </xml>
/MODS/MyNewClubRecipeMod/Config/recipes.xml
<configs> <remove xpath="/recipes/recipe[@name='clubSpiked']" /> <append xpath="/recipes" > <recipe name="clubSpiked" count="1"> <ingredient name="nail" count="10"/> <!-- Changed from "forgedIron" Count 10 --> <ingredient name="clubWood" count="1"/> <!-- Changed from "wood" Count 10 --> </recipe> </append> </configs>
The advantages being that if recipes.xml updates your mod will still get applied. If you add some other mods that include recipes, they will all just be combined without any changes or work on your part.
Last edited by Red Eagle LXIX; Nov 15, 2018 @ 4:06pm
Red Eagle LXIX Nov 15, 2018 @ 4:11pm 
@Nightchills,
Here is another way that might work (forgive me if this does not as I am still reading/learning myself).
In the first method above we completely remove the original recipe and then add the new recipe to the recipes node.
In the version below the changes are done to the existing recipe by changing the ingredient names and the count for one of the ingredients.

/MODS/MyNewClubRecipeMod/Config/recipes.xml
<configs> <set xpath="/recipes/recipe[@name='clubSpiked']/ingredient[@name='forgedIron']/@name">nail</set> <set xpath="/recipes/recipe[@name='clubSpiked']/ingredient[@name='wood']/@name">clubWood</set> <set xpath="/recipes/recipe[@name='clubSpiked']/ingredient[@name='clubWood']/@count">1</set> </configs>

This second method is a bit more complex but demonstrates using a changed value in the next set command. Might need to reverse the order for wood and do the count update first (i.e. update count then name). Not sure since obviously cannot try it yet. This second method would be more compatible with other mods if they also touched clubSpiked.

EDIT: 2018-11-18 added missing slashes based on some reading.
Last edited by Red Eagle LXIX; Nov 18, 2018 @ 6:09am
Nightchills Nov 15, 2018 @ 6:15pm 
Originally posted by Red Eagle LXIX:
The advantages being that if recipes.xml updates your mod will still get applied. If you add some other mods that include recipes, they will all just be combined without any changes or work on your part.

Thanks!!! That is excatly what I was thinking when Iwas reading the info. I do like the idea of not having to go line by the re enter the same info every update.

Originally posted by Red Eagle LXIX:
@Nightchills,
Here is another way that might work (forgive me if this does not as I am still reading/learning myself).
In the first method above we completely remove the original recipe and then add the new recipe to the recipes node.
In the version below the changes are done to the existing recipe by changing the ingredient names and the count for one of the ingredients.

/MODS/MyNewClubRecipeMod/Config/recipes.xml
<configs> <set xpath="/recipes/recipe[@name='clubSpiked']/ingredient[@name='forgedIron']@name">nail</set> <set xpath="/recipes/recipe[@name='clubSpiked']/ingredient[@name='wood']@name">clubWood</set> <set xpath="/recipes/recipe[@name='clubSpiked']/ingredient[@name='clubWood']@count">1</set> </configs>

This second method is a bit more complex but demonstrates using a changed value in the next set command. Might need to reverse the order for wood and do the count update first (i.e. update count then name). Not sure since obviously cannot try it yet. This second method would be more compatible with other mods if they also touched clubSpiked.

Yeah this sounds about right. Thanks Red I really appreciate it.
Last edited by Nightchills; Nov 15, 2018 @ 6:23pm
Nightchills Nov 15, 2018 @ 6:19pm 
Do u mind if I add you? It would be nice to have a someone that knows a more than me too shoot a quick question too everyy now and then.
Nightchills Nov 15, 2018 @ 6:21pm 
<configs>
<set xpath="/recipes/recipe[@name='clubSpiked']/ingredient[@name='forgedIron']@name">nail</set>
<set xpath="/recipes/recipe[@name='clubSpiked']/ingredient[@name='wood']@name">clubWood</set>
<set xpath="/recipes/recipe[@name='clubSpiked']/ingredient[@name='clubWood']@count">1</set>
</configs>

Basicly what I have been doing already just more typing and slightly diffrent syntax.
dominicawb Nov 16, 2018 @ 6:48pm 
thats nice but what about if there are multiple different recipies for the same item?
Red Eagle LXIX Nov 17, 2018 @ 12:21am 
Originally posted by dominicawb:
thats nice but what about if there are multiple different recipies for the same item?
I'm not sure what you are getting at. You want to change multiple different recipes in what way?
Red Eagle LXIX Nov 17, 2018 @ 10:46am 
Originally posted by dominicawb:
thats nice but what about if there are multiple different recipies for the same item?
Do you mean if you wanted to change one of these antibiotics recipes (as an example)?
<recipe name="antibiotics" count="1" craft_area="chemistryStation"> <ingredient name="moldyBread" count="1"/> <ingredient name="potassiumNitratePowder" count="1"/> <ingredient name="bottledRiverWater" count="1"/> </recipe> <recipe name="antibiotics" count="1" craft_area="campfire" craft_tool="beaker"> <ingredient name="moldyBread" count="4"/> <ingredient name="potassiumNitratePowder" count="3"/> <ingredient name="bottledWater" count="1"/> </recipe>

It would depend on if you want to change both recipes in some way or just one of them.
Let us say for the sake of example you wanted to change Moldy Bread count on the first of those 2 recipes, then recipes.xml in your mod's config folder would be:
<configs> <!-- Change count of Moldy Bread for <recipe name="antibiotics" count="1" craft_area="chemistryStation"> --> <set xpath="/recipes/recipe[@name='antibiotics'][@craft_area='chemistryStation']/ingredient[@name='moldyBread']/@count">2</set> </configs>
As you can see I combined 2 values to ensure I matched a single unique recipe.

If on the other hand you wanted to add aloeCream to both recipes you could do:
<configs> <!-- Add aloeCream to all antibiotics recipes --> <append xpath="/recipes/recipe[@name='antibiotics']" > <ingredient name="aloeCream" count="1"/> <append> </configs>

Edit 2018-11-18 added missing slashes based on some reading.
Edit 2018-11-19 removed bad AND which was not required.
Last edited by Red Eagle LXIX; Nov 19, 2018 @ 6:59am
dominicawb Nov 17, 2018 @ 6:51pm 
Ahh yeah I meant if you only wanted to edit one of those recipies. Still i'm not sure how useful this all is when using a notepad comparing program lets you update xmls pretty quickly

I use Beyond Compare 4 to go thorugh each line one at a time or groups of lines, tis great at matching recipies and other XML values.
Last edited by dominicawb; Nov 17, 2018 @ 7:00pm
Red Eagle LXIX Nov 18, 2018 @ 6:08am 
I corrected a couple of formatting errors for the set commands above.
Taddy Mason Nov 18, 2018 @ 7:17am 
So, did I read that right? There was a lot of good info in here, but is it correct that you can just keep altering the actual xml files and ignore all the xpath stuff if you want?

I’m not against the new system and I’ll try it out at some point, but I have dozens and dozens of mods I’ve make and I keep making more-it seems like a waste of drive space and a waste of time to make a new mod file and folder and go thru all these steps if I can still just directly edit the xml.
Nightchills Nov 18, 2018 @ 8:36am 
Originally posted by Taddy Mason:
So, did I read that right? There was a lot of good info in here, but is it correct that you can just keep altering the actual xml files and ignore all the xpath stuff if you want?

I’m not against the new system and I’ll try it out at some point, but I have dozens and dozens of mods I’ve make and I keep making more-it seems like a waste of drive space and a waste of time to make a new mod file and folder and go thru all these steps if I can still just directly edit the xml.

I conpletely agree with you here but there is one thing that if it is correct makes the new system much better. If you only have to do it once. Right now everytime they push a new update you have to go back and remake those changes. (correect?) With this new system if I understand it correctly you can make the change once and it will stick even when the original is updated your changes over ride the .xml. Its kinda like modding Fallout and such, the .xml loads first then the xpath mod lods making changes that overwrite the base .xml

Yeah its a new syntax but seams like a more efficent way to do it in the long run

Please correct me if I am wrong on any of these points I am still "VERY" new to modding 7D2D.
Taddy Mason Nov 18, 2018 @ 10:35am 
Yeah I understand that you only have to do it once, but it seems you also have to do one for each mod rather than just making your edits as you go. Especially as the game gets closer to full release and considering how long it can take between updates, I’m less worried about having to redo some mods if there’s an update than I am about having to make a new file with the extra code every time I want to make a new mod.
This system seems less relevant and necessary the closer we get to full release. It’s been nearly a year between updates and a17 technically still isn’t even out yet. What purpose does this serve when they stop updating?
I’m not against the system, I just want to make sure I don’t have to use it if I don’t want to. I’ll probably mess around with it eventually, but I still want to know if direct xml edits work because they’re faster and more efficient to make and use in game. No need for all that extra work if I’m just trying to increase the stack limit of bandages from 5 to 30 or decrease the hydration lost when taking painkillers from whatever it used to be down to 3-5.
Nightchills Nov 18, 2018 @ 10:49am 
Originally posted by Taddy Mason:
No need for all that extra work if I’m just trying to increase the stack limit of bandages from 5 to 30 or decrease the hydration lost when taking painkillers from whatever it used to be down to 3-5.
Right there with ya. I basicly change some the the recipies and head shoot dmg thats about it. I do my best to get the game to a some what realistic state or as close as I can.
Red Eagle LXIX Nov 19, 2018 @ 7:02am 
Depends on what you wanted to do as to how useful it could be. As an example you could change the stack limit for everything that currently has a stack limit (including items with stack limits added via other mods) in a single modlet.

I also corrected an issue above by removing an unnecessary AND in one of the examples.
< >
Showing 1-15 of 16 comments
Per page: 1530 50

Date Posted: Nov 14, 2018 @ 6:18pm
Posts: 16