Types & Constants ​
Vec2/vec3 math types and the named constant tables (modifier_flag, slot, bone, hero_id).
vec3 ​
3D vector. Returned by position queries and used as input to drawing functions.
local v = vec3(100, 200, 50)
v.x, v.y, v.z -- field access| Method | Returns | Description |
|---|---|---|
v:length() | number | Magnitude |
v:length_2d() | number | XY magnitude (ignores Z) |
v:normalized() | vec3 | Unit vector |
v:dot(other) | number | Dot product |
v:cross(other) | vec3 | Cross product |
v:distance(other) | number | Distance to another point |
v:angle_to(other) | number | Angle in degrees |
v:empty() | boolean | True if all zero |
Operators: v + other, v - other, v * scalar.
vec2 ​
2D vector. Same operators as vec3 minus cross. Use vec2(x, y) to construct.
modifier_flag ​
Status flags you can check via player:has_modifier_flag(...). There are 303 in total; below are the ones most scripts use. For the complete list see Modifier Flags Reference.
if player:has_modifier_flag(modifier_flag.STUNNED) then ... endYou can also use the string shorthand: player:is_("stunned").
| Flag | Value |
|---|---|
IMMOBILIZED | 11 |
DISARMED | 12 |
MUTED | 13 |
ITEMS_DISABLED | 14 |
SILENCED | 15 |
SILENCE_MOVEMENT_ABILITES | 16 |
STUNNED | 18 |
INVULNERABLE | 19 |
STATUS_IMMUNE | 24 |
UNSTOPPABLE | 25 |
COMMAND_RESTRICTED | 28 |
CHARGING | 29 |
OBSCURED | 30 |
INVISIBLE_TO_ENEMY | 31 |
INVISIBLE_TO_ENEMY_CAST | 32 |
SPRINTING | 35 |
UNKILLABLE | 36 |
IN_SHOP | 45 |
IN_FOUNTAIN | 46 |
DASH_DISABLED | 52 |
BURNING | 54 |
SLOWED | 61 |
SHOOTING_DISABLED | 62 |
SLIDING | 65 |
VISIBLE_TO_ENEMY | 68 |
IS_ASLEEP | 75 |
USING_ZIPLINE | 84 |
BULLET_INVULNERABLE | 92 |
MELEE_DISABLED | 106 |
GLITCHED | 109 |
RELOAD_DISABLED | 112 |
FLYING | 119 |
SCOPED | 120 |
VISCOUS_CUBED | 122 |
IN_COMBAT | 163 |
YAMATO_SHADOW_FORM | 166 |
FROZEN | 193 |
PARRY_ACTIVE | 219 |
WEREWOLF | 260 |
Caveat ​
Not every flag is populated by the engine in every situation. Some flags are set reliably and broadly (e.g. STUNNED fires for almost every hard stun: Knockdown, Cursed Relic, Dynamo ult, etc., and INVISIBLE_TO_ENEMY fires for Smoke Bomb, Shadow Weave, etc.). Others may not fire at all even when the player is clearly in that state. Examples we've seen in testing:
SLIDINGmay not be set while a player is slidingUSING_ZIPLINEmay not be set while a player is on a ziplineIS_IN_CHARGE_MELEEmay not be set during a heavy charged meleeSLOWEDandBURNINGare inconsistent: some sources set them, others apply the effect via stat modifiers without ever tripping the flag
The full list of 303 flags is exposed for completeness. Some of them may turn out to be set by items or interactions we haven't tested, so they're available if you discover one that's useful. But test before you ship. Use the Debugging Modifiers workflow to confirm the flag actually flips during the effect you care about. If it doesn't, fall back to player:get_modifiers() and match by name or token directly.
slot ​
Ability, item, and action slot indexes.
| Constant | Value | Description |
|---|---|---|
slot.ability1 | 0 | Hero ability 1 |
slot.ability2 | 1 | Hero ability 2 |
slot.ability3 | 2 | Hero ability 3 |
slot.ability4 | 3 | Ultimate |
slot.item1 | 4 | Active item 1 |
slot.item2 | 5 | Active item 2 |
slot.item3 | 6 | Active item 3 |
slot.item4 | 7 | Active item 4 |
slot.held | 8 | Currently-held / channeled action |
slot.zipline | 9 | Zipline ride |
slot.mantle | 10 | Mantle (ledge grab) |
slot.climb_rope | 11 | Climb rope |
slot.jump | 12 | Jump |
slot.slide | 13 | Slide |
slot.teleport | 14 | Teleport |
slot.zipline_boost | 15 | Zipline boost |
slot.innate1 | 16 | Innate ability 1 |
slot.innate2 | 17 | Innate ability 2 |
slot.innate3 | 18 | Innate ability 3 |
slot.weapon_secondary | 19 | Secondary weapon |
slot.weapon_primary | 20 | Primary weapon |
slot.weapon_melee | 21 | Melee weapon |
Slots 0-3 are abilities, 4-7 are items, 8-21 are action/weapon slots. Abilities and items are sequential. for i = slot.ability1, slot.ability4 do ... end iterates 0,1,2,3 and for i = slot.item1, slot.item4 do ... end iterates 4,5,6,7.
local key = slot_to_key(slot.ability3)
input.press_key(key)bone ​
String constants for player:bone_pos(...) and the targeting helpers. Bones are parsed from Deadlock's game files at startup; custom mods and Deadlock Mod Manager are supported and bones from custom models will be parsed correctly in most cases.
local head_pos = player:bone_pos("head") -- string literal works
local head_pos = player:bone_pos(bone.head) -- bone.head == "head"
local head_pos = player:bone_pos(7) -- raw integer index, legacyNames are case-insensitive: "arm_upper_L" and "arm_upper_l" both resolve to the same bone.
Named aliases ​
These standard aliases map to specific VPK bones with fallback chains. If the primary bone isn't present on a hero's model, the alias falls back to the next one in the chain. Use these unless you need a bone that isn't in the alias list.
| Alias | Primary bone | Fallback chain |
|---|---|---|
bone.head | head | (exact only) |
bone.neck | neck_0 | first neck_N |
bone.chest | spine_3 | spine_2 → spine_1 → spine_0 |
bone.lower_chest | spine_2 | spine_1 → chest result |
bone.stomach | spine_0 | spine_1 |
bone.pelvis | pelvis | (exact only) |
Body bones ​
All standard humanoid body bones are available as bone.* constants. These don't have fallback chains; if the model doesn't have the bone, bone_pos returns nil.
| Constant | Value |
|---|---|
bone.clavicle_l, bone.clavicle_r | "clavicle_l", "clavicle_r" |
bone.arm_upper_l, bone.arm_upper_r | "arm_upper_l", "arm_upper_r" |
bone.arm_lower_l, bone.arm_lower_r | "arm_lower_l", "arm_lower_r" |
bone.hand_l, bone.hand_r | "hand_l", "hand_r" |
bone.leg_upper_l, bone.leg_upper_r | "leg_upper_l", "leg_upper_r" |
bone.leg_lower_l, bone.leg_lower_r | "leg_lower_l", "leg_lower_r" |
bone.ankle_l, bone.ankle_r | "ankle_l", "ankle_r" |
bone.ball_l, bone.ball_r | "ball_l", "ball_r" |
To discover all bones on a specific model at runtime, use player:bone_names(). The full body bone set varies between heroes (some have ears, tails, weapon bones, etc.).
Raw spine bones ​
The aliases above (bone.chest, bone.lower_chest, bone.stomach) map to spine bones with fallback chains. The raw bones are also exposed as constants if you want to target a specific vertebra without the fallback:
| Constant | Value |
|---|---|
bone.spine_0 | "spine_0" (stomach) |
bone.spine_1 | "spine_1" |
bone.spine_2 | "spine_2" (lower chest) |
bone.spine_3 | "spine_3" (chest) |
bone.neck_0 | "neck_0" (neck) |
Notes ​
- Bone probing only runs on enemies. Calling
bone_poson a teammate falls back to the player's origin position. - See Debugging Modifiers for the in-menu bone label overlay that shows every bone on a hero in real time.
hero_id ​
Hero identifier passed at script load.
| Constant | Value | Meaning |
|---|---|---|
hero_id.any | -1 | Script applies to any hero (the default if id is omitted) |
hero_id.none | 0 | No hero selected, used by the engine; not typically set from scripts |
All real hero IDs are positive integers (1+, non-sequential, e.g. infernus is 1, abrams is 6, pocket is 50). Scripts gating on hero can compare numerically: if id > 0 then -- valid hero end.
id = hero_id.any -- script runs regardless of which hero is selectedNumeric hero IDs are exposed via player:get_hero_id() for runtime checks. Use print(player:hero_name(), player:get_hero_id()) to discover values for heroes you want to gate logic on.
VK codes (common) ​
Windows virtual-key codes for input.*. Full list at Microsoft's docs.
| Code | Key |
|---|---|
0x01 | Left mouse |
0x02 | Right mouse |
0x04 | Middle mouse |
0x05 | Mouse 4 |
0x06 | Mouse 5 |
0x10 | Shift |
0x11 | Ctrl |
0x12 | Alt |
0x20 | Space |
0x70-0x7B | F1-F12 |
0x41-0x5A | A-Z |
0x30-0x39 | 0-9 |