Tutorial: How to edit the trader files

This is a discussion on Tutorial: How to edit the trader files within the S.T.A.L.K.E.R. SoC Modding, Mapping and Editing forums, part of the S.T.A.L.K.E.R. Shadow of Chernobyl category; Many people ask how to add stuff to the trader, change prices or they have some other reason to ask ...

S.T.A.L.K.E.R. SoC Modding, Mapping and Editing Want more info about a Mod? Making a Mod? Looking for Modders, Mappers, Skinners, etc.? This is your Spot!

Reply
 
LinkBack Thread Tools Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
  #1  
Old May 13th, 2008
Atrocious's Avatar
Oblivion Lost supplier
Bloodsucker
 
Join Date: March 24th, 2008
Location: Germany
Posts: 1,438
Rep Power: 5
Atrocious should make some friends
Default Tutorial: How to edit the trader files

Many people ask how to add stuff to the trader, change prices or they have some other reason to ask for the trader files. Now this post will explain exactly how the trader files work.

Note: If you want to learn more about basic modding, please read the Basic Modding with Playable Examples thread, where many stuff is explained.

Now for the trader files...

The files can be found in \gamedata\config\misc . There is a file for every trader:
Quote:
Sidorovich - trade_trader.ltx
Barkeep - trade_barman.ltx
Ecologists - trade_ecolog.ltx
Duty - trade_dolg.ltx
Freedom - trade_freedom.ltx
Other NPCs - trade_generic.ltx
In this tutorial I will use Sidorovich's file, to make things easier for me.

Part 1 - [trader] The info portions that control the changes
Spoiler:

Every trader file starts with a [trader] section (I will call everything that has [around] it a section). This first section contains info portions that tell the game which sections to call next. Info portions are used by STALKER to control many things. They are given to you (silently) when you advance in the game. Sid's [trader] section looks like this:
Quote:
[trader]
buy_condition = trader_generic_buy
sell_condition = {+esc_kill_bandits_quest_done} trader_after_fabric_sell, trader_start_sell
buy_supplies = {+esc_kill_bandits_quest_done} supplies_after_fabric, supplies_start
This means,
- the buy condition is always trader_generic_buy
- the sell condition is trader_start_sell as default and trader_after_fabric_sell, if the info portion esc_kill_bandits_quest_done is given. That is the case, when you've killed the bandits that keep the rookie stalker captive.
- the buy_supplies are supplies_start as default and supplies_after_fabric after the same info portion is given.

Barkeep even has a second info portion, so his stuff is changed after X18 and then again after X16.

Now what do these different sections mean? Read in the next parts...

Part 2 - [trader_generic_buy] What the trader buys from you, for how much
Spoiler:
From now on, you will find items listed in every section. They usually have two numbers behind them, but those numbers have different meanings for every section. In this first section you will find something like this:
Quote:
;Артефакты
Don't care about such things. They are Cyrillic comments (wrong depicted). Everything behind a ; in any .ltx file is a comment or something that someone has deactivated. If a ; is in the middle of a line, the line is active but everything behind that sign will be ignored.

Then there is also something like this:
Quote:
mutant_dog_tail ;NO TRADE
It means you can't sell a dog tail to Sid, because Sid doesn't care about dog tails! He hasn't fixed a price for it.

Finally there will be something like this:
Quote:
wpn_addon_silencer = 0.7, 0.2
It means Sid will give you money for a silencer. How much? Well, you have to do some math, to read it:
0.7 + 0.2 = 0.9 -> 0.9 / 2 = 0.45 -> 0.45 == 45%
So he will pay you 45% of the base price. The base price is set in the other ltx files, that define the properties of weapons, suits, etc.
Why so complicated? Don't ask me, I'm not GSC. They probably wanted to calculate it different first, but then just made it this way.

