Skip to content

Helper Functions

Built-in Lua helpers that handle common patterns. All yield-based helpers are coroutine-aware.

sleep

Pause for N milliseconds (coroutine-based, yields between ticks). Use this for delays in scripts — does not block the thread.

lua
sleep(ms)

wait_for_cast_delay

Wait until ability finishes cast delay. Returns false on timeout.

lua
wait_for_cast_delay(slot, timeout_ms)        -- default timeout: 3000

wait_for_cooling_down

Wait until ability finishes cooldown. Returns false on timeout.

lua
wait_for_cooling_down(slot, timeout_ms)      -- default timeout: 3000

wait_for_target

Wait until target is within distance (meters). Returns false if target dies or timeout.

lua
wait_for_target(player, distance, timeout_ms) -- default timeout: 3000

aim_at_target

Aim at a target. Behavior depends on speed:

  • speed = 0 (default): instant single-frame flick, returns true if on target
  • speed > 0: smooth aim loop that yields until on target or timeout
lua
aim_at_target(player, {
    projectile_velocity = 0,  -- lead amount for projectiles (0 = hitscan)
    speed = 0,                -- smooth aim speed (0 = instant flick, 0.01-1.0 = smooth)
    threshold = 0.5,          -- FOV degrees to consider "on target"
    timeout = 2000,           -- give up after ms (only used when speed > 0)
    bone = bone.head          -- which bone to aim at
})

lock_aim / unlock_aim

Lock aim onto a target — aim is automatically maintained every tick. Useful during combos to keep crosshair on target between abilities.

lua
lock_aim(player, {
    bone = bone.head,             -- which bone to track
    projectile_velocity = 0,      -- lead for projectiles
    speed = 0                     -- smooth aim speed
})

unlock_aim()

Example: Aim Lock in a Combo

lua
lock_aim(target, { bone = bone.spine_1 })

press_ability(slot.ability2)
sleep(100)
click_mouse()
sleep(100)
press_ability(slot.ability1)

unlock_aim()

press_ability

Shortcut: press the key bound to an ability slot.

lua
press_ability(slot)

hold_key

Hold a key for a duration (coroutine-based, yields during hold).

lua
hold_key(vk, duration_ms)       -- default duration: 500

hold_ability

Hold an ability key for a duration.

lua
hold_ability(slot, duration_ms) -- default duration: 500