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

XPath Modding Explanation Thread

This is a large amount of information in these posts. I'll be working on a full, properly formed tutorial as we get access to A17 and we can really make the xpath system shine. I've listed some examples here, and we'll be posting a ton more xpath samples over the coming weeks, as we port the SDX modlets over to use the native hooks.

By all means, begin posting your comments, questions, or requests for clarity.

Since we now know that xpath support will be built-into the vanilla base game, and discussions earlier were getting a bit confusing, I've decided to make a new thread to try to demystify xpath and what it'll mean for mods and modders going forward in A17. The information in this thread has been pieced together from forum and discord discussions. They may not be 100% accurate, but I will update this thread when we know the full implementation.

XPath is a way of adding, changing, or removing XML lines and nodes, without directly editing the XML files. It allows you to apply patches to the XML files without manually editing the vanilla XML files.

SDX has had partial support for this since its initial release, and a lot of the SDX Modlets are already written this way. We will be using some of the SDX's xpath as examples in this thread, but SDX is not required to do this in A17 and onwards.

I believe in using examples to explain concept, so in the next few posts, you'll see a mixture of explanation, along with sample xpath code.

The following Mod structure is expected for A17 and beyond:

Code:
Mods/
   <ModName>/
       Config/
       UIAtlases/ItemIconAtlas/
       ModInfo.xml

   <ModName2>/
       Config/
       ModInfo.xml
You will be able to have multiple mods loaded, and loading will occur as long as the ModInfo.xml exists. This is unchanged from what we've been doing doing with other alphas, with the exception of the Config folder.

This Config folder will support loading XML files, written using xpath, in the following folder structure:

Code:
Config/entityclasses.xml
Config/gamestages.xml
Config/items.xml
The files in the Config folder will not be a full copy of the vanilla file with your changes. Rather, it'll contain the changes you want done to the vanilla files. The files under the Config must match the vanilla file name. You cannot create an entityclasses2.xml file, and expect it to work. Any changes in the entityclasses.xml will have to be done in the same file. However, each mod can have its own entityclasses.xml.

During the game's initialization, it will perform the xpath merge in-memory only; no files will be actually be modified. This would allow us to remove mods we no longer want, without re-validating against steam, or previous copies of the xml. That's a big one. No more half merging of a mod, and not having it work, then trying to pull it back out.

What this means for us is that we'll be able to make a variety of smaller mods, which I've been calling modlets, which can add, remove and change smaller pieces of the game. They can be used together, or they could be added to an overhaul mod, in order to style your game play easier.

These modlets would also exists outside of the Data/Config folder, so if you have made direct XML changes in your Alpha 17.1 Data/Config files, and Steam updated the game to 17.2, you would have lost your changes, or would have to re-merge them in. We've all been there before. But if they existed as modlets, under the Mods folder, they would be safe. And as long as your xpath is still valid to the new XML, it should load up with no additional work on your part.

If we could use xyth's JunkItems modlet, which adds random, scrappable junk items to loot containers, and add them to Valmod Overhaul. Likewise, if Valmod Overhaul did not have the No Ammo modlet (which gives you the ability to unload a gun and get its bullets back without disassembling it), you could drop the NoAmmo modlet into your Mods folder. Headshots only? Want to increase stack sizes? Same deal.

With a properly constructed modlet, we'll be able to piece together new play styles for people to enjoy and share. A modder working on a large overhaul won't have to duplicate work. If they wanted to include the No Ammo mod, they wouldn't have to code it themselves, letting them focus on the bits that make their mod really unique.

Let's get started on your journey...

 
Last edited by a moderator:
I'm trying to replace Spiders with Dogs. I have used the example a bit higher up using csv add/remove commands to replace entire lines, where spiders are mentioned, and it mostly does what i want, i think.
 

Edit: so i realized several misconceptions i had in my initial approach.

The main question remains how to get the config dumps people have mentioned, so i can actually see the effect of the mod, rather than trying to infer it from gameplay testing.
Sorry, i'm sure it's common knowledge for the more experienced modders, but i'm new to this and google has failed me.

