Agent
Agent combines player state including health, aim, movement, inventory, and stats. All Agent and nested API properties are read-only; event structures and AgentStats fields are the exceptions.
How data flows
Section titled “How data flows”Server simulation owns an agent’s health, movement, inventory, aim, and stats. Reflex server.lua wrappers read that state on the server; main.lua reads its replicated client copy and local presentation data. Visibility restrictions may hide some information about an enemy.
Agent, Health, Movement, Inventory, Aim, and the other nested objects access an existing agent; they are not separate character copies. A retained reference may become unavailable after death, a round transition, or disconnect, so long-running code should reacquire the agent through Agents.
HitEvent, DamageEvent, DeathEvent, and AgentStats pass Lua a snapshot of a result that has already been calculated. Assigning their fields only changes the received Lua value; it does not rewrite damage, death, or the scoreboard.
What changes visually
Section titled “What changes visually”- On success,
Agent:TrySpectate()switches the main view and standard spectator HUD to the selected agent. AgentInput:SetLookRotation()changes the local agent’s look direction; it does not create a separate camera.- On the client,
SetMoveDirection()andSetButtonState()change the local agent’s pending input; the methods do not show UI or a notification themselves. The temporary Reflex server bug documented below still applies. Aim:SetAimTarget()andResetAimTarget()change server-side aim-target state. They do not draw a target marker—use separate UI or WorldVisuals for that.
Setter methods return nil. Verify an available getter after a command instead of expecting on-screen confirmation.
Quick example
Section titled “Quick example”local localAgent = Agents:GetLocalAgent()
if localAgent ~= nil then print(localAgent.Nickname) print("HP: " .. tostring(localAgent.Health.CurrentHealth)) print("Position: " .. tostring(localAgent.Movement.Position))endRepresents an agent in the game. This class provides access to various properties and methods related to the agent, such as movement, health, inventory, and more.
Base: Entity
Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
Aim |
Aim | get |
Access to the agent aiming API. |
Avatar |
Texture | get |
Client only Agent avatar. Returns the player’s avatar or the team icon. |
AvatarIsTeamPlaceholder |
bool | get |
Client only Returns true if Avatar is currently the team placeholder icon instead of the player’s real avatar. |
Color |
Color | get |
Returns the color assigned to the agent. |
Health |
Health | get |
Access to the agent health API. |
Interactor |
Interactor | get |
Access to the agent interaction API. |
Inventory |
Inventory | get |
Access to the agent inventory API. |
IsSpectated |
bool | get |
Client only true if this agent is being spectated (when the local agent is dead or in spectator mode). |
Movement |
Movement | get |
Access to the agent movement API. |
Nickname |
string | get |
Player nickname. |
Number |
int | get |
Returns the number assigned to the agent. |
OcclusionCulling |
OcclusionCulling | get |
Access to the agent occlusion/visibility API. |
Stats |
AgentStats | get |
Agent stats, always available. |
Team |
Team | get |
Team the agent belongs to. |
Methods
Section titled “Methods”GetHitboxes
Section titled “GetHitboxes”Agent:GetHitboxes(): Array<Hitbox>Returns the agent’s hitboxes.
Returns: Array<Hitbox>
TrySpectate
Section titled “TrySpectate”Agent:TrySpectate(): boolClient only Switches spectating to this agent if allowed by the current spectator mode.
Returns: bool
AgentInput
Section titled “AgentInput”Available in client and Reflex server. Global API for reading input state and controlling the local agent.
Methods
Section titled “Methods”GetLookRotation
Section titled “GetLookRotation”AgentInput:GetLookRotation(): Vector2Returns the current look rotation of the local agent in degrees (X = pitch, Y = yaw).
Returns: Vector2
GetMoveDirection
Section titled “GetMoveDirection”AgentInput:GetMoveDirection(): Vector2Returns the current movement direction of the local agent.
Returns: Vector2
IsButtonDown
Section titled “IsButtonDown”AgentInput:IsButtonDown(inputButton: EInputButton): booltrue if the input button is being held by the local agent.
| Param | Type | Optional | Comment |
|---|---|---|---|
inputButton |
EInputButton | Button to check. |
Returns: bool
IsJustPressed
Section titled “IsJustPressed”AgentInput:IsJustPressed(inputButton: EInputButton): booltrue if the button was pressed by the local agent on this tick.
| Param | Type | Optional | Comment |
|---|---|---|---|
inputButton |
EInputButton | Button whose press is checked on the current tick. |
Returns: bool
SetButtonState
Section titled “SetButtonState”AgentInput:SetButtonState(inputButton: EInputButton, down: bool)Sets the local agent’s input button state (pressed/released).
| Param | Type | Optional | Comment |
|---|---|---|---|
inputButton |
EInputButton | Button to change. | |
down |
bool | true to press it, false to release it. |
SetLookRotation
Section titled “SetLookRotation”AgentInput:SetLookRotation(vector: Vector2)Sets the local agent’s absolute look rotation in degrees (X = pitch, Y = yaw).
| Param | Type | Optional | Comment |
|---|---|---|---|
vector |
Vector2 |
SetMoveDirection
Section titled “SetMoveDirection”AgentInput:SetMoveDirection(vector: Vector2)Sets the local agent’s movement vector in input axes (X = left/right, Y = forward/back).
| Param | Type | Optional | Comment |
|---|---|---|---|
vector |
Vector2 |
Agents
Section titled “Agents”Agent listing and events API.
Methods
Section titled “Methods”GetAll
Section titled “GetAll”Agents:GetAll(): Array<Agent>Returns all agents in the match.
Returns: Array<Agent>
GetAllies
Section titled “GetAllies”Agents:GetAllies(): Array<Agent>Returns all allied agents relative to the local team.
Returns: Array<Agent>
GetEnemies
Section titled “GetEnemies”Agents:GetEnemies(): Array<Agent>Returns all enemy agents relative to the local team.
Returns: Array<Agent>
GetLocalAgent
Section titled “GetLocalAgent”Agents:GetLocalAgent(): AgentReturns the local player’s agent, or nil if the local agent is currently unavailable.
Returns: Agent
GetLocalOrSpectatedAgent
Section titled “GetLocalOrSpectatedAgent”Agents:GetLocalOrSpectatedAgent(): AgentReturns the local player’s agent or the spectated agent, or nil if no such agent currently exists.
Returns: Agent
Combat events
Section titled “Combat events”All three events are client-only and return an EventSubscription that can be cancelled with Cancel().
local deaths = Agents:OnDeath(function(event) print(event.Killer .. " eliminated " .. event.Victim)end)
local dealt = Agents:OnLocalPlayerDealtDamage(function(event) print("Dealt: " .. tostring(event.Damage))end)
local received = Agents:OnLocalPlayerReceivedDamage(function(event) print("Received: " .. tostring(event.Damage))end)OnDeath
Section titled “OnDeath”Agents:OnDeath(callback: LuaFunction): EventSubscriptionClient only Calls the callback with a DeathEvent when an agent dies.
| Param | Type | Optional | Comment |
|---|---|---|---|
callback |
LuaFunction | Function that receives a DeathEvent. |
Returns: EventSubscription
OnLocalPlayerDealtDamage
Section titled “OnLocalPlayerDealtDamage”Agents:OnLocalPlayerDealtDamage(callback: LuaFunction): EventSubscriptionClient only Calls the callback when the local player deals damage. Returns a subscription that can be cancelled.
| Param | Type | Optional | Comment |
|---|---|---|---|
callback |
LuaFunction | Function that receives a HitEvent. |
Returns: EventSubscription
OnLocalPlayerReceivedDamage
Section titled “OnLocalPlayerReceivedDamage”Agents:OnLocalPlayerReceivedDamage(callback: LuaFunction): EventSubscriptionClient only Calls the callback when the local player takes damage. The event includes stun information if this damage applied a stun. Returns a subscription that can be cancelled.
| Param | Type | Optional | Comment |
|---|---|---|---|
callback |
LuaFunction | Function that receives a DamageEvent. |
Returns: EventSubscription
AgentStats
Section titled “AgentStats”General agent statistics. All nine fields support reading and assignment (get/set). Changing the local object is not a server command.
Fields
Section titled “Fields”| Field | Type | Access | Description |
|---|---|---|---|
Assists |
int | get/set |
Number of assists. |
Damage |
number | get/set |
Total damage dealt. |
DeathTick |
int | get/set |
Simulation tick when the agent died. |
Deaths |
int | get/set |
Number of deaths. |
IsAlive |
bool | get/set |
true if alive. |
IsConnected |
bool | get/set |
true if connected. |
Kills |
int | get/set |
Number of kills. |
Money |
int | get/set |
Number of credits. This field is known only for the allied team, for all other teams it is 0. |
Ping |
int | get/set |
Average ping in milliseconds based on recent measurements. |
Access to the agent aiming system. Handles the current aim direction, aim spread, and stun.
Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
AccumulatedUncertainty |
number | get |
Local agent Accumulated aiming inaccuracy caused by aim direction changes and other sources. |
AimingDownSightsProgress |
number | get |
Aiming progress (ADS) from 0 to 1. |
Direction |
Vector3 | get |
Current aim direction in world coordinates. |
DirectionViewportPoint |
Vector3 | get |
Client only Local agent Viewport coordinates of the aim direction position for UI rendering. |
IsAimingDownSights |
bool | get |
true if the agent is currently aiming (ADS). |
IsStunned |
bool | get |
true if the agent is currently stunned. |
IsStunnedVisually |
bool | get |
true if the stun visual effect is currently active for the agent. Remains active longer than IsStunned so the effect from a short stun does not disappear completely on high ping when the client learns about the stun after it has already ended. |
LastStunDuration |
number | get |
Local agent Duration of the last stun in seconds. |
MovementSpeedUncertainty |
number | get |
Local agent Inaccuracy caused by movement speed. |
Position |
Vector3 | get |
World position of the camera used for aiming and shooting. |
StunnedUntilTick |
int | get |
Simulation tick until which the stun remains active. |
StunnedVisuallyUntilTick |
int | get |
Simulation tick until which the stun visual effect remains active. Usually equals StunnedUntilTick plus the network latency in ticks, so the effect from a short stun does not disappear completely on high ping when the client learns about the stun after it has already ended. |
Target |
Agent | get |
Local agent Aim target. Returns nil if no target is selected or the target agent is no longer available. |
TargetPosition |
Vector3 | get |
Current aim point in world coordinates. |
TotalUncertainty |
number | get |
Local agent Sum of accumulated inaccuracy and movement inaccuracy. |
Methods
Section titled “Methods”ResetAimTarget
Section titled “ResetAimTarget”Aim:ResetAimTarget()Reflex server only Local agent Resets the aim target.
SetAimTarget
Section titled “SetAimTarget”Aim:SetAimTarget(targetPosition: Vector3, agent: Agent)Reflex server only Local agent Sets the aim target and position.
| Param | Type | Optional | Comment |
|---|---|---|---|
targetPosition |
Vector3 | ||
agent |
Agent |
DamageEvent
Section titled “DamageEvent”Damage received event. The game applies damage first and then passes this structure to OnLocalPlayerReceivedDamage(). Every field supports reading and assignment (get/set), but changing the structure does not change damage that was already applied.
Fields
Section titled “Fields”| Field | Type | Access | Description |
|---|---|---|---|
Damage |
number | get/set |
Damage taken. |
DamageDirection |
Vector3 | get/set |
Damage direction: from the point where the damage was received to the attack source. |
DamageDirectionFromHead |
Vector3 | get/set |
Damage direction: from the head to the attack source. |
DamagePosition |
Vector3 | get/set |
Point where the damage was received, relative to the agent’s position. |
DamageTick |
int | get/set |
Tick on which the damage was observed. |
StunnedUntilTick |
int | get/set |
Tick until which the stun remains active. Equals 0 if this damage did not apply a stun. |
WasStunned |
bool | get/set |
true if this damage applied a stun. |
DeathEvent
Section titled “DeathEvent”Agent death event passed to Agents:OnDeath() after the game processes the death. Every field supports reading and assignment (get/set); changing values does not cancel the death or alter the kill feed.
Fields
Section titled “Fields”| Field | Type | Access | Description |
|---|---|---|---|
IsCritical |
bool | get/set |
true if the kill was critical. |
Killer |
string | get/set |
Killer name. |
Victim |
string | get/set |
Name of the agent who died. |
WeaponId |
int | get/set |
ID of the weapon used for the kill. |
EHitboxBodyPart
Section titled “EHitboxBodyPart”Agent hitbox body part.
| Name | Value | Comment |
|---|---|---|
None |
0 |
No body part. |
Head |
1 |
Head. |
Body |
2 |
Body. |
Arm |
3 |
Arm. |
Leg |
4 |
Leg. |
EHitType
Section titled “EHitType”Hit type.
| Name | Value | Comment |
|---|---|---|
None |
0 |
No hit. |
Regular |
1 |
Regular hit. |
Critical |
2 |
Critical hit. |
Fatal |
3 |
Fatal hit. |
FriendlyFire |
4 |
Friendly fire damage. |
KineticShield |
5 |
Kinetic Shield hit. |
Stunned |
6 |
Stunning damage. |
EInputButton
Section titled “EInputButton”Game input buttons accepted by AgentInput. Numeric codes can be passed directly, but named values are easier to read and maintain.
| Name | Value | Comment |
|---|---|---|
Jump |
0 |
Jump. |
Crouch |
1 |
Crouch. |
Walk |
2 |
Walk slowly. |
Fire |
3 |
Primary attack or fire. |
AlternateFire |
4 |
Alternate attack. |
Reload |
5 |
Reload the weapon. |
PrimaryWeapon |
6 |
Select the primary weapon. |
SecondaryWeapon |
7 |
Select the secondary weapon. |
Knife |
8 |
Select the knife. |
BridgeCharge |
9 |
Select the BridgeCharge. |
CycleGrenade |
10 |
Cycle to the next grenade. |
FragGrenade |
11 |
Select the Frag Grenade. |
Incendiary |
12 |
Select the Incendiary. |
Sonar |
13 |
Select the Sonar. |
EmpGrenade |
14 |
Select the EMP Grenade. |
PowerShell |
15 |
Select the PowerShell. |
DropItem |
16 |
Drop the active item. |
Interact |
17 |
Interact with the available object. |
Health
Section titled “Health”Access to the agent health system.
Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
CurrentHealth |
int | get |
Current agent health rounded to an integer. |
CurrentHealthPrecise |
number | get |
Current exact health value of the agent. |
IsAlive |
bool | get |
true if the agent is alive. |
MaxHealth |
int | get |
Maximum agent health. |
Hitbox
Section titled “Hitbox”Agent hitbox: position, radius, body part, and hit checks.
Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
Agent |
Agent | get |
The agent this hitbox belongs to. Returns nil if the agent is no longer available. |
BodyPart |
EHitboxBodyPart | get |
Body part the hitbox belongs to. |
IsBox |
bool | get |
true if the hitbox has a box shape. |
IsSphere |
bool | get |
true if the hitbox has a spherical shape. |
IsVisible |
bool | get |
true if the agent with this hitbox is visible to the local team. When the agent is not visible, all other hitbox members return undefined values. |
Position |
Vector3 | get |
Hitbox center position. |
Radius |
number | get |
Spherical hitbox radius. |
Rotation |
Quaternion | get |
Hitbox rotation in world space. |
Size |
Vector3 | get |
Box hitbox size along each axis in local coordinates. |
HitEvent
Section titled “HitEvent”Outgoing hit event. The combat system calculates the hit and damage before passing this structure to OnLocalPlayerDealtDamage(). Changing its fields does not affect the server result of the shot.
Fields
Section titled “Fields”| Field | Type | Access | Description |
|---|---|---|---|
Damage |
number | get/set |
Damage amount. |
HitEventId |
int | get/set |
Unique hit event ID. |
HitTick |
int | get/set |
Tick on which the hit occurred. |
HitType |
EHitType | get/set |
Hit type. |
StunnedUntilTick |
int | get/set |
Tick until which the stun remains active. Equals 0 if the hit did not apply a stun. |
WasStunned |
bool | get/set |
true if the hit applied a stun. |
Interactable
Section titled “Interactable”An object an agent can interact with. Every property is read-only.
CanInteract() and GetInteractDuration() only query the interaction system’s current conditions. They do not start pickup or defusal. The actual action is performed by regular game input; a Drop also exposes a dedicated PickUp() method.
Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
ActionName |
string | get |
Name of the available action. |
AsDrop |
Drop | get |
Returns the object as a Drop, or nil if it is a different object type. |
AsPlantedBridgeCharge |
PlantedBridgeCharge | get |
Returns the object as a PlantedBridgeCharge, or nil if it is a different object type. |
IsDrop |
bool | get |
true if the object is a Drop. |
IsPlantedBridgeCharge |
bool | get |
true if the object is a PlantedBridgeCharge. |
IsVisible |
bool | get |
true if the object is visible. Other values are undefined while it is hidden. |
Methods
Section titled “Methods”CanInteract
Section titled “CanInteract”Interactable:CanInteract(agent: Agent): boolChecks whether the specified agent can currently interact with the object.
| Param | Type | Optional | Comment |
|---|---|---|---|
agent |
Agent | Agent for which eligibility is checked. |
Returns: bool
GetInteractDuration
Section titled “GetInteractDuration”Interactable:GetInteractDuration(agent: Agent): numberReturns the interaction duration in seconds.
| Param | Type | Optional | Comment |
|---|---|---|---|
agent |
Agent | Agent for which the duration is calculated. |
Returns: number
Interactor
Section titled “Interactor”Access to the agent interaction system.
Fields report the object selected by the interaction system and progress of the current action. Interactor does not expose a command to start or complete an interaction.
Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
AvailableInteractable |
Interactable | get |
Local agent Object the agent can interact with. Returns nil if there is no available object. |
InteractActionName |
string | get |
Name of the current interaction action, such as ‘Defuse’ or ‘PickUp’. |
InteractProgress |
number | get |
Progress of the current interaction from 0 to 1. |
IsDefusing |
bool | get |
Local agent true if the agent is currently defusing the BridgeCharge. |
IsInteracting |
bool | get |
true if the agent is currently interacting with an object. |
Inventory
Section titled “Inventory”Access to the agent inventory and item management.
Despite the name, the published methods here only read slots and items. They do not equip, drop, or purchase anything; those changes come from game input, Shop, or methods on specific world objects.
Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
CurrentItem |
Item | get |
Current equipped item. Returns nil if the inventory is unavailable or no item is equipped. |
IsSwitching |
bool | get |
true if the agent is currently switching CurrentItem. |
SwitchingUntil |
int | get |
Simulation tick until which the CurrentItem switch remains active. |
Methods
Section titled “Methods”GetItem
Section titled “GetItem”Inventory:GetItem(slot: EItemSlot): ItemReturns the first item in the specified slot, or nil if the slot is empty or the inventory is unavailable.
| Param | Type | Optional | Comment |
|---|---|---|---|
slot |
EItemSlot |
Returns: Item
GetItems
Section titled “GetItems”Inventory:GetItems(): Array<Item>Returns all items in the agent’s inventory.
Returns: Array<Item>
GetItemsInSlot
Section titled “GetItemsInSlot”Inventory:GetItemsInSlot(slot: EItemSlot): Array<Item>Returns the items in the specified slot.
| Param | Type | Optional | Comment |
|---|---|---|---|
slot |
EItemSlot |
Returns: Array<Item>
IsSlotEmpty
Section titled “IsSlotEmpty”Inventory:IsSlotEmpty(slot: EItemSlot): boolChecks whether the specified inventory slot is empty.
| Param | Type | Optional | Comment |
|---|---|---|---|
slot |
EItemSlot |
Returns: bool
Movement
Section titled “Movement”Data and calculations related to the agent’s movement and position in the world.
Properties are outputs of the movement system after input and physics have been processed for the current tick. Movement has no direct setters; GetZones() only classifies the current position against map zones.
Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
CrouchJumpCooldownUntil |
int | get |
Simulation tick until which the crouch jump cooldown remains active for the agent. |
CrouchProgress |
number | get |
Current crouch progress from 0 to 1. |
IsCrouching |
bool | get |
true if the agent is crouching. |
IsGrounded |
bool | get |
true if the agent is on solid ground. |
IsWalking |
bool | get |
true if the agent is walking slowly. |
JumpCooldownUntil |
int | get |
Simulation tick until which the agent’s jump cooldown remains active. |
Position |
Vector3 | get |
Current world position where the agent is standing. |
Velocity |
Vector3 | get |
Agent velocity. |
Methods
Section titled “Methods”GetZones
Section titled “GetZones”Movement:GetZones(): Array<string>Returns the list of zones the agent is currently in.
Returns: Array
OcclusionCulling
Section titled “OcclusionCulling”Access to the agent occlusion/visibility system.
The client visibility system decides which enemy information can be exposed to a module. These properties describe that result; they do not enable visibility or issue a raycast on demand.
Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
HasBeenVisible |
bool | get |
Client only true if the agent has ever been visible, or is visible now. |
SoundRange |
number | get |
Audible radius of the sound produced by the agent. |
TicksSinceLastVisible |
int | get |
Client only Number of ticks since the agent was last visible. |
Related types: Array, Color, Vector2, Vector3, and Quaternion.