Jump to content

XPath Modding Explanation Thread


sphereii

Recommended Posts

what am I doing wrong here

 

<remove xpath="/block[@name=treeJuniper4m]">

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

</remove>

 

<append xpath="/block[@name=treeJuniper4m]">

<drop event="Harvest" name="woodenStick" count="10,30" tag="oreWoodHarvest"/>

</append>

Link to comment
Share on other sites

try...

<remove xpath="/blocks/block[@name=treeJuniper4m]">

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

</remove>

 

<append xpath="/blocks/block[@name=treeJuniper4m]">

<drop event="Harvest" name="woodenStick" count="10,30" tag="oreWoodHarvest"/>

</append>

Link to comment
Share on other sites

Can anyone help with this ? I am just trying to extend the range of charsimatic nature - a different range for each level of the perk. So far i have this which is a bit of a guess based on something similar by Stallionsden.

 

<config>

 

<set xpath="/progression/perks/perk[@name=perkCharismaticNature]/effect_group/triggered_effect[@level=1]/effect[@name=range]/@value">15</set>

<set xpath="/progression/perks/perk[@name=perkCharismaticNature]/effect_group/triggered_effect[@level=2]/effect[@name=range]/@value">30</set>

<set xpath="/progression/perks/perk[@name=perkCharismaticNature]/effect_group/triggered_effect[@level=3]/effect[@name=range]/@value">45</set>

<set xpath="/progression/perks/perk[@name=perkCharismaticNature]/effect_group/triggered_effect[@level=4]/effect[@name=range]/@value">60</set>

 

</config>

 

This isn't working. Some of this is guess work on my part. By the way how do i paste into a window with sliders in this forum ?

 

Is there anything i can read that explains the xpath naming structure ? For example in this one I have assumed 'range' is refered to as a name but I really don't know if it is referred to as a name. How do you guys know what to call everything in the syntax ? Is there something in notepad ++ that tells you this ? i saw in a video someones notepad ++ was highlighting certain fields but my npad++ doesnt seem to do that. Or is there another program perhaps ? I've tried to check this code on some of the websites that say they say can check it but so far i haven't been able to make any of these checking sites work.

Link to comment
Share on other sites

Can anyone help with this ? I am just trying to extend the range of charsimatic nature - a different range for each level of the perk. So far i have this which is a bit of a guess based on something similar by Stallionsden.

 

<config>

 

<set xpath="/progression/perks/perk[@name=perkCharismaticNature]/effect_group/triggered_effect[@level=1]/effect[@name=range]/@value">15</set>

<set xpath="/progression/perks/perk[@name=perkCharismaticNature]/effect_group/triggered_effect[@level=2]/effect[@name=range]/@value">30</set>

<set xpath="/progression/perks/perk[@name=perkCharismaticNature]/effect_group/triggered_effect[@level=3]/effect[@name=range]/@value">45</set>

<set xpath="/progression/perks/perk[@name=perkCharismaticNature]/effect_group/triggered_effect[@level=4]/effect[@name=range]/@value">60</set>

 

</config>

 

This isn't working. Some of this is guess work on my part. By the way how do i paste into a window with sliders in this forum ?

 

Is there anything i can read that explains the xpath naming structure ? For example in this one I have assumed 'range' is refered to as a name but I really don't know if it is referred to as a name. How do you guys know what to call everything in the syntax ? Is there something in notepad ++ that tells you this ? i saw in a video someones notepad ++ was highlighting certain fields but my npad++ doesnt seem to do that. Or is there another program perhaps ? I've tried to check this code on some of the websites that say they say can check it but so far i haven't been able to make any of these checking sites work.

 

Which XML node are you trying to reference? The only node in there that has a level attribute is the effect_description:

 

		<effect_description level="1" desc_key="perkCharismaticNatureRank1Desc"/>
		<effect_description level="2" desc_key="perkCharismaticNatureRank2Desc"/>
		<effect_description level="3" desc_key="perkCharismaticNatureRank3Desc"/>
		<effect_description level="4" desc_key="perkCharismaticNatureRank4Desc"/>
		<effect_description level="5" desc_key="perkCharismaticNatureRank5Desc"/>

That xpath would be: /progression/perks/perk[@name=perkCharismaticNature]/effect_group/effect_description[@level=1]

 

