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

What i doing wrong with xpath

Royal Deluxe

New member
I have no idea

Code:
<set xpath="/materials/material[@id='Mgravel']/@stability_glue">5</set>
Vanilla code

Code:
<material id="Mgravel">
<property name="damage_category" value="earth"/>
<property name="surface_category" value="earth"/>
<property name="forge_category" value="stone"/>
<property name="Hardness" type="float" value="1"/>
<property name="stepsound" value="gravel"/>
<property name="stability_glue" value="4"/>
<property name="Mass" type="int" value="10"/>
<property name="MaxDamage" value="200"/>
<property name="Experience" value="1"/>
</material>
 
Try this

Code:
<set xpath="/materials/material[@id='Mgravel']/property[@name='stability_glue']/@value">5</set>
 
I'm assuming you want to set the value to 5? So you got to tell it that you're addressing the atribute 'value' of the tag 'property' with the name 'stability_glue'.

Code:
<set xpath="/materials/material[@id='Mgravel']/property[@name='stability_glue']/@value">5</set>
(or at least I think so...)

PS: Damn... beat me to it. ^^

 
Thanks both of you, works perfect and with that example i understand how i can do it elsewhere,.... at least i hope so ^^

 
Arg, the next problem

I try to add these lines

Code:
		<item group="foodAll" />
		<item group="foodAll" />			
		<item name="drinkJarCoffee" count="1,5"/>
in this code, behind the food all

Code:
<trader_info id="4" reset_interval="1" override_buy_markup="1.0" allow_sell="false" min_inventory="6" max_inventory="13" min_items_swapped="6" max_items_swapped="13">
	<trader_items count="10">
		<item group="foodAll" />
	</trader_items>
</trader_info>
by this

Code:
<insertAfter xpath="/traders/trader_info[@id='4']/trader_items count" >
		<item group="foodAll" />
		<item group="foodAll" />			
		<item name="drinkJarCoffee" count="1,5"/>		
</insertAfter>
or this (tried some other versions but no luck)

Code:
<insertAfter xpath="/traders/trader_info[@id='4']/@[trader_items count]/[@item group='foodAll']" >
		<item group="foodAll" />
		<item group="foodAll" />			
		<item name="drinkJarCoffee" count="1,5"/>		
</insertAfter>
 
Last version i tried

Code:
<insertAfter xpath="/traders/trader_info[@id='4']/trader_items/item[@group='foodAll']" >
		<item group="foodAll" />
		<item group="foodAll" />			
		<item name="drinkJarCoffee" count="1,5"/>		
</insertAfter>
still no success

 
why would you want several "foodAll" items in the wending machine?

the latest xpath looks good to me, on first sight... but I'm not sure what you're trying to do.

And I've never modded traders so I'm not sure you can add items instead of itemGroups to them. But if that doesn't work, you can add a item group just for coffee.

 
By

* Group

* Group

* Group

* Coffee

The system will role 75% the group and only 25% the coffee

Did this change as a normal xml edit, that worked fine.

Sadly with the change from post#6 my game crashes/Stopped generating a world (at "ItemIDs from mapping")

 
Last edited by a moderator:
Ok, I get it now, thanks!

hm... weird.

I'd usually go for <append> instead of <insertAfter>, but that shouldn't make a difference for that error, I guess.

 
Thanks, after you said the Code looks right i found out that (at least it looks so) Xpath dont like it to add code you set the xpath aiming to

Means as soon as i got rid of "<item group="foodAll" />" it worked

I had then issues to make a new Group so my final code looks so

Code:
<config>	
<insertAfter xpath="/traders/trader_info[@id='4']/trader_items/item[@group='foodAll']" >			
		<item name="drinkJarCoffee" count="1,3"/>
		<item name="drinkJarCoffee" count="1,3"/>
		<item group="cannedfood" count="2,4"/>
		<item group="cannedfood" count="2,4"/>
		<item group="cannedfood" count="2,4"/>		
		<item group="preparedDrink" count="1,3"/>
		<item group="preparedDrink" count="1,3"/>
		<item name="drugPainkillers"/>
		<item name="medicalFirstAidBandage" count="1,3"/>		
</insertAfter>	
</config>
The VM´s look now much better in my opinion

C317A0D62C92B202C8198B5C4CC23172EA055C35


DDB3B77294CD3DDCBB26EA670A461403CAE8026F


