PlayerID (Civ5 Type)

From Civilization Modding Wiki
Jump to navigationJump to search

This page is a part of the Lua and UI Reference (Civ5).


ID.png The PlayerID pseudo-type is actually a regular integer. Pseudo-types do not exist in Lua, they only serve a documentation purpose on the wiki!


Usage

  • You can get a player's ID through Player.GetID().
  • There is a global Players table that stores all players. Keys are the players' ID and values are Player instances.
  • The majors civs ID start at 0, up to 21. The minor civs ID start at 22, up to 62. The barbarians always have the ID 63.
  • Those numbers may change in the future, so use the constants defined in GameDefines (see the constants section below) rather than hard-coded values.


How to retrieve a Player object from an ID:

local pPlayer = Players[playerID]


Enumerating players

Radioactive.png Before you invoke a method on a player, ensure that IsEverAlive is true, otherwise Civilzation V will crash. Do not use IsAlive: while it may work sometimes, it does not always prevent a crash.

for id, player in pairs(Players) do
	if player:IsEverAlive() then
		print(id, player:GetName())
	end
end

On a map with two players and two city states this will produce the following output:

0   Wu Zetian
1   Genghis Khan
22  Monaco
23  Geneva
24  Warsaw
63  Barbarian


Built-in constants

You can also use the built-in constants: GameDefines.MAX_PLAYERS (64), GameDefines.MAX_CIV_PLAYERS (63), GameDefines.MAX_MAJOR_CIVS (22) and GameDefines.MAX_MINOR_CIVS (41). See also GameDefines
The following example enumerates major civs only:

for i = 0, GameDefines.MAX_MAJOR_CIVS - 1 do
	if Players[i]:IsEverAlive() then
		print(i, Players[i]:GetName())
	end
end


Code snippets

Here is a function to get a player by its CivilizationType. We then use it to print Wu Zeitan's name.

function GetPlayerByCivilization(civilizationType)
	for _, pPlayer in pairs(Players) do
		if pPlayer:GetCivilizationType() == civilizationType then 
			return pPlayer
		end
	end
end

local chineseCivilizationType = GameInfos.Civilizations.CIVILIZATION_CHINA.ID
local chinesePlayer = GetPlayerByCivilization(chineseCivilizationType)
print(chinesePlayer:GetName())	-- print "Wu Zeitan"


Used by

