Jump to content

XPath Modding Explanation Thread


sphereii

Recommended Posts

To make sure we are on the same page. You made a "Mods" folder with a ModInfo.xml in it then in the "Config" folder you have a progression.xml with the above in the progression.xml

 

On the other part if your question the other page is wrong, I got this to load with errors but it does seem to load and it does display a 25% chance,

 

This needs to be in items.xml

<configs>
<set xpath="/items/item[@name='foodCanBeef']/effect_group[@tiered='false']/triggered_effect[@trigger='onSelfPrimaryActionEnd'][@buff='buffIllFoodPoisoning0']/requirement[@name='RandomRoll']/@value">25</set>


<set xpath="/items/item[@name='foodCanBeef']/effect_group/display_value[@name='FoodPoisoningRisk']/@value">0.25</set>
</configs>

 

I copied and pasted your code for progression into my progression.xml which is in my Config folder which is in my mod folder that has a ModInfo.xml. Failed to load due to no xpath element.

Here is the exact code in that xml

 

<CanFoodLearnable>

<progression>

<set xpath="/progression/perks/perk[@name=perkMasterChef]/effect_group/passive_effect[@tags=foodBaconAndEggs,foodBoiledMeat,foodGrilledMeat,foodBakedPotato,foodCornBread,foodCornOnTheCob,drinkJarRedTea,drinkJarCoffee,drinkJarGoldenRodTea]/@tags">foodBaconAndEggs,foodBoiledMeat,foodGrilledMeat,foodBakedPotato,foodCornBread,foodCornOnTheCob,drinkJarRedTea,drinkJarCoffee,drinkJarGoldenRodTea,foodCanBeef</set>

</progression>

</CanFoodLearnable>

 

 

I also copied pasted your code for the food poisoning into my items.xml

 

It has the same problem no xpath element.

 

I tested them separately so I know I'm not getting them mixed up.

 

I went back and took screenshots of the error messages.

 

https://www.mediafire.com/view/we8a23kgyw389bt/FoodPosioning_Error.png/file

 

https://www.mediafire.com/view/akdjhdy2crawaqn/CanFoodLearnable_error.png/file

Edited by Winterhart
insert images (see edit history)
Link to comment
Share on other sites

I see lots of spaces where there should not be, that could be because of lack of code tags.

 

Still trying to learn xpath myself, it could be the modinfo.xml that is giving you problems.

 

Copy of the modinfo I used to test

<?xml version="1.0" encoding="UTF-8" ?>
<xml>
   <ModInfo>
       <Name value="Food Posioning" />
       <Description value="Add more posioning" />
       <Author value="Duke" />
       <Version value="A17.2b20" />
       <Website value="https://7daystodie.com/forums/forumdisplay.php?61-Game-Mods" />
   </ModInfo>
</xml>

 

You might try to hit F1 for the console and enter "exportcurrentconfigs" without the quotes, the console will tell you where the complete configs are placed so you can see just what is being loaded.

 

An example of where you should find the exported cofigs

C:\Users\Duke\AppData\Roaming\7DaysToDie\Saves\Hezubu Mountains\Perfect World2\Configs

 

Here is a start to what you want I think.

 

DOWNLOAD

Edited by DukeW74 (see edit history)
Link to comment
Share on other sites

I see lots of spaces where there should not be, that could be because of lack of code tags.

 

Still trying to learn xpath myself, it could be the modinfo.xml that is giving you problems.

 

Copy of the modinfo I used to test

<?xml version="1.0" encoding="UTF-8" ?>
<xml>
   <ModInfo>
       <Name value="Food Posioning" />
       <Description value="Add more posioning" />
       <Author value="Duke" />
       <Version value="A17.2b20" />
       <Website value="https://7daystodie.com/forums/forumdisplay.php?61-Game-Mods" />
   </ModInfo>
</xml>

 

You might try to hit F1 for the console and enter "exportcurrentconfigs" without the quotes, the console will tell you where the complete configs are placed so you can see just what is being loaded.

 

An example of where you should find the exported cofigs

C:\Users\Duke\AppData\Roaming\7DaysToDie\Saves\Hezubu Mountains\Perfect World2\Configs

 

Here is a start to what you want I think.

 

DOWNLOAD

 

I don't know what the issue is. I unzipped that file and put it in the game the same place as I put my mods. The launcher doesn't even recognize it as a modlet. It recognizes all of mine just fine.

Link to comment
Share on other sites

Do you already have a "Food Posioning" named file in any modinfo? The game will only read one, try renaming it.

 

It was the only mod in there. I tried putting a modinfo.xml from one of my mods that I know works in place of yours and it still didn't work. Again in was the only mod in the mods folder.

Link to comment
Share on other sites

  • 3 weeks later...

I am trying to add a large denomination casino token to store large piles of tokens.

It adds the new token and associated recipes to stack and unstack your tokens.

 

I can get the new item to add correctly to items.xml, but I cannot figure out how to make it add a name and description in the Localization.txt.

(edit: I know can do it manually, but I am trying to get it all self contained.)

 

Is that even possible with an xpath modlet?

Edited by Grue (see edit history)
Link to comment
Share on other sites

Question, there are two recipes for gas but I only want to change one of them, so that the oilBarrel recipe makes 1200 gas instead of 600. How do I target the correct one to make my alterations?

 

Vanilla code:

<recipe name="ammoGasCan" count="100" craft_area="chemistryStation" tags="learnable">
<ingredient name="resourceOilShale" count="12"/>
</recipe>

