From Mod Wiki
Jump to: navigation, search
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.
Nov 26, 2015 - >STALKER General Steam Group - Join chat and ask for an invite! I wish if a could express me better in english. But at least i can. Or just go to your gamedata folder in your call of pripyat folder.
The files can be found in gamedataconfigmisc . There is a file for every trader:In this tutorial I will use Sidorovich's file, to make things easier for me.
[trader] The info portions that control the changes
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:
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...
[trader_generic_buy] What the trader buys from you, for how much
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:
Don't care about such things. They are Cyrillic comments. 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:
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:
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.
[supplies_start] What the trader has to offer
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:
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:
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 ...
[trader_start_sell] What the trader sells
In this section it is defined for how much the trader will sell his supplies to you - if he sells them.
For example:
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:
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:
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.
That can be done in gamedataconfigmiscquest_items.ltx
Links
Source: http://forums.filefront.com/s-t-l-k-e-r-soc-modding-editing/362105-tutorial-how-edit-trader-files.html#post4342355
Retrieved from 'http://sdk.stalker-game.com/en/index.php?title=Editing_trader_files'
From Mod Wiki
Jump to: navigation, search
This tutorial serves as an introduction to creating a weapon based off of a 'blueprint' of a vanilla rifle, giving it another assault rifle's upgrades, and linking it so that it can function properly in game, and be upgraded by the technicians.
Some statistics and naming conventions are handled a slight bit differently then in Shadow of Chernobyl.
|
Starting Up
First off, we need to make sure that the game will load the necessary script. This is fairly simple to do:
Navigate to your gamedataconfigsweapons folder, and search for the weapons.ltx. This is the master file that tells the game which scripts to include as weapon scripts. If this file isn't modified, your gun won't load up properly - it might load up if you tell other #include files to load it, but it's best to encourage clean, tidy modification from the start.
All we have to do here is fairly simple. We make an #include reference, pointing to the script we'll be making for the rifle. Lets call it 'w_tester.ltx'. It should look something like this:
Now we make the file. You can make a LTX file in notepad, by selecting 'All File Types', and then defining it as w_tester.ltx, making sure to add the file extension.
Referencing
Since this is your first weapon, you likely won't want to deal with all of the dirty, back-end scripting, such as animation references, attachment points, and bone placement. These are arduous, requiring a fair amount of work to get working properly. We'll cover the fun stuff - like rate of fire, damage, and durability - and the not-quite as fun stuff - accuracy, recoil management, and ammunition types. These are the most noticeable, and less trial-and-error then the other facets of scripting.
To get past the need for animation, bones, and other complicated areas, we'll use a reference. A reference in the LTX is essentially a way of telling the game that a gun is based off of another gun, and thus inherits all of the statistics of that weapon unless otherwise stated. In short, anything we add in will take priority in the finished product.
For simplicity, we'll base this off of the LR-300. Not the most popular weapon, but it's a solid all around weapon, letting you see what kind of effects your scripting has compared to the standard gun.
At the top of the w_tester.ltx, put in this:
Your weapon, as it is, should work. It'll behave just like an LR-300, and traders and techs won't know what on earth it is, but you can carry it by yourself without ruining the game. But we want our gun to work, and to be different.
For the next part of this tutorial, I'll be explaining various variables most commonly manipulated, and how to change them to your tastes.
Naming
Fairly straight forward.
$spawn - The location when searching for it in the SDK Level Editor. Unnecessary, but it doesn't hurt to define it.
$npc - Whether or not npcs can use this weapon. For Call of Pripyat, it is highly recommended to leave this ON.
$prefetch - Not necessary to modify, unless you don't want it to preload.
scheduled - Again, not necessary to modify.
cform - Used for animations, another item you DO NOT modify.
class - Weapon class. All assault rifles use the WP_AK74 class.
description - The item's description. This points to your localization's weapons.xml file - name varies.
ef_main_weapon_type - The weapon type. All weapons in Call are '2', meaning they can be equipped in either inventory slot.
ef_weapon_type - Similar to main_weapon_type.
default_to_ruck - Can fire while sprinting?
sprint_allowed - Can the user sprint while wielding?
Upgrades & Cost
cost - The cost in RU, not factoring in any discounts or randomization on the trader's part.
weapon_class - Where it will appear in the multiplayer buy menu.inv_weight - How much it weighs unloaded.
upgrades - A reference to the weapon's available upgrade trees - in no case will it exceed five. It's also encouraged to keep upgrades of the same weapon type, for simplicity and stability. Note that, no matter what you do with your values, you do not need to modify upgrades to ensure they have some kind of benefit - they're coded to add or multiply.
installed_upgrades - A bit more complicated, this can be used to ensure specific upgrades are always installed - examples of items using this are Joker's Respirator, Barge's Sunrise Suit, and Snag's gear.
upgrade_scheme - The scheme used for display purposes when visiting a technician.
Firepower & Ammunition
Recoil & Accuracy
AI Stats
Add-ons & Attachments
At this point, you know how to modify the basic stats and performance of a weapon. Other things such as integral scopes, silencers, animations, HUD effects, will be covered in another, more advanced article.
Adding it to the Game
Unlike Shadow of Chernobyl, more needs to be done to get your gun to work in game. For one, while you can probably use it in game, it probably crashes when you take it to a trader, or drop it in the open. Not very pleasant bugs, and you probably notice you can't get it repaired or upgraded!
There are three more items that need to be modified;
1. Navigate to your configsmp directory, and go to mp_ranks.ltx - the weapon name needs to be added to the 'available items' field of the corresponding rank. The higher the rank number, the higher AI stalkers prioritize it in looting and equipment.
2. Navigate to the configsmisc directory, and open the inventory_upgrades.ltx - this file defines what items are upgradeable. Add the weapon name into the document.
3. In the misc directory, open stalkers_upgrade_info. A long, long file will open. Even if your weapon borrows upgrades from another rifle, technicians will not know how to upgrade it if the weapon isn't listed amongst those in the document. Each technician has their own list - only the first two can upgrade weapons.
After your weapon's name has been added to these three files, the weapon should work perfectly - the only remaining issue is acquiring it.
Adding it to traders
This is fairly simple;
In the same misc folder, go to the trade directory. Select the appropriate trader - you can guess which is which from the 'zat' 'jup' and 'prp' tags. We'll use Owl, the Zaton trader, as our reference. Open the 'trade_zat_b30_stalker_trader.ltx'.
The first long line of articles - it takes up about half the article - are sales modifiers. While Owl will take your weapon off your hands, if it's not mentioned here he won't be able to sell it back. Go ahead and add it underneath the other weapons, keeping the same variables.
To buy it from him, hit Ctrl+F and find '[supplies_generic]'. These are the items Owl will always sell regardless of faction and wealth - his starting inventory, essentially. Add the bottom, add this:
This tells Owl he will sell one of your guns, with a 100% chance of stocking it.
Start up a new game, walk up to Owl, and hopefully you have enough rubles to purchase the weapon!
Adding it to your inventory
Adding it to your starting inventory is even more straight forward.
Navigate to the configsgameplay folder, and open the 'character_desc_general.xml'. The first listing is your own character, his name, starting inventory, and cash.
Here's what the supplies category should look like:
Congratz! Your character will now spawn with the 'Tester LR300' in his inventory upon starting a new game. You've created your first modified weapon!
Retrieved from 'http://sdk.stalker-game.com/en/index.php?title=Call_of_Pripyat_Weapon_Creation'