Skip to content

API Reference

Entities

World entities surfaced by the entity ESP. Read-only objects; obtain lists via the entities.* accessors (e.g. entities.get_pickups()).

Player

Obtained from local_player() or get_players()

FunctionReturnsDescription
p:get_health()floatCurrent health points
p:get_max_health()floatMaximum health points
p:get_health_percentage()floatHealth as percentage (0-100)
p:get_position()vec3World position of the player
p:get_velocity()vec3Current velocity vector
p:get_view_angles()vec2Player's eye angles as vec2(pitch, yaw). For local player this matches camera.get_view_angles(); for enemies it returns their networked eye direction.
p:get_bone_position(bone)vec3World position of a skeleton bone (use bone enum)
p:get_hero_id()intHero identifier (compare with hero_id enum)
p:get_team()intTeam number
p:get_distance(other?)floatDistance in meters. If other is nil, returns distance to local player.
p:is_alive()boolWhether the player is alive
p:is_visible()boolWhether the player is visible (not occluded)
p:is_valid()boolWhether the player entity is valid
p:is_on_screen()boolWhether the player is within screen bounds
p:is_scoped()boolWhether the player is scoped in
p:is_in_reload()boolWhether the player is reloading
p:is_enemy()boolWhether the player is on the enemy team
p:is_primary_weapon_active()boolWhether the primary weapon is active
p:is_in_melee_attack()boolWhether the player is performing a melee attack
p:is_(player_flag)boolCheck an engine-level entity flag (use player_flag enum)
p:get_modifier_flags()intRaw modifier flag bitmask
p:has_modifier_flag(modifier_flag)boolCheck a gameplay modifier flag (use modifier_flag enum)
p:has_modifier(name)boolCheck for a named modifier, e.g. "modifier_citadel_stunned"
p:get_modifier_names()tableTable of active modifiers. Each entry is { name = string, sub_names = table }.
p:get_modifier_count()intNumber of active modifiers
p:get_active_projectile_speed()floatProjectile speed of the currently active weapon
p:get_items()tableArray of item tables with fields: name, subclass, bucket, slot, cooldown
p:has_item(name)boolCheck if player owns an item by designer name, e.g. "upgrade_burst_fire"
p:get_item(name)table?Get item by designer name. Returns table with fields: name, subclass, bucket, slot, cooldown. Returns nil if not found.
p:get_item_count()intNumber of items owned
p:has_abilities()boolWhether ability data is available
p:get_ability(slot)table?Get ability info by slot enum (slot.ability1–slot.ability4 for abilities, slot.item1–slot.item4 for active items). Returns table with fields: name, slot, points, learned, cooldown, projectile_speed, range, is_ready, is_cooling_down, is_in_cast_delay, is_casting, is_channeling. Returns nil if slot is empty or abilities unavailable.
p:is_ability_ready(slot)boolCheck if ability at slot is available and off cooldown
p:is_targetable()boolCheck if player can be targeted (alive, valid, visible, not immune/urn/godmode)
p:get_abilities()tableAll abilities keyed by slot enum value. Each value is the same table format as get_ability().

Ability Table

Returned by p:get_ability(slot). Each table has these fields:

FieldTypeDescription
namestringAbility designer name
slotintSlot enum value
pointsintUpgrade points spent
learnedboolWhether the ability has been learned (points > 0)
cooldownfloatCooldown percentage (0-100)
projectile_speedfloatProjectile speed
rangefloatRange
is_readyboolCan be cast now
is_cooling_downboolOn cooldown
is_in_cast_delayboolIn cast animation
is_castingboolCurrently casting
is_channelingboolCurrently channeling

Item Table

Returned by p:get_items(). Each entry in the table has these fields:

FieldTypeDescription
namestringItem designer name
subclassstringItem subclass name
bucketintItem category (see bucket enum)
slotintInventory slot index
cooldownfloatCooldown percentage (0-100)

Base Structures

Guardians, walkers, the patron, shrines and generic lane buildings. From entities.get_base_structures().