But they don't have a range.

 

If you are targetting this:

 

		<triggered_effect trigger="onSelfProgressionUpdate" action="ModifyCVar" cvar="CharismaticNature" operation="set" value="4" target="selfAOE" target_tags="ally,party" range="15">
			<requirement name="ProgressionLevel" progression_name="perkCharismaticNature" target="self" operation="GTE" value="4"/>
			<requirement name="CVarCompare" cvar="CharismaticNature" target="other" operation="LT" value="4"/>
		</triggered_effect>

 

Then your xpath would look like this:

 

/progression/perks/perk[@name=perkCharismaticNature]/effect_group/triggered_effect[@trigger=onSelfProgressionUpdate]/@range

 

So the @trigger, @range, etc are all referencing the attributes on the xml.

 

triggered_effect: node. It's referenced by /triggered_effect/

trigger: Attribute. It's referenced by @.

 

They go together like this, which says "find the node called triggered_effect that has a trigger called onSelfProgressionUpdate"

 

/triggered_effect[@trigger=onSelfProgressionUpdate]/

		<triggered_effect trigger="onSelfProgressionUpdate" action="ModifyCVar" cvar="CharismaticNature" operation="set" value="4" target="selfAOE" target_tags="ally,party" range="15">
			<requirement name="ProgressionLevel" progression_name="perkCharismaticNature" target="self" operation="GTE" value="4"/>
			<requirement name="CVarCompare" cvar="CharismaticNature" target="other" operation="LT" value="4"/>
		</triggered_effect>

Link to comment
Share on other sites

Hmm I'm wanting to change the range values - for each level of the perk they are set at 15, but i would like to change that value to 30, 45, 60 respectively by using xpath. Perhaps including what i thought was the level reference has just confused things.

 

Given i've seen lots of values changed in lots of modlets i assumed i could do that in this case as well. I dont want to change anything except the range value from 15 to another number, so that range=15 becomes range=30 for example. So yes there are 4 paragraphs that looks like this one all with range=15 in them and i want to have an xpath that points there so that i can edit it. In game that would mean allys can be furher apart than the default distance but still earn xp from each other. I hope that makes some sense, I'm not familiar with this stuff at all.

 

<effect_group>

<triggered_effect trigger="onSelfProgressionUpdate" action="ModifyCVar" cvar="CharismaticNature" operation="set" value="1" target="selfAOE" target_tags="ally,party" range="15">

<requirement name="ProgressionLevel" progression_name="perkCharismaticNature" target="self" operation="Equals" value="1"/>

<requirement name="CVarCompare" cvar="CharismaticNature" target="other" operation="LT" value="1"/>

</triggered_effect>

 

I'm still a bit lost though. It seems there needs ot be a way to refer to the progression level as well and that comes after the range entry i want to chnage.

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

Hmm I'm wanting to change the range values - for each level of the perk they are set at 15, but i would like to change that value to 30, 45, 60 respectively by using xpath. Perhaps including what i thought was the level reference has just confused things.

 

Given i've seen lots of values changed in lots of modlets i assumed i could do that in this case as well. I dont want to change anything except the range value from 15 to another number, so that range=15 becomes range=30 for example. So yes there are 4 paragraphs that looks like this one all with range=15 in them and i want to have an xpath that points there so that i can edit it. In game that would mean allys can be furher apart than the default distance but still earn xp from each other. I hope that makes some sense, I'm not familiar with this stuff at all.

 

<effect_group>

<triggered_effect trigger="onSelfProgressionUpdate" action="ModifyCVar" cvar="CharismaticNature" operation="set" value="1" target="selfAOE" target_tags="ally,party" range="15">

<requirement name="ProgressionLevel" progression_name="perkCharismaticNature" target="self" operation="Equals" value="1"/>

<requirement name="CVarCompare" cvar="CharismaticNature" target="other" operation="LT" value="1"/>

</triggered_effect>

 

I'm still a bit lost though. It seems there needs ot be a way to refer to the progression level as well and that comes after the range entry i want to chnage.

 

This will update the 5 ranges that are available, and set them to 30.

<set xpath="/progression/perks/perk[@name='perkCharismaticNature']/effect_group/triggered_effect[@trigger='onSelfProgressionUpdate']/@range">30</set>

 

