Jump to content

XPath Modding Explanation Thread


sphereii

Recommended Posts

Anything in your output_log.txt about the modlet not loading?

 

Yep the mod loaded with no issues.

 

Sbangs007 INPROGRESS

2019-04-11T09:28:09 5.923 INF [MODS] Loaded Mod: Cactus Drop (1.0)

2019-04-11T09:28:09 5.923 INF [MODS] Initializing mod code

2019-04-11T09:28:09 5.923 INF [MODS] Loading done

 

So weird, but a challenge..

Link to comment
Share on other sites

Yep the mod loaded with no issues.

 

Sbangs007 INPROGRESS

2019-04-11T09:28:09 5.923 INF [MODS] Loaded Mod: Cactus Drop (1.0)

2019-04-11T09:28:09 5.923 INF [MODS] Initializing mod code

2019-04-11T09:28:09 5.923 INF [MODS] Loading done

 

So weird, but a challenge..

 

introduce an error in your xpath so it'll fail.. change the block name to something that isn't available, re-try and see if it detects the error.

 

If it does not detect the error, it does not see your file at all. We'd want to take a look at your folder structure Mods/<ModName>/Config/blocks.xml or the full file of your changes.

Link to comment
Share on other sites

introduce an error in your xpath so it'll fail.. change the block name to something that isn't available, re-try and see if it detects the error.

 

If it does not detect the error, it does not see your file at all. We'd want to take a look at your folder structure Mods/<ModName>/Config/blocks.xml or the full file of your changes.

 

Interesting.. got two YELLOW errors and i may have not seen these before, as they were not RED.

534764408_2019-04-1113_32_16-7DaysToDie.jpg.e9f9350cfaca91a38f11347aa6eb0323.jpg

522114489_2019-04-1113_32_26-7DaysToDie.jpg.ac4d45ff9283f7cee151ea6f9fdeb695.jpg

 

Here was my code, i also removed an @ in line 2 in hopes of generating a typical RED syntax error, but it did not. Glad i scrolled up to check for other errors.

 

<ModFeatherFall>

<set xpath="/blocks/block[@name='treeCactus01']/drop[@name='resourceYuccaFibers']/@count">20</set>
<set xpath="/blocks/block[@name='treeCactus01']/drop[@name='resourceYuccaFruit']/count">20</set>
<set xpath="/blocks/block[@name='treeCactus01']/property[@name='OnlySimpleRotations']/@value">false</set>
<set xpath="/blocks/block[@name='treeCactus01']/drop[@event='Destroy' and @name='resourceYuccaFruit']/@count">20</set>

</ModFeatherFall>

 

hmmmm...

 

- - - Updated - - -

 

introduce an error in your xpath so it'll fail.. change the block name to something that isn't available, re-try and see if it detects the error.

 

If it does not detect the error, it does not see your file at all. We'd want to take a look at your folder structure Mods/<ModName>/Config/blocks.xml or the full file of your changes.

 

Shoot screenshot to small to read, here is the error

WRN XML patch for blocks.xml did not apply for line 2 and 4 of the above code.

 

That was it

Link to comment
Share on other sites

So i used this...

<set xpath="/blocks/block[@name='treeCactus01']/drop[@name='resourceYuccaFibers']/@count">20</set>

 

Didnt work. No errors, but the cactus01 just gave 3 the default. So i also tested this line, just to be sure i was in the right node.

<set xpath="/blocks/block[@name='treeCactus01']/property[@name='OnlySimpleRotations']/@value">false</set>

Since I know that syntax really well, little room for error, and that code failed too. The trees were able to use advanced rotation.

 

So I dont think, i'm getting the first part right or getting into the correct node, ugh, not sure.

 

your orginal suggestion WORKED!!

<set xpath="/blocks/block[@name='treeCactus01']/drop[@name='resourceYuccaFibers']/@count">20</set>

 

I was never checking the fibers as i was checking fruit. Also a huge red flag that kept me from troublshooting, was the simple rotation, that even editing the orginal XML file for the game, never worked, so it was a bad red hearing to use for testing.

 

I cant believe this.. thank you so much for your time with this issue, but wanted you to know, the your first code was the correct one that worked all this time. Ugh..

Link to comment
Share on other sites

your orginal suggestion WORKED!!

<set xpath="/blocks/block[@name='treeCactus01']/drop[@name='resourceYuccaFibers']/@count">20</set>

 

I was never checking the fibers as i was checking fruit. Also a huge red flag that kept me from troublshooting, was the simple rotation, that even editing the orginal XML file for the game, never worked, so it was a bad red hearing to use for testing.

 

I cant believe this.. thank you so much for your time with this issue, but wanted you to know, the your first code was the correct one that worked all this time. Ugh..

 

I'm glad you got it sorted out :)

 

- - - Updated - - -

 

Now the true challenge begins, now that I know i can target the node, I need to add a new item to drop. So not sure whats better for this, append or insert? I'll try append first..

 

I always recommend going with an append, it's less precise and less prone to breaking if your insertBefore or insertAfter conditions change.

Link to comment
Share on other sites

I'm glad you got it sorted out :)

 

