Target Selector Override Helper
Overview
The TS Override Helper allows plugins to programmatically configure the Target Selector's mode, ranges, weights, override slots, and blacklist marks. Instead of relying on manual menu configuration, your plugin can enforce specific targeting behavior at runtime.
Key Features:
- Mode & Range Control - Set targeting mode, pull mode, and max range
- Weight System - Enable/disable and tune individual targeting weights
- Override Slots - Configure priority override slots (focus, mark, target, etc.)
- Blacklist Marks - Exclude marked targets from targeting
- Write Modes - Control how often overrides are applied (once, on change, every frame)
- Batch Operations - Apply multiple weight changes in a single call
Importing The Module
---@type ts_override_helper
local ts = require("common/utility/ts_override_helper")
Method Access
Access functions with : (colon), not . (dot).
Write Modes
Every setter accepts an optional write_mode as the last parameter. This controls how often the override is applied.
| Mode | Enum | Description |
|---|---|---|
| Once | ts.enums.write_mode.ONCE | Apply once per session (default). Safe to call every frame. |
| On Change | ts.enums.write_mode.ON_CHANGE | Apply only when the value differs from last write. |
| Always | ts.enums.write_mode.ALWAYS | Apply every frame. Use sparingly. |
-- Default: ONCE - safe to call in on_update, only writes once
ts:set_max_range_damage(40)
-- ON_CHANGE - syncs from a menu slider, only writes when value changes
ts:set_max_range_damage(my_slider:get(), ts.enums.write_mode.ON_CHANGE)
-- ALWAYS - force every frame (rarely needed)
ts:set_max_range_damage(40, ts.enums.write_mode.ALWAYS)
Enums
All enums are accessible via ts.enums.
ts.enums.mode — Targeting Mode
| Value | Description |
|---|---|
MANUAL | Manual targeting only |
HARD_TARGET | Semi-manual: prioritize HUD target |
SILENT_AUTO | Fully automatic, no HUD changes |
DISABLED | Target selector disabled entirely |
ts.enums.pull_mode — Pull Behavior
| Value | Description |
|---|---|
DONT_PULL | Don't auto-pull |
PULL_HUD_TARGET | Pull only HUD target |
PULL_FULL_AUTOMATIC | Pull any valid target automatically |
ts.enums.context — Targeting Context
| Value | Description |
|---|---|
DAMAGE | Damage target selection |
HEAL | Heal target selection |
ts.enums.weight — Weight Types
| Weight | Type | Description |
|---|---|---|
THREAT | float | Less threat = more weight |
ANGLE | bool | Is inside angle cone |
ANGLE_F | float | Less angle = more weight (use set_weight_angle_f) |
CLOSE | float | Less distance = more weight |
HEALTH_DECREASE | float | Less HP % = more weight |
HEALTH_INCREASE | float | More HP % = more weight |
MULTIPLE_HITS | float | More nearby units = more weight (use set_weight_multiple_hits) |
LOWEST_MAX_HP | bool | Is lowest max HP unit |
LOWEST_CURRENT_HP | bool | Is lowest current HP unit |
HIGHEST_MAX_HP | bool | Is highest max HP unit |
HIGHEST_CURRENT_HP | bool | Is highest current HP unit |
FOCUS | bool | Is focus target |
TARGET | bool | Is HUD target |
SELFISH | bool | Is local player |
TANK | bool | Is tank role |
HEALER | bool | Is healer role |
DPS | bool | Is DPS role |
INJURED | bool | HP <= 60% (damage) or <= 50% (heal) |
LOW_HP | bool | HP <= 40% (damage) or <= 25% (heal) |
TEAM_TARGET_FOLLOWUP | bool | Most targeted unit by your team |
LOW_FORECAST | bool | Combat forecast <= 5.0s |
MARKS | bool | Is marked with selected marks |
ts.enums.override_type — Override Slot Types
| Value | Description |
|---|---|
DISABLED | Slot disabled |
MARK | Prioritize marked target |
TARGET | Prioritize HUD target |
FOCUS | Prioritize focus target |
MOST_HITS | Prioritize most AoE hits |
CLOSER | Prioritize closest target |
MOST_MAX_HEALTH | Prioritize highest max HP |
MOST_CURRENT_HEALTH | Prioritize highest current HP |
LEAST_MAX_HEALTH | Prioritize lowest max HP |
LEAST_CURRENT_HEALTH | Prioritize lowest current HP |
TEAM_TARGET_FOLLOWUP | Prioritize team's focus target |
Functions
Mode & Settings
ts:set_mode
Syntax
ts:set_mode(mode: number, write_mode?: number): nil
Parameters
| Parameter | Type | Description |
|---|---|---|
mode | number | Targeting mode (ts.enums.mode) |
write_mode | number|nil | Write mode (default: ONCE) |
ts:set_max_range_damage
Syntax
ts:set_max_range_damage(range: number, write_mode?: number): nil
Set max targeting range for damage (0-50).