YieldType (Civ5 Type)

From Civilization Modding Wiki
Jump to: navigation, search

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

ID.png The YieldType pseudo-type is actually a regular integer. Pseudo-types do not exist in Lua, they only serve a documentation purpose on the wiki!
  • DB.png Integers labeled as YieldType corresponds to the ID column of the Yields XML table.
  • Lua.png The standard (unmodded) values in the ID and Type columns are also stored in the YieldTypes Lua enumeration.

Lua: the YieldTypes enumeration

Firaxis provides a Lua enumeration named YieldTypes. This is just a regular global table. Its keys are the constants' names and the pairs the corresponding values.

  • This specific enumeration contains data from the Yields data table.
  • They are stored as key/value pairs: the keys are the strings from the Type column and the values are the integers from the ID column.

Radioactive.png Be careful: this enumeration do not reflect the changes, additions and deletions made by mods. As a result it is advised to rely on GameInfo instead.

Below are the values found in this enumeration.

Key Value

XML: the Yields table

Here are the ID and Type columns found in this table.

ID Type


Here is how to use the LUA enumeration to retrieve the ID from the type. Those examples will return and assign the integer value 0.

local id = YieldTypes.YIELD_FOOD
local id = YieldTypes["YIELD_FOOD"]

Used by

string GetYieldTooltip(City city, YieldType yieldType, int base, int total, string iconString, string modifiersString)
string GetYieldTooltipHelper(City city, YieldType yieldType, string icon)
int Area:GetYieldRateModifier(PlayerID index1, YieldType index2)
int City:FindBaseYieldRateRank(YieldType yield)
int City:FindYieldRateRank(YieldType yield)
int City:GetBaseYieldRate(YieldType index)
int City:GetBaseYieldRateFromBuildings(YieldType yieldType)
int City:GetBaseYieldRateFromMisc(YieldType yieldType)
int City:GetBaseYieldRateFromReligion(YieldType yieldType)
int City:GetBaseYieldRateFromSpecialists(YieldType yieldType)
int City:GetBaseYieldRateFromTerrain(YieldType yieldType)
int City:GetBaseYieldRateModifier(YieldType index, int extra = 0)
int City:GetBuildingYieldChange(BuildingClassType buildingClass, YieldType yield)
int City:GetExtraSpecialistYield(YieldType index)
int City:GetExtraSpecialistYieldOfType(YieldType index, SpecialistType specialist)
int City:GetLakePlotYield(YieldType index)
int City:GetReligionBuildingClassYieldChange(BuildingClassType buildingClass, YieldType arg1)
int City:GetResourceYieldRateModifier(YieldType index, ResourceType resource)
int City:GetRiverPlotYield(YieldType index)
int City:GetSeaPlotYield(YieldType index)
int City:GetSpecialistYield(SpecialistType specialist, YieldType yield)
string City:GetYieldModifierTooltip(YieldType yieldType)
int City:GetYieldPerPopTimes100(YieldType yieldType)
int City:GetYieldRate(YieldType index)
int City:GetYieldRateModifier(YieldType index)
int City:GetYieldRateTimes100(YieldType index)
bool City:IsCanPurchase(UnitType unitType, int buildingType, int projectType, int projectID, int projectID = nil, YieldType yield = nil)
City:SetBuildingYieldChange(BuildingClassType buildingClass, YieldType yield, int change)
int Game.GetBuildingYieldChange(BuildingType building, YieldType arg1)
int Game.GetBuildingYieldModifier(BuildingType building, YieldType arg1)
Game.SetPlotExtraYield(int x, int y, YieldType yield, int extraYield)
int Player:CalculateTotalYield(YieldType yield)
int Player:GetCapitalYieldRateModifier(YieldType index)
int Player:GetExtraYieldThreshold(YieldType index)
int Player:GetPlayerBuildingClassYieldChange(BuildingClassType buildingClass, YieldType arg1)
int Player:GetPolicyBuildingClassYieldChange(BuildingClassType buildingClass, YieldType arg1)
int Player:GetPolicyBuildingClassYieldModifier(BuildingClassType buildingClass, YieldType arg1)
int Player:GetSeaPlotYield(YieldType index)
int Player:GetSpecialistExtraYield(SpecialistType index1, YieldType index2)
int Player:GetYieldRateModifier(YieldType index)
int Player:IsCanPurchaseAnyCity(bool arg0, bool arg1, UnitType arg2, BuildingType arg3, YieldType arg4)
int Player:SpecialistYield(SpecialistType specialist, YieldType yield)
int Plot:CalculateBestNatureYield(YieldType index, TeamID team)
int Plot:CalculateImprovementYieldChange(ImprovementType improvement, YieldType yield, PlayerID player, bool optimal, RouteType assumeThisRoute)
int Plot:CalculateNatureYield(YieldType index, TeamID team, bool ignoreFeature = false)
int Plot:CalculateYield(YieldType index, bool display)
int Plot:GetYield(YieldType index)
int Plot:GetYieldWithBuild(BuildActionType build, YieldType yield, bool arg2, PlayerID activePlayer)
bool Plot:HasYield(YieldType yield)
Team:ChangeImprovementYieldChange(ImprovementType index1, YieldType index2, int change)
int Team:GetImprovementYieldChange(ImprovementType index, YieldType index2)

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.