FunctionReturnsDescription
bs:get_kind()intbase_structure_kind enum value for this structure
bs:get_label()stringReadable type label (e.g. "GUARDIAN", "WALKER", "PATRON")
bs:get_health()intCurrent health
bs:get_max_health()intMaximum health
bs:get_team()intTeam number
bs:get_distance()floatDistance from the local player, in meters
bs:get_position()vec3World-space origin
bs:is_alive()boolWhether the structure is alive
bs:is_enemy()boolWhether the structure belongs to the enemy team
bs:in_screen()boolWhether the structure projects on screen

Minions

Lane minions. From entities.get_minions().

FunctionReturnsDescription
mn:get_health()intCurrent health
mn:get_max_health()intMaximum health
mn:get_team()intTeam number
mn:get_distance()floatDistance from the local player, in meters
mn:get_position()vec3World-space origin
mn:is_alive()boolWhether the minion is alive
mn:is_enemy()boolWhether the minion belongs to the enemy team
mn:in_screen()boolWhether the minion projects on screen

Breakables

Crates, vases and objective pickups. From entities.get_breakables().

FunctionReturnsDescription
bk:get_kind()intbreakable_kind enum value
bk:get_label()stringReadable type label (e.g. "CRATE", "VASE", powerup variant)
bk:get_subclass_name()stringRaw Source2 subclass name
bk:get_distance()floatDistance from the local player, in meters
bk:get_position()vec3World-space origin
bk:is_destroyed()boolWhether the breakable has been destroyed/claimed
bk:in_screen()boolWhether the breakable projects on screen

Pickups

Permanent stat-buff drops and soul pickups. get_label() includes the tier. From entities.get_pickups().

FunctionReturnsDescription
pk:get_kind()intpickup_kind enum value
pk:get_label()stringReadable type label including tier (e.g. "COOLDOWN II", "SOUL")
pk:get_subclass_name()stringRaw Source2 subclass name
pk:get_distance()floatDistance from the local player, in meters
pk:get_position()vec3World-space origin
pk:is_destroyed()boolWhether the pickup has been collected/despawned
pk:in_screen()boolWhether the pickup projects on screen

Minigames

Sinner's Sacrifice slot machine. get_seconds_to_next_event() is the jackpot beat timer; is_hit_window_open() flags HIT NOW. From entities.get_minigames().

FunctionReturnsDescription
mg:get_health()intCurrent health
mg:get_max_health()intMaximum health
mg:get_state()intvault_state enum value
mg:get_state_label()stringReadable state label (e.g. "HIT NOW", "WAIT")
mg:is_critical()boolWhether the machine is in the critical (jackpot) state
mg:is_hit_window_open()boolWhether the HIT NOW window is currently open
mg:get_seconds_to_next_event()floatSeconds until the hit window opens (when closed) or closes (when open)
mg:get_cycle_time()floatFull cycle length in seconds
mg:get_hit_window()floatHit-window length in seconds
mg:get_distance()floatDistance from the local player, in meters
mg:get_position()vec3World-space origin
mg:is_destroyed()boolWhether the machine is gone or finishing
mg:in_screen()boolWhether the machine projects on screen

Jungle Camps

Neutral creeps (denizens / mid boss). From entities.get_jungle().

FunctionReturnsDescription
jg:get_kind()intjungle_kind enum value
jg:get_label()stringReadable type label
jg:get_health()intCurrent health
jg:get_max_health()intMaximum health
jg:get_distance()floatDistance from the local player, in meters
jg:get_position()vec3World-space origin
jg:is_alive()boolWhether the creep is alive
jg:in_screen()boolWhether the creep projects on screen

Soul Orbs

Soul orbs (XP) dropped by killing minions, players and jungle creeps. From entities.get_xp_orbs().

FunctionReturnsDescription
xo:get_distance()floatDistance from the local player, in meters
xo:get_position()vec3World-space origin
xo:get_extrapolated_position()vec3Predicted position accounting for velocity
xo:get_velocity()vec3Current velocity vector
xo:is_hittable()boolWhether the orb can be denied (attacked) right now
xo:get_time_until_hittable()floatSeconds until the orb becomes deniable (0 if already hittable)
xo:is_hit()boolWhether the orb has already been hit/denied
xo:is_destroyed()boolWhether the orb has been collected or despawned
xo:in_screen()boolWhether the orb projects on screen

Entity Lists

Accessors that snapshot the current entities into a fresh Lua array.