CivIconHookup(PlayerID player, int iconSize, Image iconControl, Image teamColorControl, int shadowIconControl, int alwaysUseComposite, int shadowed)
string GetCityStateStatus(Player player, PlayerID forPlayer, int war)
string GetMoodInfo(PlayerID otherPlayer)
int, int, table(int => PlayerID), bool, table(int => int), table GetPlayerAndTeamInfo()
table(int => PlayerID) GetShuffledCopyOfTable(table(int => int) incoming_table)
table(int => int) GetStartRegionPriorityListForCiv_GetIDs(string civType)
bool, int, table(int => int) IdentifyTableIndex(table(int => PlayerID) incoming_table, PlayerID value)
bool SimpleCivIconHookup(PlayerID player, int iconSize, Image iconControl)
int TestMembership(table(int => PlayerID) table, PlayerID value)
ResourceType, PlayerID ToGridFromHex(float i, float j)
bool UnitMoving(PlayerID player, UnitID unit)
int Area:GetCitiesPerPlayer(PlayerID index)
int Area:GetFreeSpecialist(PlayerID index)
int Area:GetPopulationPerPlayer(PlayerID index)
unknown Area:GetTargetCity(PlayerID index)
int Area:GetUnitsPerPlayer(PlayerID index)
int Area:GetYieldRateModifier(PlayerID index1, YieldType index2)
ResourceType AssignStartingPlots:AssignLuxuryToRegion(PlayerID region_number)
int AssignStartingPlots:FindFallbackForUnmatchedRegionPriority(int regionType, table(int => PlayerID) regions_still_available)
unknown AssignStartingPlots:GenerateLuxuryPlotListsInRegion(PlayerID region_number)
table(int => int), table(int => int), unknown, unknown, unknown, unknown, unknown AssignStartingPlots:ObtainNextSectionInRegion(int incoming_west_x, int incoming_south_y, int incoming_width, int incoming_height, AreaID areaID, int force_it, int ignore_collisions)
int, int, bool AssignStartingPlots:PlaceCityState(table(int => int) coastal_plot_list, table(int => int) inland_plot_list, bool check_proximity, bool check_collision)
AssignStartingPlots:PlaceCityStateInRegion(int city_state_number, PlayerID region_number)
AssignStartingPlots:PlaceFish(int frequency, table(int => PlayerID) plot_list)
AssignStartingPlots:PlaceSmallQuantitiesOfStrategics(int frequency, table(int => int) plot_list)
int AssignStartingPlots:PlaceSpecificNumberOfResources(ResourceType resource_, ResourceType quantity, int amount, float ratio, int impact_table_number, int min_radius, int max_radius, table(int => PlayerID) plot_list)
AssignStartingPlots:ProcessResourceList(int frequency, int impact_table_number, table(int => int) plot_list, table(int => table(int => ResourceType)) resources_to_place)
Button:SetVoids(PlayerID building, UnitID addToList)
CheckBox:SetVoid1(PlayerID i)
PlayerID City:GetOriginalOwner()
PlayerID City:GetOwner()
PlayerID City:GetPreviousOwner()
bool City:IsEverOwned(PlayerID index)
Context:BuildInstanceForControl(string arg0, table arg1, Stack arg2)
Deal:AddAllowEmbassy(PlayerID us)
Deal:AddCityTrade(PlayerID player, ResourceType city)
Deal:AddDeclarationOfFriendship(PlayerID us)
Deal:AddDefensivePact(PlayerID us, ResourceType dealDuration)
Deal:AddGoldPerTurnTrade(PlayerID us, int goldPerTurn, ResourceType dealDuration)
Deal:AddGoldTrade(PlayerID us, int amount)
Deal:AddOpenBorders(PlayerID us, ResourceType dealDuration)
Deal:AddPeaceTreaty(PlayerID us, int arg1)
Deal:AddResearchAgreement(PlayerID us, ResourceType dealDuration)
Deal:AddResourceTrade(PlayerID us, ResourceType resource, int amount, ResourceType dealDuration)
Deal:AddThirdPartyPeace(PlayerID who, TeamID otherPlayer, int arg2)
Deal:AddThirdPartyWar(PlayerID who, TeamID otherPlayer)
Deal:AddTradeAgreement(PlayerID us, ResourceType dealDuration)
Deal:ChangeGoldPerTurnTrade(PlayerID us, int goldPerTurn, ResourceType dealDuration)
Deal:ChangeGoldTrade(PlayerID us, int gold)
Deal:ChangeResourceTrade(PlayerID us, ResourceType resource, int numResource, ResourceType dealDuration)
int Deal:GetGoldAvailable(PlayerID us, TradeableItemType itemToBeChanged)
TradeableItemType, unknown, unknown, ResourceType, int, PlayerID Deal:GetNextItem()
int Deal:GetNumResource(PlayerID us, ResourceType resType)
PlayerID Deal:GetOtherPlayer(PlayerID player)
int Deal:IsPossibleToTradeItem(PlayerID us, PlayerID them, TradeableItemType tradeType, TeamID dealDuration, ResourceType dealDuration = nil)
Deal:RemoveByType(TradeableItemType arg0, PlayerID us)
Deal:RemoveThirdPartyPeace(PlayerID firstParty, TeamID otherPlayer)
Deal:RemoveThirdPartyWar(PlayerID firstParty, TeamID otherPlayer)
Deal:SetFromPlayer(PlayerID us)
Deal:SetToPlayer(PlayerID them)
Events.AILeaderMessage(PlayerID player, DiploUIStateType diploUIState, string leaderMessage, int animationAction, int data1)
Events.ConnectedToNetworkHost(PlayerID player)
Events.EndCombatSim(PlayerID attackingPlayer, UnitID attackingUnit, int attackingUnitDamage, int attackingUnitFinalDamage, int attackingUnitMaxHitPoints, PlayerID defendingPlayer, UnitID defendingUnit, int defendingUnitDamage, int defendingUnitFinalDamage, int defendingUnitMaxHitPoints)
Events.GameMessageChat(PlayerID fromPlayer, PlayerID toPlayer, string text, ChatTargetType targetType)
Events.GameplaySetActivePlayer(PlayerID activePlayer, int prevActivePlayer)
Events.InitCityRangeStrike(PlayerID Player, CityID CityID)
Events.LocalMachineUnitPositionChanged(PlayerID player, UnitID unitID, Vector3 unitPosition)
Events.MultiplayerGamePlayerDisconnected(PlayerID player)
Events.OpenPlayerDealScreenEvent(PlayerID player, int target = nil)
Events.PlayerVersionMismatchEvent(PlayerID player, unknown playerName, bool isHost)
Events.RunCombatSim(PlayerID attackingPlayer, UnitID attackingUnit, int attackingUnitDamage, int attackingUnitFinalDamage, int attackingUnitMaxHitPoints, PlayerID defendingPlayer, UnitID defendingUnit, int defendingUnitDamage, int defendingUnitFinalDamage, int defendingUnitMaxHitPoints)
Events.SerialEventCityCaptured(Vector2 hexPos, PlayerID player, int cityID, PlayerID newPlayer)
Events.SerialEventCityCreated(Vector2 vHexPos, PlayerID player, CityID cityID, ArtStyleType artStyleType, EraType eraType, int continent, int populationSize, int size, int fogState)
Events.SerialEventCityDestroyed(Vector2 hexPos, PlayerID player, int cityID, PlayerID newPlayer)
Events.SerialEventCitySetDamage(PlayerID player, CityID cityID, int damage, int previousDamage)
Events.SerialEventEraChanged(int arg0, PlayerID currPlayer)
Events.SerialEventHexCultureChanged(int hexX, int hexY, PlayerID player, bool unknown)
Events.SerialEventImprovementCreated(float hexX, int hexY, ArtStyleType continent1, ArtStyleType continent2, PlayerID player, int createImprovementType, ImprovementType createImprovementRRType, int createImprovementEra, int createImprovementState, unknown ImprovementEra = nil)
Events.SerialEventRawResourceCreated(float hexX, int hexY, ArtStyleType continent, ArtStyleType continent, PlayerID player, int arg5, int createResourceType, int arg7, int arg8)
Events.SerialEventRoadCreated(int hexX, int hexY, PlayerID player, int routeType)
Events.SerialEventUnitCreated(PlayerID player, UnitID unitID, int hexVec, int unitType, int cultureType, int civID, int primaryColor, int secondaryColor, int unitFlagIndex, int fogState)
Events.SerialEventUnitDestroyed(PlayerID player, UnitID unitID)
Events.SerialEventUnitFlagSelected(PlayerID player, HandicapType unit)
Events.SerialEventUnitSetDamage(PlayerID player, UnitID unitID, int damage, int previousDamage)
Events.SerialEventUnitTeleportedToHex(unknown i, unknown j, PlayerID player, UnitID unitID)
Events.ShowAttackTargets(PlayerID player, UnitID arg1)
Events.ShowMovementRange(PlayerID player, UnitID arg1)
Events.SpecificCityInfoDirty(PlayerID player, CityID cityID, CityUpdateType updateType)
Events.UnitActionChanged(PlayerID player, UnitID unitID)
Events.UnitEmbark(PlayerID player, UnitID unitID)
Events.UnitGarrison(PlayerID player, UnitID unitID, int garrisoned)
Events.UnitMarkThreatening(PlayerID player, UnitID unitID, bool mark)
Events.UnitMemberCombatStateChanged(PlayerID player, UnitID unitID, int memberID, unknown stateID)
Events.UnitMemberCombatTargetChanged(PlayerID player, UnitID unitID, int memberID, unknown targetPlayerID, unknown targetUnitID, int targetMemberID)
Events.UnitMemberOverlayAdd(PlayerID player, UnitID unitID, int memberID, unknown position)
Events.UnitMemberOverlayRemove(PlayerID player, UnitID unitID, int memberID)
Events.UnitMemberOverlayShowHide(PlayerID player, UnitID unitID, int memberID, bool show)
Events.UnitMemberPositionChanged(PlayerID player, UnitID unitID, int memberID, unknown unitPosition)
Events.UnitMoveQueueChanged(PlayerID player, UnitID unitID, bool remainingMoves)
Events.UnitSelectionChanged(PlayerID player, UnitID u, float hexX, float hexY, int k, bool isSelected, bool arg6)
Events.UnitShouldDimFlag(PlayerID player, UnitID unitID, int dim)
Events.UnitStateChangeDetected(PlayerID player, UnitID unitID, int fogState)
Events.UnitVisibilityChanged(PlayerID player, UnitID unitID, bool visible, bool checkFlag, unknown blendTime)
Game.AddPlayer(PlayerID newPlayer, LeaderType leader, CivilizationType civ)
Game.DoFromUIDiploEvent(DiploUIEventType event, PlayerID aIPlayer, SpecialistType button, int againstPlayer, int arg3)
Game.DoMinorBullyGold(PlayerID activePlayer, PlayerID minorCiv)
Game.DoMinorBullyUnit(PlayerID activePlayer, PlayerID minorCiv)
Game.DoMinorBuyout(PlayerID activePlayer, PlayerID minorCiv)
Game.DoMinorGiftTileImprovement(PlayerID fromPlayer, TaskType toPlayer, int plotX, int plotY)
Game.DoMinorPledgeProtection(PlayerID activePlayer, PlayerID minorCiv, bool arg2)
Game.EnhanceReligion(PlayerID vaticanPlayer, ReligionType religion, BeliefType belief4, BeliefType belief5)
Game.FoundReligion(PlayerID vaticanPlayer, ReligionType religion, unknown arg2, BeliefType belief2, BeliefType belief3, BeliefType belief3, int arg6, City vaticanCity)
PlayerID Game.GetActivePlayer()
PlayerID Game.GetFounder(ReligionType arg0, int arg1)
ReligionType Game.GetFounderBenefitsReligion(PlayerID player)
PlayerID Game.GetGameTurn()
City Game.GetHolyCityForReligion(ReligionType religion, PlayerID player)
PlayerID Game.GetNoNukesCount()
int Game.GetPlayerRank(PlayerID index)
int Game.GetPlayerScore(PlayerID index)
int Game.GetPlayerVote(PlayerID ownerIndex, int voteId)
PlayerID Game.GetRankPlayer(int rank)
int Game.GetResearchAgreementCost(PlayerID us, PlayerID them)
PlayerID Game.GetStartTurn()
Game.SaveReplay(PlayerID player)
Game.SetActivePlayer(PlayerID newValue, bool forceHotSeat)
Game.SetAdvisorRecommenderTech(PlayerID player)
Game.SetFounder(ReligionType arg0, PlayerID newOwner)
Game.SetPausePlayer(PlayerID arg0)
GameEvents.CityBuildingsIsBuildingSellable(PlayerID player, BuildingType building)
GameEvents.CityCanConstruct(PlayerID player, CityID city, BuildingType buildingType)
GameEvents.CityCaptureComplete(PlayerID player, int capital, ResourceType x, ResourceType y, PlayerID newPlayer, int conquest, int conquest)
GameEvents.CityConvertsReligion(PlayerID owner, ReligionType religion, int x, int y)
GameEvents.GetFounderBenefitsReligion(PlayerID player)
GameEvents.GetReligionToSpread(PlayerID player)
GameEvents.GetScenarioDiploModifier1(PlayerID player1, PlayerID player2)
GameEvents.GetScenarioDiploModifier2(PlayerID player1, PlayerID player2)
GameEvents.PlayerAdoptPolicy(PlayerID player, int policyID)
GameEvents.PlayerCanAdoptPolicyBranch(PlayerID player, int policyBranch)
GameEvents.PlayerCityFounded(PlayerID player, int cityX, int cityY)
GameEvents.PlayerDoTurn(PlayerID player)
GameEvents.PlayerPreAIUnitUpdate(PlayerID player)
GameEvents.SetAlly(PlayerID cSPlayer, PlayerID oldAlly, PlayerID newAlly)
GameEvents.UnitGetSpecialExploreTarget(PlayerID player, UnitID unitID)
GameEvents.UnitSetXY(PlayerID player, UnitID unit, int x, int y)
Grid:RegisterCallback(MouseType thisEvent, (void func(PlayerID void1, ResourceType void2, Button button)) OnContinueButtonClicked)
GridButton:SetVoids(PlayerID player, int id)
LuaEvents.PasswordChanged(PlayerID player)
LuaEvents.ScenarioPlayerStatusChanged(table(PlayerID => table(string => table)) tPlayerStatus, PlayerID turn, int year, PlayerID playerAboutToWin, int turnsControlHeld)
LuaEvents.ScenarioUnitTiersChanged(table(string => PlayerID) tUnitTiers)
LuaEvents.SetCivNameEditSlot(PlayerID slot)
PlayerID Matchmaking.GetHostID()
PlayerID Matchmaking.GetLocalID()
table(PlayerID => table) Matchmaking.GetPlayerList()
Matchmaking.KickPlayer(PlayerID player)
int Network.GetPingTime(PlayerID player)
Network.SendBarbarianRansom(int arg0, PlayerID unit)
Network.SendEnhanceReligion(PlayerID arg0, ReligionType CurrentReligion, unknown customName, unknown arg3, int arg4, int cityX, int cityY)
Network.SendFaithGreatPersonChoice(PlayerID player, unknown arg1)
Network.SendFaithPurchase(PlayerID arg0, FaithPurchaseType v1, int v2)
Network.SendFoundPantheon(PlayerID arg0, BeliefType Belief)
Network.SendFoundReligion(PlayerID arg0, ReligionType CurrentReligion, unknown customName, unknown arg3, unknown arg4, BeliefType arg5, BeliefType arg6, int cityX, int cityY)
Network.SendGreatPersonChoice(PlayerID player, unknown arg1)
Network.SendMayaBonusChoice(PlayerID player, unknown arg1)
Network.SendMinorNoUnitSpawning(PlayerID minorCiv, bool arg1)
Network.SendMoveSpy(PlayerID arg0, unknown SelectedAgentID, PlayerID arg2, int arg3)
Network.SendPledgeMinorProtection(PlayerID minorCiv, bool arg1)
Network.SendResearch(PlayerID tech, ResourceType discover, int value, bool arg3 = nil)
Network.SendStageCoup(PlayerID arg0, unknown arg1)
Player:AddNotification(NotificationType notificationType, string description, string title, int x = -1, int y = -1, PlayerID extra1 = -1, int extra2 = -1)
bool Player:CanContact(PlayerID player)
bool Player:CanMajorBullyGold(PlayerID major)
bool Player:CanMajorBullyUnit(PlayerID activePlayer)
int Player:CanMajorBuyout(PlayerID activePlayer)
bool Player:CanMajorGiftTileImprovement(PlayerID activePlayer)
bool Player:CanMajorGiftTileImprovementAtPlot(PlayerID fromPlayer, int plotX, int plotY)
bool Player:CanMajorStartProtection(PlayerID activePlayer)
bool Player:CanMajorWithdrawProtection(PlayerID activePlayer)
bool Player:CanTradeWith(PlayerID whoTo)
Player:ChangeMinorCivFriendshipWithMajor(PlayerID player)
Player:Contact(PlayerID player)
Player:DoForceDenounce(PlayerID player)
Player:DoForceDoF(PlayerID player)
Player:DoMinorLiberationByMajor(PlayerID player)
Player:DoUpdateProximityToPlayer(PlayerID player)
Player:ForcePeace(PlayerID player)
MinorCivQuestType Player:GetActiveQuestForPlayer(PlayerID player)
PlayerID Player:GetAlly()
MajorCivApproachType Player:GetApproachTowardsUsGuess(PlayerID player)
int Player:GetBuyoutCost(PlayerID activePlayer)
int Player:GetCommonFoeValue(PlayerID activePlayer)
CoopWarState Player:GetCoopWarAcceptedState(PlayerID withPlayer, PlayerID againstPlayer)
int Player:GetCurrentCapitalFoodBonus(PlayerID major)
int Player:GetCurrentCultureBonus(PlayerID activePlayer)
int Player:GetCurrentOtherCityFoodBonus(PlayerID major)
int Player:GetCurrentScienceFriendshipBonusTimes100(PlayerID major)
int Player:GetCurrentSpawnEstimate(PlayerID major)
int Player:GetExtraBuildingHappinessFromPolicies(PlayerID building)
int Player:GetFriendshipChangePerTurnTimes100(PlayerID major)
int Player:GetFriendshipFromGoldGift(PlayerID activePlayer, int gold)
int Player:GetGiftTileImprovementCost(PlayerID activePlayer)
int Player:GetHappinessFromMinor(PlayerID minor)
PlayerID Player:GetID()
DisputeLevelType Player:GetLandDisputeLevel(PlayerID activePlayer)
int Player:GetMinorCivBullyGoldAmount(PlayerID activePlayer)
int Player:GetMinorCivContestValueForPlayer(PlayerID major, MinorCivQuestType arg1)
int Player:GetMinorCivCurrentCultureBonus(PlayerID major)
int Player:GetMinorCivCurrentFaithBonus(PlayerID major)
int Player:GetMinorCivCurrentHappinessBonus(PlayerID major)
DisputeLevelType Player:GetMinorCivDisputeLevel(PlayerID activePlayer)
int Player:GetMinorCivFriendshipAnchorWithMajor(PlayerID major)
int Player:GetMinorCivFriendshipLevelWithMajor(PlayerID arg0)
int Player:GetMinorCivFriendshipWithMajor(PlayerID major)
int Player:GetMinorCivNumActiveQuestsForPlayer(PlayerID player)
int Player:GetNumCiviliansReturnedToMe(PlayerID activePlayer)
int Player:GetNumRequestsRefused(PlayerID activePlayer)
int Player:GetNumTimesCultureBombed(PlayerID activePlayer)
int Player:GetNumTradeResourceImports(PlayerID player)
int Player:GetNumWarsFought(PlayerID otherPlayer)
table(unknown => unknown) Player:GetOpinionTable(PlayerID activePlayer)
int Player:GetOtherPlayerNumProtectedMinorsAttacked(PlayerID activePlayer)
int Player:GetOtherPlayerNumProtectedMinorsKilled(PlayerID activePlayer)
int Player:GetProximityToPlayer(PlayerID index)
int Player:GetQuestData1(PlayerID major, MinorCivQuestType type = nil)
int Player:GetQuestData2(PlayerID major, MinorCivQuestType type = nil)
int Player:GetQuestTurnsRemaining(PlayerID major, MinorCivQuestType type, PlayerID arg2)
int Player:GetRecentAssistValue(PlayerID activePlayer)
SpecialistType, int Player:GetRecentIntrigueInfo(PlayerID aIPlayer)
int Player:GetRecentTradeValue(PlayerID activePlayer)
PlayerID Player:GetTeam()
int Player:GetTurnLastPledgeBrokenByMajor(PlayerID activePlayer)
int Player:GetTurnLastPledgedProtectionByMajor(PlayerID activePlayer)
ThreatType Player:GetWarmongerThreat(PlayerID activePlayer)
DisputeLevelType Player:GetWonderDisputeLevel(PlayerID activePlayer)
int Player:HasRecentIntrigueAbout(PlayerID player)
bool Player:IsAllies(PlayerID major)
bool Player:IsCapitalCapturedBy(PlayerID activePlayer)
bool Player:IsDemandEverMade(PlayerID activePlayer)
bool Player:IsDenouncedPlayer(PlayerID otherPlayer)
bool Player:IsDenouncingPlayer(PlayerID player)
bool Player:IsDoF(PlayerID otherPlayer)
bool Player:IsDoFMessageTooSoon(PlayerID activePlayer)
bool Player:IsDontSettleMessageTooSoon(PlayerID withPlayer)
int Player:IsFriendDeclaredWarOnUs(PlayerID activePlayer)
int Player:IsFriendDenouncedUs(PlayerID activePlayer)
int Player:IsFriends(PlayerID major = nil)
bool Player:IsGaveAssistanceTo(PlayerID activePlayer)
bool Player:IsHasPaidTributeTo(PlayerID activePlayer)
bool Player:IsLiberatedCapital(PlayerID activePlayer)
bool Player:IsLiberatedCity(PlayerID activePlayer)
bool Player:IsLoyalMember(PlayerID minor)
bool Player:IsMinorCivActiveQuestForPlayer(PlayerID major, MinorCivQuestType type)
bool Player:IsMinorCivContestLeader(PlayerID major, MinorCivQuestType arg1)
bool Player:IsMinorCivUnitSpawningDisabled(PlayerID activePlayer)
bool Player:IsMinorWarQuestWithMajorActive(PlayerID playerLoop = nil)
bool Player:IsNukedBy(PlayerID activePlayer)
bool Player:IsPlayerBrokenBorderPromise(PlayerID activePlayer)
bool Player:IsPlayerBrokenCityStatePromise(PlayerID activePlayer)
bool Player:IsPlayerBrokenCoopWarPromise(PlayerID activePlayer)
bool Player:IsPlayerBrokenExpansionPromise(PlayerID activePlayer)
bool Player:IsPlayerBrokenMilitaryPromise(PlayerID activePlayer)
bool Player:IsPlayerDenouncedEnemy(PlayerID otherPlayer)
bool Player:IsPlayerDenouncedFriend(PlayerID activePlayer)
bool Player:IsPlayerDoFwithAnyEnemy(PlayerID activePlayer)
bool Player:IsPlayerDoFwithAnyFriend(PlayerID otherPlayer)
bool Player:IsPlayerHasOpenBorders(PlayerID major)
bool Player:IsPlayerHasOpenBordersAutomatically(PlayerID major)
bool Player:IsPlayerIgnoredBorderPromise(PlayerID activePlayer)
bool Player:IsPlayerIgnoredCityStatePromise(PlayerID activePlayer)
bool Player:IsPlayerIgnoredExpansionPromise(PlayerID activePlayer)
bool Player:IsPlayerIgnoredMilitaryPromise(PlayerID activePlayer)
bool Player:IsPlayerNoSettleRequestEverAsked(PlayerID activePlayer)
bool Player:IsPlayerRecklessExpander(PlayerID activePlayer)
bool Player:IsProtectedByMajor(PlayerID activePlayer)
int Player:IsProtectingMinor(PlayerID player)
bool Player:IsStopSpyingMessageTooSoon(PlayerID activePlayer)
bool Player:IsThreateningBarbariansEventActiveForPlayer(PlayerID major)
bool Player:IsWillAcceptPeaceWithPlayer(PlayerID player)
Player:IsWorkingAgainstPlayerAccepted(PlayerID withPlayer, PlayerID againstPlayer)
Player:IsWorkingWithPlayer(PlayerID withPlayer)
Player:IsWorkingWithPlayerMessageTooSoon(PlayerID withPlayer)
Player:SetLoyalMember(PlayerID minor, bool newValue)
bool Player:WasResurrectedThisTurnBy(PlayerID player)
int Plot:CalculateImprovementYieldChange(ImprovementType improvement, YieldType yield, PlayerID player, bool optimal, RouteType assumeThisRoute)
bool Plot:CanBuild(BuildActionType build, PlayerID player, bool testVisible)
int Plot:CountNumAirUnits(PlayerID player)
unknown Plot:GetBestDefender(PlayerID owner, PlayerID attackingPlayer, Unit attacker, bool testAtWar, bool testPotentialEnemy, bool testCanMove)
int Plot:GetFoundValue(PlayerID index)
int Plot:GetNumDefenders(PlayerID player)
PlayerID Plot:GetOwner()
int Plot:GetPlayerCityRadiusCount(PlayerID index)
PlayerID Plot:GetRevealedOwner(TeamID team, bool debug)
int Plot:GetUnitPower(PlayerID owner)
int Plot:GetUpgradeTimeLeft(ImprovementType improvement, PlayerID player)
int Plot:GetYieldWithBuild(BuildActionType build, YieldType yield, bool arg2, PlayerID activePlayer)
bool Plot:IsAdjacentPlayer(PlayerID player, bool landOnly)
bool Plot:IsBestAdjacentFound(PlayerID index)
bool Plot:IsFriendlyTerritory(PlayerID player)
bool Plot:IsPlayerCityRadius(PlayerID index)
int Plot:IsVisibleEnemyUnit(PlayerID player)
bool Plot:IsVisibleOtherUnit(PlayerID player)
bool Plot:IsWithinTeamCityRadius(TeamID team, PlayerID ignorePlayer)
Plot:SetOwner(PlayerID newValue, int acquiringCityID, bool checkUnits = true, bool updateResources = true)
CivilizationType PreGame.GetCivilization(PlayerID i = nil)
int PreGame.GetCivilizationColor(PlayerID player)
string PreGame.GetCivilizationDescription(PlayerID player)
unknown PreGame.GetCivilizationPackageTextKey(PlayerID player)
string PreGame.GetCivilizationShortDescription(PlayerID player)
HandicapType PreGame.GetHandicap(PlayerID player = nil)
string PreGame.GetLeaderName(PlayerID player)
string PreGame.GetNickName(PlayerID activePlayer)
SlotClaim PreGame.GetSlotClaim(PlayerID player)
SlotStatus PreGame.GetSlotStatus(PlayerID player)
TeamID PreGame.GetTeam(PlayerID player)
bool PreGame.HasPassword(PlayerID player)
bool PreGame.IsCivilizationKeyAvailable(PlayerID player)
int PreGame.IsReady(PlayerID player)
PreGame.SetCivilization(PlayerID player, CivilizationType civ = nil)
PreGame.SetCivilizationAdjective(PlayerID EditSlot, string arg1)
PreGame.SetCivilizationDescription(PlayerID EditSlot, string arg1)
PreGame.SetCivilizationShortDescription(PlayerID EditSlot, string arg1)
PreGame.SetHandicap(PlayerID player, HandicapType id)
PreGame.SetLeaderName(PlayerID EditSlot, string arg1)
PreGame.SetNickName(PlayerID EditSlot, string arg1)
PreGame.SetPassword(PlayerID player, string arg1, string arg2 = nil)
PreGame.SetReady(PlayerID arg0, bool checked = nil)
PreGame.SetSlotClaim(PlayerID player, SlotClaim arg1)
PreGame.SetSlotStatus(PlayerID i, SlotStatus arg1)
PreGame.SetTeam(PlayerID player, PlayerID playerChoice)
int PreGame.TestPassword(PlayerID player, string arg1)
PullDown:RegisterSelectionCallback((void func(PlayerID playerID, HandicapType id, unknown control)) OnChatTarget)
Slider:SetValue(string sliderValue, PlayerID value = nil)
table(unknown => unknown) Steam.GetPlayerSteamID(PlayerID player)
PlayerID Team:GetLeaderID()
PlayerID Team:GetSecretaryID()
Team:SetHasTech(TechType index, bool newValue, PlayerID player, bool first, bool announce)
TeamTechs:ChangeResearchProgress(TechType index, int change, PlayerID player)
int TeamTechs:ChangeResearchProgressPercent(TechType index, int percent, PlayerID player)
TeamTechs:ChangeResearchProgressTimes100(TechType index, int change, PlayerID player)
TeamTechs:SetResearchProgress(TechType index, int newValue, PlayerID player)
TextBase:SetWrapWidth(PlayerID arg0)
TextButton:SetVoid1(PlayerID playerLoop)
UI.ActivateNotification(PlayerID blockingNotificationIndex)
UI.DoFinalizePlayerDeal(PlayerID them, PlayerID us, bool arg2)
int UI.GetNumCurrentDeals(PlayerID player)
int UI.GetNumHistoricDeals(PlayerID player)
PlayerID UI.HasMadeProposal(PlayerID us)
UI.LoadCurrentDeal(PlayerID player, SpecialistType i)
UI.LoadHistoricDeal(PlayerID player, SpecialistType i)
UI.LoadProposedDeal(PlayerID us, PlayerID them)
UI.OnHumanDemand(PlayerID aIPlayer)
UI.OnHumanOpenedTradeScreen(PlayerID aIPlayer)
bool UI.ProposedDealExists(PlayerID them, PlayerID us)
UI.SetInterfaceModeValue(PlayerID minorCiv)
UI.SetRepeatActionPlayer(PlayerID player)
Unit:ChangeDamage(int change, PlayerID player)
Unit Unit:GetFireSupportUnit(PlayerID defender, int x, int y)
PlayerID Unit:GetOwner()
Unit:Kill(bool delay, PlayerID player = NO_PLAYER)
Unit:SetDamage(int newValue, PlayerID player, bool notifyEntity = true)
Unit:SetOriginalOwner(PlayerID oldOwner)



The initial version of this page was created by the Civ5 API Bot, see the Civ5 API Reference FAQ. Some of the texts come from the 2kgames' wiki and most of code samples are copyrighted to Firaxis.
Functions' signatures were either copied from the 2kgames' wiki, or infered from the Lua source files and the binaries. Errors are possible.
Contributors may find help in the Contributors guide to the Civ5 API.