If you want to change individually, you'll want to look at setting and extra condition on @value.

 

<set xpath="/progression/perks/perk[@name='perkCharismaticNature']/effect_group/triggered_effect[@trigger='onSelfProgressionUpdate' and @value='1']/@range">30</set>

<set xpath="/progression/perks/perk[@name='perkCharismaticNature']/effect_group/triggered_effect[@trigger='onSelfProgressionUpdate' and @value='2']/@range">30</set>

<set xpath="/progression/perks/perk[@name='perkCharismaticNature']/effect_group/triggered_effect[@trigger='onSelfProgressionUpdate' and @value='3']/@range">30</set>

<set xpath="/progression/perks/perk[@name='perkCharismaticNature']/effect_group/triggered_effect[@trigger='onSelfProgressionUpdate' and @value='4']/@range">30</set>

 

That covers the first 4. The other last one, does not have a @level. Instead, we'll look for something on that line that's not in the other 4 lines. In this case, it has a @buff attribute:

 

<set xpath="/progression/perks/perk[@name='perkCharismaticNature']/effect_group/triggered_effect[@trigger='onSelfProgressionUpdate' and @buff='buffPerkCharismaticNature']/@range">30</set>

Link to comment
Share on other sites

Thanks alot. Loads up fine. You should publish that as a modlet ! I am curious to know where the Party controls are. Any idea ?

 

To be completely candid, I have no idea what effect those changes have on the game =D

 

I'm not sure about the Party controls.

Link to comment
Share on other sites

Can anyone tell me how to make items I've appended use custom icons?

 

I've got this, for example:

 

<item name="foodBaconAndEggSandwich">

<property name="HoldType" value="31"/>

<property name="CustomIcon" value="foodBaconAndEggSandwich"/>

<property name="DisplayType" value="food"/>

<property name="Meshfile" value="Items/Misc/parcelPrefab"/>

<property name="DropMeshfile" value="Items/Misc/sack_droppedPrefab"/>

<property name="Material" value="Morganic"/>

<property name="Stacknumber" value="50"/> <!-- STK food -->

<property name="EconomicValue" value="72"/>

<property class="Action0">

<property name="Class" value="Eat"/>

<property name="Delay" value="2.1"/>

<property name="Use_time" value="..."/>

<property name="Sound_start" value="player_eating"/>

</property>

<property name="Smell" value="largeSmell"/>

<property name="Group" value="Food/Cooking"/>

 

<effect_group tiered="false">

<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$foodAmountAdd" operation="add" value="50"/>

<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="foodHealthAmount" operation="add" value="18"/>

<triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" target="self" buff="buffProcessConsumables"/>

</effect_group>

</item>

 

And my folder setup is:

 

7 Days To Die > Mods > MyMod > Config, ItemIcons, and ModInfo > Items

Link to comment
Share on other sites

Thanks alot. Loads up fine. You should publish that as a modlet ! I am curious to know where the Party controls are. Any idea ?

 

serverconfig.xml in the root 7 Days To Die folder

 

<property name="PartySharedKillRange" value="100"/> <!-- The distance you must be within to receive party shared kill xp and quest party kill objective credit. -->

 

 

Edit "value=100" is 100 blocks in game

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

Can anyone tell me how to make items I've appended use custom icons?

 

I've got this, for example:

 

<item name="foodBaconAndEggSandwich">

<property name="HoldType" value="31"/>

<property name="CustomIcon" value="foodBaconAndEggSandwich"/>

<property name="DisplayType" value="food"/>

<property name="Meshfile" value="Items/Misc/parcelPrefab"/>

<property name="DropMeshfile" value="Items/Misc/sack_droppedPrefab"/>

<property name="Material" value="Morganic"/>

<property name="Stacknumber" value="50"/> <!-- STK food -->

<property name="EconomicValue" value="72"/>

<property class="Action0">

<property name="Class" value="Eat"/>

<property name="Delay" value="2.1"/>

<property name="Use_time" value="..."/>

<property name="Sound_start" value="player_eating"/>

</property>

<property name="Smell" value="largeSmell"/>

<property name="Group" value="Food/Cooking"/>

 

