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

Having trouble adding new items to the traders inventory

I have created a new item and it is working. I have added it to the starting items to make sure. 

I would like this new item to always be available to buy at all of the traders. 

I have been working on this all morning and am having trouble figuring out what I am doing wrong.

Any help would be greatly appreciated.

The code I have in my traders.xml file for the mod is pasted below:


<configs>
 

    <append xpath="//trader_item_groups">
        <trader_item_group name="mushroom1Up" count="1">
            <item name="food1UpMushroom" count="1,2"/>
        </trader_item_group>
    </append>
 

    
    <insertBefore xpath="//trader_info[@id='1']/trader_items/item[@name='traderAlways']">
        <item group="mushroom1Up" count="1,2" />
    </insertBefore>
    <insertBefore xpath="//trader_info[@id='8']/trader_items/item[@name='traderAlways']">
        <item group="mushroom1Up" count="1,2" />
    </insertBefore>
    <insertBefore xpath="//trader_info[@id='7']/trader_items/item[@name='traderAlways']">
        <item group="mushroom1Up" count="1,2" />
    </insertBefore>
    <insertBefore xpath="//trader_info[@id='2']/trader_items/item[@name='traderAlways']">
        <item group="mushroom1Up" count="1,2" />
    </insertBefore>
    <insertBefore xpath="//trader_info[@id='6']/trader_items/item[@name='traderAlways']">
        <item group="mushroom1Up" count="1,2" />
    </insertBefore>
 

</configs>
 
Thank you so much for the help.
 
The way you've got it coded now, it seems like it should work, although it's a bit labor intensive. You could try this instead: append your food1UpMushroom to the 'traderAlways' group, since everything in there should be stocked every time. Then, when each of those traders call on 'traderAlways', your food1UpMushroom should show up in their for sale inventory.

    <append xpath="//trader_item_groups/trader_item_group[@name='traderAlways']">
            <item name="food1UpMushroom" count="1,2"/>
    </append>
 
That should be all you need. Give it a try.
 
Back
Top