Part 3 - [supplies_start] What the trader has to offer
Spoiler:
Let me say this right at the beginning: If you add things here, you'll also have to add/edit the same thing in the corresponding sell section. Explained in part 4.

So, this is where you can add stuff that the trader should sell to you. Since this is the [supplies_start] section, he will offer it right from the beginning - but he will offer it only until the next section becomes active ([supplies_after_fabric]). If he should offer it then also, you'd have to add/edit it there as well.

Let's say you want to buy a Gauss rifle from Sid, you'd put:
Quote:
wpn_gauss = 1, 1
The first 1 means he could have one Gauss rifle in stock. The second 1 means the chance he will actually have it in stock is 100%.

To make things a bit more difficult, you want to add the gauss ammo, too:
Quote:
ammo_gauss = 10, 0.3
He can have 10 boxes of ammo, but only with a possibility of 30% for each box!

Like I told you, this isn't everything: When adding stuff to the supplies, you have to add or edit the same stuff in the corresponding section ...

Part 4 - [trader_start_sell] What the trader sells
Spoiler:

In this section it is defined for how much the trader will sell his supplies to you - if he sells them.

For example:
Quote:
vodka = 1, 3
He will sell you his Vodka for twice its base price! Obviously the price calculation is done like explained in part 2 of this guide.

But many stuff isn't for sale:
Quote:
mutant_dog_tail ;NO TRADE
Maybe Sid does care about dog tails, because he doesn't sell them either! He likes to keep them obviously!

If you want to be able to buy your Gauss rifle and ammo at start, you have to add it somewhere in this section [trader_start_sell]. If you want to be able to buy it for literally no money, you could add it like this:
Quote:
wpn_gauss = 0.00004, 0.00004
ammo_gauss = 0.002, 0.002
The Gauss base price is 25000, so this would sell it for 0.004 % = 1 RU.
The ammo base price is 550. Sid throws it out for 0.2 % - around 1 RU.

Of course it would be much easier to edit the base price, than making this complicated rocket-science percentage calculations.

Also, usually prices that traders sell their stuff for, are higher than 100% - because they want to make profit. So the numbers would look like in the Vodka example.

Important: If you want to add something that is already in the file (but has ;NO TRADE behind it maybe), then you have to edit the line instead of adding the same item again. Don't make duplicates in the same section!

Note: All price calculations are shown for items which are 0% damaged. If they are damaged, they price will be reduced of course.

Quest items: If you want to sell or buy quest items, you have to set their quest item status to false.
Quote:
quest_item = false
That can be done in gamedata\config\misc\quest_items.ltx

----

Special thanks to EggChen, for providing me with the most important information!
Also thanks to Kanyhalos for explaining the quest item issue.

Last edited by Atrocious; May 13th, 2008 at 05:27 PM..
Reply With Quote
Remove advertisements
Advertisement
Advertisement Sponsored links

  #2  
Old May 13th, 2008
Atrocious's Avatar
Oblivion Lost supplier
Bloodsucker
 
Join Date: March 24th, 2008
Location: Germany
Posts: 1,438
Rep Power: 5
Atrocious should make some friends
Default Re: Tutorial: How to edit the trader files

Another thing - not directly related to trader files:

If you just want to get yourself some equipment when the game starts, you don't have to edit the trader files and mess with the prices. You can simply change what Wolf gives you after your first conversation with him.

What he gives to you is defined in a script file - namely
gamedata\scripts\escape_dialog.script

