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

Redoing Trader open hours

Seen a few posts here and on reddit about how to change the settings concerning traders asking the same thing, I've also seen the same code suggestions used in several Mod's going around none of which use the features xpath provides. I won't post all the code just a few snippets.

First example is used to change the settings for just @id='1'

<set xpath="/traders/trader_info[@id='1']/@reset_interval">1</set>
<set xpath="/traders/trader_info[@id='1']/@min_inventory">40</set>
<set xpath="/traders/trader_info[@id='1']/@max_inventory">100</set>
<set xpath="/traders/trader_info[@id='1']/@min_items_swapped">40</set>
<set xpath="/traders/trader_info[@id='1']/@max_items_swapped">100</set>
<set xpath="/traders/trader_info[@id='1']/@open_time">0:00</set>
<set xpath="/traders/trader_info[@id='1']/@close_time">0:00</set>


Now if instead you use the features provided by xpath instead of redoing the above lines for @id='2', @id='6', @id='7' & @id='8' and having 7 lines for each ID

You can have just 7 lines instead of 35

<set xpath="/traders/trader_info[@id < 3 or @id > 5]/@reset_interval">1</set>
<set xpath="/traders/trader_info[@id < 3 or @id > 5]/@min_inventory">50</set>
<set xpath="/traders/trader_info[@id < 3 or @id > 5]/@max_inventory">100</set>
<set xpath="/traders/trader_info[@id < 3 or @id > 5]/@min_items_swapped">50</set>
<set xpath="/traders/trader_info[@id < 3 or @id > 5]/@max_items_swapped">100</set>
<set xpath="/traders/trader_info[@id < 3 or @id > 5]/@open_time">0:00</set>
<set xpath="/traders/trader_info[@id < 3 or @id > 5]/@close_time">0:00</set>


For played owned/rented vending machine ie @id'3' & @id'5' instead of 4 lines for both

<set xpath="/traders/trader_info[@id='3']/@reset_interval">1</set>
<set xpath="/traders/trader_info[@id='3']/@allow_sell">true</set>
<set xpath="/traders/trader_info[@id='5']/@reset_interval">1</set>
<set xpath="/traders/trader_info[@id='5']/@allow_sell">true</set>


You get the following 2 lines to cover both

<set xpath="/traders/trader_info[@id='3' or @id='5']/@reset_interval">1</set>
<set xpath="/traders/trader_info[@id='3' or @id='5']/@allow_sell">true</set>




Or if you don't want to type it all out here you go BG's Trader Fix
 

 
Last edited by a moderator:
Or just 

<set xpath="//@open_time">0:00</set>

<set xpath="//@close_time">0:00</set>




This will change all the trader lines in just 2 lines of codes since traders are the only entities that have open and close times.  

The less than and greater than functionality is only needed if they share variables, like min_inventory, and you don't want to do an universal change.

Another option is to do this

<set xpath="//trader_info[@open_time='6:05']/@min_inventory">20</set>




This would only change the min count for traders (since they only have the open_time variable).  Copy the line and throw in a NOT logic before open_time and then it would only apply to the vending machines in the world.

Multiple ways to reduce lines of code if you stop and plan ahead.

 
I've only had 7D2D since Jan 4th 2023 and still digging out info, so thanks for the info👍 I'd just all "keep trader open" mod's used  were addressing every single one separately after downloading so I just rewrote it from what was being used be so it was more efficient, still need to go thru the files and dig out info as currently I don't much about the internals yet

 
For us simpletons who dont code or feel confident in playing with scripts, is there a modlet available to instal do you guys know of please?

 
For us simpletons who dont code or feel confident in playing with scripts, is there a modlet available to instal do you guys know of please?


You think you can't but I know you can. The old cliche, "If I can do it, anyone can do it." applies to this.

I recommend installing Notepad ++ as that is what pretty much everyone I have ever seen uses to edit xml files and it is super easy to install.

