Home › Lua API › Unit

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

Unit

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

Community reference for this object: Unit (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
ChangeActionCharges Unit:ChangeActionCharges(iDelta: integer) (or nothing) gameplay yes ↗ 0x6fd410 0x6fdb60
ChangeDamage Unit:ChangeDamage(iChange?: number) (or nothing) gameplay yes ↗ 0x6fd460 0x6fdbb0
ChangeExtraMoves Unit:ChangeExtraMoves(iChange?: number) → 1 values ⚠
args: iChange — A number.
gameplay yes ↗ 0x6fd4c0 0x6fdc10
ChangeMovesRemaining Unit:ChangeMovesRemaining(xDelta?: any) → boolean gameplay yes ↗ 0x6fd530 —
GetAbility Unit:GetAbility() → UnitAbility
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc110 0x6bc690
GetActionCharges Unit:GetActionCharges() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc140 0x6bc6c0
GetAirSlots Unit:GetAirSlots() → number
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x6bc190 0x6bc710
GetAirUnits Unit:GetAirUnits() → boolean, Unit[]
✓ called in the game: 2 value(s) as documented
ui-cache yes ↗ 0x6bc1e0 0x6bc760
GetAntiAirCombat UI state: Unit:GetAntiAirCombat() → number
gameplay state: Unit:GetAntiAirCombat() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc2d0 0x6bc850
GetArchaeology Unit:GetArchaeology() → UnitArchaeology
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x6bc320 0x6bc8a0
GetArchaeologyHomeCity Unit:GetArchaeologyHomeCity() → number
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x6bc350 0x6bc8d0
GetAttacksRemaining Unit:GetAttacksRemaining() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc3a0 0x6bc920
GetBarbarianTargetPlayer Unit:GetBarbarianTargetPlayer() → number
✓ called in the game: 1 value(s) as documented
returns: Id of a player: the scripts use the result as Players[result].
ui-cache yes ↗ 0x6bc3f0 0x6bc970
GetBarbarianTribeIndex Unit:GetBarbarianTribeIndex() → number
✓ called in the game: 1 value(s) as documented
returns: The scripts pass the result to Barbarians.GetTribeInciteTargetPlayer. (inferred)
ui-cache yes ↗ 0x6bc440 0x6bc9c0
GetBombardCombat UI state: Unit:GetBombardCombat() → number
gameplay state: Unit:GetBombardCombat() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc490 0x6bca10
GetBuildCharges Unit:GetBuildCharges() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc4e0 0x6bca60
GetChildIDs Unit:GetChildIDs() → table (or nothing) gameplay yes ↗ 0x6fd700 0x6fde50
GetCombat UI state: Unit:GetCombat() → number
gameplay state: Unit:GetCombat() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc530 0x6bcab0
GetComponentID Unit:GetComponentID() → 1 values ⚠
✓ exists at runtime (not called)
ui-cache, gameplay yes ↗ 0x6bc580 0x6bcb00
GetDamage Unit:GetDamage() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc5e0 0x6bcb60
GetDisasterCharges Unit:GetDisasterCharges() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc630 0x6bcbb0
GetDomain Unit:GetDomain() → number
returns: The scripts pass the result to UnitManager.CanFormMilitaryFormation (parameter eDomain). (inferred)
gameplay yes ↗ 0x6fd9b0 0x6fe100
GetExperience Unit:GetExperience() → UnitExperience
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc680 0x6bcc00
GetExtraMoves Unit:GetExtraMoves() → number gameplay yes ↗ 0x6fda40 0x6fe190
GetFormationClass UI state: Unit:GetFormationClass() → number
gameplay state: Unit:GetFormationClass() → number (FormationClassTypes)
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc6b0 0x6bcc30
GetFormationID UI state: Unit:GetFormationID() → number
gameplay state: Unit:GetFormationID() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc700 0x6bcc80
GetFormationMaxMoves UI state: Unit:GetFormationMaxMoves() → number
gameplay state: Unit:GetFormationMaxMoves() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc750 0x6bccd0
GetFormationMovesRemaining UI state: Unit:GetFormationMovesRemaining() → number
gameplay state: Unit:GetFormationMovesRemaining() → number (FixedPoint)
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc7a0 0x6bcd20
GetFormationUnitCount UI state: Unit:GetFormationUnitCount() → number
gameplay state: Unit:GetFormationUnitCount() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc810 0x6bcd90
GetFormationUnitIDs Unit:GetFormationUnitIDs() → table (or nothing) gameplay yes ↗ 0x6fdc40 0x6fe390
GetFormationUnits Unit:GetFormationUnits() → Unit[] (or nothing) gameplay yes ↗ 0x6fdd50 0x6fe4a0
GetFortifyTurns Unit:GetFortifyTurns() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc860 0x6bcde0
GetGreatPerson Unit:GetGreatPerson() → UnitGreatPerson
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bc8b0 0x6bce30
GetGreatWorkIndex Unit:GetGreatWorkIndex() → number
✓ called in the game: 1 value(s) as documented
returns: The scripts pass the result to Game.GetGreatWorkType. (inferred)
ui-cache yes ↗ 0x6bc8e0 0x6bce60
GetHeroClassType Unit:GetHeroClassType() → number
✓ called in the game: 1 value(s) as documented
returns: Key of a row of the HeroClasses table: the scripts look it up with GameInfo.HeroClasses[result]. (inferred)
ui-cache, gameplay yes ↗ 0x6bc930 0x6bceb0
GetID Unit:GetID() → number
✓ called in the game: 1 value(s) as documented
returns: Id of a unit (the scripts name the result unitID). (inferred)
ui-cache, gameplay yes ↗ 0x6bc980 0x6bcf00
GetLocation Unit:GetLocation() → 1 values ⚠
✓ exists at runtime (not called)
ui-cache, gameplay yes ↗ 0x6bc9d0 0x6bcf50
GetLootName Unit:GetLootName() → string
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x6bca20 0x6bcfa0
GetMaxDamage UI state: Unit:GetMaxDamage() → number
gameplay state: Unit:GetMaxDamage() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bcaa0 0x6bd020
GetMaxMoves UI state: Unit:GetMaxMoves() → number
gameplay state: Unit:GetMaxMoves() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bcaf0 0x6bd070
GetMilitaryFormation Unit:GetMilitaryFormation() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bcb40 0x6bd0c0
GetMovementMovesRemaining UI state: Unit:GetMovementMovesRemaining() → number
gameplay state: Unit:GetMovementMovesRemaining() → number (FixedPoint)
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bcb90 0x6bd110
GetMovesRemaining Unit:GetMovesRemaining() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bcc00 0x6bd180
GetName Unit:GetName() → nil/string
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bcc70 0x6bd1f0
GetOperationParameter Unit:GetOperationParameter(arg1: number/string) → number, number (or nothing) gameplay yes ↗ 0x6fe1f0 0x6fe940
GetOperationType Unit:GetOperationType() → number gameplay yes ↗ 0x6fe3e0 0x6feb30
GetOriginalOwner Unit:GetOriginalOwner() → number
✓ called in the game: 1 value(s) as documented
returns: Id of a player: the scripts use the result as Players[result].
ui-cache, gameplay yes ↗ 0x6bccd0 0x6bd250
GetOwner Unit:GetOwner() → number
✓ called in the game: 1 value(s) as documented
returns: Id of a player: the scripts use the result as Players[result].
ui-cache, gameplay yes ↗ 0x6bcd20 0x6bd2a0
GetParentID Unit:GetParentID() → 1 values (or nothing) ⚠ gameplay yes ↗ 0x6fe510 0x6fec60
GetParkCharges Unit:GetParkCharges() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bcd70 0x6bd2f0
GetPlotId Unit:GetPlotId() → number
✓ called in the game: 1 value(s) as documented
returns: Plot index: the scripts pass the result to Map.GetPlotByIndex.
ui-cache yes ↗ 0x6bcdc0 0x6bd340
GetProperties Unit:GetProperties() → 1 values ⚠
✓ exists at runtime (not called)
ui-cache, gameplay yes ↗ 0x6bce30 0x6bd3b0
GetProperty Unit:GetProperty()
✓ called in the game: 0 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bce70 0x6bd3f0
GetPursuingSpyName Unit:GetPursuingSpyName() → string
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x6bcea0 0x6bd420
GetRange UI state: Unit:GetRange() → number
gameplay state: Unit:GetRange() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bcf20 0x6bd4a0
GetRangedCombat UI state: Unit:GetRangedCombat() → number
gameplay state: Unit:GetRangedCombat() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bcf70 0x6bd4f0
GetReligion Unit:GetReligion() → UnitReligion gameplay yes ↗ 0x6fe720 0x6fee70
GetReligionType Unit:GetReligionType() → number
✓ called in the game: 1 value(s) as documented
returns: Key of a row of the Religions table: the scripts look it up with GameInfo.Religions[result].
ui-cache yes ↗ 0x6bcfc0 0x6bd540
GetReligiousHealCharges Unit:GetReligiousHealCharges() → number
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x6bd010 0x6bd590
GetReligiousStrength Unit:GetReligiousStrength() → number
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x6bd060 0x6bd5e0
GetRockBand Unit:GetRockBand() → UnitRockBand
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x742b10 0x743450
GetSpreadCharges Unit:GetSpreadCharges() → number
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x6bd0b0 0x6bd630
GetSpyOperation Unit:GetSpyOperation() → number
✓ called in the game: 1 value(s) as documented
returns: Key of a row of the UnitOperations table: the scripts look it up with GameInfo.UnitOperations[result].
ui-cache yes ↗ 0x6bd100 0x6bd680
GetSpyOperationEndTurn Unit:GetSpyOperationEndTurn() → number
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x6bd150 0x6bd6d0
GetTrade Unit:GetTrade() → UnitTrade
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x6bd1a0 0x6bd720
GetType Unit:GetType() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bd1d0
same code as GetUnitType
0x6bd750
GetTypeHash Unit:GetTypeHash() → number gameplay yes ↗ 0x6fe7b0 0x6fef00
GetUnitType Unit:GetUnitType() → number
✓ called in the game: 1 value(s) as documented
returns: Key of a row of the Units table: the scripts look it up with GameInfo.Units[result].
ui-cache yes ↗ 0x6bd1d0
same code as GetType
0x6bd750
GetUpgradeCost UI state: Unit:GetUpgradeCost() → number
gameplay state: Unit:GetUpgradeCost() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bd220 0x6bd7a0
GetUpgradeResourceCost Unit:GetUpgradeResourceCost() → number, number
✓ called in the game: 2 value(s) as documented
ui-cache yes ↗ 0x742b40 0x743480
GetX Unit:GetX() → number
✓ called in the game: 1 value(s) as documented
returns: The scripts pass the result to PlayerVisibility.IsVisible (parameter x). (inferred)
ui-cache, gameplay yes ↗ 0x6bd270 0x6bd7f0
GetY Unit:GetY() → number
✓ called in the game: 1 value(s) as documented
returns: The scripts pass the result to PlayerVisibility.IsVisible (parameter y). (inferred)
ui-cache, gameplay yes ↗ 0x6bd2c0 0x6bd840
HasHiddenVisibility Unit:HasHiddenVisibility() → boolean
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bd310 0x6bd890
HasMovedIntoZOC UI state: Unit:HasMovedIntoZOC() → boolean
gameplay state: Unit:HasMovedIntoZOC() → boolean
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bd360 0x6bd8e0
HasPendingOperations Unit:HasPendingOperations() → boolean
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bd3b0 0x6bd930
IgnoresZOC Unit:IgnoresZOC() → boolean
✓ exists at runtime (not called)
ui-cache, gameplay yes ↗ 0x6bd400 0x6bd980
IsAutomated Unit:IsAutomated() → boolean
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x6bd450 0x6bd9d0
IsCannotAttack Unit:IsCannotAttack() → boolean
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x6bd4a0 0x6bda20
IsDead UI state: Unit:IsDead() → boolean
gameplay state: Unit:IsDead() → boolean
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bd4f0 0x6bda70
IsDelayedDeath Unit:IsDelayedDeath() → boolean
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bd540 0x6bdac0
IsEmbarked UI state: Unit:IsEmbarked() → boolean
gameplay state: Unit:IsEmbarked() → boolean
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bd590 0x6bdb10
IsGreatPerson Unit:IsGreatPerson() → boolean gameplay yes ↗ 0x6feb60 0x6ff2b0
IsHero Unit:IsHero() → boolean gameplay yes ↗ 0x6febc0 0x6ff310
IsHuman UI state: Unit:IsHuman() → boolean
gameplay state: Unit:IsHuman() → boolean
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bd5e0 0x6bdb60
IsReadyToAutomate UI state: Unit:IsReadyToAutomate() → boolean
gameplay state: Unit:IsReadyToAutomate() → boolean
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bd630 0x6bdbb0
IsReadyToMove UI state: Unit:IsReadyToMove() → boolean
gameplay state: Unit:IsReadyToMove() → boolean
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bd680 0x6bdc00
IsReadyToSelect UI state: Unit:IsReadyToSelect() → boolean
gameplay state: Unit:IsReadyToSelect() → boolean
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x6bd6d0 0x6bdc50
SetActionCharges Unit:SetActionCharges(arg1: integer) (or nothing) gameplay yes ↗ 0x6fed50 0x6ff4a0
SetDamage Unit:SetDamage(iNewValue?: number) (or nothing) gameplay yes ↗ 0x6feda0 0x6ff4f0
SetFortifyTurns Unit:SetFortifyTurns(iTurns?: number) (or nothing) gameplay yes ↗ 0x6fee00 0x6ff550
SetMilitaryFormation Unit:SetMilitaryFormation(eMilitaryFormation?: number) (or nothing)
args: eMilitaryFormation — A constant from the Lua table MilitaryFormationTypes.
gameplay yes ↗ 0x6fee60 0x6ff5b0
SetProperty Unit:SetProperty() (or nothing) gameplay yes ↗ 0x6feec0 0x6ff610