Open that file and search for "give_weapon". You should land at
Quote:
function give_weapon_to_actor (trader, actor)
dialogs.relocate_item_section(trader, "wpn_pm", "in")
dialogs.relocate_item_section(trader, "ammo_9x18_fmj", "in")
dialogs.relocate_item_section(trader, "ammo_9x18_fmj", "in")
dialogs.relocate_item_section(trader, "wpn_knife", "in")
end
That's what you usually get from him. Now you can change that or add new lines, like I've done below:
Quote:
function give_weapon_to_actor (trader, actor)
dialogs.relocate_item_section(trader, "wpn_pm", "in")
dialogs.relocate_item_section(trader, "ammo_9x18_fmj", "in")
dialogs.relocate_item_section(trader, "ammo_9x18_fmj", "in")
dialogs.relocate_item_section(trader, "wpn_knife", "in")
dialogs.relocate_item_section(trader, "exo_outfit", "in")
dialogs.relocate_item_section(trader, "wpn_fn2000", "in")
dialogs.relocate_item_section(trader, "ammo_5.56x45_ss190", "in")
dialogs.relocate_item_section(trader, "ammo_5.56x45_ap", "in")

end
Of course you could - and really should - use other and less powerful items. Open the trader files, to find the correct names for the items.

If you want to give yourself some money in the beginning, you can use the same script. Change it like this:
Quote:
function give_weapon_to_actor (trader, actor)
dialogs.relocate_item_section(trader, "wpn_pm", "in")
dialogs.relocate_item_section(trader, "ammo_9x18_fmj", "in")
dialogs.relocate_item_section(trader, "ammo_9x18_fmj", "in")
dialogs.relocate_item_section(trader, "wpn_knife", "in")
dialogs.relocate_money(actor, 5000, "in")
end
Of course, you can change the value (5000) to give yourself a different amount of money.
__________________
S.T.A.L.K.E.R. My Mods on FileFront | How to edit trader files | Mod Wiki
Reply With Quote
  #3  
Old May 14th, 2008
Atrocious's Avatar
Oblivion Lost supplier
Bloodsucker
 
Join Date: March 24th, 2008
Location: Germany
Posts: 1,438
Rep Power: 5
Atrocious should make some friends
Default Extracting new files

Another general modding tip: If you can't find one of the files you want to edit, then the mods you are currently using did not edit that file. You would have to extract the file from your database files.

Here's a post from Jarvis explaining it. I edited it a bit.
Quote:
Originally Posted by Jarvis View Post
Use this to locate the [...] file:

The S.T.A.L.K.E.R. Yellow Pages - VALUE5games Forum

and extract it with this:

S.T.A.L.K.E.R. Database Extractor, Stalker Downloads, Stalker Miscellaneous

You're looking through the gamedata.db files in your install folder. Each one of those holds the different parts the game uses to run. Use the yellow pages to find where [the file] is kept, then extract that gamedata.db to a folder. Be careful though, if you extract it to your current gamedata, it will overwrite it, so make a backup first.
__________________
S.T.A.L.K.E.R. My Mods on FileFront | How to edit trader files | Mod Wiki
Reply With Quote
  #4  
Old May 14th, 2008
Amraam's Avatar
I follow teh Moo!
Scientist
 
Join Date: April 29th, 2008
Location: Newcastle, UK
Posts: 741
Rep Power: 4
Amraam is a regular member
Send a message via MSN to Amraam Send a message via Skype™ to Amraam
Default Re: Tutorial: How to edit the trader files

Awesome mate, it's precisely what I need!!
Reply With Quote
  #5  
Old May 14th, 2008
Amraam's Avatar
I follow teh Moo!
Scientist
 
Join Date: April 29th, 2008
Location: Newcastle, UK
Posts: 741
Rep Power: 4
Amraam is a regular member
Send a message via MSN to Amraam Send a message via Skype™ to Amraam
Default Re: Tutorial: How to edit the trader files

So for the trader to buy something off me for 100% of the base price, I would do this?

Code:
[barman_generic_buy]
...
wpn_g36                    = 1,    1
I tried that and the weapons were only being bought for a fraction of what he was selling them for
Reply With Quote
  #6  
Old May 14th, 2008
Atrocious's Avatar
Oblivion Lost supplier
Bloodsucker
 
Join Date: March 24th, 2008
Location: Germany
Posts: 1,438
Rep Power: 5
Atrocious should make some friends
Default Re: Tutorial: How to edit the trader files

