Weapon editing

From Mod Wiki

Jump to: navigation, search

This tutorial maybe a starting point for modding weapons and ammo. I was using information revealed by niphty in his great tutorial - Basic Modding with Playable Examples. So what another tutorial for? Well, I will try to show you how to do this in a simple step-by-step manner. Besides I will add some my own "findings" and I'll show you how to modd ammo. I hope you'll enjoy this one ...

Contents


Modding weapons

There are three ways to mod weapons in stalker. I will give you a short description for each way:

Editing existing weapons

This is the simplest way, however you can't edit unique weapons:

  1. choose which weapon you want to mod
  2. your weapon is located in config\weapons\, file name: w_weaponname.ltx (example: w_fn2000.ltx for FT 200M)
  3. edit file using information provided below to modd your weapon
  4. if you want, you can reskin this weapon - textures are located in textures\wpn\, file name: wpn_weaponname.dds (FT 200M example: wpn_fn2000.dds); look at editing *.dds files below
  5. (optional) edit weapon description in config\text\eng\string_table_enc_weapons.xml

Modding existing weapons

This tutorial will describe this approach:

  1. choose weapon you want to mod
  2. create section with your weapon in config\misc\unique_items.ltx
  3. inherit some properties from base weapon, add new features
  4. (optional) create hud icon (inventory icon) of your weapon
  5. (optional) create new textures and meshes (ogf files sucks so much!)
  6. (optional) edit weapon description in config\text\eng\string_table_enc_weapons.xml
  7. enable weapon (stash/task reward/trader's stock)

Creating completely new weapons

This is the toughest way:

  1. imagine the weapon you want to create
  2. create it somehow in ogf file - use the tutorials here: Weapon import and Weapon model creation (HUD)
  3. create textures textures\wpn\wpn_yourweaponname.dds and bumps for it
  4. create weapon properties file config\weapons\w_yourweaponname.ltx
  5. include it in weapons.ltx
  6. create and add weapon description in config\text\eng\string_table_enc_weapons.xml
  7. enable weapon (stash/task reward/trader's stock)

Modding existing weapons - variables

As I said earlier we'll create new weapons by inheriting some properties from base weapons. But before we do this we have to know which variables can help us in this task. There are plenty such variables but I will cover only few, most valuable of them. So here we go:

[wpn_weaponname_mnumber]:wpn_baseweaponname (m stands for modified) - new weapon section; for programmers: it is something like object oriented approach (inheritance); for non-programmers: this is really helpful because we don't have to list all properties of our new weapon, we just inherit some properties from base weapon and then we can change base weapon properties by editing them; in that way our new weapon will have "new features" (oh God, i hope this make sense ...)

For example, say you want to create a new Obokan. Starting point of the new Obokan section will looks like this one:

[wpn_abakan_m1]:wpn_abakan

Now, if you want to create another one and use some features you enabled in wpn_abakan_m1, you can do this:

[wpn_abakan_m2]:wpn_abakan_m1

This means that: you created a new Obokan called wpn_abakan_m2 which inherited some features from wpn_abakan_m1 which inherits some features from the original Obokan (wpn_abakan)

$spawn - this is a name and section in level editor, whatever it means it goes in this manner: "weapons\wpn-baseweaponname"

$npc - it PROBABLY means: whether NPC can carry this type of weapon or not. You can use two values: on or off

description - description of new weapon (config\text\eng\string_table_enc_weapons.xml)

inv_name - name of a new weapon inv_name_short - short name of a new weapon

There are two ways to name your weapon:

inv_name       = "This weapon really kicks ass"
inv_name_short = "BIG Gun"

or:

inv_name       = wpn-weaponname_mnumber
inv_name_short = wpn-weaponname_mnumber

Of course you will probably want to give your weapon some fancy name, so you can bind it to those variables. About the second way - you will have to add wpn-weaponname_mnumber variable name to config\text\eng\string_table_enc_weapons.xml

weapon_class - class of the weapon

  • sniper_rifle
  • assault_rifle
  • shotgun
  • heavy_weapon - only RPG
  • pistols don't have a class - do not use weapon_class if you are modding pistol
  • inv_weight - unloaded weapon weight

fire_modes - this is firing mode; there are 4 values (NOT FOR ALL WEAPONS):

  • -1 - full auto
  • 1 - single shot
  • 2 - double burst
  • 3 - triple burst
  • scope_status - scope
  • silencer_status - silencer
  • grenade_launcher_status - grenade launcher

The preceding three variables may have these values (NOT FOR ALL WEAPONS):

  • 0 - no addon
  • 1 - permanent addon
  • 2 - attachable addon
  • zoom_enabled - can we zoom in/out (true or false)
  • scope_zoom_factor - zoom factor when you are using scope; lower values = you can see further. For example: first image use scope_zoom_factor = 15 (standard Vintar value) while the secon one use
  • scope_zoom_factor = 10 (modded Vintar value)
  • scope_texture - we can assign different textures, for example: first image - Vintar with normal scope texture, the second one - Vintar with GP 36 scope texture
    scope_texture = wpn\wpn_crosshair_g36
  • ammo_class - type of ammo which your gun will use, for example:
    ammo_class = ammo_5.56x45_ss190, ammo_5.56x45_ap
  • ammo_mag_size - clip (magazine) size
  • condition_shot_dec - how much weapon condition is lost per round fired
  • misfire_probability - chance that your weapon will jam
  • cost - the price of the weapon
  • sprint_allowed - while carrying heavy weapons you can't sprint (false). If you want to sprint with, say Dragunov assign true value
  • inv_grid_x and inv_grid_y - position of inventory (hud) icon. More on that later
  • rpm - how many rounds per minute your weapon can fire
  • slot - weapon slot:
    • 1 - primary slot (pistols slot)
    • 2 - secondary slot (assault rifles slot)

All weapon's sounds can be found in sounds\weapons\

  • snd_draw - sound when you grab weapon from holster
  • snd_holster - sound when hiding weapon to holster
  • snd_shoot - standard shot sound
  • snd_shoot1 - shot sound 1
  • snd_shoot2 - shot sound 2
  • snd_shoot3 - shot sound 3
  • snd_empty - empty clip sound
  • snd_reload - reload sound
  • snd_shoot_grenade - grenade shot sound
  • snd_reload_grenade - loading grenade sound
  • ammo_limit and ammo_elapsed - i've no idea what they means but they are obsolete, so don't use them

Modding our first weapon - finally

There is one disabled task whose target is upgraded Vintar BC. Well, there is no modified Vintar but we will change it here. Paste this into config\misc\unique_items.ltx:

[wpn_vintorez_m1]:wpn_vintorez
$spawn                  = "weapons\wpn-vintorez"
description             = enc_weapons1_wpn-vintorez_m1
inv_name                = wpn-vintorez_m1
inv_name_short          = wpn-vintorez_m1
weapon_class            = sniper_rifle ;-- obvious
inv_weight              = 0.5
fire_modes              = 1, -1 ;-- single and full auto
scope_status            = 1 ;-- permanent scope
silencer_status         = 1 ;-- permanent silencer
grenade_launcher_status = 0 ;-- no grenade launcher at all
zoom_enabled            = true ;-- obvious for sniper rifles
scope_zoom_factor       = 10 ;-- better zoom
;--scope_texture        = wpn\wpn_crosshair_g36
ammo_class              = ammo_5.56x45_ss190, ammo_5.56x45_ap ;-- NATO ammo type
ammo_mag_size           = 50 ;-- 50 rounds per magazine
cost                    = 1000 ;-- quite cheap
sprint_allowed          = true ;-- you can skip (comment) this line
misfire_probability     = 0.0 ;-- no jamming at all
condition_shot_dec      = 0.0 ;-- no condition decreasing
rpm                     = 700 ;-- this weapon can fire 700 rounds per minute
slot                    = 2 ;-- secondary slot (assault rifles slot)
 
;-- standard Vintorez sounds: for the sake of example, you can omit them
snd_draw           = weapons\generic_draw
snd_holster        = weapons\generic_holster
snd_shoot          = weapons\tm_val_shot_0
snd_shoot1         = weapons\tm_val_shot_1
snd_shoot2         = weapons\tm_val_shot_2
snd_shoot3         = weapons\tm_val_shot_3
snd_empty          = weapons\gen_empty, 0.5
snd_reload         = weapons\vintorez_reload, 0.7, 0.5
snd_shoot_grenade  = weapons\gen_grenshoot
snd_reload_grenade = weapons\gen_grenload

and description (config\text\eng\string_table_enc_weapons.xml):

<string id="enc_weapons1_wpn-vintorez_m1">
	<text>Absolutely awesome sniper rifle created by one of the stalker from ZSG. It has so many features: \n - this weapon will never jam, \n - it will never lose their condition, \n - it have 50 rounds per magazine, \n - zoom ratio has been modified, \n - this weapon is really cheap.\n Ammunition:\n standard 5.56x45 mm SS109,\n armor-piercing 5.56x45 mm AP.</text>
</string>
<string id="wpn-vintorez_m1">
	<text>Vintorez ZSG</text>
</string>

Ok, now he have to obtain it somehow. We know how to do that with stashes (Cheating with stashes - a little tutorial) and lately with task's rewards (Cheating with tasks - tutorial). Let's use the second approach ...

-- task_manager.ltx
[wolf_eliminate_lager_1]
type              = eliminate_lager
community         = actor
text              = wolf_eliminate_lager_1_text
description       = wolf_eliminate_lager_1_descr
;condlist         = {+esc_serious_talk}
parent            = wolf
target            = esc_bridge_boar
;reward_money     = 1500
reward_reputation = +20
reward_rank       = 3
reward_item       = ammo_5.56x45_ss190, ammo_5.56x45_ap, wpn_vintorez_m1
time              = 86400
prior             = 1

Nice, but there is something wrong with our Vintar inventory icon. Well, all unique weapons are marked with white arrow. How can we do that? All hud icons are located in one file textures\ui\ui_icon_equipment.dds.

We are going to edit this file, but to do this we need some external tools. This is dds file, to edit it we need Adobe Photoshop with dds plugin. However i prefer Gimp because it's freeware, smaller and faster than Photoshop. Besides i just like Gimp and hate jasc software Smile

Please read Editing ui icon equipment.dds, before you proceed.

Here you can download Gimp: http://gimp-win.sourceforge.net/stable.html

  1. First download and install GTK+ 2 Runtime Environment (~6 MB)
  2. Then download and install Gimp (~8 MB)
  3. Download dds plugin here: http://registry.gimp.org/plugin?id=4816 (use Windows binaries link) (~200 KB)

To install dds plugin simply copy whole zip contents to X:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins\. Now, step-by-step:

  1. Run Gimp and open ui_icon_equipment.dds file
  2. Use "select rectangular regions" tool (or press "R") and mark Vintar BC
  3. Press CTRL+C to copy selected region, press CTRL+V to paste it and then move it below unique suits
  4. Now do the same thing with white arrow image, stick it to Vintar
  5. Save file

Well that's all, now we have our hud icon, however with a little bit fancy you can reskin our new Vintar.

Ok, now we have to mark in unique_items.ltx that we want to use our inventory icon for upgraded Vintar. We will need inv_grid_x and inv_grid_y variables. This image maybe helpful (this is original image without our Vintar icon, i've added some helpful marks) - just find square where our Vintar is:

so our new Vintar hud icon should be in square (right below Kombez):

inv_grid_x = 12
inv_grid_y = 27

Some other examples to clarify this method:

Guitar:

inv_grid_x = 10
inv_grid_y = 19

RPG:

inv_grid_x = 6
inv_grid_y = 0

Thunder:

inv_grid_x = 0
inv_grid_y = 14

Now you should get it.

Ok let's back to our new Vintar (this time without useless variables):

[wpn_vintorez_m1]:wpn_vintorez
$spawn              = "weapons\wpn-vintorez"
description         = enc_weapons1_wpn-vintorez_m1
inv_name            = wpn-vintorez_m1
inv_name_short      = wpn-vintorez_m1
inv_weight          = 0.5
scope_zoom_factor   = 10; -- better zoom
ammo_class          = ammo_5.56x45_ss190, ammo_5.56x45_ap; -- NATO ammo type
ammo_mag_size       = 50; -- 50 rounds per magazine
cost                = 1000; -- quite cheap
misfire_probability = 0.0; -- no jamming at all
condition_shot_dec  = 0.0; -- no condition decreasing
rpm                 = 700; -- this weapon can fire 700 rounds per minute
 
;-- our Vintar hud (inventory) icon
inv_grid_x = 12
inv_grid_y = 27

Modding ammo

Well, modding ammo is pretty same as modding weapons. All ammo, grenades and addons descriptions you can find in file config\weapons\weapons.ltx. As an example we will modd ammo_9x18_pbp, this one:

Image:modding_ammo.jpg

So here we go:

[ammo_9x18_special]:ammo_9x18_pbp
$spawn          = "weapons\ammo\ammo_9x18_pbp"
class           = AMMO
description     = enc_weapons1_ammo_ammo-9x18-special
cost            = 10
box_size        = 20
inv_name        = "9x18 PBP special"
inv_name_short  = "ZSG PBP"
inv_weight      = .2
inv_grid_width  = 1
inv_grid_height = 1
inv_grid_x      = 12
inv_grid_y      = 27
k_dist          = 1.1
k_disp          = 1
k_hit           = 1.1
k_impulse       = 20
k_pierce        = 5.25
tracer          = on
explosive       = on


Something to fire our new fancy bullets, say, PMm - config\weapons\w_pm.ltx

ammo_class = ammo_9x18_fmj, ammo_9x18_pmm, ammo_9x18_special

and description: config\text\eng\string_table_enc_weapons.xml

<string id="enc_weapons1_ammo_ammo-9x18-special">
      <text>An improved 9x18 PBP rounds. An extremely power armor piercing round created by ZSG stalkers. Bullets explode when they reach the target. This ammo is quite cheap and light-weight.</text>
</string>
 
<string id="enc_weapons1_wpn-pm">
      <text>The most widespread pistol in the Zone. It is a legacy of the Soviet era. It is relatively reliable and cheap, has low magazine capacity, low power and an unsatisfactory grouping of shots. It is the main weapon of a beginning stalker. However with ZSG ammunition it can really dangerous\n Ammunition:\n standard 9x18 mm,\n improved 9x18 mm +P+, deadly 9x18 ZSG ammo</text>
</string>

Finally we made:

  • custom ammo icon
    Image:custom_ammo_icon.jpg
  • armor piercing better than Dragunov ammo (k_piercing)
  • explosive bullets (borrowed from Dragunov)
  • you can see the bullet trace (borrowed from Dragunov)
  • impulse borrowed from Gauss rifle (upgraded of course)

Jesus, well done this one. Wolf died pretty quick with his AK. And rookies ... they ... well they just fly away up in the sky ... literally

Author

Team:Dez0wave

See also

Editing Weapons (superseded article)

Personal tools