• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

S.T.A.L.K.E.R.: Basic Modding

Joined
Aug 10, 2006
Messages
4,413 (0.64/day)
Processor Intel Core i7-7700K
Motherboard ASUS ROG Strix Z270E Gaming
Cooling Arctic Cooling Freezer i11
Memory 4x 8GB DDR4 Corsair Vengeance LPX @ 2133MHz
Video Card(s) 2x NVIDIA GTX 1080 Ti FEs
Storage 512GB SSD, 2x2TB HDD
Display(s) AOC U2879VF, AOC G2260VWQ6
Case Corsair 750D Airflow Edition
Power Supply EVGA Supernova 850G
Software Windows 10 x64 Pro
Well, this should give people a basic start on a weapon by example. If you want, ignore the text outside of the quotes for the most part, and add the pre-made stuff in to the correct files and you'll be on your way with an awesome gun :P
But if you want to learn to mod your own, just sit back and read.

First, you want to open the unique_items.ltx, and find the start of the weapons section. I prefer to keep things in order, adding my newer creations at the bottom, rather than having them all over the place and hard to find.

First, you need to give your weapon a description for the system. Weapons begin with the WPN prefix, then a name, then you should add on "_m#" to note it's a modified weapon and what version number it is.

You should see a few existing modded guns like the upgraded SVD and Viper with silencer. You can use these base parts to help you construct a gun, or you can look at the actual gun's base file in the weapons directory.

Next, is a colon ( : ) then an inheritor. Basically, you should link to the base (or modded) version of the gun you're making a mod for. That way, you ONLY have to add lines for the things you WANT TO CHANGE, the rest is inherited from the base gun version =D

Here's a short rundown of what you need/want to have in order to have a good looking modded gun:

$spawn - used for the system, generally keep it the same as the base gun, or a unique modded version for simplicity.

description - text string which the engine uses to look up the description of your gun when you examine it. Important if you want people to know your gun is special :P You can get creative with the descriptions, which are explained more below.

inv_name & inv_name_short - Short names similar to the description, again.. must have so people can tell your gun apart from the regular one.

cost - You can be realistic, unless you're testing the gun, in which case you should make it cheap so you can buy it at the very start.

fire_modes - single (1), double (2), triple (3), and auto (-1). Doesn't work on all guns just by settings.

ammo_limit - Theoretically the limit of ammo you can carry, though I've never seen it work, may be only for AI. ammo_current is the same.

ammo_mag_size - how big is the magazine? Again, think realistically, or insanely =D

ammo_class - what ammo it shoots. You may want to make a SPR with an AK over-bored to take .45 rounds

sprint_allowed - some guns are just too big to run with. But you can change that here

misfire_probability - chance the weapon will jam.

condition_shot_dec - how much condition is lost per round fired.

hit_power - the amount of force behind the hits. I still haven't figured out what the four divisions are =D higher = better, with sniper rifles typically 1.0+

hit_impulse - raw impact force of the bullet. Setting this high results in some crazy physics. The gun below is capable of shooting a barrel through a wall at times..

fire_distance - max range of the shell. May also be used for AI purposes.

bullet_speed - how fast your bullet zings. higher speeds = less leading of target. I think realistically 10k = instant hit for all ranges you can see.

rpm - rounds per minute. raise this to make a high rate of fire gun.

scope_zoom_factor - How much your scope moves in and out. I'm not -totally- sure how this number works, it seems like lower is better just by thumbing through the config files, just haven't tested it yet.

A couple others not on the gun below:

holder_range_modifier - Some guns shoot further, this allows you to see further. Be wary: turning this up too high results in your client trying to render every living body within sight range.

holder_fov_modifier - same as above, but allows you to restrict the rendering view. The higher you range, the lower you should make your FOV to keep things balanced.

fire_dispersion_base - base distance the rounds will disperse across for accuracy. Lower should be better.

inv_grid_x & inv_grid_y - these two confused me at first, but they relate to the actual image of the item displayed in the inventory. Be SURE to set this to either the base item's settings (by not including them, like I have below) or to the same as another modded item of the same kind (or the gun you're using to represent your modded weapon). The difference at times between two sets of these is that one is the "base" and displays nothing special, just the gun. The other is a "+" version, with the green arrow in the lower left corner. I'm sure you could add your own, but I've not gotten there yet.

That's the majority of things to get you started. I'll cover more later after I've played with them =D Here's my first modded gun for you to look at/play with:


[wpn_niphty_m1]:wpn_gauss
$spawn = "weapons\wpn-gauss"
description = enc_weapons1_wpn-niphty_m1
inv_name = wpn-niphty_m1
inv_name_short = wpn-niphty_m1
cost = 25
fire_modes = 1
ammo_limit = 1000
ammo_current = 500
ammo_mag_size = 1000
ammo_class = ammo_gauss
sprint_allowed = true
misfire_probability = 0.0
condition_shot_dec = 0.0
hit_power = 10.10, 10.10, 10.10, 16.60
hit_impulse = 6000
fire_distance = 10000
bullet_speed = 150000
rpm = 500
scope_zoom_factor = 7.5

Add that in to your unique_weapons.ltx, just above the arena guns.

Next you'll need some descriptions of what's what with your new item. The encyclopedia files keep track of all the string data, so that the items can just use short names and all the text can be kept elsewhere.. like the /text/eng folder!

This is pretty straight forward, all you have to do is copy the formatting and ensure the ID names are typed right. If you find your game isn't starting up, check to see if you forgot to end a formatting in these =D
And my example, for the gun above..


<string id="enc_weapons1_wpn-niphty_m1">
<text>An awesomely modified version of the standard Gauss rifle. Niphty's team has reworked the otherwise cumbersome and slow weapon into one of sheer terror. Still single shot, the weapon's capacitors have been heavily upgraded with artificat components to recharge almost instantly, creating an insane fire rate from an otherwise deadly gun. To compliment this, the clip has been extended greatly. Artifact barrel upgrades have been implimented as well, making this gun even more deadly accurate and high speed, while retaining the low kick of the original. A true weapon to be feared on the battlefield.</text>
</string>
<string id="wpn-niphty_m1">
<text>Niphty Gauss</text>
</string>

And add that into the "string_table_enc_weapons.xml" in the text/eng folder. I split them up in mine, just like the rest of the gun descriptions/names are, but it's not necessary.

Now you need to put it up on the trader; the inital guy is "trade_trader.ltx" and look for the "[supplies_start]" section. Scroll from there and find the section with the modified items, which all end in _m1, _m2, etc. Then just add in this line

wpn_niphty_m1 = 1, 3

The first number means quantity carried, and the second number I'm unsure of at this point. You can add it to the two other sections, which relate his stock based on different points in the story, as well as adding it to the other traders if you wish. All in all, lots of small modifications to tons of text files. Almost makes you wish you had an IDE =D

Next up.. basic armor modding! And later.. how to make one of those smaller machine guns fit into the pistol slot. It's big enough to hold one, so why doesn't it go there! =D
 
You don't HAVE to put a description in the string_table_enc_weapons.xml, you can do it in the unique_items.ltx file much easier like so;

[outfit_psy]:military_outfit
$spawn =
inv_name =
inv_name_short =
description = "......................................"
inv_weight =
telepatic_protection =
fire_wound_protection =
cost =

You can add a lot of other paramaters too, but this example explains well enough. When writing the description, inv_name etc its important to remember the quotes or no spacing will be used. ;)
 
Back
Top