Skip to content

Example Scripts

Minimal Script

A simple script that uses ability 1 on the closest target:

lua
name = "Example"
id = hero_id.abrams

function is_enabled()
    return config.get_bool("enabled") and input.is_key_held(VK.XBUTTON2)
end

function on_tick()
    local target = targeting.find_closest(5.0, 50.0)
    if not target then return end

    if ability.is_ready(slot.ability1) then
        if aim_at_target(target, { threshold = 1.0, bone = bone.spine_1 }) then
            press_ability(slot.ability1)
        end
    end
end

settings = {
    { key = "enabled", type = "bool", default = false, label = "Enabled" },
}

Combo Script

Combos use helpers like lock_aim, sleep, wait_for_target, and press_ability together. on_tick() runs as a coroutine — when it returns, it will be restarted on the next tick.

lua
name = "Bebop"
id = hero_id.bebop

function is_enabled()
    return config.get_bool("enabled")
        and input.is_key_held(config.get_int("activation_key"))
end

function on_tick()
    -- find target
    local target = targeting.find_closest(config.get_float("max_fov"), 70.0)
    if not target then return end

    -- hook (ability 3)
    if not ability.is_ready(slot.ability3) then return end

    -- if not aim_at_target(target, { projectile_velocity = 3100, threshold = 0.5, bone = bone.spine_1 }) then return end
    lock_aim(target, { projectile_velocity = 3100, threshold = 0.5, bone = bone.spine_1 })
    sleep(100)
    press_ability(slot.ability3)
    unlock_aim()

    -- wait for hook cooldown
    if not wait_for_cooling_down(slot.ability3, 5000) then return end

    -- wait for target to get close
    if not wait_for_target(target, 4.0, 4000) then return end

    -- bomb (ability 2)
    if config.get_bool("bomb") then
        if ability.is_ready(slot.ability2) then
            aim_at_target(target, { threshold = 1.0, bone = bone.spine_1 })
            sleep(100)
            press_ability(slot.ability2)
            sleep(100)
            click_mouse()
        end

        -- echo shard
        if config.get_bool("echoshard") then
            local item_key = slot_to_key(config.get_int("echoshard_slot") + 4)
            input.press_key(item_key)
            sleep(100)

            if ability.is_ready(slot.ability2) then
                aim_at_target(target, { threshold = 1.0, bone = bone.spine_1 })
                sleep(100)
                press_ability(slot.ability2)
                sleep(100)
                click_mouse()
            end
        end
    end

    -- uppercut (ability 1)
    if config.get_bool("uppercut") then
        if ability.is_ready(slot.ability1) then
            aim_at_target(target, { threshold = 1.0, bone = bone.spine_1 })
            sleep(100)
            press_ability(slot.ability1)
        end
    end
end

settings = {
    { key = "enabled",        type = "bool",    default = false,       label = "Enabled" },
    { key = "activation_key", type = "keybind", default = VK.XBUTTON2, label = "Activation Key" },
    { key = "max_fov",        type = "float",   default = 5.0,         label = "Max FOV", min = 1.0, max = 15.0 },
    { key = "bomb",           type = "bool",    default = true,        label = "Bomb" },
    { key = "uppercut",       type = "bool",    default = true,        label = "Uppercut" },
    { key = "echoshard",      type = "bool",    default = false,       label = "Echo Shard" },
    { key = "echoshard_slot", type = "item_slot", default = 0,           label = "Echo Shard Slot", depends_on = "echoshard", depends_value = 1 },
}

Key Patterns

Activation with Hold Key

lua
function is_enabled()
    return config.get_bool("enabled")
        and input.is_key_held(config.get_int("hotkey"))
end

Activation Mode (Hold Key vs Always On)

lua
function is_enabled()
    if not config.get_bool("enabled") then return false end

    local mode = config.get_int("activation_mode")
    if mode == 0 then
        return input.is_key_held(config.get_int("activation_key"))
    end
    return true -- always on
end

settings = {
    { key = "enabled",         type = "bool",    default = false,       label = "Enabled" },
    { key = "activation_mode", type = "combo",   default = 0,           label = "Activation", options = { "Hold Key", "Always On" } },
    { key = "activation_key",  type = "keybind", default = VK.XBUTTON2, label = "Key", depends_on = "activation_mode", depends_value = 0 },
}

Low-Health Execute

lua
function on_tick()
    local players = get_players()
    for _, target in ipairs(players) do
        if target:is_alive() and target:is_visible() then
            local hp = target:get_health_percentage()
            if hp < 20 and ability.is_ready(slot.ability4) then
                if aim_at_target(target, { bone = bone.spine_1 }) then
                    press_ability(slot.ability4)
                    return
                end
            end
        end
    end
end