API Reference
Player Object
Obtained from local_player() or get_players()
| Function | Returns | Description |
|---|---|---|
p:get_health() | float | Current health points |
p:get_max_health() | float | Maximum health points |
p:get_health_percentage() | float | Health as percentage (0-100) |
p:get_position() | vec3 | World position of the player |
p:get_velocity() | vec3 | Current velocity vector |
p:get_view_angles() | vec2 | Player'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) | vec3 | World position of a skeleton bone (use bone enum) |
p:get_hero_id() | int | Hero identifier (compare with hero_id enum) |
p:get_team() | int | Team number |
p:get_distance(other?) | float | Distance in meters. If other is nil, returns distance to local player. |
p:is_alive() | bool | Whether the player is alive |
p:is_visible() | bool | Whether the player is visible (not occluded) |
p:is_valid() | bool | Whether the player entity is valid |
p:is_on_screen() | bool | Whether the player is within screen bounds |
p:is_scoped() | bool | Whether the player is scoped in |
p:is_in_reload() | bool | Whether the player is reloading |
p:is_enemy() | bool | Whether the player is on the enemy team |
p:is_primary_weapon_active() | bool | Whether the primary weapon is active |
p:is_in_melee_attack() | bool | Whether the player is performing a melee attack |
p:is_(player_flag) | bool | Check an engine-level entity flag (use player_flag enum) |
p:get_modifier_flags() | int | Raw modifier flag bitmask |
p:has_modifier_flag(modifier_flag) | bool | Check a gameplay modifier flag (use modifier_flag enum) |
p:has_modifier(name) | bool | Check for a named modifier, e.g. "modifier_citadel_stunned" |
p:get_modifier_names() | table | Array of active modifier name strings |
p:get_modifier_count() | int | Number of active modifiers |
p:get_active_projectile_speed() | float | Projectile speed of the currently active weapon |
p:get_items() | table | Array of item tables with fields: name, subclass, bucket, slot, cooldown |
p:has_item(name) | bool | Check 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() | int | Number of items owned |
p:has_abilities() | bool | Whether 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) | bool | Check if ability at slot is available and off cooldown |
p:is_targetable() | bool | Check if player can be targeted (alive, valid, visible, not immune/urn/godmode) |
p:get_abilities() | table | All 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:
| Field | Type | Description |
|---|---|---|
name | string | Ability designer name |
slot | int | Slot enum value |
points | int | Upgrade points spent |
cooldown | float | Cooldown percentage (0-100) |
projectile_speed | float | Projectile speed |
range | float | Range |
is_ready | bool | Can be cast now |
is_cooling_down | bool | On cooldown |
is_in_cast_delay | bool | In cast animation |
Item Table
Returned by p:get_items(). Each entry in the table has these fields:
| Field | Type | Description |
|---|---|---|
name | string | Item designer name |
subclass | string | Item subclass name |
bucket | int | Item category (see bucket enum) |
slot | int | Inventory slot index |
cooldown | float | Cooldown percentage (0-100) |
Targeting
| Function | Returns | Description |
|---|---|---|
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) | vec2 | Compute 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) | float | Get angular distance (FOV) from crosshair to target bone |
targeting.find_all_in_range(max_distance) | table | Get all valid, alive enemy players within distance (meters). |
targeting.smoothness_compensation(speed) | float | Compute smoothness compensation factor for a given smooth speed. Useful for velocity prediction when using smoothed mouse movement. |
Input
| Function | Returns | Description |
|---|---|---|
input.is_key_held(key) | bool | Check if a key is currently held down |
input.press_key(key) | void | Send a key press and release |
input.key_down(key) | void | Send a key down event (hold) |
input.key_up(key) | void | Send a key up event (release) |
input.is_mouse_key(key) | bool | Check if a virtual key code is a mouse button |
input.move_mouse(delta, speed?, detach_factor?) | bool | Move 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?) | void | Instantly move crosshair to target bone |
Keybinds
Read the user's configured keybinds
lua
keybinds.ability1_key()
keybinds.ability2_key()
keybinds.ability3_key()
keybinds.ability4_key()
keybinds.item1_key()
keybinds.item2_key()
keybinds.item3_key()
keybinds.item4_key()
keybinds.reload_key()
keybinds.parry_key()
keybinds.dash_key()
keybinds.jump_key()Global Functions
| Function | Returns | Description |
|---|---|---|
local_player() | player? | Get the local player object, or nil if unavailable |
get_players() | table | Get array of valid enemy player objects |
left_click() | void | Simulate a left mouse click (press + 25ms + release) |
right_click() | void | Simulate a right mouse click (press + 25ms + release) |
clock() | float | High-resolution timer in seconds since first call |
lock_aim(target, opts?) | void | Lock aim onto a target. Options table fields: bone (int), projectile_velocity (float), speed (float, 0.1-1.0, default 0.5). |
unlock_aim() | void | Release the current aim lock |
slot_to_key(slot) | int | Convert a slot enum value to its configured virtual key |
print(...) | void | Print to the script log with the script name prefix |
Config
Per-script configuration accessed via the config table
| Function | Returns | Description |
|---|---|---|
config.get_bool(key) | bool | Get a boolean config value by key |
config.set_bool(key, value) | void | Set a boolean config value |
config.get_int(key) | int | Get an integer config value by key |
config.set_int(key, value) | void | Set an integer config value |
config.get_float(key) | float | Get a float config value by key |
config.set_float(key, value) | void | Set 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/Method | Type | Description |
|---|---|---|
x | float | X component |
y | float | Y component |
vec2:dot(other) | float | Dot product with another vec2 |
vec2:angle_to(other) | float | Angle in degrees from this vector to another (atan2-based) |
vec2:empty() | bool | Check if zero vector |
vec2:length() | float | Vector magnitude |
vec2:length_sqr() | float | Squared magnitude (faster than length) |
vec2:distance(other) | float | Distance to another vec2 |
vec2:normalized() | vec2 | Return unit-length copy |
vec3
3D vector type. Construct with vec3() or vec3(x, y, z). Supports +, -, *, / operators with both vec3 and float operands.
| Field/Method | Type | Description |
|---|---|---|
x | float | X component |
y | float | Y component |
z | float | Z component |
vec3:dot(other) | float | Dot product with another vec3 |
vec3:cross(other) | vec3 | Cross product with another vec3 |
vec3:angle_to(other) | float | Angle in degrees between this vector and another |
vec3:empty() | bool | Check if zero vector |
vec3:length() | float | Vector magnitude |
vec3:length_sqr() | float | Squared magnitude (faster than length) |
vec3:length_2d() | float | Magnitude of XY components only |
vec3:distance(other) | float | Distance to another vec3 |
vec3:normalized() | vec3 | Return unit-length copy |
Camera
Camera state, coordinate conversion, and screen information
| Function | Returns | Description |
|---|---|---|
camera.get_position() | vec3 | Camera origin in world space |
camera.get_view_angles() | vec2 | Current view angles as vec2(pitch, yaw) |
camera.get_forward() | vec3 | Unit forward direction vector derived from view angles |
camera.get_fov() | float | Current screen field-of-view in degrees |
camera.get_screen_size() | vec2 | Screen 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. |