- - - Updated - - -

 

 

 

I always recommend going with an append, it's less precise and less prone to breaking if your insertBefore or insertAfter conditions change.

 

Yea i did.. when I finish and release my mod, i'll be giving you credit.. thanks again for your time.

Link to comment
Share on other sites

I'm glad you got it sorted out :)

 

- - - Updated - - -

 

 

 

I always recommend going with an append, it's less precise and less prone to breaking if your insertBefore or insertAfter conditions change.

 

Yea i did.. when I finish and release my mod, i'll be giving you credit.. thanks again for your time.

Link to comment
Share on other sites

Halp! :)

I'm trying to add the hazmat suit in the yeah science 2 perk requirement, already added the recipes. I want to add it here:

	<perk name="perkYeahScience" parent="skillCraftsmanship" name_key="perkYeahScienceName" desc_key="perkYeahScienceDesc" icon="ui_game_symbol_chemistry">
	<SNIP>
	<effect_group>
	<SNIP>
	<passive_effect name="RecipeTagUnlocked" operation="base_set" value="1" level="2,5"
			tags="thrownDynamite,ammo9mmBulletSteel,ammo44MagnumBulletSteel,ammo762mmBulletFMJSteel,ammoShotgunSlug,ammoArrowSteelAP,ammoCrossbowBoltSteelAP,ammoArrowFlaming,mineAirFilter,rScrapIronPlateMine,resourceMilitaryFiber,modMeleeBunkerBuster"/>
	<SNIP>
	</effect_group>
</perk>

 

So I thought I'd just append a new passive effect line that resembles the one above, like this:

<append xpath="/progression/perk[@name='perkYeahScience']/effect_group">
		<passive_effect name="RecipeTagUnlocked" operation="base_set" value="1" level="2,5"
			tags="hazmatBoots,hazmatPants,hazmatShirt,hazmatGloves,hazmatMask"/>
</append>

However I'm getting an error that this couldn't be applied, I'm guessing I've done an error in the xpath, but I can't figure out what exactly.

 

 

Edit: nvm, think hard enough and the answer will come on it's own

/perks is missing between progression and perk.....

doh!

