Home › Lua API › PlayerUnits

Available out of the box. Usable from Lua in the unmodified game.

PlayerUnits

11 methods. Symbol/current columns are function addresses (RVA) of the native wrapper.

Community reference for this object: PlayerUnits (Sukrit Tan, external).

Signatures are recovered from the game code. ⚠ = partly understood (arguments may be missing or approximate). ? after a name = optional argument. Types: integer/number are Lua numbers, enum-typed arguments show the C++ type in brackets. Two signatures mean the method is registered separately for the UI and the gameplay state and each wrapper was decoded on its own. "same code as" in the Symbol column means the compiler merged identical functions: those methods share one wrapper and cannot be told apart by address.

Method Signature Where Reference Symbol Current
Create PlayerUnits:Create(arg1?: number, iX?: integer, iY?: integer) → Unit
args: iX — Plot x coordinate (plot:GetX()).; iY — Plot y coordinate (plot:GetY()).
gameplay yes ↗ 0x6f7e00 0x6f8540
Destroy PlayerUnits:Destroy(pkUnit: Unit) (or nothing)
args: pkUnit — A Unit object (the scripts pass a variable named pUnit).
gameplay yes ↗ 0x6f7f80 0x6f86c0
FindID UI state: PlayerUnits:FindID(arg1?: number) → Unit
gameplay state: PlayerUnits:FindID(arg1?: number) → Unit
args: arg1 — Id of a unit (named unitID in the scripts). (inferred)
ui-cache, gameplay yes ↗ 0x6b68c0 0x6b6e40
GetCount PlayerUnits:GetCount() → number ui-cache, gameplay yes ↗ 0x6b6930 0x6b6eb0
GetFirstReadyUnit PlayerUnits:GetFirstReadyUnit() → Unit ui-cache yes ↗ 0x6b6980 0x6b6f00
GetNextExtractingArchaeologist PlayerUnits:GetNextExtractingArchaeologist() → Unit ui-cache yes ↗ 0x6b69c0 0x6b6f40
GetProcessingState PlayerUnits:GetProcessingState() → table{Total: number, NeedsAttention: number, CanMove: number, Automated: number} (or nothing) ui-cache yes ↗ 0x6b6a00 0x6b6f80
IsBuildDisabled PlayerUnits:IsBuildDisabled(eUnit: integer) → boolean gameplay yes ↗ 0x6f8090 0x6f87d0
RecomputeAllCosts PlayerUnits:RecomputeAllCosts() (or nothing) gameplay yes ↗ 0x6f8280 0x6f89c0
RecomputeCost PlayerUnits:RecomputeCost(eUnit: integer[UnitTypes]) → number
args: eUnit — Index of a row of the Units table (the value of GameInfo.Units[...].Index).
gameplay yes ↗ 0x6f82a0 0x6f89e0
SetBuildDisabled PlayerUnits:SetBuildDisabled(eUnit: integer, bNewValue: boolean) (or nothing)
args: bNewValue — A boolean flag (true/false).
gameplay yes ↗ 0x6f8310 0x6f8a50