Jump to content

Defining the traders items


Recommended Posts

Hi all, first post here, so forgive any common errors.

 

I am just getting in to messing with the game files and am wondering if it's possible to define what traders have for sale and how much they cost.

 

For example if I want the trader to sell things like concrete blocks and frames, is this possible?

 

I have been in to the Traders.xml and tried adding:

 

<item name="pouredConcreteBlock" count="1,3" prob="20"/>

 

to the all traders section and specifically to trader Joel

 

I then realised the the concrete block probably doesnt have a value set to it so added this to the items.xml

 

<item name="resourceConcreteMix">
    <property name="HoldType" value="45"/>
    <property name="Meshfile" value="#Other/Items?Misc/sackPrefab.prefab"/>
    <property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab"/>
    <property name="Material" value="MresourceConcreteMix"/>
    <property name="Weight" value="20"/>
    <property name="Stacknumber" value="1000"/> <!-- STK resource -->
    <property name="EconomicValue" value="125"/>
    <property name="EconomicBundleSize" value="50"/>
    <property name="Group" value="Resources"/>
</item>

 

But no dice.  Am I missing something or is it just not possible?

 

 

Link to comment
Share on other sites

Thanks for the reply, I was just editing the main XML's however I am now reworking it with a proper mod setup.

 

I have no idea how to do the xpath thing for this however.

 

This is as far as I have gotten:

 

<setattribute xpath="//trader_info[@id='1']/trader_items[@group='generalResources']" name="

 

If you can give me any pointers at all I would be eternally grateful, or if you could give me an example for the concreteBlock I could work out the rest

 

thanks

 

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

For starters, read up on what each xpath does. Setattribute would be to add something within a node. Think of it more like AddAttribute. If i wanted to add a value to a line that doesnt have one, for example: <item name="billysbillystick"> doesnt have a value. I could use setattribute to add value="x" and it would come out <item name="billysbillystick" value="x">..

What you're looking for is to add to something existing. In other words append. So...

<append xpath="...">

 

Also note, you have to go to where the items are located in this instance. You can't just go to the trader items. You're trying to add an item to an item group, not the trader itself.

Second up, if you have notepad++, I suggest doing this.. Open the normal traders.xml and hit alt 0. This will collapse all nodes. As you open them up, write them in the xpath, untill you get to where you're trying to add.


Seems like you understand how the bracket stuff works, so nothin to really say there.


To help, here's the xpath you'd want to use, but try to do it yourself first to see how close you get with this new information.

 

Spoiler

 

<append xpath="/traders/trader_item_groups/trader_item_group[@name='generalResources']">

yourstuffhere

</append>

 

 

Link to comment
Share on other sites

Thank you so much, I think I have it cracked:

 

<append xpath="/traders/trader_item_groups/trader_item_group[@name='traderAlways']">
    <item name="resourceForgedIron" count="100" prob="1" />
    <item name="resourceForgedSteel" count="100" prob="1" />
    <item group="cannedfood" count="100" prob="1" />
    <item name="forge" count="4" prob="1" />
    <item name="workbench" count="4" prob="1" />
    <item name="cementMixer" count="4" prob="1" />
    <item name="chemistryStation" count="4" prob="1" />
</append>

 

Seems to be making everything appear always, which is perfect

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