Weapon reference (Killing Floor): Difference between revisions

From Tripwire Interactive Wiki
Jump to navigation Jump to search
(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...")
 
No edit summary
Line 15: Line 15:
* {{Anchor|Ammunition}}'''[[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'.<br/><br/>Specified in '''WeaponFire''''s ''AmmoClass'' variable.<br/>Specified in '''Ammo''''s ''InventoryType'' variable.<br/>
* {{Anchor|Ammunition}}'''[[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'.<br/><br/>Specified in '''WeaponFire''''s ''AmmoClass'' variable.<br/>Specified in '''Ammo''''s ''InventoryType'' variable.<br/>
<br/>
<br/>
* {{Anchor|Ammo}}'''[[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'.<br/><br/>Specified in '''Ammunition''''s ''PickupClass'' variable.<br/>
* {{Anchor|Ammo}}'''[[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'.<br/><br/>Specified in '''Ammunition''''s ''PickupClass'' variable.<br/>
<br/>
<br/>
* {{Anchor|Projectile}}'''[[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'.<br/><br/>Specified in '''WeaponFire''''s ''ProjectileClass'' variable.<br/>
* {{Anchor|Projectile}}'''[[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'.<br/><br/>Specified in '''WeaponFire''''s ''ProjectileClass'' variable.<br/>
Line 43: Line 43:
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):
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):


* [[InstantFire|DamageMax]] ([[#WeaponFire]]) - Used if the fire mode is hitscan (such as is the case with pistols).
* [[InstantFire|DamageMax]] ([[#WeaponFire]]) &nbsp;— Used if the fire mode is hitscan (such as is the case with pistols).
* [[Projectile|Damage]] ([[#Projectile]]) - Used if the fire mode uses a projectile, the damage is specified in the projectile class itself.
* [[Projectile|Damage]] ([[#Projectile]]) &nbsp;— 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:
Head shot damage is a little more complicated since several weapons implement this differently:


* [[KFWeaponDamageType|HeadShotDamageMult]] ([[#DamageType]]) - Most weapons (all hitscan weapons and some projectile weapons) use this.
* [[KFWeaponDamageType|HeadShotDamageMult]] ([[#DamageType]]) &nbsp;— Most weapons (all hitscan weapons and some projectile weapons) use this.
* HeadShotDamageMult ([[CrossbowArrow]], [[M99Bullet]], [[CrossbuzzsawBlade]]) - Specified in specific projectile classes.
* HeadShotDamageMult ([[CrossbowArrow]], [[M99Bullet]], [[CrossbuzzsawBlade]]) &nbsp;— Specified in specific projectile classes.


=== Rate of fire ===
=== Rate of fire ===
Line 55: Line 55:
You may want to alter both of these variables since they are related:
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):<br/><blockquote><code>class'SingleFire'.default.FireRate = 0.175;</code></blockquote>
* [[WeaponFire|FireRate]] ([[#WeaponFire]]) &nbsp;— Rate of fire. This is actually how many seconds between each shot (0.5 is 2 rounds a second).
* 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):<br/><blockquote><code>class'SingleFire'.default.FireAnimRate = 1.5;</code></blockquote>
* [[WeaponFire|FireAnimRate]] ([[#WeaponFire]]) &nbsp;— 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 ===
=== Recoil ===
Line 62: Line 62:
If altering the rate of fire you will especially want to alter the 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:<br/><blockquote><code>class'SingleFire'.default.RecoilRate = 0.07;</code></blockquote>
* [[KFFire|RecoilRate]] ([[#WeaponFire]]) &nbsp;— 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.
* Maximum vertical recoil angle:<br/><blockquote><code>class'SingleFire'.default.MaxVerticalRecoilAngle = 300;</code></blockquote>
* [[KFFire|MaxVerticalRecoilAngle]] ([[#WeaponFire]]) &nbsp;— Maximum vertical recoil angle.
* Maximum horizontal recoil angle. This is generally less than the vertical recoil:<br/><blockquote><code>class'SingleFire'.default.MaxHorizontalRecoilAngle = 50;</code></blockquote>
* [[KFFire|MaxHorizontalRecoilAngle]] ([[#WeaponFire]]) &nbsp;— Maximum horizontal recoil angle. This is generally less than the vertical recoil.


=== Accuracy ===
=== Accuracy ===
Line 70: Line 70:
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:
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:<br/><blockquote><code>class'SingleFire'.default.Spread = 0.015;</code></blockquote>
* [[WeaponFire|Spread]] ([[#WeaponFire]]) &nbsp;— Spread base value. This is how much initial spread is applied when the weapon starts firing.
* 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:<br/><blockquote><code>class'SingleFire'.default.MaxSpread = 0.12;</code></blockquote>
* [[KFFire|MaxSpread]] ([[#WeaponFire]]) &nbsp;— 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 ===
=== Aiming ===
Line 77: Line 77:
Any weapon can have the ability to zoom (ironsights or scope), and these variables affect the intensity (and whether the weapon can zoom):
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.<br/><blockquote><code>class'Single'.default.bHasAimingMode = true;</code></blockquote>
* [[KFWeapon|bHasAimingMode]] ([[#Weapon]]) &nbsp;— Whether the weapon (or other item, such as binoculars) has zooming capability.
* 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.<br/><blockquote><code>class'Single'.StandardDisplayFOV = 70.0;</code></blockquote>
* [[KFWeapon|StandardDisplayFOV]] ([[#Weapon]]) &nbsp;— 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.
* Intensity of the zoom effect (how far it zooms). Again, defined as a FOV angle. A lower value results in a higher magnification zoom.<br/><blockquote><code>class'Single'.ZoomedDisplayFOV = 65.0;</code></blockquote>
* [[KFWeapon|ZoomedDisplayFOV]] ([[#Weapon]]) &nbsp;— Intensity of the zoom effect (how far it zooms). Again, defined as a FOV angle. A lower value results in a higher magnification zoom.
* 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.<br/><blockquote><code>class'Single'.PlayerIronSightFOV = 75.0;</code></blockquote>
* [[KFWeapon|PlayerIronSightFOV]] ([[#Weapon]]) &nbsp;— 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 ===
=== Ammunition ===
Line 86: Line 86:
Several ammunition variables are used to specify:
Several ammunition variables are used to specify:


* Maximum ammo for the weapon.<br/><blockquote><code>class'SingleAmmo'.default.MaxAmmo = 240;</code></blockquote>
* [[Ammunition|MaxAmmo]] ([[#Ammunition]]) &nbsp;— Maximum ammo for the weapon.
* Initial ammo when the weapon is spawned or purchased.<br/><blockquote><code>class'SingleAmmo'.default.InitialAmount = 120;</code></blockquote>
* [[Ammunition|InitialAmount]] ([[#Ammunition]]) &nbsp;— Initial ammo when the weapon is spawned or purchased.
* How much ammo the weapon gains when you pick up a generic ammo container.<br/><blockquote><code>class'SingleAmmo'.default.AmmoPickupAmount = 30;</code></blockquote>
* [[KFAmmunition|AmmoPickupAmount]] ([[#Ammunition]]) &nbsp;— How much ammo the weapon gains when you pick up a generic ammo container.
* How much ammo the weapon gains when you pick up a specific ammo container (9mm rounds for example)<br/><blockquote><code>class'SingleAmmoPickup'.default.AmmoAmount = 20;</code></blockquote>
* [[Ammo|AmmoAmount]] ([[#Ammo]]) &nbsp;— How much ammo the weapon gains when you pick up a specific ammo container (9mm rounds for example).


=== Pickup message ===
=== Pickup message ===


This message appears when you pick up this weapon:
* [[Pickup|PickupMessage]] ([[#WeaponPickup]]) &nbsp;— Message that appears when you pick up this weapon.
 
<blockquote><code>class'SinglePickup'.default.PickupMessage = "You got the 9mm handgun";</code></blockquote>


=== Trader ===
=== Trader ===


Here are the important variables used by the shop (trader):
Here are the important variables used by the shop (trader):
* [[KFWeaponPickup|Cost]] ([[#WeaponPickup]]) &nbsp;— Amount of cash required to purchase this weapon (standard weapons usually have no cost).
* [[KFWeaponPickup|AmmoCost]] ([[#WeaponPickup]]) &nbsp;— Cost for an ammo clip.
* [[KFWeaponPickup|BuyClipSize]] ([[#WeaponPickup]]) &nbsp;— Size of a purchased ammo clip.
Additionally there are three variables to control the displayed statistics, with a maximum value of 100:
* [[KFWeaponPickup|PowerValue]] ([[#WeaponPickup]]) &nbsp;— How much damage the weapon deals.
* [[KFWeaponPickup|SpeedValue]] ([[#WeaponPickup]]) &nbsp;— How often the weapon can fire.
* [[KFWeaponPickup|RangeValue]] ([[#WeaponPickup]]) &nbsp;— The effective range of the weapon.
=== Inventory information ===
These are variables to control specific aspects of the weapons in your inventory.
* [[Inventory|InventoryGroup]] ([[#Weapon]]) &nbsp;— 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.
* [[Inventory|GroupOffset]] ([[#Weapon]]) &nbsp;— Controls where in the group the inventory item appears (and thus the order of items when cycling through them).
* [[Weapon|Priority]] ([[#Weapon]]) &nbsp;— 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).
* [[KFWeapon|Weight]] ([[#Weapon]]) &nbsp;— Weight. Standard equipment such as the knife, 9mm, syringe, and welder usually has a weight of zero.
* [[KFWeaponPickup|Weight]] ([[#WeaponPickup]]) &nbsp;— Same as above. Both variables must be set since they are used in different functions.
* [[KFWeapon|bKFNeverThrow]] ([[#Weapon]]) &nbsp;— 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.


{{KFDevNavBox}}
{{KFDevNavBox}}
[[Category:Killing Floor]]

Revision as of 13:29, 27 November 2012

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.