Weapon reference (Killing Floor)

From Tripwire Interactive Wiki
Revision as of 12:41, 27 November 2012 by Benjamin (talk | contribs) (Created page with "This page details the attributes (variables) and functionality used for weapons in Killing Floor. == Class explanation == Attributes are split into different classes dep...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page details the attributes (variables) and functionality used for weapons in Killing Floor.

Class explanation

Attributes are split into different classes depending on their use. For example, general attributes such as magazine size, inventory placement, first person visuals, etc. are stored in the Weapon class, while damage and fire rate are stored in the FireRate class. Nearly every weapon uses its own personalized classes that extend from a common base class.

  • Weapon - This is the inventory class of the weapon, and contains general information such as where the item should appear in the inventory, what its name is, and how much it weighs. It contains references to the associated WeaponPickup class, WeaponAttachment class, and FireMode classes. It also manages how the weapon appears in first person view. A typical example of this class is 'Single'.

    Specified in Pickup's InventoryType variable.


  • WeaponPickup - Handles the weapon when it is sitting about in the game world outside of anyone's inventory (also in the trader). It contains information about the name of the weapon, how much the weapon (and its ammunition) costs, and so on. A typical example of this class is 'SinglePickup'.

    Specified in Weapon's PickupClass variable.


  • WeaponAttachment - Manages how the weapon appears in third person view (and thus to all other players). A typical example of this class is 'SingleAttachment'.

    Specified in Weapon's AttachmentClass variable.


  • WeaponFire - Handles how a particular mode fires, what kind of ammo it uses, how much damage it does, and other related things. A weapon may have two fire modes, and a fire mode doesn't necessarily need to be offensive (for example, the 9mm's alt-fire switches on the flashlight). A typical example of this class is 'SingleFire'.

    Specified in Weapon's FireModeClass array.


  • Ammunition - Handles how much ammunition a weapon can hold, how much ammunition it initially contains, and how much ammunition you gain when picking up a generic ammo crate. A typical example of this class is 'SingleAmmo'.

    Specified in WeaponFire's AmmoClass variable.
    Specified in Ammo's InventoryType variable.


  • Ammo - Simply used to indicate how much ammunition a weapon gains when picking up a particular ammo crate (for example 9mm rounds). A typical example of this class is 'SingleAmmoPickup'.

    Specified in Ammunition's PickupClass variable.


  • Projectile - Used by weapons that fire projectiles (shotgun, crossbow, etc.) and describes the speed at which the projectile travels as well as damage and other information. A typical example of this class is 'CrossbowArrow'.

    Specified in WeaponFire's ProjectileClass variable.


  • DamageType - Indicates the type of damage, including various attributes such as behaviour of characters stricken with this damage, the message that is displayed when the player is killed with it, head shot multiplier, and so on. A typical example of this class is 'DamTypeDeagle'.

    Specified in WeaponFire's DamageType variable for hitscan weapons.
    Specified in Projectile's MyDamageType variable for projectile weapons.
    Specified in KFMeleeFire's hitDamageClass variable for melee weapons.


All information here will reference these base classes (even when the variable in question is only defined in a derived class) unless strictly necessary, simply to inform the reader on the type of class rather than the class itself. For example, the ItemName variable is mentioned as belonging to WeaponPickup, however it is actually defined in KFWeaponPickup. Click the variable name to find the class it is in.

Common attributes

Name