Once installed find your trader.xml file in your game folder. (C:\Program Files (x86)\Steam\steamapps\common\7 Days To Die\Data\Config\traders.xml)

If you have Notepad++ installed you should be able to double click the file and it should open.

Then you just need to find this line...

You will have to do this for each trader but you just have to scroll down to change each one (or figure out how the search and replace works)

image.png

This is what you change to change the trader open and close hours. Edit to what you want and then hit the save icon at top and there ya go.

Will warn you once you have found out how easy it is you may try to change other things.

If you ever find you have errors popping up or just want to go back to the vanilla game just open steam and do a game verify and it should reset your game back to original.

You can also find out in forum how to do this.

As to your other question, yes, there are mods that can most likely do this and much more.

I use Nexus alot and have also used the 7daystodie.com to check out mods.

https://www.nexusmods.com/7daystodie/mods/

https://7daystodiemods.com/

PS: Don't blame me if you get hooked on editing your game :)

 
Last edited by a moderator:
You think you can't but I know you can. The old cliche, "If I can do it, anyone can do it." applies to this.

I recommend installing Notepad ++ as that is what pretty much everyone I have ever seen uses to edit xml files and it is super easy to install.

Once installed find your trader.xml file in your game folder. (C:\Program Files (x86)\Steam\steamapps\common\7 Days To Die\Data\Config\traders.xml)

If you have Notepad++ installed you should be able to double click the file and it should open.

Then you just need to find this line...

You will have to do this for each trader but you just have to scroll down to change each one (or figure out how the search and replace works)

View attachment 33123

This is what you change to change the trader open and close hours. Edit to what you want and then hit the save icon at top and there ya go.

Will warn you once you have found out how easy it is you may try to change other things.

If you ever find you have errors popping up or just want to go back to the vanilla game just open steam and do a game verify and it should reset your game back to original.

You can also find out in forum how to do this.

As to your other question, yes, there are mods that can most likely do this and much more.

I use Nexus alot and have also used the 7daystodie.com to check out mods.

https://www.nexusmods.com/7daystodie/mods/

https://7daystodiemods.com/

PS: Don't blame me if you get hooked on editing your game :)
TYVM, I will give it a shot, I REALLY appreciate you taking your time to explain all that, Thanks.

OH BTW I forgot to say, I am renting a server so does this make any difference? cheers.

 
So, I used an existing mod with the code

<configs>
<set xpath="/traders/trader_info/@open_time">7:05</set>
</configs>




But for whatever reason, the opening time remained 04:00

When that didn't work, I tried following the advice from this thread, and put in this instead

<configs>
<set xpath="//@open_time">7:05</set>
</configs>




With my great luck, that didn't fly either.

So... what's wrong here?

 
So, I used an existing mod with the code

<configs>
<set xpath="/traders/trader_info/@open_time">7:05</set>
</configs>




But for whatever reason, the opening time remained 04:00

When that didn't work, I tried following the advice from this thread, and put in this instead

<configs>
<set xpath="//@open_time">7:05</set>
</configs>




With my great luck, that didn't fly either.

So... what's wrong here?


It might have change since the last time I adjusted Trader Times (I didn't do that for 1.0).  If someone else doesn't answer your question, I will look tonight to see if I can spot what needs to be done

 
It might have change since the last time I adjusted Trader Times (I didn't do that for 1.0).  If someone else doesn't answer your question, I will look tonight to see if I can spot what needs to be done


All good. As it turns out I was using a Nexus mod the modder claimed was updated for 1.0 (and I checked the comments to see if there had been any complaints or problems), but his modinfo.xml was out of date and... nobody had complained in the year or so since 1.0 dropped, lmao.

 
All good. As it turns out I was using a Nexus mod the modder claimed was updated for 1.0 (and I checked the comments to see if there had been any complaints or problems), but his modinfo.xml was out of date and... nobody had complained in the year or so since 1.0 dropped, lmao.
Thanks for following up so I didn’t start looking for a different problem. 🙂

 
Back
Top