Jump to content

XPath Modding Explanation Thread


sphereii

Recommended Posts

Perfect, that is what I was missing in this case. However, some blocks have drop event="destroy", some have drop event="disassemble", and some have the drop event="Harvest" any ideas how I would point out those paths?

 

You can do multi-conditionals

 

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

Link to comment
Share on other sites

Could you please help me with something, I'm new to this modding and I have been trying to make a mod which makes the Iron Hoe faster but I keep getting syntax error

 

Code:

<set xpath="/items/item[@name=meleeToolHoeIron]/property[@class=Action1]/property[@name'Delay']/@value">0.05

<set>

 

EDIT:After reading a few post before, I manage to find out where I was wrong :positive:, but thanks anyway for making this modding tutorial :angel:

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

Could you please help me with something, I'm new to this modding and I have been trying to make a mod which makes the Iron Hoe faster but I keep getting syntax error

 

Code:

<set xpath="/items/item[@name=meleeToolHoeIron]/property[@class=Action1]/property[@name'Delay']/@value">0.05

<set>

 

EDIT:After reading a few post before, I manage to find out where I was wrong :positive:, but thanks anyway for making this modding tutorial :angel:

 

Glad you were able to figure it out. :)

Link to comment
Share on other sites

so I created a modlet and have a new item I appended to items.xml. I want to create an icon for it.

 

1. is there an icon tutorial? like size, file type, location it goes, etc.

 

2. will a player need to install anything or can I just put the mod and icon on the server?

 

Icon size right now is 116x80. I *think* the A18 HD ones are 116x116, could be wrong. Create a folder in your mod folder called ItemIcons. Place them in there. I know png and jpg work for sure. Maybe others.

 

Any mod that contains anything more than just xmls has to be installed on the server and client both. Resources, icons, localization will not push from the server.

Link to comment
Share on other sites

hello everyone,

 

i tried to create a modlet which went good so far but i want to add another tag at the progression xml.

 

For example at the perk living of the land i want to add the tag chocolateseeds but i got no idea how to write that down. Do I have to use append, set or setattribute for this to work? And how does the line actually look if its done right.

 

I tried a lot but coudnt figure out right typing.

Link to comment
Share on other sites

...i need to remove these T5 quest from vanilla quests.xml: https://i.imgur.com/cSOOrT2.png

 

   <quest_list id="trader_quests">
       <!-- Tier 1 -->
           <quest id="tier1_clear" />
           <quest id="tier1_fetch" />
           <quest id="tier1_buried_supplies" />
       <!-- Tier 2 -->
           <quest id="tier2_clear" />
           <quest id="tier2_fetch" />
           <quest id="tier2_hidden_cache" />
           <quest id="tier2_fetch_clear" />
       <!-- Tier 3 -->
           <quest id="tier3_clear" />
           <quest id="tier3_fetch" />
           <quest id="tier3_hidden_cache" />
           <quest id="tier3_fetch_clear" />
           <quest id="tier3_hidden_clear" />
       <!-- Tier 4 -->
           <quest id="tier4_clear" />
           <quest id="tier4_fetch" />
           <quest id="tier4_hidden_cache" />
           <quest id="tier4_fetch_clear" />
           <quest id="tier4_hidden_clear" />    
       <!-- Tier 5 -->
           <quest id="tier5_clear" />
           <quest id="tier5_fetch" />
           <quest id="tier5_hidden_cache" />
           <quest id="tier5_fetch_clear" />
           <quest id="tier5_hidden_clear" />
       <!-- Tier 6 -->
           <!--    <quest id="tier6_clear" /> -->
           <!--    <quest id="tier6_fetch" /> -->
           <!--    <quest id="tier6_hidden_cache" /> -->
           <!--    <quest id="tier6_fetch_clear" /> -->
           <!--    <quest id="tier6_hidden_clear" /> -->
   </quest_list>

 

This is what i got, but doubt it's right, and i can't test it right now:

<configs>
   <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_clear']"/>
   <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_fetch']"/>
   <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_hidden_cache']"/>
   <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_fetch_clear']"/>
   <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_hidden_clear']"/>
</configs>

 

this is to bypass a game-breaking bug found here: https://7daystodie.com/forums/showthread.php?122290-KeyNotFoundException

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

...i need to remove these T5 quest from vanilla quests.xml: https://i.imgur.com/cSOOrT2.png

 

   <quest_list id="trader_quests">
       <!-- Tier 1 -->
           <quest id="tier1_clear" />
           <quest id="tier1_fetch" />
           <quest id="tier1_buried_supplies" />
       <!-- Tier 2 -->
           <quest id="tier2_clear" />
           <quest id="tier2_fetch" />
           <quest id="tier2_hidden_cache" />
           <quest id="tier2_fetch_clear" />
       <!-- Tier 3 -->
           <quest id="tier3_clear" />
           <quest id="tier3_fetch" />
           <quest id="tier3_hidden_cache" />
           <quest id="tier3_fetch_clear" />
           <quest id="tier3_hidden_clear" />
       <!-- Tier 4 -->
           <quest id="tier4_clear" />
           <quest id="tier4_fetch" />
           <quest id="tier4_hidden_cache" />
           <quest id="tier4_fetch_clear" />
           <quest id="tier4_hidden_clear" />    
       <!-- Tier 5 -->
           <quest id="tier5_clear" />
           <quest id="tier5_fetch" />
           <quest id="tier5_hidden_cache" />
           <quest id="tier5_fetch_clear" />
           <quest id="tier5_hidden_clear" />
       <!-- Tier 6 -->
           <!--    <quest id="tier6_clear" /> -->
           <!--    <quest id="tier6_fetch" /> -->
           <!--    <quest id="tier6_hidden_cache" /> -->
           <!--    <quest id="tier6_fetch_clear" /> -->
           <!--    <quest id="tier6_hidden_clear" /> -->
   </quest_list>

 