The original question - now cleaned up of some of my initial misconceptions...

I did this:

<csv xpath="/entitygroups/entitygroup[contains(@name, '')]/text()" delim="\n" op="remove">zombieSpider*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, '')]/text()" delim="\n" op="add">animalZombieDog</csv>




and it seemed to work superficially.

However, i am now realizing, that while it does probably remove all the spiders just as i wanted, the second part does not at all work as i intially thought. It's not conditioned on the first line triggering, so it will just add a dog to every entitygroup. (I also realized, that there are no feral or radiated dogs i think? So i'd probably want another stand in, but let's ignore that for now)

So what would be the best way of something like this (while catching all the possible combinations of potentially different probability weights)

zombieSpider
zombieSpiderFeral, .25


into ideally something like

animalZombieDog



My main concern are entity groups that only have a single entry - just removing the Spider from there without replacement would leave the group empty.

Code:
	<entitygroup name="zombieSpider">zombieSpider</entitygroup>
 
Last edited by a moderator:
Ok, had a thought and did some testing.  I added this code to the beginning of my entitygroups.xml mod file and by doing this, I got NO errors with anything in the log files...

<!-- Correct Bug???  with individual entity group ZombieDogGroup -->
    <remove xpath="/entitygroups/entitygroup[@name='ZombieDogGroup']" />
    <append xpath="/entitygroups">
        <entitygroup name="ZombieDogGroup">
        animalZombieDog
        </entitygroup>
    </append>

This is the output i got in the dump file....

  <entitygroup name="animalZombieDog">animalZombieDog
animalIceburgBabyZombieDog
animalIceburgTeenZombieDog<!--Content CSV manipulated by: "IceBurg_Animals_Overhaul"--><!--Content CSV manipulated by: "IceBurg_Animals_Overhaul"--></entitygroup>
 

Going to call this a functional workaround?????   LOL

 
Last edited by a moderator:
I'm trying to replace Spiders with Dogs. I have used the example a bit higher up using csv add/remove commands to replace entire lines, where spiders are mentioned, and it mostly does what i want, i think.
 

Edit: so i realized several misconceptions i had in my initial approach.

The main question remains how to get the config dumps people have mentioned, so i can actually see the effect of the mod, rather than trying to infer it from gameplay testing.
Sorry, i'm sure it's common knowledge for the more experienced modders, but i'm new to this and google has failed me.

The original question - now cleaned up of some of my initial misconceptions...

I did this:

<csv xpath="/entitygroups/entitygroup[contains(@name, '')]/text()" delim="\n" op="remove">zombieSpider*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, '')]/text()" delim="\n" op="add">animalZombieDog</csv>




and it seemed to work superficially.

However, i am now realizing, that while it does probably remove all the spiders just as i wanted, the second part does not at all work as i intially thought. It's not conditioned on the first line triggering, so it will just add a dog to every entitygroup. (I also realized, that there are no feral or radiated dogs i think? So i'd probably want another stand in, but let's ignore that for now)

So what would be the best way of something like this (while catching all the possible combinations of potentially different probability weights)

zombieSpider
zombieSpiderFeral, .25


into ideally something like

animalZombieDog



My main concern are entity groups that only have a single entry - just removing the Spider from there without replacement would leave the group empty.

<entitygroup name="zombieSpider">zombieSpider</entitygroup>



You would first want to remove the zombiespider group since it will no longer exist and there is already a zombie dog group

<remove xpath="/entitygroups/entitygroup[@name='ZombieSpiderGroup']" />

