In 1986, the world's worst nuclear disaster occurred at the Chernobyl power station. Soviet authorities established a 30km 'Exclusion Zone' around this nuclear wasteland, but in 2006 a second explosion rocked the stricken reactor, obliterating all living things and causing the Zone's boundaries to ripple outwards. From this epicenter came waves of mutated creatures, deadly radiation, and a strange, anomalous energy. The Zone was cordoned off by the military, who would shoot on sight anyone foolish enough to brave the horrors within.
This tutorial will teach you how to add and modify weapons used by the STALKER game. It will also look at some other tweaks and changes.
Posted by Sigma on May 19th, 2007
Basic Client Side Coding.
This tutorial will teach you how to add and modify weapons used by the STALKER game. It will also look at some other tweaks and changes. To follow this tutorial you will need the following:
I use these words so you need to know what they mean:
You can find the finished 'mod' in the tutorial_end.rar file contained in the file linked above.
[page=Part 1: Preparing the files and folders]
First extract the gamedata_original.Rar file to a safe location, we will copy the files you need from there. Then go to your stalker folder and open up fsgame.ltx
Change the second line from this:
$game_data$ = false| true| $fs_root$| gamedata\
$game_data$ = true| true| $fs_root$| gamedata\
This will make sure that the game loads your files for usage in-game.
Now we need to make the directory structure. Create the following folder structure inside your root stalker install folder:
Now everything is set to do some config modding.
[page=Part 2: Defining the base weapon]
Go to the folder where you extracted the original gamedata and go here > /gamedata/config/weapons
Here you can find all the normal guns from the game, lets "borrow" one. Copy a gun which you want to use for a base, in this case we will use the fn2000 (w_fn2000.ltx). Also copy the weapons.ltx file to this folder. You should recreate the folder structure in your stalker gamedata folder so it looks like this:
Change the filename to the gunname you want to use, but keep the extension (I will use supergun.ltx in this case). Now, open that file in notepad.
The first line is one we need to change which should currently read:
This means it is a base gun. Change that line to the name you want to refer it to (in the traders files...) but keep the wpn_ prefix. In my case it will be:
Now, look for:
description = enc_weapons1_wpn-fn2000
Change the 'enc_weapons1_wpn-fn2000' to something like this: 'enc_weapons1_wpn-supergun' (replace supergun with your gunname, but don't use spaces) .This tells the game in which section of the stringlist it needs to search for the long description
Now look for the line 'cost' and change it to 1 (for testing purpose, later change this to a realistic cost).
I will just tell the meaning of the following lines (since they are pretty much self explanatory)
weapon_class = This is used for the weapon selection in multiplayer
ammo_limit = I honestly don't know, i think it is used for the AI, but it has not got any effect on the player
ammo_current = Same as ammo_limit
ammo_elapsed = Don't know
ammo_mag_size = How big the mag is, i mostly set this to 100 or so to test it out properly and after that i change it to something realistic)
hand_dependence = Think this is a remnants of the game where you could dual wield guns
single_handed = You really need an explanation for this one
ammo_class = The type of ammo it can use, look in the file weapons.ltx (under all the #includes for the types of ammo)
fire_modes = The modes it supports, more of this later
launch_speed = I think this is how much time elapses from clicking to firing (only applies to the grenade launcher upgrade)
slot = The slot the gun is in, more of this later
animation_slot = Just ignore this one an leave it at the default value
inv_name = Short description of the gun, should be something like this: wpn-supergun (change supergun to your weapon)
inv_name_short = Type the same as you typed in inv_name
inv_weight = The weight of the gun
inv_grid_width = ignore these, you need custom art to make these properly work
inv_grid_height = they are use for the inventory graphic
inv_grid_x = same
inv_grid_y = same
you can use these values to choose the shooting mode of your gun:
single = 1
double = 2
triple = 3
auto = -1
You can combine these so you can choose multiple fire modes (what else would you use that key in the options for). You do it like this:
fire_modes = 1, 2, 3, -1
Here you can define in which slot the gun resides, these are the values:
-1 = knife
1 = pistols
2 = rifles
4 = grenades
6 = armor
Note that not all guns goes in all slots, a sniper rifle in the pistol slot crashes the game
We are almost done with this file. Search for the line that starts with 'hit_power', here are the explanations:
hit_power = The damage each hit does, i think each set of numbers represents the difficulty level
hit_impulse = the force behind the shot, change this to make the ragdolls fly
hit_type = the type of damage the gun does, change this if you want your gun to fire radiactive bullets, i have yet to find all of the values for this.
fire_distance = The distance you can fire
bullet_speed = The starting speed of the bullets
rpm = Rate Of Fire of the gun, change this to change the speed of the gunfire
Only 1 more thing is left in this file, search for the word 'hud'. Replace 'wpn_fn2000_hud' with 'wpn_supergun_hud'. Search further and replace [wpn_fn2000_hud] with [wpn_supergun_hud]
Finally if you continue you will also find this:
visual = weapons\fn2000\wpn_fn2000_hud_new.ogf
I think this is the model used in-game, not sure so leave it like this. We are now done with this file, so save it but keep it open, we will need it again later (for reference).
Open weapons.ltx. Add this line below '#include "w_g36.ltx"'
Save and close the file. We are all done defining our base weapon, only thing we need to do are the descriptions for the gun.
Copy the string_table_enc_weapons.xml file from the original gamedata/config/text/eng to the same folder in your stalker gamedata. Open it up in a text editor and add these lines at the bottom (syntax highlighting will really come in handy now):
Note, it should actually be at the bottom but above the last line (which is )
Change the first string id ("enc_weapons1_wpn-supergun") to the one you used in the description field in the .ltx file. Also change the second strign id ("wpn-supergun") to the one you gave in the inv_name and inv_name_short fields. Ok, now we are really done with the weapon, last thing to do is adding it to the trader.
[page=Part 3: Adding the weapon to the traders]
Copy the traders_trader.ltx file from original gamedata/config/misc to the same folder in your stalker gamedata folder. This defines the stock from the first trader (AKA 'The Trader')
Open up the file in a text editor and search for 'supplies_start'. You will find the line at the top but search again, you will find it atop of a list. Just add a new line below [supplies_start] (thats how I do it always) and add the following line:
wpn_supergun = 1, 3
There is alot of discussion of what these numbers mean. If you put it in supplies_start they mean this:
- first number (1) is the number of items there will be available
- second number (3) is the chance that the item actually is in stock
You actually need to add your gun to the [trader_start_sell] but every time i putted it there, it wont show up. When i did it this way, there where no problems so it is an easy choice to me.
You can also find the other traders in that folder:
trader_freedom.ltx = The trader from the freedom faction (or A trader from it, whatever)
trader_dolg.ltx = Same as above but for the duty faction
trader_barman.ltx = The barman
trader_generic.ltx = I think this is trading with random stalkers
Now it is time for your first playtest (for me it worked fine so hopefully you get the same results!) Only issue was a thunder appeared but thats ok - it is only a minor bug!
That concludes our base gun tutorial. Next is a modded version of the gun with an insane amount of damage - lets see if the XRay engine supports gibbbing *evil laugh*
[page=Part 4: Making a modded version of our gun]
Now we are going to make a modded version of our gun, which is not as difficult as it sounds! First copy the file unique_itmes.ltx from the original gamedata/config/misc folder to the same folder of your stalker gamedata and open it in a text editor. Search for the weapon section and go to the bottom of it (above the arena section) and add the following:
The first between  is the modded weapon id (this is the same as the original but with _m# behind it (where # is the version of the mod is)). Then comes an inheritor (the ':') this notes upon the weapon this is build (in this case its my supergun). The $spawn line should be the same as your original weapon (in this case: $spawn = "weapons\fn-2000"). Now you only need to fill in the lines you want to change.
In my example I changed the weapons power and force and cost line is just to make sure it stays at 1RU. You will also need new descriptions for the gun, so add those 3 lines (description, inv_name and inv_name_short):
Save and close the file. Reopen the string_table_enc_weapons.xml file and add new entries, just like you did in step 3. Mine are:
Add them below your previous entries and as you can see, I was low on inspiration. Now reopen the traders_trader.ltx file and add it just like you did in step 3, just add wpn_supergun_m1 instead of wpn_supergun.
Save and try ingame. In my case I made a mistake in the .xml file and the description did not showed up (don't worry, i fixed it here to) and if you were wondering: the thunder was gone.
This concludes the weapon tutorials, now to cover some tweaks and changes.
[page=Part 5: Tweaks and changes]
Upping the maximum carrying weight
Copy the file system.ltx from the original gamedata/config to the same folder of your stalker gamedata. Open it in a text editor and search for [inventory]:
take_dist = Don't know
max_weight = The max weight you can carry before you get exhausted from walking
max_ruck = Max weight until you cant move at all
max_belt = Maximum artifacts hanging on your belt (apparently it was once 16 instead of 5; I have not tested if more then 5 does any harm or crashing)
Remove dead npcs faster
Copy the file stalkers.ltx from the orignial gamedata/config/creatures to the same folder of your stalker gamedata. Open it in a text editor and add this to the bottom:
Now, if you stay out of that level for 1 (game) hour, the corpses will be gone, BUT, the ones that have a script attached to them stay (the one that give you stash locations).
Copy the file actor.ltx from the orignial gamedata/config/creatures to the same folder of your stalker gamedata. Open it in a text editor and search for 'limping_health_begin '
change those values to reflect these:
Now copy the file effectors.ltx from the original gamedata/config/misc to the same folder of your stalker gamedata. Open it in a text editor and search for [bobbing_effector]. Change those values to reflect these:
Save all and try ingame, when you have 30% of your health you will start to limp (effect may be exaggerated but its for showing purpose, you can tweak it)
Here are the settings explanation:
limping_health_begin = at how many % of your health do you start to limp? (example: 0.3 is 30%)
everything in the [bobbing_effector]: self explanatory? (I don't know what the _amplitude values are though)
NOTE: this is for you only, not the npcs
To remove prefetch, copy all the files you can find which contain prefetch in its filename to your stalker gamedata folder, it should look like this:
Just open up the 2 files marked with (*) and remove all its contents and save them. Now you should not get any prefetching (since that took the longest for me to load). If you want to be sure you can do the same with the other prefetch files.
[page=Part 6: The End]
Thanks for reading my tutorial, I hope you liked it. I went through every setting so i don't want any questions of those (you may, after your read them carefully). If you liked the tutorial you can always send me a note through a Private Message. I might post a tutorial on armor/artifact modding later.
Also, thanks to these people:
- niphty for the intor (i found most stuff on my own tough)
- vetis AKA "Wardrop" for the limping