This is what i got, but doubt it's right, and i can't test it right now:

<configs>
   <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_clear']"/>
   <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_fetch']"/>
   <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_hidden_cache']"/>
   <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_fetch_clear']"/>
   <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_hidden_clear']"/>
</configs>

 

this is to bypass a game-breaking bug found here: https://7daystodie.com/forums/showthread.php?122290-KeyNotFoundException

 

That should work. Are you getting any errors or warnings in your output_log.txt of it not applying?

Link to comment
Share on other sites

  • 2 weeks later...

Hi,It's me again :wave:

This time I need help on how to change the dry time of the concrete block on both the reinforce and the normal one, I been doing some digging but came up with nothing :upset:,So before I change every value I see :tongue:, I would like to ask you for help!

Link to comment
Share on other sites

  • 2 weeks later...
Hi,It's me again :wave:

This time I need help on how to change the dry time of the concrete block on both the reinforce and the normal one, I been doing some digging but came up with nothing :upset:,So before I change every value I see :tongue:, I would like to ask you for help!

 

Hi,

 

To change the drying speed of concrete you need to change the values for UpgradeRated.Rate under pouredConcreteMaster and pouredRConcreteMaster blocks in blocks.xml file.

 

It appears that it dries fastest when the value is 1 (default value is 4 and 5 respectively). I have tried lower values but decimals (e.g. 0.5) give an error and the world fails to load and 0 or negative values didn't seem to be any different from 1. Someone please correct me if there are any values which make it even faster.

 

Alternatively to editing the file yourself, you can download my mod which I have created just now and which does exactly that: https://www.nexusmods.com/7daystodie/mods/406

 

Here's the code that my mod uses.

 

<configs>
<set xpath="/blocks/block[@name='pouredConcreteMaster']/property[@name='UpgradeRated.Rate']/@value">1</set>
<set xpath="/blocks/block[@name='pouredRConcreteMaster']/property[@name='UpgradeRated.Rate']/@value">1</set>
</configs>

Link to comment
Share on other sites

Hi,

 

I have a question regarding the xpath command remove.

 

Is it possible to remove only a part of a string in an attribute?

 

For example, Advanced Engineering skill level 2 teaches these recipes:

 

gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel,dartTrap

 

<passive_effect name="RecipeTagUnlocked" operation="base_set" value="1" level="2,5" tags="gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel,dartTrap" />

 

Is is possible to use the remove command to remove only a single recipe from this skill? I tried to format the remove command in a similar fashion as append command but that didn't work.

 

<remove xpath="/progression/perks/perk[@name='perkAdvancedEngineering']/effect_group/passive_effect[@name='RecipeTagUnlocked' and @level='2,5']/@tags">,dartTrap</remove>

 

Or do I have to use the set command and set it to the same string but without the one recipe that I don't want there?

 

<set xpath="/progression/perks/perk[@name='perkAdvancedEngineering']/effect_group/passive_effect[@name='RecipeTagUnlocked' and @level='2,5']/@tags">gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel</set>

 

Is there any other command which can remove only a specific part of the string?

 

Thanks.

Link to comment
Share on other sites

Hi,

 

I have a question regarding the xpath command remove.

 

Is it possible to remove only a part of a string in an attribute?

 

For example, Advanced Engineering skill level 2 teaches these recipes:

 

gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel,dartTrap

 

<passive_effect name="RecipeTagUnlocked" operation="base_set" value="1" level="2,5" tags="gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel,dartTrap" />

 

Is is possible to use the remove command to remove only a single recipe from this skill? I tried to format the remove command in a similar fashion as append command but that didn't work.

 

<remove xpath="/progression/perks/perk[@name='perkAdvancedEngineering']/effect_group/passive_effect[@name='RecipeTagUnlocked' and @level='2,5']/@tags">,dartTrap</remove>

 

Or do I have to use the set command and set it to the same string but without the one recipe that I don't want there?

 

<set xpath="/progression/perks/perk[@name='perkAdvancedEngineering']/effect_group/passive_effect[@name='RecipeTagUnlocked' and @level='2,5']/@tags">gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel</set>

 

Is there any other command which can remove only a specific part of the string?

 

Thanks.

 

I don't think its possible. XPath itself is just a method of referencing XML nodes and attributes, and the game's own settings control what it can do with that information. Remove itself removes a node or attribute, but not a sub-string value. Append can add a sub-string, but I don't think its possible to remove one.

