Weapon reference (Killing Floor)

From Tripwire Interactive Wiki
Jump to: navigation, 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 - 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.

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:

  • 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)

Recoil

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

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 (#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.

Aiming

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.

Ammunition

Several ammunition variables are used to specify:

Pickup message

Trader

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

Additionally there are three variables to control the displayed statistics, with a maximum value of 100:

Inventory information

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.

Example

CustomShotgun.uc:

class CustomShotgun extends Shotgun;

defaultproperties { ItemName="Rocket Shotgun" MagCapacity=9 FireModeClass(0)=class'CustomShotgunFire' PickupClass=class'CustomShotgunPickup' }

CustomShotgunFire.uc:

class CustomShotgunFire extends ShotgunFire;

defaultproperties { ProjectileClass=class'KFMod.LAWProj' ProjPerFire=2 }

CustomShotgunPickup.uc:

class CustomShotgunPickup extends ShotgunPickup;

defaultproperties { ItemName="Rocket Shotgun" ItemShortName="Rocket Shotgun" InventoryType=class'MyPackage.CustomShotgun' PickupMessage="You got the Rocket Shotgun." }

MyMutator.uc:

class MyMutator extends Mutator;

function ModifyPlayer(Pawn Player) { Super.ModifyPlayer(Player); Player.GiveWeapon("MyPackage.CustomShotgun"); }

defaultproperties { GroupName="KFMyMutator" FriendlyName="MyMutator" Description="..."

RemoteRole=ROLE_SimulatedProxy bAlwaysRelevant=true bAddToServerPackages=true }

External links

Weapons Technical Guide on UDN