Characters

Agent

A handle to one character, gadget, attack target or ground item.

An Agent holds only an agent id and looks the agent up again on every call, so it's always safe to keep one between ticks. Once the agent is gone, agent:valid() is false and its other methods return nil.

Methods that don't apply to an agent's kind return nil: agent:health() on a ground item, or agent:skills() on a gadget. Two handles to the same agent are ==, and tostring(agent) is Agent(id, kind, name).

local target = agents.selected()
if target and target:is_character() then
    local hp = target:health()
    print(target:name(), hp.current .. "/" .. hp.max, target:has_buff("Stability"))
end

Identity

These work even after the agent is gone.

agent:id()integer
The agent id.
"character", "gadget", "attack_target" or "ground_item".
Whether the agent is still there.
Whether it's a character.
Whether it's a gadget.
Whether it's an attack target.
Whether it's a ground item.

Every kind of agent

The agent's name. Attack targets have none.
Where the agent is.
Which way it faces.
How it's moving.
Its movement speed.
Its height.
The radius it takes up.
One of the agents.TYPE_* constants.
One of the agents.SUBTYPE_* constants.
Whether it's a player's character.
Whether it's a character that isn't a player.
Whether it's your character.
The distance to a position (or to another agent).
The distance on the ground, ignoring height.
Whether it's closer than range to a position.
The same, ignoring height.
The distance to your character.
The distance to your character, ignoring height.

Actions

Your character does these to the agent.

Interacts with it: talks to an NPC, gathers a node, uses an object.
Revives it.
Finishes it (stomps a downed enemy).
Targets it.
Picks it up, if it's a ground item.

Characters and gadgets

{current, max, barrier, percent}.
{state, current}: state is one of agents.BREAK_BAR_*, current how much is left.
Its boons, conditions and effects. See Buff.
One buff, by buff id or by name.
Whether it has a buff.
One of the agents.ATTITUDE_* constants.
The game's raw flags for the agent.
Who it belongs to: the player for a pet, minion or clone.
Its owner's agent id.
Whether it can be targeted.

Characters

Whether it's alive.
Downed.
Dead.
One of the agents.DEAD_STATE_* constants.
In combat.
Has aggro on someone.
In a conversation.
A mesmer clone.
Moving.
Gliding.
Gliding faster.
Gliding slower.
The glider's endurance.
Going up or down while swimming or flying.
Raw swimming state.
Where the character is drawn, which can lag behind position().
Its team, in PvP and WvW.
The kind of monster (the same for every one of its kind).
The player's index in the game's player list.
The player's character name.
The player's uuid, as 32 hex digits.
The profession id; see professions.
{current, max}: the dodge bar.
{race, gender, profession, stats, scaled_stats}, where both stat tables are Stats.
A player's three selected specializations, with their traits. See Spec.
Profession mechanics, each {current, max} or nil: warrior_adrenaline, thief_initiative, necromancer_life_force, holosmith_heat, druid_astral_force, firebrand_pages, mesmer_clones, deadeye_malice, specter_shadow_force, scourge_shades, catalyst_energy, evoker_skill_charge, evoker_empowered_skill_charge, galeshot_arrows, bladesworn_flow, conduit_affinity, and revenant as {energy, stance_id, stance_swap_cooldown, stance_swap_ready}.

Skills

Every skill the character has. See Skill.
One skill, by skill id or name.
The skill in a skill bar slot.
{skills, queued_skills, selected_auto_attack_slot, weapon_swap_cooldown, weapon_swap_ready}.
What it's casting: {id, skill_id, name, target_agent_id, target}.
Whether it's casting anything, or that skill.

Control effects

Evading.
The evade in progress.
Where it's been ordered to move.
A knockdown on it: {max_duration, current_duration}.
A stun or daze on it: {max_duration, current_duration}.
A float on it: {max_duration, current_duration}.
Being knocked back or pulled.
Being launched.

Movement and physics

These change how your own character moves. Restore what you changed in on_stop.

Sets the movement speed.
The gravity on it.
Sets the gravity.
The gravity while gliding.
Sets the gravity while gliding.
The jump mode.
Sets the jump mode.
How steep a slope it can climb.
Sets how steep a slope it can climb.
The height of the floor under it.
Sets the floor height.
How high the skyscale can fly.
Sets how high the skyscale can fly.
The mount's endurance.
Sets the mount's endurance.
Moves the character on your screen only.
Moves the character for the server.
Moves the character and syncs the server to it.

Gadgets

The gadget's level.
Whether it can be attacked.
Whether it's a prop.
Its prop token.
Its sequence number.
Raw state of a resource node.
Its attack targets.
A capture point's {state, progress}.
{prop_token, prop_sequence}.
Goes through a doorway gadget.

Attack targets and ground items

The gadget an attack target belongs to.
A ground item's item id.
What a ground item is. See ItemDef.