Link to comment
Share on other sites

could you add a page explaining how to use different Xpath functions such as pulling a numerical value from the vanilla files, and multiplying them by 2, and then setting that multiplication as the new value?

 

I don't think this is possible either. While you can do math in an xpath evaluation, there isn't a way for us to take the new value it calculates and add it to the @value.

 

The xpath="" finds the node, then the game takes the <set, <append, etc and replaces the node or attribute with the >NEED THE CALCULATED VALUE HERE<. Inside those > <, there isn't support for an xpath statement.

<set xpath="/myNod/price">NEED THE CALCULATED VALUE HERE</set>

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

I understand how to change the size of a loot container's loot box. What I don't understand is how to make a mod that edits the amount of each item in the loot container.

 

For example, I know

 

<set xpath="/lootcontainers/lootcontainer[@id=25]/@size">7,6</set>

will change the bird nest's loot box size to 7x6.

 

However, how do I change the amount of eggs and feathers gained from each bird's nest? I don't understand how to point to "resourceFeather" to change the count. I know I can easily change the XML itself. What I'm asking is how do I make a modlet to edit this?

 

<lootcontainer id="25" count="1,2" size="6,2" sound_open="UseActions/open_garbage" sound_close="UseActions/close_garbage" loot_quality_template="qualBaseTemplate">

<item name="foodEgg" prob="0.25"/>

<item name="resourceFeather" count="1,5" prob="0.75"/>

</lootcontainer>

 

I've tried

 

<config> <set xpath="/loot/lootcontainer[@id='25']/@name='resourceFeather'/@count">5,10</set> </config>

 

and many other things but nothing works. Can't find any other mods to reverse engineer to make this work, either.

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

I understand how to change the size of a loot container's loot box. What I don't understand is how to make a mod that edits the amount of each item in the loot container.

 

For example, I know

 

<set xpath="/lootcontainers/lootcontainer[@id=25]/@size">7,6</set>

will change the bird nest's loot box size to 7x6.

 

However, how do I change the amount of eggs and feathers gained from each bird's nest? I don't understand how to point to "resourceFeather" to change the count. I know I can easily change the XML itself. What I'm asking is how do I make a modlet to edit this?

 

<lootcontainer id="25" count="1,2" size="6,2" sound_open="UseActions/open_garbage" sound_close="UseActions/close_garbage" loot_quality_template="qualBaseTemplate">

<item name="foodEgg" prob="0.25"/>

<item name="resourceFeather" count="1,5" prob="0.75"/>

</lootcontainer>

 

I've tried

 

<config> <set xpath="/loot/lootcontainer[@id='25']/@name='resourceFeather'/@count">5,10</set> </config>

 

and many other things but nothing works. Can't find any other mods to reverse engineer to make this work, either.

 

Your XPath starts with /loot/, which isn't a valid node. Shouldn't it be xpath="/lootcontainers/ ?

Link to comment
Share on other sites

Your XPath starts with /loot/, which isn't a valid node. Shouldn't it be xpath="/lootcontainers/ ?

 

Is everything else right? I still get an error "XpathException: Expression must evaluate to a node-set" after changing it to

 

<config>

<set xpath="/lootcontainers[@id=25]/@name='resourceFeather'/@count">5,10</set>

</config>

I've tried <set xpath="/lootcontainers/lootcontainer[@id=25]/@name='resourceFeather'/@count">5,10</set> too and get the same error.

 

I'm just not clear on how to target the things beyond "[@id=25]" and its attributes.

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

Is everything else right? I still get an error "XpathException: Expression must evaluate to a node-set" after changing it to

 

<config>

<set xpath="/lootcontainers[@id=25]/@name='resourceFeather'/@count">5,10</set>

</config>

I've tried <set xpath="/lootcontainers/lootcontainer[@id=25]/@name='resourceFeather'/@count">5,10</set> too and get the same error.

 

I'm just not clear on how to target the things beyond "[@id=25]" and its attributes.

 

Oh, sorry, I did misunderstand

 

The words in between the / / are nodes in the XML.

 

<lootcontainer id="25" count="1,2" size="6,2" sound_open="UseActions/open_garbage" sound_close="UseActions/close_garbage" loot_quality_template="qualBaseTemplate">
	<item name="foodEgg" prob="0.25"/>
	<item name="resourceFeather" count="1,5" prob="0.75"/>
</lootcontainer>

 

To reference the count, you want to do this:

 

xpath="/lootcontainers/lootcontainer[@id=25']/item[@name=resourceFeather]/@count"

 

The item itself is a node, that has a name, much like the lootcontainer has an id.

Link to comment
Share on other sites

<config>

<set xpath="/lootcontainers/lootcontainer[@id=25']/item[@name=resourceFeather]/@count">5,10</set>

</config>

 

gives me an error upon loading "XmlException: name cannot begin with the "]" character, hexadecimal value 0x5D. Line 2, position 53" which I believe is referring to the "]" after @id='25'"]?

 

Edit: Figured it out, it was the " after '25'. Thanks for the help!

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