Jump to content

Easy new item

Recommended Posts

Hello together,

I will start with a easy item. I have experience with programming old languages C++, Pascal, Sharp ans wo on. I Understand the xml files with change the values. That realy easy. But Now I will create a new item. I not know xpath. So I do not understand what is wrong.

I create a folder

Mods - Test_1







UIAtlases - ItemIconAtlas



Here the Code from items.xml:

<?xml version="1.0" encoding="UTF-8"?>

<append xpath="/items">

<item name="foodCornBread_V">
    <property name="Tags" value="food"/>
    <property name="HoldType" value="31"/>
    <!-- <property name="DisplayType" value="food"/> -->
    <property name="DisplayType" value="foodWaterNegative"/>
    <property name="Meshfile" value="#Other/Items?Misc/parcelPrefab.prefab"/>
    <property name="CustomIcon" value="foodCornBread_V"/>
    <property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab"/>
    <property name="Material" value="Morganic"/>
    <property name="Stacknumber" value="10"/> <!-- STK food -->
    <property name="EconomicValue" value="16"/>
    <property name="UnlockedBy" value="perkMasterChef,foodCornBreadSchematic"/>
    <property class="Action0">
        <property name="Class" value="Eat"/>
        <property name="Delay" value="1.0"/>
        <property name="Use_time" value="..."/>
        <property name="Sound_start" value="player_eating"/>
        <!-- jar from cooking food <property name="Create_item" value="drinkJarEmpty"/> -->
    <property name="Group" value="Food/Cooking,CFFood/Cooking"/>

    <effect_group tiered="false" name="Food Tier 1">
        <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$foodAmountAdd" operation="add" value="10"/>
        <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="foodHealthAmount" operation="add" value="5"/>
        <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyStats" stat="water" operation="add" value="-5"/>
        <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar=".foodStaminaBonusAdd" operation="add" value="10"/>
        <triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" buff="buffProcessConsumables"/>
        <display_value name="$waterAmountAdd" value="-5"/>



But I get a xpath error: I cannot find a solution in this forum or in the internet. Can you help?
660 ERR XML loader: Patching 'items.xml" from mod 'Test_1' failed:
661 EXC XML.Patch (/append/item, line 5 at pos 2): Patch element does not have an 'xpath' attribute


Thanks for your help or ideas.

best regeards Pascal

Link to comment
Share on other sites

I’m not super sure but you might want to remove (maybe) the top xml line (with the XML version declaration) and then put an xml tag at the top and a closed version of that same tag bottom of the file (you can name it whatever you want). Basically wrapping your entire items.xml in another layer of tag. If adding the tags at the top and bottom

work, then see if you can put back the XML declaration. I know it’s likely “correct” to have that declaration, but not sure for mods in this game


top of file:


bottom of file:



Usually people put their forum name in these tags or use <config> and </config>

Link to comment
Share on other sites

example (from what doughphunghus mentioned)


    <insertAfter xpath="/items/item[@name='meleeWpnSpearT1IronSpear']/property[@name='Extends']">
        <property name="Tags" value="T1Spear,T1Crafting,melee,grunting,medium,weapon,meleeWeapon,longShaft,attPerception,perkJavelinMaster,canHaveCosmetic,thrownWeapon"/>



I use config because I thought we had to.  Once I found out you can add whatever you want, I became lazy at that point and just continue to use config  😉

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...