FunctionReturnsDescription
entities.get_base_structures()tableArray of base_structure objects
entities.get_minions()tableArray of minion objects
entities.get_breakables()tableArray of breakable objects
entities.get_pickups()tableArray of pickup objects
entities.get_minigames()tableArray of minigame objects
entities.get_jungle()tableArray of jungle objects
entities.get_xp_orbs()tableArray of xp_orb objects (soul orbs)

Targeting

FunctionReturnsDescription
targeting.find_closest_by_fov(max_fov, max_distance)player?Find the enemy closest to crosshair within FOV and distance limits
targeting.find_closest_by_distance(max_distance)player?Find the nearest enemy within distance limit
targeting.compute_aim_delta(target, bone, projectile_speed?, speed?, target, position, projectile_speed?, speed?, position)vec2Compute mouse delta needed to aim at target bone, with optional projectile leading. Speed (0.01-1.0) enables smoothness compensation to predict target movement during smooth aiming. Compute mouse delta needed to aim at a world position with prediction applied against target (tick comp, smoothness, projectile leading). Compute mouse delta needed to aim at a world position. No prediction is applied.
targeting.get_fov(target, bone)floatGet angular distance (FOV) from crosshair to target bone
targeting.find_all_in_range(max_distance)tableGet all valid, alive enemy players within distance (meters).
targeting.smoothness_compensation(speed)floatCompute smoothness compensation factor for a given smooth speed. Useful for velocity prediction when using smoothed mouse movement.

Input

FunctionReturnsDescription
input.is_key_held(key)boolCheck if a key is currently held down
input.press_key(key)voidSend a key press and release
input.key_down(key)voidSend a key down event (hold)
input.key_up(key)voidSend a key up event (release)
input.is_mouse_key(key)boolCheck if a virtual key code is a mouse button
input.move_mouse(delta, speed?, detach_factor?)boolMove mouse by pixel delta. With no extra args: raw movement. With speed (0.01-1.0, lower = smoother): smoothed. With detach_factor: controls smoothing curve aggressiveness.
input.snap_to(target, bone, projectile_speed?)voidInstantly move crosshair to target bone

Keybinds

Read the user's configured keybinds

FunctionReturnsDescription
keybinds.get(name)intVirtual key for any in-game action by its raw name, e.g. "Reload", "HeldItem", "Roll", "Mantle", "Ability1", "Item1". Returns 0 if unbound or unknown.
keybinds.ability1_key()intVirtual key for ability slot 1
keybinds.ability2_key()intVirtual key for ability slot 2
keybinds.ability3_key()intVirtual key for ability slot 3
keybinds.ability4_key()intVirtual key for ability slot 4
keybinds.item1_key()intVirtual key for item slot 1
keybinds.item2_key()intVirtual key for item slot 2
keybinds.item3_key()intVirtual key for item slot 3
keybinds.item4_key()intVirtual key for item slot 4
keybinds.reload_key()intVirtual key for reload
keybinds.parry_key()intVirtual key for parry
keybinds.dash_key()intVirtual key for dash
keybinds.jump_key()intVirtual key for jump

Action Names

keybinds.get(name) accepts any raw Deadlock action name. These are pre-seeded with default keys and always resolve:

NameActionDefault
ReloadReloadR
HeldItemParry / Heavy MeleeF
RollDashShift
MantleJumpSpace
Ability1 - Ability4Ability slots 1-41 2 3 4
Item1 - Item4Item slots 1-4Z X C V

Other common names from the game's keybind file: Attack, Attack2, AbilityMelee, Crouch, Walk, MoveForward, MoveBack, MoveLeft, MoveRight, Ping, PingWheel, VoiceChat, TextChat, TeamChat, Scoreboard, ShowMap, Shop, Interact, InspectHero, Recall. Keybinds refresh from Steam every 30s. Returns 0 for unbound or unknown names. See Script Structure for the full list.

Camera

Camera state, coordinate conversion, and screen information

FunctionReturnsDescription
camera.get_position()vec3Camera origin in world space
camera.get_view_angles()vec2Current view angles as vec2(pitch, yaw)
camera.get_forward()vec3Unit forward direction vector derived from view angles
camera.get_fov()floatCurrent screen field-of-view in degrees
camera.get_screen_size()vec2Screen resolution as vec2(width, height)
camera.world_to_screen(pos)vec2?Project a world position to screen coordinates. Returns vec2(x, y) or nil if behind camera.