DF2D313FDD26A6725FB365A1602DC20508CC2EDE


FD832FF037C0E4433EB391B11B6462F08C8CE608


 
Damn and the next problem

want to lower the Attribute gates

Code:
<configs>
<set xpath="/progression/perks/perk[@name='perkRuleOneCardio']/level_requirements [@level='2']/@value">1</set>
<set xpath="/progression/perks/perk[@name='perkRuleOneCardio']/level_requirements [@level='3']/@value">2</set>
</configs>
result in

8C6D742B95B5D14E2A1ADD46CA7FBD4FD8D9B6A6


vanilla code

Code:
<!-- Athletics Perks (Agility) -->
<perk name="perkRuleOneCardio" parent="skillAthletics" name_key="perkRuleOneCardioName" desc_key="perkRuleOneCardioDesc" icon="ui_game_symbol_cardio">
	<level_requirements level="1"><requirement name="ProgressionLevel" progression_name="attAgility" operation="GTE" value="1" desc_key="reqAgilityLevel1"/></level_requirements>
	<level_requirements level="2"><requirement name="ProgressionLevel" progression_name="attAgility" operation="GTE" value="3" desc_key="reqAgilityLevel3"/></level_requirements>
	<level_requirements level="3"><requirement name="ProgressionLevel" progression_name="attAgility" operation="GTE" value="5" desc_key="reqAgilityLevel5"/></level_requirements>
	<level_requirements level="4"><requirement name="ProgressionLevel" progression_name="attAgility" operation="GTE" value="7" desc_key="reqAgilityLevel7"/></level_requirements>
	<level_requirements level="5"><requirement name="ProgressionLevel" progression_name="attAgility" operation="GTE" value="10" desc_key="reqAgilityLevel10"/></level_requirements>

	<effect_group>
		<effect_description level="1" desc_key="perkRuleOneCardioNameRank1Desc" desc_base="Increases stamina regeneration by"/>
		<effect_description level="2" desc_key="perkRuleOneCardioNameRank2Desc" desc_base="Increases stamina regeneration by"/>
		<effect_description level="3" desc_key="perkRuleOneCardioNameRank3Desc" desc_base="Increases stamina regeneration by"/>
		<effect_description level="4" desc_key="perkRuleOneCardioNameRank4Desc" desc_base="Increases stamina regeneration by"/>
		<effect_description level="5" desc_key="perkRuleOneCardioNameRank5Desc" desc_base="Increases stamina regeneration by"/>

		<passive_effect name="StaminaChangeOT" operation="perc_add" value="0.1,0.3" level="1,5" tags="running"/>
	</effect_group>
</perk>
 
I really have problems to write how i feel about these Xpath stuff without risking a ban

Such a damn .......

Code:
<configs>
<set xpath="/progression/perks/perk[@name='perkRuleOneCardio']/level_requirements [@level='2']/requirement[@name='ProgressionLevel' and @progression_name='attAgility' and @operation='GTE']"/@value">1</set>
</configs>
 
I really have problems to write how i feel about these Xpath stuff without risking a banSuch a damn .......

Code:
<configs>
<set xpath="/progression/perks/perk[@name='perkRuleOneCardio']/level_requirements [@level='2']/requirement[@name='ProgressionLevel' and @progression_name='attAgility' and @operation='GTE']"/@value">1</set>
</configs>
Xpath is super fun to do. :-) The problem with the above code is that you closed the xpath too early and then added an extra quote. Here is the fixed code. Although it's really just removing one of the quotes. This should work.

Code:
<configs>
<set xpath="/progression/perks/perk[@name='perkRuleOneCardio']/level_requirements [@level='2']/requirement[@name='ProgressionLevel' and @progression_name='attAgility' and @operation='GTE']/@value">1</set>
</configs>
I'll also add that you don't need to be so specific. Nothing wrong with being specific, it's just a lot of extra code to achieve the same thing. for just a tiny example of this you can use "//" to have xpath a little more dynamically.

Code:
<configs>
<set xpath="//perk[@name='perkRuleOneCardio']/level_requirements [@level='2']/requirement[@name='ProgressionLevel' and @progression_name='attAgility' and @operation='GTE']/@value">1</set>
</configs>
 
Thank you very much.

Works perfect

Its really evil to find a wrong character if you are not in the slightest sure that the general syntax is right

 
Back
Top