Jump to content

Having trouble adding new items to the traders inventory


Recommended Posts

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.
Link to post
Share on other sites

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.
Link to post
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...