and probably (didn't look to see if it exists)

<remove xpath="/entitygroups/entitygroup[@name='ZombieSpiderFeralGroup']" />

Second, you will want to add in the zombie dog wherever there is a zombie spider entry, but just zombie spider, not feral ones, or ones with a probability

    <csv xpath="/entitygroups/entitygroup/text()[contains(., 'zombieSpider') and not(contains(., 'zombieSpider,')) and not(contains(., 'zombieSpiderFeral'))]" delim="\n" op="add" >animalZombieDog</csv>>

    <csv xpath="/entitygroups/entitygroup/text()[contains(., 'zombieSpiderFeral') and not(contains(., 'zombieSpiderFeral,'))]" delim="\n" op="add" >animalZombieDog</csv>>

The first contains evaluates to true if zombieSpider is found.

The second contains evaluates to true if zombieSpider, is NOT found.  Note the "," at the end.  VERY IMPORTANT because with a "," there is a probability

The Third contains evaluates to true if zombieSpiderFeral Is NOT found.  

Note the differnce between the feral and non feral versions of the code.

Now for the third step.  Adding in the spiders that DO have a probability.

    <csv xpath="/entitygroups/entitygroup/text()[contains(., 'zombieSpider, 10')]" delim="\n" op="add" >animalZombieDog, 10</csv>>

this just looks for an entry of zombieSpider, 10 and changes it to animalZombieDog, 10. 

doing it this way will maintain your spider probability with the dog replacing it.  and I just use "10" as an example, it could be any probabliity.  And you will have one entry for each probability that currently exists in the game.  Just search the Vanilla entityGroups.xml file for "zombieSpider," and write down all the numbers.  then you will have one line for each number you write down with that number probability instead of 10.  Again, note the "," after zombieSpider.  will narrow your search a little.

Change zombieSpider, to ZombieSpiderFeral to to the same to those.

Now to delete the  zombieSpider and zombieSpiderFeral from everywhere..

    <csv xpath="/entitygroups/entitygroup/text()[contains(., 'zombieSpider')]" delim="\n" op="remove" >zombieSpider</csv>>

    <csv xpath="/entitygroups/entitygroup/text()[contains(., 'zombieSpiderFeral')]" delim="\n" op="remove" >zombieSpiderFeral</csv>>

Doing it this way will make sure you don't ever end up with an empty group, which will throw a fatal error and prevent the mod from running correctly.

You will also maintain the probabilities of the zombie spiders carried into the dogs.  probably a good thing.

Also, I am pretty sure that last step will remove all entries for zombieSpider even if it contains a probability.  Never tried it, so don't know for sure.

Also also, I don't know if ZombieSpiderGroup is used in spawning.xml or not.  So you may have to make some adjustments and not remove them.  If you don't remove them, then just skip the step where they are removed.  The rest of the code will catch them and populate them correctly.

You just have to add before you remove.

 
Last edited by a moderator:
Thank you Iceburg! Some excellent advice - i did not even realize, that the order i would do things matters, but indeed it does solve some issues.

One more thing - i sorta burrowed the question in my original post:

How do i get/see those dump files you mentioned, to see how the config files look after the mod is applied? It would really help as compared to just trying it in game. I tried searching it on google, but apparently the terms are too ambiguous.

 
Last edited by a moderator:
One more thing - i sorta burrowed the question in my original post:

How do i get/see those dump files you mentioned, to see how the config files look after the mod is applied? It would really help as compared to just trying it in game. I tried searching it on google, but apparently the terms are too ambiguous.
Those are created in the userdata folder, inside the save folder for the world you are playing in. So

Code:
Saves/WorldName/Savename/ConfigsDump
As an additional note on my last post, even something like

<csv xpath="//entitygroup/text()" delim="\n" op="add" >
I Don't Know You And I Don't Care To Know You.
</csv>


causes no errors. It just gets completely ignored. The change is visible in the configs dump on every entitygroup.

 
In an attempt to lower melee damage with decreasing stamina, I adapted a part of the game code, but it doesn't seem to work. This is what I tried:

<append xpath="/buffs/buff[@name='buffStatusCheck01']/effect_group">
<passive_effect name="EntityDamage" operation="perc_add" value="-.05" tags="melee">
<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.9"/>
</passive_effect>
<passive_effect name="EntityDamage" operation="perc_add" value="-.06" tags="melee">
<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.8"/>
</passive_effect>
<passive_effect name="EntityDamage" operation="perc_add" value="-.07" tags="melee">
<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.7"/>
</passive_effect>
<passive_effect name="EntityDamage" operation="perc_add" value="-.08" tags="melee">
<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.6"/>
</passive_effect>
<passive_effect name="EntityDamage" operation="perc_add" value="-.09" tags="melee">
<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.5"/>
</passive_effect>
<passive_effect name="EntityDamage" operation="perc_add" value="-.1" tags="melee">
<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.4"/>
</passive_effect>
<passive_effect name="EntityDamage" operation="perc_add" value="-.1" tags="melee">
<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.3"/>
</passive_effect>
<passive_effect name="EntityDamage" operation="perc_add" value="-.1" tags="melee">
<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.2"/>
</passive_effect>
<passive_effect name="EntityDamage" operation="perc_add" value="-.1" tags="melee">
<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.1"/>
</passive_effect>
</append>


The part is used in "Being at low health increases the chance of getting hit by a critical effect" in the buff.xml, but here nothing happens. I tried to set the penalty to -.9 for all for testing purposes, but still no effect. Does anyone have an idea why, or can offer a solution that works as intended?

 
How would i go about adding a zombie to each entitygroup. Say I wanted to add zombieSpecialScreamer to every scout group?


Code:
[COLOR=#ebe7e3]    [/COLOR][COLOR=#ebe7e3]<!-- To add to an existing group, spread it over multiple lines -->[/COLOR][COLOR=#ebe7e3]
    [/COLOR][COLOR=#e8bd89]<csv[/COLOR][COLOR=#ebe7e3] [/COLOR][COLOR=#df897a]xpath[/COLOR][COLOR=#d9b180]=[/COLOR][COLOR=#7ea9c4]"/entitygroups/entitygroup[@name='ZombiesAll']/text()"[/COLOR][COLOR=#ebe7e3] [/COLOR][COLOR=#df897a]delim[/COLOR][COLOR=#d9b180]=[/COLOR][COLOR=#7ea9c4]"\n"[/COLOR][COLOR=#ebe7e3] [/COLOR][COLOR=#df897a]op[/COLOR][COLOR=#d9b180]=[/COLOR][COLOR=#7ea9c4]"add"[/COLOR][COLOR=#ebe7e3] [/COLOR][COLOR=#e8bd89]>[/COLOR][COLOR=#ebe7e3]
        zombieFatHawaiian2, .3
        zombieFatHawaiian3, .3
        zombieFatHawaiian4, .3
        zombieFatHawaiian5, .3
    [/COLOR][COLOR=#e8bd89]</csv>[/COLOR]
 
Thanks so much Sphereii and everyone else. Thanks BFT2020 for pointing me over here. I was able to get my vultures mod to work again. I played it safe by doing a remove/add but wondering if it can be simplified.

<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="\n" op="remove" >
animalZombieVulture*
none*
</csv>
<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="\n" op="add" >none, 40</csv>
<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsWasteland']/text()" delim="\n" op="remove" >
animalZombieVulture*
none*
</csv>
<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsWasteland']/text()" delim="\n" op="add" >none, 60</csv>
<csv xpath="/entitygroups/entitygroup[@name='ZombiesWastelandNightNoBears']/text()" delim="\n" op="remove" >animalZombieVulture*</csv>
<csv xpath="/entitygroups/entitygroup[@name='ZombiesWastelandNight2']/text()" delim="\n" op="remove" >animalZombieVulture*</csv>




My real problem is conditionals. Getting the usual unhelpful invalid token.

<csv xpath="/entitygroups/entitygroup[not contains(@name, 'zombieSpider*')and contains(text(), 'zombieSpider*'))]" delim="\n" op="remove" >zombieSpider*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')and contains(text(), 'zombieSpider*'))]" delim="\n" op="remove" >zombieSpider*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')and contains(text(), 'animalZombieDog*'))]" delim="\n" op="remove" >animalZombieDog*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')and contains(text(), 'zombieSteveCrawler*'))]" delim="\n" op="remove" >zombieSteveCrawler*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')and contains(text(), 'animalZombieVulture*'))]" delim="\n" op="remove" >animalZombieVulture*</csv>


I'm sure it is something simple I'm missing. the goal here is to remove the selected zeds from any horde and in addition I want to remove spiders from everything except their base entry and POI groups.

I changed it to this (among many other failed attempts)

<!-- <csv xpath="/entitygroups/entitygroup[not contains(@name, 'zombieSpider*')]/text()" delim="\n" op="remove" >zombieSpider*</csv> -->
<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove">zombieSpider*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove">animalZombieDog*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove">animalZombieDog*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove">animalZombieVulture*</csv>


and the error log gives me

2023-08-05T10:20:38 35.314 WRN XML patch for "entitygroups.xml" from mod "Krougal_HordeNoDogNoSpider" did not apply: <csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove" (line 3 at pos 3)
2023-08-05T10:20:38 35.315 WRN XML patch for "entitygroups.xml" from mod "Krougal_HordeNoDogNoSpider" did not apply: <csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove" (line 4 at pos 3)
2023-08-05T10:20:38 35.316 WRN XML patch for "entitygroups.xml" from mod "Krougal_HordeNoDogNoSpider" did not apply: <csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove" (line 5 at pos 3)
2023-08-05T10:20:38 35.317 WRN XML patch for "entitygroups.xml" from mod "Krougal_HordeNoDogNoSpider" did not apply: <csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove" (line 6 at pos 3)


as opposed to the commented out line, which gave me invalid token.

OH FFS! So it is Horde not horde! I had a few other little issues, and I had a couple other tiny errors. Working code  in a minute when I fix 1 issue on the

spider line.

<csv xpath="/entitygroups/entitygroup[not(contains(@name, 'zombieSpider*'))]/text()" delim="\n" op="remove" >zombieSpider*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, 'Horde')]/text()" delim="\n" op="remove">zombieSpider*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, 'Horde')]/text()" delim="\n" op="remove">animalZombieDog*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, 'Horde')]/text()" delim="\n" op="remove">animalZombieDog*</csv>
<csv xpath="/entitygroups/entitygroup[contains(@name, 'Horde')]/text()" delim="\n" op="remove">animalZombieVulture*</csv>