<effect_group tiered="false">

<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$foodAmountAdd" operation="add" value="50"/>

<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="foodHealthAmount" operation="add" value="18"/>

<triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" target="self" buff="buffProcessConsumables"/>

</effect_group>

</item>

 

And my folder setup is:

 

7 Days To Die > Mods > MyMod > Config, ItemIcons, and ModInfo > Items

 

 

Looks right if your icon is in fact in ItemIcons and if it is named correctly (case sensitive). I personally rarely use the customIcon property (No reason not to use it, I just don't), I just make sure the item name and the icon name match, then drop it in the ItemIcons folder.

 

One other thing you might try is using a shorter name for the icon, IIRC a few Alphas back an icon name would not show for me with a longer name. I am not aware of problems with long names but it's worth a try.

Link to comment
Share on other sites

Looks right if your icon is in fact in ItemIcons and if it is named correctly (case sensitive). I personally rarely use the customIcon property (No reason not to use it, I just don't), I just make sure the item name and the icon name match, then drop it in the ItemIcons folder.

 

One other thing you might try is using a shorter name for the icon, IIRC a few Alphas back an icon name would not show for me with a longer name. I am not aware of problems with long names but it's worth a try.

 

I forgot I'd posted this. I think I may have had a slight error at the beginning of the <append xpath> line, an extra / possibly. It's sorted now.

 

- - - Updated - - -

 

I have been trying to add a property to an existing item but nothing works. Does anyone know how to do this?

 

What is the property?

Link to comment
Share on other sites

What is the property?

 

the code you used in a16 was: <property name="MeltTimePerUnit" value="#"/>

and now I want to add it with the xpath but I don't understand how to do it, I have tried a bunch of ways but nothing work.

I know the property works since I tested it with changing the items.xml manually.

Link to comment
Share on other sites

* = whatever item name you want to add the property to

# = default melt time on all items in the forge is 0.25, it all extends from unit_iron

 

<configs>
<append xpath="/items/item[@name='*']">
<property name="MeltTimePerUnit" value="#"/>
</append>
</configs>

Link to comment
Share on other sites

Hey guys, wanted to expand on a bit I just figured out, apologies if this has already been covered.

 

Was trying to increase the yield of resourceCrushedSand from terrDesertGround blocks, but didn't want to bump up the return of resourceClayLump.

Issue was that both resources share much of their path & I was struggling with the syntax needed to isolate one from the other;

 

<drop event="Harvest" name="resourceCrushedSand" count="11" tag="oreWoodHarvest"/>

<drop event="Harvest" name="resourceClayLump" count="2" tag="oreWoodHarvest"/>

 

Original from blocks.xml

 

<block name="terrDesertGround">
<property name="Material" value="MDesertGround"/>
<property name="Shape" value="Terrain"/>
<property name="Mesh" value="terrain"/>
<property name="Texture" value="185,184,184,184,184,184"/>
<property name="ImposterExclude" value="true"/>
<property name="Map.Color" value="255,221,153"/>
<drop event="Harvest" name="resourceCrushedSand" count="11" tag="oreWoodHarvest"/>
<drop event="Harvest" name="resourceClayLump" count="2" tag="oreWoodHarvest"/>
<drop event="Destroy" count="0"/>
<property class="RepairItems">
	<property name="resourceCrushedSand" value="8"/>
	<property name="resourceClayLump" value="1"/>
</property>
<drop event="Fall" name="resourceCrushedSand" count="11" prob="0.5" stick_chance="0"/>
<property name="Group" value="Decor/Miscellaneous"/>
<property name="CanMobsSpawnOn" value="true"/>
<property name="EconomicValue" value="5"/>
<property name="EconomicBundleSize" value="1"/>
<property name="SellableToTrader" value="false"/>
<property name="FilterTags" value="fterrain"/>
<property name="SortOrder1" value="d0k0"/>
<property name="SortOrder2" value="0050"/>
<property name="DisplayType" value="blockTerrainFertile" />
</block>

 

Found the clue I needed in your first posts spereii; use of "and". This line now ups sand but leaves clay at default;

 

<set xpath="/blocks/block[@name='terrDesertGround']/drop[@event='Harvest' and @name='resourceCrushedSand']/@count">20</set>

 

Don't know what you'd call/describe this as? "Isolating a specific value when multiple attributes are shared"?

Good luck searching for that right? 0_o :)

 

Anyway, thought this might be helpful so figured I'd post it.

 

Thanks a bunch for this thread sphereii, -very- useful!

Link to comment
Share on other sites

This will do the same thing. I am not sure which is the best or if it just don't matter as long as it gets the job done. :)

 

<set xpath="/blocks/block[@name='terrDesertGround']/drop[@event='Harvest'][@name='resourceCrushedSand']/@count">20</set>

Link to comment
Share on other sites

  • 2 weeks later...

I made a mod to cook canned food to remove the food poisoning risk and give you basic hot food. Worked great until I made them learnable. I want them to unlock at the first level. I found the code I need to work with but I can't figure out how to add my foods to it.

 

I think this where I need to do it:

 

<perk name="perkMasterChef" parent="skillCraftsmanship" name_key="perkMasterChefName" desc_key="perkMasterChefDesc" icon="ui_game_symbol_spatula">

<level_requirements level="1"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="1" desc_key="reqIntellectLevel01"/></level_requirements>

<level_requirements level="2"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="3" desc_key="reqIntellectLevel03"/></level_requirements>

<level_requirements level="3"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="5" desc_key="reqIntellectLevel05"/></level_requirements>

<level_requirements level="4"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="7" desc_key="reqIntellectLevel07"/></level_requirements>

<level_requirements level="5"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="10" desc_key="reqIntellectLevel10"/></level_requirements>

 

<effect_group>

<passive_effect name="RecipeTagUnlocked" operation="base_set" level="1,5" value="1" tags="foodBaconAndEggs,foodBoiledMeat,foodGrilledMeat,foodBakedPotato,foodCornBread,foodCornOnTheCob,drinkJarRedTea,drinkJarCoffee,drinkJarGoldenRodTea"/>

<passive_effect name="RecipeTagUnlocked" operation="base_set" level="2,5" value="1" tags="foodSteakAndPotato,foodBlueberryPie,foodMeatStew,foodVegetableStew"/>

<passive_effect name="RecipeTagUnlocked" operation="base_set" level="3,5" value="1" tags="foodShamChowder,foodHoboStew,foodFishTacos"/>

<passive_effect name="RecipeTagUnlocked" operation="base_set" level="4,5" value="1" tags="drinkYuccaJuiceSmoothie,foodChiliDog"/>

<passive_effect name="RecipeTagUnlocked" operation="base_set" level="5,5" value="1" tags="drinkJarGrandpasMoonshine,drinkJarGrandpasAwesomeSauce,drinkJarGrandpasLearningElixir"/>

<effect_description level="1" desc_key="perkMasterChefRank1Desc"/>

<effect_description level="2" desc_key="perkMasterChefRank2Desc"/>

<effect_description level="3" desc_key="perkMasterChefRank3Desc"/>

<effect_description level="4" desc_key="perkMasterChefRank4Desc"/>

<effect_description level="5" desc_key="perkMasterChefRank5Desc"/>

</effect_group>

</perk>

 

Can you help me with this?

 

I also want to up the chance of food poisoning on the canned food. This is what I came up with, but it doesn't work. It still shows Food Poisoning at 5%.

 

<FoodPoisoningMod>

<setattribute xpath="/items/item[@name =foodCanBeef]/property[@name=FoodPoisoningRisk]" name="display_value">.25</setattribute>

</FoodPoisoningMod>

 

Thank you for your time. :smile-new:

Edited by Winterhart
change code info (see edit history)
Link to comment
Share on other sites

I am sure there are easier ways to do this but this way worked for me. NOTE: I only added "foodCanBeef", to add more be sure to add a comma between names.

 

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

 

Check the video tutorial for maybe some help on the second part of your question

Link to comment
Share on other sites

I am sure there are easier ways to do this but this way worked for me. NOTE: I only added "foodCanBeef", to add more be sure to add a comma between names.

 

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

 

Check the video tutorial for maybe some help on the second part of your question

 

Thank you so much for your reply. I copied it exactly as you have it. It failed to load, the message says there was no xpath attribute. I don't get it. I see one there lol.

Link to comment
Share on other sites

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>

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