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

Need help with xpath: it just won't work

JustBoredYo

New member
Hi I'm trying to add back that you get an empty glass jar or can after consuming the item, since I think this change was stupid and only slows down gameplay in an unimaginative and annoying way.

This is the first time I'm trying to make a 7Dtd mod, so this might just be a noob issue.

Right now my goal is to add the "drinkJarEmpty" item into the inventory after Action0 is executed. I have added this behaviour successfully by manipulating the items.xml file of the game and now tried to implement the same using the config/items.xml file of my mod using this code:

<insertBefore xpath="/items/item[@name='drinkJarBoiledWater']">
<item name="drinkJarEmpty">
<property name="HoldType" value="3"/>
<property name="Meshfile" value="@:Other/Items/Food/emptyJarPrefab.prefab"/>
<property name="DropMeshfile" value="@:Other/Items/Misc/sack_droppedPrefab.prefab"/>
<property name="Material" value="Mglass"/>
<property name="Stacknumber" value="125"/>
<property name="CustonIcon" value="drinkJarEmpty"/>
<property name="EconomicValue" value="6"/>
<property name="CraftingIngredientTime" value="9"/>
<property class="Action1">
<property name="Class" value="CollectWater"/>
<property name="Delay" value="1.0"/>
<property name="Change_item_to" value="drinkJarRiverWater"/>
<property name="Sound_start" value="bucketfill_water"/>
</property>
<property name="Group" value="Resources"/>
</item>
</insertBefore>

<append xpath="/items/item[@name='drinkJarBoiledWater']/property[@class='Action0']">
<property name="Create_item" value="drinkJarEmpty"/>
</append>


From my understanding the code does the following:

1. Inserts the "drinkJarEmpty" item before the "drinkJarBoiledWater" item(idk if it is important although I could imagine so)

2. Appends the '<property name="Create_item" value="drinkJarEmpty">' inside the '<property class="Action0">' node

I have verified that my mod is being loaded successfully so I am pretty sure here is where my mod fails.

I have no idea if my understanding is correct however what I do know is that the code doesn't work.

 
Last edited by a moderator:
Hi I'm trying to add back that you get an empty glass jar or can after consuming the item, since I think this change was stupid and only slows down gameplay in an unimaginative and annoying way.

This is the first time I'm trying to make a 7Dtd mod, so this might just be a noob issue.

Right now my goal is to add the "drinkJarEmpty" item into the inventory after Action0 is executed. I have added this behaviour successfully by manipulating the items.xml file of the game and now tried to implement the same using the config/items.xml file of my mod using this code:

<insertBefore xpath="/items/item[@name='drinkJarBoiledWater']">
<item name="drinkJarEmpty">
<property name="HoldType" value="3"/>
<property name="Meshfile" value="@:Other/Items/Food/emptyJarPrefab.prefab"/>
<property name="DropMeshfile" value="@:Other/Items/Misc/sack_droppedPrefab.prefab"/>
<property name="Material" value="Mglass"/>
<property name="Stacknumber" value="125"/>
<property name="CustonIcon" value="drinkJarEmpty"/>
<property name="EconomicValue" value="6"/>
<property name="CraftingIngredientTime" value="9"/>
<property class="Action1">
<property name="Class" value="CollectWater"/>
<property name="Delay" value="1.0"/>
<property name="Change_item_to" value="drinkJarRiverWater"/>
<property name="Sound_start" value="bucketfill_water"/>
</property>
<property name="Group" value="Resources"/>
</item>
</insertBefore>

<append xpath="/items/item[@name='drinkJarBoiledWater']/property[@class='Action0']">
<property name="Create_item" value="drinkJarEmpty"/>
</append>


From my understanding the code does the following:

1. Inserts the "drinkJarEmpty" item before the "drinkJarBoiledWater" item(idk if it is important although I could imagine so)

2. Appends the '<property name="Create_item" value="drinkJarEmpty">' inside the '<property class="Action0">' node

I have verified that my mod is being loaded successfully so I am pretty sure here is where my mod fails.

I have no idea if my understanding is correct however what I do know is that the code doesn't work.




Hi JustBoredYo

I think it would be easier to put append xpath, instead of insertBefore to add the empty jar, at least I did my mod like that, you could check it out to get an idea.





Regards

Gouki

 
Thanks for the reply @Gouki I've changed my code to use '<append xpath="/items">' instead of '<insertBefore ...>' but sadly it still doesn't work.

Is there something I'm overlooking?

 
Thanks for the reply @Gouki I've changed my code to use '<append xpath="/items">' instead of '<insertBefore ...>' but sadly it still doesn't work.

Is there something I'm overlooking?


In your first code (drinkJarEmpty) you need to add these properties:

<property name="Weight" value="2"/>
<property name="Class" value="ItemClassWaterContainer"/>

<property name="WaterCapacity" value="1"/>

In the second code, change drinkJarBoiledWater to drinkJarRiverWater or put it as I have it in my code, because with yours you will only make it so that when you drink the boiled water you get the empty jar.

Regards

Gouki

 
Alright I solved the issue. I was following this page to setup my mod and their folder structure contained a 'config' folder. The issue with this is the 'c' need to be capitalized. I just renamed it to 'Config' and now everything is running as it should.

 
Last edited by a moderator:
Alright I solved the issue. I was following this page to setup my mod and their folder structure contained a 'config' folder. The issue with this is the 'c' need to be capitalized. I just renamed it to 'Config' and now everything is running as it should.


I'm glad it's fixed.
Sometimes anything can cause it to fail.

Regards

Gouki

 
Back
Top