FFS(again) always check your output, because even though it stopped erroring (mostly) the group name filter is not working on any of them. 

I am really at a loss.

So mostly got it. The secret sauce seems to be you still need "@name="

I am still trying to get the "not" to work though. Also condensed the 4 Horde entries into 1.

<csv xpath="/entitygroups/entitygroup[@name=not'(contains(@name, 'zombieSpider*'))']/text()" delim="\n" op="remove" >zombieSpider*</csv>
<csv xpath="/entitygroups/entitygroup[@name='contains(@name, 'Horde')']/text()" delim="\n" op="remove">
zombieSpider*
animalZombieDog*
zombieSteveCrawler*
animalZombieVulture*
</csv>




Results are still very inconsistent. It also logs the modified tag repeatedly on the same line. I'm thinking I need to delete the configsdump between runs? I do fully shutdown and restart the game between edits. Very frustrating.

Ok, it looks like I figured it out. More or less, there are a couple groups that still have zombieSpider that should not. Namely the biome groups.

<csv xpath="/entitygroups/entitygroup[contains(@name, 'Horde')]/text()" delim="\n" op="remove">
zombieSpider*
animalZombieDog*
animalSteveCrawler*
animalZombieVulture*
</csv>
<csv xpath="/entitygroups/entitygroup[not(contains(@name, 'zombieSpider*'))]/text()" delim="\n" op="remove" >zombieSpider*</csv> -->


