Skip to content

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.

lua
local v = vec3(100, 200, 50)
v.x, v.y, v.z  -- field access
MethodReturnsDescription
v:length()numberMagnitude
v:length_sqr()numberSquared magnitude (cheaper than length())
v:length_2d()numberXY magnitude (ignores Z)
v:normalized()vec3Unit vector
v:dot(other)numberDot product
v:cross(other)vec3Cross product
v:distance(other)numberDistance to another point
v:angle_to(other)numberAngle in degrees
v:empty()booleanTrue if all zero

Operators: v + other, v - other, v * scalar, v / scalar.

vec2 ​

2D vector. Same operators as vec3 minus cross (+, -, *, /). Use vec2(x, y) to construct.

MethodReturnsDescription
v:length()numberMagnitude
v:length_sqr()numberSquared magnitude (cheaper than length())
v:normalized()vec2Unit vector
v:dot(other)numberDot product
v:distance(other)numberDistance to another point
v:angle_to(other)numberAngle in degrees (atan2)
v:empty()booleanTrue if both components are zero

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.

lua
if player:has_modifier_flag(modifier_flag.STUNNED) then ... end

There is no string shorthand for modifier_flag checks. player:is_(flag) requires an integer (a player_flag bitmask such as player_flag.onground); passing a string throws a Lua error via luaL_checkinteger. To check a modifier by name string, use player:has_modifier("stunned") instead.

FlagValue
IMMOBILIZED11
DISARMED12
MUTED13
ITEMS_DISABLED14
SILENCED15
SILENCE_MOVEMENT_ABILITES16
STUNNED18
INVULNERABLE19
STATUS_IMMUNE24
UNSTOPPABLE25
COMMAND_RESTRICTED28
CHARGING29
OBSCURED30
INVISIBLE_TO_ENEMY31
INVISIBLE_TO_ENEMY_CAST32
SPRINTING35
UNKILLABLE36
IN_SHOP45
IN_FOUNTAIN46
DASH_DISABLED52
BURNING54
SLOWED61
SHOOTING_DISABLED62
SLIDING65
VISIBLE_TO_ENEMY68
IS_ASLEEP75
USING_ZIPLINE84
BULLET_INVULNERABLE92
MELEE_DISABLED106
GLITCHED109
RELOAD_DISABLED112
FLYING119
SCOPED120
VISCOUS_CUBED122
IN_COMBAT163
YAMATO_SHADOW_FORM166
FROZEN193
PARRY_ACTIVE219
WEREWOLF260

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:

  • SLIDING may not be set while a player is sliding
  • USING_ZIPLINE may not be set while a player is on a zipline
  • IS_IN_CHARGE_MELEE may not be set during a heavy charged melee
  • SLOWED and BURNING are 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.

ConstantValueDescription
slot.ability10Hero ability 1
slot.ability21Hero ability 2
slot.ability32Hero ability 3
slot.ability43Ultimate
slot.item14Active item 1
slot.item25Active item 2
slot.item36Active item 3
slot.item47Active item 4
slot.held8Currently-held / channeled action
slot.zipline9Zipline ride
slot.mantle10Mantle (ledge grab)
slot.climb_rope11Climb rope
slot.jump12Jump
slot.slide13Slide
slot.teleport14Teleport
slot.zipline_boost15Zipline boost
slot.cosmetic116Cosmetic slot 1
slot.innate117Innate ability 1
slot.innate218Innate ability 2
slot.innate319Innate ability 3
slot.weapon_secondary20Secondary weapon
slot.weapon_primary21Primary weapon
slot.weapon_melee22Melee weapon

Slots 0-3 are abilities, 4-7 are items, 8-22 are action/weapon slots. 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.

lua
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 are parsed when the model ships standard VPK skeleton names.

lua
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, legacy

Names 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.