Quote:
Originally Posted by Amraam View Post
wpn_g36 = 1, 1
It is 100% of the base price - but I bet he is not selling it for 100% of the base price, but for something like 400%. Check under [barman_start_sell].
__________________
S.T.A.L.K.E.R. My Mods on FileFront | How to edit trader files | Mod Wiki
Reply With Quote
  #7  
Old May 14th, 2008
Amraam's Avatar
I follow teh Moo!
Scientist
 
Join Date: April 29th, 2008
Location: Newcastle, UK
Posts: 741
Rep Power: 4
Amraam is a regular member
Send a message via MSN to Amraam Send a message via Skype™ to Amraam
Default Re: Tutorial: How to edit the trader files

Quote:
Originally Posted by Atrocious View Post
It is 100% of the base price - but I bet he is not selling it for 100% of the base price, but for something like 400%. Check under [barman_start_sell].
By '[barman_start_sell]' do you assume I'm at the start of the game? I'm actually after the brain scorcher, so should I look at [barman_after_brain_sell] ?
Reply With Quote
  #8  
Old May 14th, 2008
Amraam's Avatar
I follow teh Moo!
Scientist
 
Join Date: April 29th, 2008
Location: Newcastle, UK
Posts: 741
Rep Power: 4
Amraam is a regular member
Send a message via MSN to Amraam Send a message via Skype™ to Amraam
Default Re: Tutorial: How to edit the trader files

OK, i've edited the files, but I've got a little problem. When I sell my SS190 rounds, they don't sell in even quantities. When you double click to sell them in the trade, they used to go up in even number (30 intervals IIRC). Now they seen to go up in random intervals.

I hope you understand what I'm trying to say

Here are the changes I've made:
Code:
[barman_generic_buy]
ammo_5.56x45_ss190        = 1,    1; buys for 100% of base price

[supplies_after_brain]
...
ammo_5.56x45_ss190        = 15,    1; 15 boxes, 100% chance


[barman_after_brain_sell]
...
ammo_5.56x45_ss190        = 1,    1; sells for 100% of base price
Do they seem correct?
Reply With Quote
  #9  
Old May 14th, 2008
Amraam's Avatar
I follow teh Moo!
Scientist
 
Join Date: April 29th, 2008
Location: Newcastle, UK
Posts: 741
Rep Power: 4
Amraam is a regular member
Send a message via MSN to Amraam Send a message via Skype™ to Amraam
Default Re: Tutorial: How to edit the trader files

OK, yeah I have a problem selling SS190 ammo to barman.

When I first double click the ammo to sell him, 5 rounds go into the trade box. Double click again, the quantity changes to 35 (increment of 30). Double click a third time, it goes to 49 (increment of 14). Double click a fifth time it goes to 61 (increment of 12). Sixth time, it goes to 70 (increment of 9). Each double click after that, the increment is always 9.

Is this meant to happen, or have broken something?
Reply With Quote
  #10  
Old May 14th, 2008
EggChen's Avatar
Addicted to GF
 
Join Date: June 4th, 2007
Location: Birmingham, England
Posts: 269
Rep Power: 0
EggChen is a n00b
Default Re: Tutorial: How to edit the trader files

Hey Amraam, (Nice name by the way, is that after the air-to-air missile?)

That problem is not to do with your changes to the trader files, it is a game glitch. Did you happen to get all that ammo from corpses? What happen is if you loot 10 rounds, it is 10 rounds in one box, and the traders pay you the price for one box!! So it is a bit of an exploit....

There is a script that fixes this and "merges" looted ammo into boxes of 30, or 20 depending on the ammo. It is called dunin_ammo.script.... just place it in your scripts folder....

All credit to Dunin
Attached Files
File Type: rar Dunin_ammo.rar (1.6 KB, 137 views)
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7.