Oh, FF! So I had forgotten the close comment (-->) at the end of the spider line (I moved it to last so it didn't prevent the rest of the script working) so it was erroring and not applying at all, I just missed it somehow. Fixing that, I am back to it is removing everything, which of course throws errors from spawning.xml because of the empty groups (which I don't want those groups emptied).

Well @%$# me! It was the *. Originally I was trying to do it with a setxpath and a wildcard for the groupname and I forgot to remove it with the contains.

Now the next issue is it is touching every stinking group and leaving a comment, even though it is benign it irks me. I need to make a tighter filter.

    <csv xpath="/entitygroups/entitygroup[not(contains(@name, 'zombieSpider'))and contains(text(), 'zombieSpider' )]/text()" delim="\n" op="remove" >zombieSpider*</csv>
 

<csv xpath="/entitygroups/entitygroup[not(contains(@name, 'zombieSpider'))and contains(text(), 'zombieSpider' )]/text()" delim="\n" op="remove" >zombieSpider*</csv>


And now it does exactly what I want. So it looks for all groups that have zombieSpiders of any subtype or quantity as long as the groupname doesn't include zombieSpider. This is important, otherwise we have to edit the spawning.xml to remove the mob entirely, which if that is your intent is fine, but I wanted to keep the base entity and the POI groups intact (I like the POIs enough that I want to experience them as intended, but an excess of certain mobs annoy me and spiders really annoy me) I will leave all this in case it helps someone else. If I was feeling brave I could remove the zombieSpider from the horde entry and this should take care of it as well.

 
Last edited by a moderator:
with the csv xpath, is there a "modify" command or just add and remove.  all I want to do is modify a current value from "animalChicken, 15" to "animalChicken, 6"