AliasPrimary boneFallback chain
bone.headhead(exact only)
bone.neckneckneck_0 (no further fallback)
bone.chestspine_3spine_2 → spine_1 → spine_0
bone.lower_chestspine_2spine_1 → chest result
bone.stomachspine_0spine_1
bone.pelvispelvis(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.

ConstantValue
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:

ConstantValue
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_pos on 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 and returned by player:get_hero_id().

lua
id = hero_id.any  -- script runs regardless of which hero is selected

-- Gate logic on a specific hero at runtime:
local lp = local_player()
if lp and lp:get_hero_id() == hero_id.haze then ... end
ConstantValue
hero_id.any-1
hero_id.none0
hero_id.infernus1
hero_id.seven2
hero_id.vindicta3
hero_id.ladygeist4
hero_id.abrams6
hero_id.wraith7
hero_id.mcginnis8
hero_id.paradox10
hero_id.dynamo11
hero_id.kelvin12
hero_id.haze13
hero_id.holliday14
hero_id.bebop15
hero_id.calico16
hero_id.greytalon17
hero_id.moandkrill18
hero_id.shiv19
hero_id.ivy20
hero_id.warden25
hero_id.yamato27
hero_id.lash31
hero_id.viscous35
hero_id.pocket50
hero_id.mirage52
hero_id.dummy55
hero_id.viper58
hero_id.vyper58
hero_id.sinclair60
hero_id.mina63
hero_id.drifter64
hero_id.venator65
hero_id.victor66
hero_id.paige67
hero_id.doorman69
hero_id.billy72
hero_id.graves76
hero_id.apollo77
hero_id.rem79
hero_id.silver80
hero_id.celeste81

hero_id.viper and hero_id.vyper are the same value (58). IDs are non-sequential; not all integers in the range are assigned. Use print(player:hero_name(), player:get_hero_id()) at runtime to discover values for heroes not yet listed.

bucket ​

Item upgrade bucket categories. Returned as ActiveItemInfo.bucket and accepted by any API that filters by upgrade tier.

ConstantValueDescription
bucket.innate0Innate / passive
bucket.weapon1Weapon
bucket.vitality2Vitality
bucket.spirit3Spirit
lua
local items = player:get_active_items()
for _, item in ipairs(items) do
    if item.bucket == bucket.weapon then
        print("weapon item:", item.name)
    end
end

modifier_token ​

Named subclass token IDs for well-known modifiers. Pass to player:has_modifier(token) or compare against ModifierInfo.token. Values are uint32 constants.

lua
if player:has_modifier(modifier_token.knockdown) then
    print("target is knocked down")
end
ConstantValue
modifier_token.knockdown0x4ABFEA98
modifier_token.bebop_sticky_bomb0x96512C8E
modifier_token.lash_death_slam0x17A9E77A
modifier_token.warden_binding_word0x62C27FFE
modifier_token.paige_captivating_read0xB6177F0A
modifier_token.seven_static_charge0x400ED943
modifier_token.doorman_call_bell0x062B3CCC
modifier_token.viktor_rebirth0xD04073B3
modifier_token.calico_cat0x3C249027
modifier_token.mo_burrow0x8F74398D
modifier_token.rem_ability0x5D82ADA5

player_flag ​

Player entity flags (FL_* bitfield). Test with player:is_(flag). Values are bitmasks (1<<N), not raw bit indices - do not pass them to has_modifier_flag.

lua
if player:is_(player_flag.onground) then
    print("player is on the ground")
end
ConstantValueBit
player_flag.onground11<<0
player_flag.ducking21<<1
player_flag.waterjump41<<2
player_flag.frozen321<<5
player_flag.atcontrols641<<6
player_flag.client1281<<7
player_flag.fakeclient2561<<8
player_flag.fly163841<<14
player_flag.godmode327681<<15
player_flag.notarget655361<<16
player_flag.aimtarget1310721<<17
player_flag.staticprop2621441<<18
player_flag.grenade5242881<<19
player_flag.donttouch10485761<<20
player_flag.basevelocity20971521<<21
player_flag.worldbrush41943041<<22
player_flag.object83886081<<23
player_flag.onfire335544321<<25
player_flag.dissolving671088641<<26
player_flag.transragdoll1342177281<<27
player_flag.unblockable_by_player2684354561<<28

VK codes (common) ​

Windows virtual-key codes for input.*. Full list at Microsoft's docs.

The overlay exposes a VK table with named constants so you don't have to remember raw hex values:

lua
-- Named constants
input.is_key_held(VK.LBUTTON)   -- left mouse
input.is_key_held(VK.SHIFT)     -- Shift
input.is_key_held(VK.F)         -- F key
input.is_key_held(VK.LCONTROL)  -- Left Ctrl

-- Raw hex works too
input.is_key_held(0x01)
ConstantCodeKey
VK.LBUTTON0x01Left mouse
VK.RBUTTON0x02Right mouse
VK.MBUTTON0x04Middle mouse
VK.XBUTTON10x05Mouse 4
VK.XBUTTON20x06Mouse 5
VK.RETURN0x0DEnter / Return
VK.SHIFT0x10Shift
VK.CONTROL0x11Ctrl (either)
VK.ESCAPE0x1BEscape
VK.SPACE0x20Space
VK.KEY_0-VK.KEY_90x30-0x39Digit keys 0-9
VK.A-VK.Z0x41-0x5AA-Z
VK.F1-VK.F120x70-0x7BF1-F12
VK.LCONTROL0xA2Left Ctrl

Not affiliated with Valve Corporation.