Commands/Lua

Reference for console commands, Lua hooks and Lua commands in CS2D.

CS2D Command CS2D Console Commands

CS2D Command mp_kevlar

Categories

Parameters

  • percent (0.0-1.0): percentage (0.0=0%, 1.0=100%) of damage which will be absorbed by kevlar

Info

Controls how much damaged is absorbed by kevlar vests.
The internal calculation depends on this setting, the damage value and the armor points you have left.

Possible values range from 0.0 to 1.0 with:
0.0 = no protection (0%)
1.0 = best protection (100%)

the default value is 0.3 (30% protection)

The internal damage calculation works like described below in pseudo code.

// AP = armor points of the hit player
// HP = health points of the hit player
// DMG = damage the player receives
// MAX(X,Y) = returns the bigger of both values
// MIN(X,Y) = returns the smaller of both values (used here to keep value always >= 0)

// Calculate shielded damage
SHIELDED = MIN(DMG, AP)

// Reduce AP by shielded damage
AP = MAX(AP - SHIELDED, 0)

// Reduce HP by percentage of shielded damage (controlled by mp_kevlar)
HP = MAX(HP - (SHIELDED * (1.0 - mp_kevlar)), 0)

// Reduce HP by remaining unshielded damage (full damage)
DMG = DMG - SHIELDED
HP = MAX(HP - DMG, 0)

Lua Hook Lua Hooks

Lua Command Lua Commands