how can I do that?  either with or without using csv commands???

 
with the csv xpath, is there a "modify" command or just add and remove.  all I want to do is modify a current value from "animalChicken, 15" to "animalChicken, 6"

how can I do that?  either with or without using csv commands???
The entitygroups.xml is different from the other xml files in A21 in that the csv method has to be used to make modifications beyond simple append or remove. I know it was a jumbled mess as I edited it every time I checked back here since I figured it out myself before I ever got any help (sometimes that's just the way it is) but that was pretty much me struggling to figure out how to port my mod from A20. Anyway, here is a clearer example:

<Krougal>

<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="\n" op="remove" >
animalZombieVulture*
none*
</csv>
<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="\n" op="add" >none, 40</csv>
<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsWasteland']/text()" delim="\n" op="remove" >
animalZombieVulture*
none*
</csv>
<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsWasteland']/text()" delim="\n" op="add" >none, 60</csv>
<csv xpath="/entitygroups/entitygroup[@name='ZombiesWastelandNightNoBears']/text()" delim="\n" op="remove" >animalZombieVulture*</csv>
<csv xpath="/entitygroups/entitygroup[@name='ZombiesWastelandNight2']/text()" delim="\n" op="remove" >animalZombieVulture*</csv>

</Krougal>




And another:

<Krougal>

<csv xpath="/entitygroups/entitygroup[contains(@name, 'Horde')]/text()" delim="\n" op="remove">
zombieSpider*
animalZombieDog*
animalSteveCrawler*
animalZombieVulture*
</csv>
<csv xpath="/entitygroups/entitygroup[not(contains(@name, 'zombieSpider'))and contains(text(), 'zombieSpider' )]/text()" delim="\n" op="remove" >zombieSpider*</csv>

</Krougal>


Depending exactly how you want to accomplish it, there are different ways for you to filter it, but I think that is a pretty good mix of a few ways to skin that cat chicken.

 
I'm being dumb again and got stuck .

trying to use insertafter to add lines when drinking a bottle of murkywater,

Using this basic line, but it's not working

<insertAfter xpath="/items/item[@name='drinkJarRiverWater']/effect_group[@tiered='false']">


probably because the orginal line <effect_group tiered="false" name="Drink Tier 0"> has the extra name="Drink Tier 0"

How should I get the path right here?

 
Hello I am trying to learn how to make small changes to make a harder game for me and my brothers but i cant for the life of me figure out how to remove specific quest rewards using xpath specifically all the weapons ,ammo ,armor basically anything that gives a complete item that can be crafted. I have pretty much no experience with this just started learning last night so any help would be greatly appreciated

Edit for progress. so i stopped receiving errors but i got a yellow console message saying that the changes didnt load this is the code i tried

<remove xpath="//lootgroup[@name='groupQuestAmmo']"/> 

Edit 2: i managed to get it to remove the stuff i wanted except when they are included in a reward choice that can be different things for example

<reward type="LootItem" id="groupQuestAmmo,groupQuestResources,groupQuestMods,groupQuestT1SkillMagazineBundle"

it doesnt remove them from these lines that can be different rewards each time.

 
Last edited by a moderator:
Hello I am trying to learn how to make small changes to make a harder game for me and my brothers but i cant for the life of me figure out how to remove specific quest rewards using xpath specifically all the weapons ,ammo ,armor basically anything that gives a complete item that can be crafted. I have pretty much no experience with this just started learning last night so any help would be greatly appreciated

Edit for progress. so i stopped receiving errors but i got a yellow console message saying that the changes didnt load this is the code i tried

<remove xpath="//lootgroup[@name='groupQuestAmmo']"/> 

Edit 2: i managed to get it to remove the stuff i wanted except when they are included in a reward choice that can be different things for example

<reward type="LootItem" id="groupQuestAmmo,groupQuestResources,groupQuestMods,groupQuestT1SkillMagazineBundle"

it doesnt remove them from these lines that can be different rewards each time.


If you are removing the entire item, you need to do something like:

Remove from the quests file

<remove xpath="//reward[@id='groupQuestTools']">




This would remove every reward in each quest that has this id.

For the second example, try using this (quest file again)

<csv xpath="//reward[@id='groupQuestAmmo,groupQuestResources,groupQuestMods,groupQuestT1SkillMagazineBundle']/@value" delim="," op="remove">

groupQuestMods

groupQuestT1SkillMagazineBundle

</csv>




This should (if I done it right) remove the QuestMods and QuestT1SkillMagazineBundle from those lines.  You can adjust want you want to remove.

 
If you are removing the entire item, you need to do something like:

Remove from the quests file

<remove xpath="//reward[@id='groupQuestTools']">




This would remove every reward in each quest that has this id.

For the second example, try using this (quest file again)

<csv xpath="//reward[@id='groupQuestAmmo,groupQuestResources,groupQuestMods,groupQuestT1SkillMagazineBundle']/@value" delim="," op="remove">

groupQuestMods

groupQuestT1SkillMagazineBundle

</csv>




This should (if I done it right) remove the QuestMods and QuestT1SkillMagazineBundle from those lines.  You can adjust want you want to remove.
Thank you this will help alot i got it working but in a very round about and time consuming way lol with this i can shorten it a whole bunch

 
Hello again I am trying to add gas to the resource pool for quests using the following  code but i get a yellow console message that says it didnt get applied and I am unsure what to change to fix it. Thank you in advance for any help you guys give.

<append xpath="/loot/lootgroup[@name='groupQuestResources']">
    <item name="ammoGasCan" count="200"/>
    </append>

Edit: I got it to work after looking at several examples and taking apart a couple mods i use ty for all the help you gave me

 
Last edited by a moderator:
Hi there, 

If lets say I want to create a mod which overwrites the items.xml base file with the following. 

For example, for the Claw Hammer, in order to repair it, besides the repair kit, I wish to add in an additional say forged iron. When I do the mod, do I simply do the following:

<append xpath="/items/<item name="meleeToolRepairT1ClawHammer">
        <property name="RepairTools" value="resourceRepairKit, resourceForgedIron"/>
</append>

Or would I need to copy the entire Claw Hammer item name and its properties and amend from there?

Also, if i'm trying to introduce more than 1 resource required to repair an item, would the above line work? 

Thanks!
 

 
Hi there, 

If lets say I want to create a mod which overwrites the items.xml base file with the following. 

For example, for the Claw Hammer, in order to repair it, besides the repair kit, I wish to add in an additional say forged iron. When I do the mod, do I simply do the following:

<append xpath="/items/<item name="meleeToolRepairT1ClawHammer">
        <property name="RepairTools" value="resourceRepairKit, resourceForgedIron"/>
</append>

Or would I need to copy the entire Claw Hammer item name and its properties and amend from there?

Also, if i'm trying to introduce more than 1 resource required to repair an item, would the above line work? 

Thanks!
 


Some feedback (some critical but not going to be insulting):

You got some fundamental issues with your coding above, so you need to learn a bit more about the basics so you can get the coding correct

  • Pathing

    when you do the pathing so the program knows where to apply the new code, it needs to be in this format  xpath="/node/node/node/node" 
  • So using your example above, it should be
    xpath="/items/item[@name='meleeToolRepairT1ClawHammer']"



[*]Using the right command

  • Based on what you stated, you want to add another resource to RepairTools.  However, based on your command, you are adding another property line of RepairTools instead of replacing the existing one.
  • In this case, you would be better to use set or setattritibute.
  • Code:
    <set xpath="/items/item[@name='meleeToolRepairT1ClawHammer']/property[@name='RepairTools']/@value">resourceRepairKit,resourceForgedIron</set>
  • This is telling the program to go to this location and change the variable value to the values you have between the > and </


Will this work?  I don't think so but you can try.  I believe it was tried before, but never gotten to work (adding more items).  This is why you have to have a repair kit which is composed of multiple items.  This is also why on the items that only require basic resources (T0), they only use one resource to repair.

Now blocks use more items to repair, but they are structured differently (example below is from auto turrets)

    <property class="RepairItems">
        <property name="resourceForgedIron" value="12"/>
        <property name="resourceMechanicalParts" value="2"/>
        <property name="resourceElectricParts" value="2"/>
    </property>




Notice that the repair property is a class.  You could try to setup the item to use the class itself, but I don't think that works with items.  Never tried it before myself.  In addition, since it is tied to the class, you will need another repair tool to repair your repair tool (assuming that class would work with items in the first place).  This is tied to the repair action from repair tools:

    <property class="Action1"> <!-- UseAction -->
        <property name="Class" value="Repair"/>
        <property name="Delay" value=".64"/> <!-- Repair actions still need the delay amount -->
        <property name="Repair_amount" value="400"/>
        <property name="Upgrade_hit_offset" value="-2"/>
        <property name="Sound_start" value="repair_block"/>
        <property name="Allowed_upgrade_items" value="resourceWood,resourceClayLump,resourceSnowBall,resourceScrapIron,resourceForgedIron,resourceForgedSteel,resourceConcreteMix,resourceCobblestones,ironDoorBlockVariantHelper,ironDoorDoubleBlockVariantHelper,vaultDoor01,vaultDoor01Double,ironHatchBlockVariantHelper,vaultHatch01,cellarDoorDoubleIron,cellarDoorDoubleSteel,shuttersIronBlockVariantHelper,shuttersSteelBlockVariantHelper,resourceYuccaFibers,resourceCloth,resourceScrapPolymers,resourceNail"/>
        <property name="UsePowerAttackAnimation" value="false"/>
    </property>




There is a mod out there (not sure when it was last updated) where the mod creator make different types of repair kits for different equipment.

 
Can anyone help me?
Totally noob here (at least in 7dtd modding)
I believe my mod did load properly, but I get the yellow message that the line didn't do anything
The log warning is this
 

2023-10-16T18:34:14 74.700 WRN XML patch for "spawning.xml" from mod "ProjectGyropilot" did not apply: <set xpath="/spawning/biome/spawn/respawndelay"  (line 3 at pos 6)
2023-10-16T18:34:14 74.700 WRN XML patch for "spawning.xml" from mod "ProjectGyropilot" did not apply: <set xpath="/spawning/biome/spawn/maxcount"  (line 5 at pos 6)
2023-10-16T18:34:14 74.700 WRN XML patch for "spawning.xml" from mod "ProjectGyropilot" did not apply: <set xpath="/spawning/biome/spawn/time"  (line 7 at pos 6)




And my mod is like this

<config>

    <!--Sets zombies in all biomes to never respawn-->

    <set xpath="/spawning/biome/spawn/respawndelay">999</set>

    <!--Multiply biomes spawn numbers-->

    <set xpath="/spawning/biome/spawn/maxcount">3 * number(/spawning/biome/spawn/@maxcount)</set>

    <!--Sets zombies to spawn any time of the day-->

    <set xpath="/spawning/biome/spawn/time">any</set>

</config>



Why didn't any of those lines work?

 
Back
Top