Weapon reference (Killing Floor)
This page details the attributes (variables) and functionality used for weapons in Killing Floor.
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 - The pickup class for a particular weapon's ammunition. 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.
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):
- bWaitForRelease (#WeaponFire) — Indicates whether or not the trigger must be released between each shot.
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:
- HeadShotDamageMult (#DamageType) — Most weapons (all hitscan weapons and some projectile weapons) use this.
- HeadShotDamageMult (CrossbowArrow, M99Bullet, CrossbuzzsawBlade) — Specified in specific projectile classes.
Rate of fire
You may want to alter both of these variables since they are related:
- FireRate (#WeaponFire) — Rate of fire. This is actually how many seconds between each shot (0.5 is 2 rounds a second).
- FireAnimRate (#WeaponFire) — 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)
If altering the rate of fire you will especially want to alter the recoil:
- RecoilRate (#WeaponFire) — 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.
- MaxVerticalRecoilAngle (#WeaponFire) — Maximum vertical recoil angle.
- MaxHorizontalRecoilAngle (#WeaponFire) — Maximum horizontal recoil angle. This is generally less than the vertical recoil.
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 (#WeaponFire) — Spread base value. This is how much initial spread is applied when the weapon starts firing.
- MaxSpread (#WeaponFire) — 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.
Any weapon can have the ability to zoom (ironsights or scope), and these variables affect the intensity (and whether the weapon can zoom):
- bHasAimingMode (#Weapon) — Whether the weapon (or other item, such as binoculars) has zooming capability.
- StandardDisplayFOV (#Weapon) — 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.
- ZoomedDisplayFOV (#Weapon) — Intensity of the zoom effect (how far it zooms). Again, defined as a FOV angle. A lower value results in a higher magnification zoom.
- PlayerIronSightFOV (#Weapon) — 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.
Several ammunition variables are used to specify:
- MaxAmmo (#Ammunition) — Maximum ammo for the weapon.
- InitialAmount (#Ammunition) — Initial ammo when the weapon is spawned or purchased.
- AmmoPickupAmount (#Ammunition) — How much ammo the weapon gains when you pick up a generic ammo container.
- AmmoAmount (#Ammo) — How much ammo the weapon gains when you pick up a specific ammo container (9mm rounds for example).
Here are the important variables used by the shop (trader):
- Cost (#WeaponPickup) — Amount of cash required to purchase this weapon (standard weapons usually have no cost).
- AmmoCost (#WeaponPickup) — Cost for an ammo clip.
- BuyClipSize (#WeaponPickup) — Size of a purchased ammo clip.
Additionally there are three variables to control the displayed statistics, with a maximum value of 100:
- PowerValue (#WeaponPickup) — How much damage the weapon deals.
- SpeedValue (#WeaponPickup) — How often the weapon can fire.
- RangeValue (#WeaponPickup) — The effective range of the weapon.
These are variables to control specific aspects of the weapons in your inventory.
- InventoryGroup (#Weapon) — Determines which set of items it will appear in. A group value of 1 will put the item with the melee weapons, while a group value of 2 will put it with pistols, and so on.
- GroupOffset (#Weapon) — Controls where in the group the inventory item appears (and thus the order of items when cycling through them).
- Priority (#Weapon) — Determines whether a weapon will be switched to when picked up. If you pick up a weapon with a higher priority than the current weapon, it will be equiped. Additionally, this controls which weapon will be first equiped when you pick a new weapon group (for example, if you have your knife equiped and you switch to the pistols category, it will pick the weapon with the highest priority - the deagle if you have it).
- Weight (#Weapon) — Weight. Standard equipment such as the knife, 9mm, syringe, and welder usually has a weight of zero.
- Weight (#WeaponPickup) — Same as above. Both variables must be set since they are used in different functions.
- bKFNeverThrow (#Weapon) — Whether or not the item cannot be dropped or sold (true means it cannot, false means it can). All standard equipment sets this to true.