In order to rename a weapon you will want to alter several variables, as they are all used in different places:

  • ItemName (#Weapon)  — The HUD itself where the current weapon name is displayed.
  • ItemName (#WeaponPickup)  — The purchase panel in the shop.
  • ItemShortName (#WeaponPickup)  — The inventory panel in the shop. This is meant to be a short version of the name due to the reduced area the text is displayed in.

Automatic & semi-automatic firing

Changing between automatic and semi-automatic is just a case of modifying a variable indicating if the trigger should be released before a consecutive shot can be fired (true = semi-automatic, false = automatic):

Damage

Damage is determined depending on whether the fire mode is an hitscan (such as the 9mm's primary fire) or whether the weapon fires a projectile which deals damage itself (such as the crossbow and its arrow projectile):

  • DamageMax (#WeaponFire) - Used if the fire mode is hitscan (such as is the case with pistols).
  • Damage (#Projectile) - Used if the fire mode uses a projectile, the damage is specified in the projectile class itself.

Head shot damage is a little more complicated since several weapons implement this differently:

Rate of fire

You may want to alter both of these variables since they are related:

  • Rate of fire. This is actually how many seconds between each shot (0.5 is 2 rounds a second):

    class'SingleFire'.default.FireRate = 0.175;

  • Animation speed for the firing animation. It is used as a multiplier for the animation's default speed (0.5 is half speed, 1 is full speed, 2 is double speed):

    class'SingleFire'.default.FireAnimRate = 1.5;

Recoil

If altering the rate of fire you will especially want to alter the recoil:

  • Rate of recoil itself. This is how often the recoil is applied (again, it's the amount of seconds between applying recoil), and should be less than the rate of fire:

    class'SingleFire'.default.RecoilRate = 0.07;

  • Maximum vertical recoil angle:

    class'SingleFire'.default.MaxVerticalRecoilAngle = 300;

  • Maximum horizontal recoil angle. This is generally less than the vertical recoil:

    class'SingleFire'.default.MaxHorizontalRecoilAngle = 50;

Accuracy

A couple of spread variables are used to affect the accuracy of the weapon. Generally since Killing Floor doesn't have crosshairs, the initial spread value is low in order to make at least the first shot very accurate:

  • Spread base value. This is how much initial spread is applied when the weapon starts firing:

    class'SingleFire'.default.Spread = 0.015;

  • Maximum spread. This affects the limit that the spread can reach. After each consecutive shot within 0.5 seconds this value divided by six is added to the current spread value, meaning within 6 shots (if they all have less than a half-second gap between each other) you will reach the maximum spread:

    class'SingleFire'.default.MaxSpread = 0.12;

Aiming

Any weapon can have the ability to zoom (ironsights or scope), and these variables affect the intensity (and whether the weapon can zoom):

  • Whether the weapon (or other item, such as binoculars) has zooming capability.

    class'Single'.default.bHasAimingMode = true;

  • How the weapon appears while not zoomed in. This affects how much of the weapon (and attached arms) is in view, and consequently affects the apparent size of the weapon. It is defined as an angle describing the field-of-view of the weapon. A higher value results in the weapon being displayed further from the camera, and thus more of the model will be shown.

    class'Single'.StandardDisplayFOV = 70.0;

  • Intensity of the zoom effect (how far it zooms). Again, defined as a FOV angle. A lower value results in a higher magnification zoom.

    class'Single'.ZoomedDisplayFOV = 65.0;

  • How the weapon appears when zoomed in. Again, defined as a FOV angle. Usually it's best to have this at least slightly higher than the original view angle, meaning the weapon won't take up as much room on the screen, making it easier to aim.

    class'Single'.PlayerIronSightFOV = 75.0;

Ammunition

Several ammunition variables are used to specify:

  • Maximum ammo for the weapon.

    class'SingleAmmo'.default.MaxAmmo = 240;

  • Initial ammo when the weapon is spawned or purchased.

    class'SingleAmmo'.default.InitialAmount = 120;

  • How much ammo the weapon gains when you pick up a generic ammo container.

    class'SingleAmmo'.default.AmmoPickupAmount = 30;

  • How much ammo the weapon gains when you pick up a specific ammo container (9mm rounds for example)

    class'SingleAmmoPickup'.default.AmmoAmount = 20;

Pickup message

This message appears when you pick up this weapon:

class'SinglePickup'.default.PickupMessage = "You got the 9mm handgun";

Trader

Here are the important variables used by the shop (trader):