Edited by Gornemant
I am an idiot (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...

Is there a fast way to remove a whole section of code with one line? For example I want to remove an entire quest from the game, how can i do that with one line of code and not have to write a whole bunch of <remove xpath=".... blah blah etc...

Link to comment
Share on other sites

Is there a fast way to remove a whole section of code with one line? For example I want to remove an entire quest from the game, how can i do that with one line of code and not have to write a whole bunch of <remove xpath=".... blah blah etc...

 

You should be able to use <remove xpath="/quests/quest[@name=whatever]" /> to remove the quest

Link to comment
Share on other sites

Quick question...has something changed with <set> and/or <append>? I've been using the following:

 

       <append xpath="recipes/recipe[@name='foodBaconAndEggs']">
	<ingredient name="resourceAnimalFat" count="1"/>
</append>

<set xpath="recipes/recipe[@name='foodBoiledMeat']">
	<ingredient name="foodRawMeat" count="2"/>
</set>

 

to add Fat to Bacon and Eggs and lower the Meat content in Boiled Meat to 2 instead of 5.

 

However...I went to craft some Boiled Meat and noticed that the recipe in game is now ONLY:

 

2 Raw Meat and NO Jar of Water

 

Also...the Fat ADDED to what was already in the original recipe (was 1 and then 2 with my edits)...that I can understand.

 

I did an experiment and changed the APPEND in Bacon and Eggs to SET (no other change) and in game I get that Bacon and Eggs only requires Fat AND NOTHING ELSE...here's what I did:

 

       <set xpath="recipes/recipe[@name='foodBaconAndEggs']">
	<ingredient name="resourceAnimalFat" count="1"/>
</set>

The top code I've been using for quite a while with no issues. As I understand...SET is used when you want to CHANGE a value and APPEND is used when you want to ADD something. But it seems that SET is ONLY using what it's given and removing everything else. Again...I can understand APPEND adding (from 1 to 2 if the original recipe had 1) so that's not really too much of an issue but this is the first time I've had this happen and I'm confused.

Link to comment
Share on other sites

  • 2 weeks later...

I'm having trouble trying to append some recipes. I keep getting and error that says;

 

Patch element does not have an xpath attribute. Here is the code I used.

 

<New_Recipies>
   <append xpath="/recipes">
	<recipe name="solarCell" count="1">
		<ingredient name="resourceScrapIron" count="1"/>
		<ingredient name="resourceScrapPolymers" count="1"/>
	</recipe>
	<recipe name="solarbank" count="1">
		<ingredient name="resourceScrapIron" count="1"/>			
		<ingredient name="resourceScrapPolymers" count="5"/>
	</recipe>
	<recipe name="carBattery" count="1">
		<ingredient name="resourceScrapIron" count="1"/>			
		<ingredient name="resourceScrapPolymers" count="5"/>
	</recipe>
	<recipe name="resourceElectricParts" count="1">
		<ingredient name="resourceScrapIron" count="1"/>			
	</recipe>
</append>
<New_Recipies/>

 

Not sure where I went wrong, i followed Buggi's video but it's not working. Any help would be appreciated.

Link to comment
Share on other sites

I'm having trouble trying to append some recipes. I keep getting and error that says;

 

Patch element does not have an xpath attribute. Here is the code I used.

 

<New_Recipies>
   <append xpath="/recipes">
	<recipe name="solarCell" count="1">
		<ingredient name="resourceScrapIron" count="1"/>
		<ingredient name="resourceScrapPolymers" count="1"/>
	</recipe>
	<recipe name="solarbank" count="1">
		<ingredient name="resourceScrapIron" count="1"/>			
		<ingredient name="resourceScrapPolymers" count="5"/>
	</recipe>
	<recipe name="carBattery" count="1">
		<ingredient name="resourceScrapIron" count="1"/>			
		<ingredient name="resourceScrapPolymers" count="5"/>
	</recipe>
	<recipe name="resourceElectricParts" count="1">
		<ingredient name="resourceScrapIron" count="1"/>			
	</recipe>
</append>
<New_Recipies/>

 

Not sure where I went wrong, i followed Buggi's video but it's not working. Any help would be appreciated.

 

Take a look at your last entry: <New_Recipes/> should be </New_Recipes>, as it's closing the top node.

Link to comment
Share on other sites

  • 1 month later...

Alright, quick question for you... I'm trying to adjust a particular block in the blocks.xml. The line I have is

 

<drop event="Harvest" name="resourceWood" count="500" tag="oreWoodHarvest"/>

 

I'm attempting to change the "500" part of the above code. What I attempted was:

 

<set xpath="/blocks/block[@name='woodLogPillar100']/property[@name='drop']@count">600</set>

 

I know the code is wrong but I can't find any information on how to point to the "count" field inside the (drop event="Harvest") line?

 

I want to change an existing harvest amount to be different in case the above jumble made no sense. For my future reference I would like to change the (name) field as well? Maybe it is simpler than I think. Any ideas?

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

Alright, quick question for you... I'm trying to adjust a particular block in the blocks.xml. The line I have is

 

<drop event="Harvest" name="resourceWood" count="500" tag="oreWoodHarvest"/>

 

I'm attempting to change the "54000" part of the above code. What I attempted was:

 

<set xpath="/blocks/block[@name='woodLogPillar100']/property[@name='drop']@count">600</set>

 

I know the code is wrong but I can't find any information on how to point to the "count" field inside the (drop event="Harvest") line?

 

I want to change an existing harvest amount to be different in case the above jumble made no sense. For my future reference I would like to change the (name) field as well? Maybe it is simpler than I think. Any ideas?

 

Try this:

 

<set xpath="/blocks/block[@name='woodLogPillar100']/drop[@name='resourceWood']/@count">600</set>

 

You wouldn't use property here, since <property does not exist on the line.

Link to comment
Share on other sites

Try this:

 

<set xpath="/blocks/block[@name='woodLogPillar100']/drop[@name='resourceWood']/@count">600</set>

 

You wouldn't use property here, since <property does not exist on the line.

 

Okay after you pointed out my very obvious retardation I tried this:

 

<set xpath="/blocks/block[@name='woodLogPillar100']/drop_event[@name='Harvest']@count">60000</set>

 

I also tried

<set xpath="/blocks/block[@name='woodLogPillar100']/drop[@event='Harvest']@count">60000</set>

 

Still no dice. I've tried variations of dropEvent, drop, drop_Event, and drop event but it still errors out. I would like to make sure that my change ONLY affects the <drop event="Harvest" name="resourceWood" count="???"> area...

Link to comment
Share on other sites

Try this:

 

<set xpath="/blocks/block[@name='woodLogPillar100']/drop[@name='resourceWood']/@count">600</set>

 

You wouldn't use property here, since <property does not exist on the line.

 

Okay after you pointed out my very obvious retardation I tried this:

 

<set xpath="/blocks/block[@name='woodLogPillar100']/drop_event[@name='Harvest']@count">60000</set>

 

I also tried

<set xpath="/blocks/block[@name='woodLogPillar100']/drop[@event='Harvest']@count">60000</set>

 

Still no dice. I've tried variations of dropEvent, drop, drop_Event, and drop event but it still errors out. I would like to make sure that my change ONLY affects the <drop event="Harvest" name="resourceWood" count="???"> area...

 

The code you provided gives me a syntax error.

Link to comment
Share on other sites

Okay after you pointed out my very obvious retardation I tried this:

 

<set xpath="/blocks/block[@name='woodLogPillar100']/drop_event[@name='Harvest']@count">60000</set>

 

I also tried

<set xpath="/blocks/block[@name='woodLogPillar100']/drop[@event='Harvest']@count">60000</set>

 

Still no dice. I've tried variations of dropEvent, drop, drop_Event, and drop event but it still errors out. I would like to make sure that my change ONLY affects the <drop event="Harvest" name="resourceWood" count="???"> area...

 

The code you provided gives me a syntax error.

 

I think my example still works. In both of your other iterations, you forgot to put in a forward slash in front of the @ /@count

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