Headshot mechanics (Killing Floor)

From Tripwire Interactive Wiki
Jump to navigation Jump to search

“Aiming for the head is a good idea. If you score a critical headshot, you can remove a Specimen's head, rendering them unable to use special abilities, and increasing any further damage they take.”

– Loading screen hint

A weapon's headshot multiplier is applied by the pawn taking damage, except in the case of the CrossbowArrow, M99Bullet, and CrossbuzzsawBlade classes, which apply it themselves before passing to the pawn's TakeDamage() function. In any case, the headshot mechanics are identical.

Headshot detection

Only damagetypes with bCheckForHeadShots set to true will have headshot detection enabled (otherwise the pawn will take regular damage). Obviously, specimens that have already been decapitated skip the check. Melee weapons perform the headshot check with a 25% larger head area, making it easier to hit.

When a specimen (pawn) takes damage, a line is traced from the impact point (a point on the collision cylinder) and an equation is used to determine if it passes through the head sphere. Just to be clear, it doesn't matter at which point or angle the shot is taken from, as long as the trace line passes through the head detection area (you always shoot through the collision cylinder).

It should be noted that on a dedicated server a pawn's standard animations (walk, run, strafe) aren't played server-side, so the server must make an approximation when calculating where the head is. For the falling, crouch walking, and swimming animations the server sets the pawn's animation to the midpoint of said animation. In other cases two variables, OnlineHeadshotOffset and OnlineHeadshotScale are used to approximate the location of the head:

KFMonster.uc IsHeadShot():
HeadLoc = Location + (OnlineHeadshotOffset >> Rotation); AdditionalScale *= OnlineHeadshotScale;

Effects

If a headshot is detected, the damage is multiplied with damagetype's HeadShotDamageMult value, which has already been multiplied by the current perk's headshot multiplier. This value is then subtracted from the specimen's health and head health. If the resulting health or head health is zero or lower, decapitation occurs. If using a relevant weapon, the player's headshot counter is immediately increased.

After decapitation, specimens receive the BRAINS_Retarded intelligence value, and will stumble around, losing their special abilities. After a set period the specimen will automatically die.