Raytrace

Ray/primitive intersection helpers and world line-of-sight queries against the loaded map BVH. Hit functions that report a distance return the parametric t along the ray (multiply by ray.dir to recover the hit position).

FunctionReturnsDescription
raytrace.is_world_loaded()boolWhether the map BVH is loaded and raytrace.world will perform a real trace.
raytrace.world(from, to)boolReturns true if the segment from→to is occluded by world geometry (the map BVH). Returns false when the map is not loaded. Use this for line-of-sight checks against the level.
raytrace.sphere(r, center, radius)float?Ray vs sphere. Returns the parametric distance t along the ray to the hit, or nil if it misses.
raytrace.aabb(r, min, max)boolRay vs axis-aligned box (defined by its two opposite corners). Returns true on intersection.
raytrace.obb(r, origin, extents, angles)table?Ray vs oriented box. angles is (pitch, yaw) in degrees. Returns { near = float, far = float } slab distances on hit, or nil on miss.
raytrace.capsule(r, start, finish, radius)float?Ray vs capsule (a cylinder with hemispherical caps) defined by its two end points and a radius. Returns the parametric distance t along the ray to the hit, or nil on miss.
raytrace.triangle(r, a, b, c)vec3?Ray vs triangle. Returns the world-space hit position, or nil on miss.

Ray

Ray used by raytrace.* intersection helpers. Construct with ray(origin, dir, max_distance) for a parametric ray, or ray(start, end) for a segment between two world positions. The direction is normalized on construction and the reciprocal direction (used by AABB tests) is computed automatically.

Field/MethodTypeDescription
originvec3Ray origin
dirvec3Normalized ray direction
targetvec3End point (origin + dir * length)
lengthfloatMaximum traversal distance along the ray

Global Functions

FunctionReturnsDescription
local_player()player?Get the local player object, or nil if unavailable
get_players()tableGet array of valid enemy player objects
left_click()voidSimulate a left mouse click (press + 25ms + release)
right_click()voidSimulate a right mouse click (press + 25ms + release)
clock()floatHigh-resolution timer in seconds since first call
lock_aim(target, opts?)voidLock aim onto a target. Options table fields: bone (int), projectile_velocity (float), speed (float, 0.1-1.0, default 0.5).
unlock_aim()voidRelease the current aim lock
slot_to_key(slot)intConvert a slot enum value to its configured virtual key
print(...)voidPrint to the script log with the script name prefix

Config

Per-script configuration accessed via the config table

FunctionReturnsDescription
config.get_bool(key)boolGet a boolean config value by key
config.set_bool(key, value)voidSet a boolean config value
config.get_int(key)intGet an integer config value by key
config.set_int(key, value)voidSet an integer config value
config.get_float(key)floatGet a float config value by key
config.set_float(key, value)voidSet a float config value

Vector Types

vec2

2D vector type. Construct with vec2() or vec2(x, y). Supports +, -, *, / operators with both vec2 and float operands.

Field/MethodTypeDescription
xfloatX component
yfloatY component
vec2:dot(other)floatDot product with another vec2
vec2:angle_to(other)floatAngle in degrees from this vector to another (atan2-based)
vec2:empty()boolCheck if zero vector
vec2:length()floatVector magnitude
vec2:length_sqr()floatSquared magnitude (faster than length)
vec2:distance(other)floatDistance to another vec2
vec2:normalized()vec2Return unit-length copy

vec3

3D vector type. Construct with vec3() or vec3(x, y, z). Supports +, -, *, / operators with both vec3 and float operands.

Field/MethodTypeDescription
xfloatX component
yfloatY component
zfloatZ component
vec3:dot(other)floatDot product with another vec3
vec3:cross(other)vec3Cross product with another vec3
vec3:angle_to(other)floatAngle in degrees between this vector and another
vec3:empty()boolCheck if zero vector
vec3:length()floatVector magnitude
vec3:length_sqr()floatSquared magnitude (faster than length)
vec3:length_2d()floatMagnitude of XY components only
vec3:distance(other)floatDistance to another vec3
vec3:normalized()vec3Return unit-length copy