Home › Lua API › Game

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

Game

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

Community reference for this object: Game (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
AddWorldViewText Game.AddWorldViewText(arg1: table, arg2: string, arg3?: number, iData3?: number, arg5?: number, arg6: Unit) (or nothing)
args: arg3 — Plot x coordinate (plot:GetX()).; iData3 — Plot y coordinate (plot:GetY()).; arg5 — A number.
gameplay yes ↗ 0x6d5dc0 0x6d6460
GenerateUnitName Game:GenerateUnitName(uiUnitNamePrefix: integer, uiUnitNameSuffix: integer) → nil
args: uiUnitNamePrefix — A Unit object (the scripts pass a variable named pUnit). (inferred)
✓ exists at runtime (not called)
ui-cache yes ↗ 0x69a5b0 0x69ab80
GetActivePlayerCount Game.GetActivePlayerCount() → number
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x69a7e0 0x69adb0
GetArtifactAtPlot Game.GetArtifactAtPlot(arg1?: number)
✓ exists at runtime (not called)
ui-cache yes ↗ 0x69a820 0x69adf0
GetArtifactByIndex Game.GetArtifactByIndex(arg1?: number)
✓ exists at runtime (not called)
ui-cache yes ↗ 0x69a880 0x69ae50
GetBarbarianManager UI state: Game.GetBarbarianManager() → Barbarians (or nothing)
gameplay state: Game.GetBarbarianManager() → BarbarianTribes (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x69a8c0 0x69ae90
GetComponentID Game.GetComponentID() → 1 values ⚠
✓ exists at runtime (not called)
ui-cache, gameplay yes ↗ 0x69a900 0x69aed0
GetCulture Game.GetCulture() → GameCulture (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x69a940 0x69af10
GetCurrentGameTurn Game.GetCurrentGameTurn() → number
✓ called in the game: 1 value(s) as documented
returns: A turn number (the scripts name the result turn). (inferred)
ui-cache, gameplay yes ↗ 0x69a980 —
GetCurrentTurnPhase Game.GetCurrentTurnPhase() → number
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x69a9c0 —
GetCurrentTurnPhaseName Game.GetCurrentTurnPhaseName() → nil/string
✓ called in the game (returned nothing in that state)
ui-cache, gameplay yes ↗ 0x69aa00
same code as GetCurrentTurnSegmentName
0x69b070
GetCurrentTurnPhaseSound Game.GetCurrentTurnPhaseSound() → nil/string
✓ called in the game (returned nothing in that state)
ui-cache yes ↗ 0x69aa60 0x69afd0
GetCurrentTurnSegment Game.GetCurrentTurnSegment() → number
✓ called in the game: 1 value(s) as documented
returns: A turn number (the scripts name the result turn). (inferred)
ui-cache, gameplay yes ↗ 0x69aac0 —
GetCurrentTurnSegmentName Game.GetCurrentTurnSegmentName() → nil/string
✓ called in the game (returned nothing in that state)
ui-cache, gameplay yes ↗ 0x69aa00
same code as GetCurrentTurnPhaseName
0x69b070
GetDefeatRequirements Game.GetDefeatRequirements(arg1: integer, arg2: number/string) → number
✓ exists at runtime (not called)
ui-cache, gameplay yes ↗ 0x69ab00 0x69b0d0
GetEconomicManager Game.GetEconomicManager() → GameEconomicManager (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x69ac50 0x69b220
GetEmergencyManager Game.GetEmergencyManager() → EmergencyManager (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x711670 0x711ee0
GetEras UI state: Game.GetEras() → GameEras (or nothing)
gameplay state: Game.GetEras() → GameEras (or nothing) ⚠
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x7116b0 0x711f20
GetFalloutManager Game.GetFalloutManager() → GameFalloutManager (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x69ac90 0x69b260
GetGameDiplomacy Game.GetGameDiplomacy() → GameDiplomacy (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x69acd0 0x69b2a0
GetGameEndTurn Game.GetGameEndTurn() → number
✓ called in the game: 1 value(s) as documented
returns: A turn number (the scripts name the result turn). (inferred)
ui-cache yes ↗ 0x69ad10 0x69b2e0
GetGossipManager Game.GetGossipManager() → GameGossipManager (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x69ad50 0x69b320
GetGreatPeople Game.GetGreatPeople() → GameGreatPeople (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x69ad90 0x69b360
GetGreatWorkDataFromIndex ★ Game.GetGreatWorkDataFromIndex(arg1?: number) → string
✓ exists at runtime (not called)
ui-cache yes ↗ 0x69add0 0x69b3a0
GetGreatWorkPlayer ★ Game.GetGreatWorkPlayer(arg1?: number) → number
✓ exists at runtime (not called)
returns: Id of a player: the scripts use the result as Players[result].
ui-cache yes ↗ 0x69b080 0x69b650
GetGreatWorkType Game.GetGreatWorkType(arg1?: number) → number
✓ exists at runtime (not called)
returns: Key of a row of the GreatWorks table: the scripts look it up with GameInfo.GreatWorks[result].
ui-cache yes ↗ 0x69b140 0x69b710
GetGreatWorkTypeFromIndex Game.GetGreatWorkTypeFromIndex(arg1: integer[GreatWorkListIndex]) → number
args: arg1 — Great work list index: the index of a work in the game-wide great work list (not the row in the GreatWorks tab
✓ exists at runtime (not called)
returns: Key of a row of the GreatWorks table: the scripts look it up with GameInfo.GreatWorks[result]. (inferred)
ui-cache yes ↗ 0x69b200 0x69b7d0
GetHeroesManager Game.GetHeroesManager() → GameHeroesManager (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x69b260 0x69b830
GetHistoryManager Game.GetHistoryManager() → GameHistoryManager (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x7116f0 0x711f60
GetLocalObserver Game.GetLocalObserver() → number
✓ called in the game: 1 value(s) as documented
returns: Id of a player: the scripts use the result as Players[result]. (inferred)
ui-cache, gameplay yes ↗ 0x69b2a0 —
GetLocalPlayer Game.GetLocalPlayer() → 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 ↗ 0x69b2e0 —
GetMaxGameTurns Game.GetMaxGameTurns() → number
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x69b320 0x69b8f0
GetNationalParks Game.GetNationalParks() → GameNationalParks (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x69b360 0x69b930
GetObjectFromComponentID Game.GetObjectFromComponentID() → object (or nothing) ⚠ gameplay yes ↗ 0x6d68d0 0x6d6f70
GetPhaseName Game.GetPhaseName() → string (or nothing)
✓ called in the game (returned nothing in that state)
ui-cache, gameplay yes ↗ 0x69b3a0 0x69b970
GetPhaseSound Game.GetPhaseSound() → string (or nothing)
✓ called in the game (returned nothing in that state)
ui-cache yes ↗ 0x69b3f0 0x69b9c0
GetPlayers Game.GetPlayers(arg1?: table) → table
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x69b440 0x69ba10
GetProperties Game.GetProperties() → 1 values ⚠
✓ exists at runtime (not called)
ui-cache, gameplay yes ↗ 0x69ba40 0x69c010
GetProperty UI state: Game.GetProperty() → 1 values (or nothing) ⚠
gameplay state: Game.GetProperty() (or nothing)
✓ called in the game: 0 value(s) as documented
ui-cache, gameplay yes ↗ 0x69ba80 0x69c050
GetQuestsManager Game.GetQuestsManager() → QuestsManager (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x69bb60 0x69c130
GetRandNum Game.GetRandNum(arg1?: number, pszLog?: string[const char]) → number (IntRange)
args: arg1 — A number.; pszLog — A string.
gameplay yes ↗ 0x6d7070 0x6d7710
GetRandomSeed Game.GetRandomSeed() → number gameplay yes ↗ 0x6d7150 0x6d77f0
GetReligion Game.GetReligion() → GameReligion (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x69bba0 0x69c170
GetTechs Game.GetTechs() → GameTechs (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x69bbe0 0x69c1b0
GetTradeManager Game.GetTradeManager() → TradeManager (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache, gameplay yes ↗ 0x69bc20 0x69c1f0
GetUnitNamePrefix ★ Game:GetUnitNamePrefix() → number
⚠ test call in the game raised: Not a valid instance. Either the instance is NULL or you used '.' instead of ':'
returns: The scripts pass the result to Game.GenerateUnitName (parameter uiUnitNameSuffix). (inferred)
ui-cache yes ↗ 0x69bc60 0x69c230
GetUnitNameSuffix ★ Game:GetUnitNameSuffix() → number
⚠ test call in the game raised: Not a valid instance. Either the instance is NULL or you used '.' instead of ':'
returns: The scripts pass the result to Game.GenerateUnitName. (inferred)
ui-cache yes ↗ 0x69bd20 0x69c2f0
GetUnits Game.GetUnits(arg1?: table) → number[][]
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x69bde0 0x69c3b0
GetVictoryProgressForTeam Game.GetVictoryProgressForTeam(arg1?: number, eTeam: integer[TeamTypes]) → number (or nothing)
args: eTeam — Id of a team.
✓ exists at runtime (not called)
ui-cache, gameplay yes ↗ 0x69c330 0x69c900
GetVictoryRequirements Game.GetVictoryRequirements(arg1: integer, arg2: number/string) → number
✓ exists at runtime (not called)
returns: The scripts pass the result to GameEffects.GetRequirementSetInnerRequirements. (inferred)
ui-cache, gameplay yes ↗ 0x69c480 0x69ca50
GetWinningTeam ★ Game.GetWinningTeam() → number, number (or nothing)
✓ called in the game (returned nothing in that state)
ui-cache, gameplay yes ↗ 0x69c5d0 0x69cba0
GetWorldCongress Game.GetWorldCongress() → WorldCongress (or nothing)
✓ called in the game: 1 value(s) as documented
ui-cache yes ↗ 0x740440 0x740d80
IsAllowStrategicCommands UI state: Game.IsAllowStrategicCommands(ePlayer: integer[PlayerTypes]) → boolean
gameplay state: Game.IsAllowStrategicCommands(ePlayer: integer[PlayerTypes]) → boolean
args: ePlayer — Id of a player (as in Players[id]).
✓ exists at runtime (not called)
ui-cache, gameplay yes ↗ 0x69c690 —
IsAllowTacticalCommands UI state: Game.IsAllowTacticalCommands(ePlayer: integer[PlayerTypes]) → boolean
gameplay state: Game.IsAllowTacticalCommands(ePlayer: integer[PlayerTypes]) → boolean
args: ePlayer — Id of a player (as in Players[id]).
✓ exists at runtime (not called)
ui-cache, gameplay yes ↗ 0x69c6f0 —
IsDefeatEnabled ★ Game.IsDefeatEnabled(defeatType: string/number) → boolean
⚠ test call in the game raised: Invalid argument type. Expected number or string. stack traceback: [C]: in funct
ui-cache, gameplay yes ↗ 0x69c750 0x69cd20
IsVictoryEnabled ★ Game.IsVictoryEnabled(victoryType: string/number) → boolean
⚠ test call in the game raised: Invalid argument type. Expected number or string. stack traceback: [C]: in funct
ui-cache, gameplay yes ↗ 0x69c810 0x69cde0
ObserverCanSeePlayer Game.ObserverCanSeePlayer(ePlayer: integer[PlayerTypes]) → boolean
args: ePlayer — Id of a player (as in Players[id]).
✓ exists at runtime (not called)
ui-cache, gameplay yes ↗ 0x69c8d0 0x69cea0
RetirePlayer Game.RetirePlayer(player?: number) (or nothing) gameplay yes ↗ 0x6d7830 0x6d7ed0
SetCurrentGameTurn Game.SetCurrentGameTurn(iTurn: integer) (or nothing)
args: iTurn — A number. (inferred)
gameplay yes ↗ 0x6d7880 0x6d7f20
SetProperty Game.SetProperty() (or nothing) gameplay yes ↗ 0x6d78b0 0x6d7f50
SetRandomSeed Game.SetRandomSeed(newSeed: integer[SeedType]) (or nothing) gameplay yes ↗ 0x6d7920 0x6d7fc0
SetWinningTeam Game.SetWinningTeam(team?: number, victoryType?: number) (or nothing) gameplay yes ↗ 0x6d7950 0x6d7ff0
UnlockAchievement Game.UnlockAchievement(ePlayer: integer[PlayerTypes], szAchievement: string[const char]) (or nothing)
args: ePlayer — Id of a player (as in Players[id]).; szAchievement — A string.
gameplay yes ↗ 0x6d7a00 0x6d80a0

Notes (★)

GetGreatWorkDataFromIndex

Returns the data record for a great work list index.

See also: Game.GetGreatWorkPlayer

GetGreatWorkPlayer

Returns the player recorded on a great work record, or -1 for an index outside the list.

See also: Game.GetGreatWorkDataFromIndex, player-operation.CHOOSE_ARTIFACT_PLAYER

GetUnitNamePrefix

Not callable with no arguments; the recovered signature (no parameters) is incomplete.

GetUnitNameSuffix

Not callable with no arguments; the recovered signature (no parameters) is incomplete.

GetWinningTeam

Returns nothing (not two numbers) while no team has won.

IsDefeatEnabled

Takes a defeat type argument (a number or a type name).

IsVictoryEnabled

Takes a victory type argument (a number or a type name).