One action, one command owner¶
Hold the action key to attempt a configured ability on the current hostile target. Choose a learned ability before holding the key; the default is Force Stun. This script uses combat.ability_executor and keeps polling it after key release so the pending command can settle. It is a single-action script rather than a class rotation.
Before enabling¶
Install the required shared helper:
combat/ability_executor.lua must be available under your actual COMMON_PATH.
This complete entry script does not include that module. A missing module fails
at require during loading; inspect the selected script's Log tab.
Download single-action.lua and use the same file, Reload and Enable steps as the status panel. Under Controls, set Ability name to an ability your character knows and choose Action key before holding it against a hostile target.
Complete code¶
local AbilityExecutor = require("combat.ability_executor")
local executor = AbilityExecutor.new()
local ID = "example_single_action"
gos.settings.register(ID, {
title = "Example: Single Action", version = 1,
activation = { mode = "hold", label = "Action key", default = "mouse4" },
fields = {{ key = "ability", type = "string", label = "Ability name", default = "Force Stun", max_length = 96 }},
})
gos.on_tick(function()
executor:tick() -- Poll even after the activation key is released.
local settings = gos.settings.get(ID)
if not settings.enabled or not settings.active then
if executor:has_pending() then executor:cancel("inactive") end
return
end
if executor:has_pending() then return end
local loadout = gos.abilities.loadout()
if loadout.status ~= "ready" or not loadout.known[settings.ability] then return end
local world = gos.world()
local target = world.current_target
if not world.player or not target or target:reaction() ~= "hostile" then return end
local hp = target:hp()
if not hp or hp.current <= 0 then return end
if not gos.abilities.can_cast(settings.ability, target).ok then return end
executor:submit(settings.ability, target, {
idempotencyKey = "example_action:" .. target:handle(),
target_fallback = "none",
})
end)