<recipe name="ammoGasCan" count="600" craft_exp_gain="0" craft_time="5" always_unlocked="true">
<ingredient name="oilBarrel" count="1"/>
</recipe>

Edited by Grue (see edit history)
Link to comment
Share on other sites

A17.2 Vanilla gas is 600 not 1000 so depending on which version and what changes have been made one of these should work.

 

<set xpath="/recipes/recipe[@name='ammoGasCan'][@count='600']/@count">1200</set>

 

<set xpath="/recipes/recipe[@name='ammoGasCan'][@count='1000']/@count">1200</set>

Link to comment
Share on other sites

A17.2 Vanilla gas is 600 not 1000 so depending on which version and what changes have been made one of these should work.

 

Yes thank you, but accidentally typed in the wrong amount.

 

Am I correct that this pair or recipes would do and undo correctly?

 

<set xpath="/recipes/recipe[@name='ammoGasCan'][@count='600']/@count">1200</set>

<set xpath="/recipes/recipe[@name='oilBarrel']/ingredient[@name='ammoGasCan']/@count">1200</set>

 

I might have done something wrong, It still seems to be using 600 units of gas both ways in the recipe.

Edited by Grue (see edit history)
Link to comment
Share on other sites

Those should work with no problem. F1 for the console and type in "exportcurrentconfigs" without the quotes the check and see just what its loading or not loading.

 

assuming a default install here is the path the exported configs will be.

 

your map name\your world gen name

C:\Users\YOURNAME\AppData\Roaming\7DaysToDie\Saves\Hezubu Mountains\PerfectWorld\Configs

Link to comment
Share on other sites

Those should work with no problem. F1 for the console and type in "exportcurrentconfigs" without the quotes the check and see just what its loading or not loading.

 

assuming a default install here is the path the exported configs will be.

 

your map name\your world gen name

C:\Users\YOURNAME\AppData\Roaming\7DaysToDie\Saves\Hezubu Mountains\PerfectWorld\Configs

 

The recipes were unchanged in the exported configs.

 

Edit: Found the problem-- I left the "s" off the end of recipes in the mod xml

Edited by Grue (see edit history)
Link to comment
Share on other sites

I am having an issue with xpath and Blocks is there a way to add in a property to an existing block or do i need to remove the block some how and append in a replacement one with the changes?

 

is this used to remove the block, if so could someone explain how.

<remove xpath="">

 

i Thank you for any help you may provide.

Link to comment
Share on other sites

I am having an issue with xpath and Blocks is there a way to add in a property to an existing block or do i need to remove the block some how and append in a replacement one with the changes?

 

is this used to remove the block, if so could someone explain how.

 

 

i Thank you for any help you may provide.

 

iam very "noobish", but better quick reply then nothing. why dont u use set or append to change that block?!

Link to comment
Share on other sites

iam very "noobish", but better quick reply then nothing. why dont u use set or append to change that block?!

 

sorry should elaborate on what i need to do i need to add in a property line that is not in the block.

<append xpath="/blocks/block[@name=NAMEOFITEMADDINGTO]/property[@name=NAMEOFPROPERTY' and @value='PROPERTYVALUE]/@value"></append>

i have tried it this way but it don't seem to work.

Link to comment
Share on other sites

<append xpath="/blocks/block[@name='NAMEOFITEMADDINGTO']
<property name="NAMEOFPROPERTY" value="PROPERTYVALUE"/>
</append>

 

Sure This is the way it should be i get errors

 

<append xpath="/blocks/block[@name='NAMEOFITEMADDINGTO']">
     <property name="NAMEOFPROPERTY" value="PROPERTYVALUE"/>
   </append>

Link to comment
Share on other sites

We would need to see just what you are trying to do to be of any help, or at least I would.

 

Got it working.

   <append xpath="/blocks/block[@name='NAMEOFBLOCKADDINGTO']">
         <property name="NAMEOFPROPERTY" value="PROPERTYVALUE"/>
   </append>

 

Thank You For All The Help :)

Link to comment
Share on other sites

  • 2 weeks later...

Heya, i'm having a bit of trouble, this line of code is supposed to replace the original entry in another mod.

 

<set xpath="/items/item[@name='Luger']/property[@class='Action0']/property[@name='Magazine_items'][@value='9x19mm Bullet']/@value">ammo9mmBullet,ammo9mmBulletSteel,9x19mm Bullet,9x19mm JHP Bullet,9x19mm FMJ Bullet,9x19mm Bullet Steel,9x19mm JHP Bullet Steel,9x19mm FMJ Bullet Steel,ammo9mmBullet,ammo9mmBulletSteel</set>

 

for some reason, it simply refuses to make the change, am i missing something?

Link to comment
Share on other sites

Heya, i'm having a bit of trouble, this line of code is supposed to replace the original entry in another mod.

 

<set xpath="/items/item[@name='Luger']/property[@class='Action0']/property[@name='Magazine_items'][@value='9x19mm Bullet']/@value">ammo9mmBullet,ammo9mmBulletSteel,9x19mm Bullet,9x19mm JHP Bullet,9x19mm FMJ Bullet,9x19mm Bullet Steel,9x19mm JHP Bullet Steel,9x19mm FMJ Bullet Steel,ammo9mmBullet,ammo9mmBulletSteel</set>

 

for some reason, it simply refuses to make the change, am i missing something?

 

is this xpath running from a modlet after the original one, or before it? Do you have the output_log.txt? If it does not apply, it should be displayed in the logs.

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...