Skip to content
RecursiveVision edited this page Oct 13, 2021 · 24 revisions

A

Return Method (arguments) Description
void AddMessage(string sMessage, opt PlayerID iNotifyPlayer)

C

Return Method (arguments) Description
void ChangeBaseYieldRateFromMisc(YieldType iYield, int iChange) Change the yields you get from "Traits and Other Sources" (as said in the UI)
void ChangeCityAutomatonWorkersChange(int iChange) Change the change in the number of automaton workers in the city.
void ChangeCityWorkingChange(int iChange) Changes the change in plot working range due to local buildings in the city.
void ChangeDisloyaltyCounter(int iChange) Method for JFDLC.
void ChangeFaithPerTurnFromReligion(int iChange) Change the faith per turn due to religion in this city.
void ChangeJONSCulturePerTurnFromReligion(int iChange)
void ChangeLoyaltyCounter(int iChange) Method for JFDLC.
void ChangeOverflowProduction(int iChange)
void ChangePlagueCounter(int iChange) Method for JFDLC.
void ChangePlagueTurns(int iChange) Method for JFDLC.
void ChangeResistanceCounter(int iChange) Method for JFDLC.
void ChangeTourismRateModifier(int iChange) Changes the tourism modifier for great works in the city.
int CountFeature(FeatureType iFeature) Returns the total number of plots in the city which have the specified feature.
int CountImprovement(ImprovementType iImprovement) Returns the total number of plots in the city which have the specified improvement.
int CountNumImprovement(ImprovementType iImprovement) Returns the total number of plots in the city which have the specified improvement.
int CountNumWorkedFeature(FeatureType iFeature) Returns the number of worked plots in the city which have the specified feature.
int CountNumWorkedImprovement(ImprovementType iImprovement, opt bool bIgnorePillaged = true) Returns the number of worked plots in the city which have the specified feature.
int CountNumWorkedResource(ResourceType iResource) Returns the number of worked plots in the city which have the specified resource.
int CountNumWorkedRiverTiles(opt TerrainType iTerrain = NO_TERRAIN) Returns the number of worked plots in the city which are river tiles. If no terrain is specified, counts all worked river tiles. Otherwise, counts only worked river tiles of the particular terrain type.
int CountPlotType(PlotType iPlotType) Returns the number of plots in the city which are of the specified type.
int CountResource(ResourceType iResource) Returns the total number of plots in the city which have the specified resource.
int CountTerrain(TerrainType iTerrain) Returns the total number of plots in the city which have the specified terrain.
int CountWorkedFeature(FeatureType iFeature) Returns the number of worked plots in the city which have the specified feature.
int CountWorkedImprovement(ImprovementType iImprovement) Returns the number of worked plots in the city which have the specified improvement.
int CountWorkedPlotType(PlotType iPlotType) Returns the number of worked plots in the city which are of the specified type.
int CountWorkedResource(ResourceType iResource) Returns the number of worked plots in the city which have the specified resource.
int CountWorkedTerrain(TerrainType iTerrain) Returns the number of worked plots in the city which have the specified terrain.
void ChangeYieldFromTraits(YieldType iYield, int iChange) Changes the Yield of the city by that amount, shows up in the UI as coming from a Civ Trait.

D

Return Method (arguments) Description
void DoCancelCityEventChoice(CityEventChoiceType iChoice) Stops the specified event choice at the city.
void DoCityEventChoice(CityEventChoiceType iChoice) Activates the specified event choice at the city. Does not require the city event to already be active.
void DoCityStartEvent(CityEventType iEvent) Activates the specified event at the city.
void DoFranchiseAtCity(City pCity) Builds the caller city's owner's corporate franchise at the argument city.

F

Return Method (arguments) Description
int FoodConsumptionSpecialistTimes100() Returns the food consumption of a specialist. Can depend on the era and other modifiers.

G

Return Method (arguments) Description
int GetActiveSpyYieldMod(YieldType iYield) What is the yield modifier in the city due to the player having active spies?
int GetAdditionalFood() Returns the food cost reduction per citizen set by Lua. See SetAdditionalFood.
int GetAutomatons() The number of automaton workers in a city.
int GetBaseYieldRateFromCSAlliance(YieldType iYieldType) Yields from having city state friends and allies.
int GetBaseYieldRateFromGreatWorks(YieldType iYieldType)
int GetBaseYieldRateFromLeague(YieldType iYieldType)
int GetBaseYieldRateFromProcess(YieldType iYieldType)
int GetBaseYieldRateFromTradeRoutes(YieldType iYieldType)
int, bool GetBombardRange() Returns both the range, and whether indirect fire is allowed.
int GetBuildingClassCultureChange(BuildingClassType iBuildingClass) Deprecated.
int GetBuildingConversionModifier(BuildingType iBuildingType)
int GetBuildingGlobalConversionModifier(BuildingType iBuildingType)
int GetBuildingInvestment(BuildingTypes iBuildingType) Returns the discounted cost of a building after investment, if the building has been invested. Otherwise returns 0.
int GetBuildingYieldChangeFromCorporationFranchises(BuildingClassType iBuildingClass, YieldType iYield) How much yields does the building class get from franchises of the player's corporation?
int GetBuyPlotDistance() How far out this city may buy plots.
int GetCityAutomatonWorkersChange() What are the changes to the number of automaton workers in the city? Includes from the city, player, and team levels.
int GetCityBuildingRangeStrikeModifier() Returns the change to city bombard range due to buildings in the city.
int GetCityEventChoiceCooldown(CityEventChoiceType iChoice) Returns the number of turns before the specified event choice can be selected again.
int GetCityEventCooldown(CityEventType iEvent) Returns the number of turns before the specified city event can activate again. Returns -1 for one shot events which have already activated before.
string GetCityUnhappinessBreakdown(opt bool bIncludeMedian = false, opt bool bFlavor = false) Builds and returns text breaking down the unhappiness situation in the city.
int GetCityWorkingChange() What is the change in plot working range due to local buildings?
int GetCityYieldModFromMonopoly(YieldType iYield) Returns the yield modifier due to the player's resource monopolies.
int GetCounterSpy() Returns the ID of the counter spy in the city. If none exists, returns -1.
int GetCultureModFromCarnaval() What is the culture modifier due to the city celebrating 'We Love The King Day'? This is for the column WLTKDCultureBoost in the database table Traits. If the city is not currently celebrating, returns a 0. Note the typo 'Carnaval' in the method name.
int GetDisloyaltyCounter() Method for JFDLC.
string GetDisabledTooltip(CityEventChoiceType iChoice) Generates the tooltip explaining why a city event choice is disabled.
int getEmpireSizeMod() What is the multiplier for happiness needs due to the player's number of non-puppet cities?
int GetEventBuildingClassYield(BuildingClassType iBuildingClass, YieldType iYield) What is the yield change for the building class due to events?
int GetEventBuildingClassModifier(BuildingClassType iBuildingClass, YieldType iYield) What is the yield modifier for the building class due to events?
int GetEventCityYield(YieldType iYield) What is the yield in the city due to events?
int GetGreatWorkYieldMod(YieldType iYield) What is the yield modifier due to the number of great works?
int GetGPRateModifierPerXFranchises() Returns the great person rate modifier per x number of franchises for the city.
int getHappinessDelta() Returns the excess happiness in the city.
int getHappinessThresholdMod(YieldType iYield) What is the happiness threshold modifier in the city for the specified yield?
int GetLocalBuildingClassYield(BuildingClassType iBuildingClass, YieldType iYield) What is the change in yield for the building class due to other buildings in the city?
int GetLoyaltyCounter() Method for JFDLC.
LoyaltyStateType GetLoyaltyState() Method for JFDLC.
int GetModFromGoldenAge(YieldType iYield) Returns the golden age yield modifier for the city. If the player is not currently in a golden age, returns 0.
int GetModFromWLTKD(YieldType iYield) Returns the yield modifier in the city when celebrating 'We Love The King Day'. If the city is not currently celebrating, returns 0.
int GetNumAvailableGreatWorkSlots(GreatWorkSlotType iSlot) How many unfilled great work slots of the specified type does the city have?
int GetNumBuildingClass(BuildingClassType iBuildingClassType) How many buildings belonging to building class type does the city have?
int GetNumGreatWorksFilled(GreatWorkSlotType iSlot) How many great work slots of the specified type have been filled?
int GetNumPoliciesNeeded(BuildingTypes iBuilding) How many policies does the player need to have for the building to be unlocked?
int GetNumTimesOwned(PlayerID iPlayer) How many times has this player owned this city?
int GetNumTotalBuildings(opt bool bSkipDummy = true, opt bool bSkipWorldWonder = true, opt bool bSkipNationalWonder = true) Counts the total number of buildings in the city. Can be toggled to include dummy buildings, world wonders, and national wonders.
int GetOrganizedCrime() Method for JFDLC.
int GetPlagueCounter() Method for JFDLC.
int GetPlagueTurns() Method for JFDLC.
int GetPlagueType() Method for JFDLC.
int getPopThresholdMod() Returns the population of the city multiplied by BALANCE_HAPPINESS_POP_MULTIPLIER in defines divided by 100.
int getPotentialUnhappinessWithGrowth() If the city's population increases by 1, what is the potential increase in unhappiness?
int GetProcessProductionTurnsLeft(ProcessTypes iProcess, int iNum) Used for the stockpile process mod. iNum can be any value.
int GetProvinceLevel() Method for JFDLC.
int GetReligionBuildingYieldRateModifier(BuildingClassType iBuildingClass, YieldType iYield) Yield modifier to the specified building class due to religion.
int GetReligionYieldRateModifier(YieldType iYield) What is the modifier for the specified type due to religion?
int GetRemainingFreeSpecialists() Returns the number of specialists that still can be assigned without causing unhappiness.
int GetResistanceCounter() Method for JFDLC.
int GetResourceQuantityPerXFranchises(ResourceType iResource) Returns the number of resources per x number of franchises for the city.
string GetScaledEventChoiceValue(CityEventChoiceType iChoice, bool bYieldsOnly) Generates the tooltip showing the event choice yields after era scaling.
int GetSpecialistCityModifier(SpecialistType iSpecialist) Returns the great person rate modifier for the specific great person type.
int GetSpecialistYieldChange(SpecialistType iSpecialist, YieldType iYield) What is the change in specialist yields in the city due to religion and events?
int GetStaticTechDeviation() Returns the increase in needs to prevent unhappiness due to the global technology level.
int GetTheoreticalUnhappinessDecrease(BuildingType iBuilding) Calculate the theoretical decrease in unhappiness if the building is built in the city. If the building cannot be built in the city, returns 0.
int getThresholdAdditions(YieldType iYield) Happiness mod related.
int getThresholdSubtractions(YieldType iYield) Happiness mod related.
int GetTotalSpecialistCount() What is the total number of worked specialists in the city?
int GetTourismRateModifier()
int GetTradeRouteCityMod(YieldType iYield) Get the yield modifier due to the city being connected to another city with the player's corporate franchise.
int getUnhappinessAggregated() Calculates the total unhappiness due to various sources.
int GetUnhappinessFromCulture() Calculates the unhappiness due to a deficit of culture, after applying a hierarchy of needs.
int GetUnhappinessFromCultureDeficit() Calculates the additional culture per citizen required before eliminating unhappiness due to culture.
int GetUnhappinessFromCultureNeeded() Calculates the culture per citizen needed to eliminate unhappiness due to culture.
int GetUnhappinessFromCultureYield() Calculates the culture per citizen.
int GetUnhappinessFromDefense() Calculates the unhappiness due to a deficit of defense, after applying a hierarchy of needs.
int GetUnhappinessFromDefenseDeficit() Calculates the additional defense per citizen required before eliminating unhappiness due to defense.
int GetUnhappinessFromDefenseNeeded() Calculates the defense per citizen needed to eliminate unhappiness due to defense.
int GetUnhappinessFromDefenseYield() Calculates the defense per citizen.
int GetUnhappinessFromConnection() What is the unhappiness in the city due to not being connected to the capital?
int GetUnhappinessFromGold() Calculates the unhappiness due to a deficit of gold, after applying a hierarchy of needs.
int GetUnhappinessFromGoldDeficit() Calculates the additional gold per citizen required before eliminating unhappiness due to gold.
int GetUnhappinessFromGoldNeeded() Calculates the gold per citizen needed to eliminate unhappiness due to gold.
int GetUnhappinessFromGoldYield() Calculates the gold per citizen.
int GetUnhappinessFromMinority() What is the unhappiness in the city due to religious conflict?
int GetUnhappinessFromPillaged() What is the unhappiness in the city due to having pillage tiles?
int GetUnhappinessFromScience() Calculates the unhappiness due to a deficit of science, after applying a hierarchy of needs.
int GetUnhappinessFromScienceDeficit() Calculates the additional science per citizen required before eliminating unhappiness due to science.
int GetUnhappinessFromScienceNeeded() Calculates the science per citizen needed to eliminate unhappiness due to science.
int GetUnhappinessFromScienceYield() Calculates the science per citizen.
int getUnhappinessFromSpecialists() What is the unhappiness in the city due to the number of specialists worked?
int GetUnhappinessFromStarving() What is the unhappiness in the city due to starvation?
int GetUnhappinessFromYieldRaw(YieldType iYield) Calculates the raw unhappiness due to a deficit for the specified yield type.
int GetUnitInvestment(UnitClassType iUnitClass) Returns the discounted cost of a unit class after investment, if the it has been invested in. Otherwise returns 0.
int GetWorkPlotDistance() How far out this city may work plots.
int GetWorldWonderCost(BuildingTypes iBuilding) Returns the percent increase to world wonder cost due to the player having already built world wonders. iBuilding needs to be a world wonder for the method to work, though it doesn't matter which one.
int GetYieldChangeFromCorporationFranchises(YieldType iYield) How much yields do the buildings in the city get from corporate franchises?
int GetYieldChangeTradeRoute(YieldType iYield) Returns the yields in the city due to being connected to the capital. Only includes the yields due to policies, rather than traits.
int GetYieldFromCityYield(YieldType iYield) What is the yield for the specified type due to yields of other types? Related to the database table Building_YieldFromYieldPercent.
int GetYieldFromCrime(YieldType iYield) Method for JFDLC.
int GetYieldFromDevelopment(YieldType iYield) Method for JFDLC.
int GetYieldFromHappiness(YieldType iYield) Method for JFDLC.
int GetYieldFromHealth(YieldType iYield) Method for JFDLC.
int GetYieldFromUnitsInCity(YieldType iYield) Returns the yields in the city due to units on the city plot.
int GetYieldModifierFromCrime(YieldType iYield) Method for JFDLC.
int GetYieldModifierFromDevelopment(YieldType iYield) Method for JFDLC.
int GetYieldModifierFromHappiness(YieldType iYield) Method for JFDLC.
int GetYieldModifierFromHealth(YieldType iYield) Method for JFDLC.
int GetYieldPerPopInEmpireTimes100(YieldType iYield) Related to the database table Building_YieldChangesPerPopInEmpire.
int GetYieldPerTurnFromMinors(YieldType iYield) Returns the yields in the city due to city state alliances.
int GetYieldPerTurnFromTraits(YieldType iYield) Returns the yields in the city due to the player's civilization traits.

H

Return Method (arguments) Description
bool HasAnyDomesticTradeRoute()
bool HasAnyInternationalTradeRoute()
bool HasAnyNaturalWonder()
bool HasAnyReligion()
bool HasAnyWonder()
bool HasBelief(BeliefType iBeliefType)
bool HasBuilding(BuildingType iBuildingType)
bool HasBuildingClass(BuildingClassType iBuildingClassType)
bool HasCounterSpy()
bool HasDiplomat(PlayerID iPlayer)
bool HasFeature(FeatureType iFeatureType)
bool HasImprovement(ImprovementType iImprovementType)
bool HasLoyaltyState(LoyaltyStateType iValue) Method for JFDLC.
bool HasNaturalWonder(FeatureType iFeatureType) Functionally the same as HasFeature.
bool HasOffice() Does the city have the owner's corporate office?
bool HasOrganizedCrime(int iValue) Method for JFDLC.
bool HasPlague() Method for JFDLC.
bool HasPlotType(PlotType iPlotType)
bool HasProvinceLevel(int iValue) Method for JFDLC.
bool HasReligion(ReligionType iReligionType)
bool HasResource(ResourceType iResourceType) Does any of the plots within the city's working range contain the resource? The player must be able to see the resource. This method does not count resources granted directly by buildings.
bool HasSpecialist(SpecialistType iSpecialistType)
bool HasSpecialistSlot(SpecialistType iSpecialistType)
bool HasSpy(PlayerType iPlayer)
bool HasTerrain(TerrainType iTerrainType)
bool HasTradeRouteFrom(City pCity)
bool HasTradeRouteFromAnyCity()
bool HasTradeRouteTo(City pCity)
bool HasTradeRouteToAnyCity()
bool HasWonder(BuildingType iBuildingType) Functionally the same as HasBuilding.
bool HasWorkedFeature(FeatureType iFeatureType)
bool HasWorkedImprovement(ImprovementType iImprovementType)
bool HasWorkedPlotType(PlotType iPlotType)
bool HasWorkedResource(ResourceType iResourceType)
bool HasWorkedTerrain(TerrainType iTerrainType)

I

Return Method (arguments) Description
bool IsAddsFreshWater() Does any of the local buildings in the city add fresh water to the adjacent plots?
bool IsAdjacentToFeature(FeatureTypes iFeatureType)
bool IsAdjacentToImprovement(ImprovementType iImprovementType)
bool IsAdjacentToPlotType(PlotType iPlotType)
bool IsAdjacentToResource(ResourceType iResourceType)
bool IsAdjacentToTerrain(TerrainType iTerrainType)
bool IsBlockadedTest() Is the city being blockaded?
bool IsCityEventChoiceActive(CityEventChoiceType iChoice, opt bool bInstantEvents = false) Is the city event choice currently in effect?
bool IsCityEventChoiceValid(CityEventChoiceType iChoice, CityEventType iEvent) Checks if the city event choice is valid to be selected. The specified city event needs to be a parent of event choice, and must be activated.
bool IsCivilization(CivilizationType iCivilizationType)
bool IsColony() Method for JFDLC. Checks if the city is a colony.
bool IsConnectedTo(City pCity) Is the city connected to the other city via road, rail, or sea connections?
bool IsConnectedToCapital() Is the city connected to the capital via road, rail, or sea connections?
bool IsFoodRoutes() Can the city send food domestic trade routes?
bool IsFranchised(PlayerID iPlayer) Does the city have the specified player's corporate franchise?
bool IsHasBuildingClass(BuildingClassType iBuildingClassType)
bool IsOnFeature(FeatureType iFeatureType)
bool IsOnImprovement(ImprovementType iImprovementType)
bool IsOnPlotType(PlotType iPlotType)
bool IsOnResource(ResourceType iResourceType)
bool IsOnTerrain(TerrainType iTerrainType)
bool IsProductionRoutes() Can the city send production domestic trade routes?
bool IsWithinDistanceOfFeature(FeatureType iFeatureType, int iDistance)
bool IsWithinDistanceOfImprovement(ImprovementType iImprovementType, int iDistance)
bool IsWithinDistanceOfPlotType(PlotType iPlotType, int iDistance)
bool IsWithinDistanceOfResource(ResourceType iResourceType, int iDistance)
bool IsWithinDistanceOfTerrain(TerrainType iTerrainType, int iDistance)
bool IsWithinDistanceOfUnit(UnitType iUnitType, int iDistance, bool IsFriendly, bool IsEnemy)
bool IsWithinDistanceOfUnitClass(UnitClassType iUnitClass, int iDistance, bool IsFriendly, bool IsEnemy)
bool IsWithinDistanceOfUnitCombatType(UnitCombatType iUnitCombat, int iDistance, bool IsFriendly, bool IsEnemy)
bool IsWithinDistanceOfUnitPromotion(UnitPromotionType iUnitPromotion, int iDistance, bool IsFriendly, bool IsEnemy)
bool IsWorldWonder(BuildingType iBuilding) Checks if a building type is a world wonder.

P

Return Method (arguments) Description
void Purchase(UnitType iUnitType, BuildingType iBuildingType, ProjectType iProjectType, YieldType iYieldType) City purchases the unit/building/project using gold/faith. Purchase must be valid. Yields will be deducted as normal.

R

Return Method (arguments) Description
void RefreshTourism() Prompts the game to recalculate the tourism values of the city.

S

Return Method (arguments) Description
void SetAdditionalFood(int iValue) Set the reduction in food cost per citizen for the city. Stacks additively with other sources of food cost reduction, until a minimum of 1 food per citizen.
void SetAutomatons(int iValue, bool bReassignPop) Set the number of automaton workers in a city. bReassignPop should be true unless you really know what you are doing.
void SetCityEventChoiceCooldown(int iCooldown) Sets the number of turns before the city event choice can be selected again.
void SetCityEventCooldown(int iCooldown) Sets the number of turns before the city event can activate again.
void SetColony(bool bValue) Method for JFDLC. Sets the colony status of the city.
void SetDisloyaltyCounter(int iValue) Method for JFDLC.
void SetLoyaltyState(LoyaltyStateType iValue) Method for JFDLC.
void SetNumFreeBuilding(BuildingType iBuildingType, int iCount) The city will have a number of the specified free building. Free buildings cost no maintenance and resources. Note that this method will not change any real buildings if they already exist, you'll need to take care of that in your code.
void SetLoyaltyCounter(int iValue) Method for JFDLC.
void SetOrganizedCrime(int iValue) Method for JFDLC.
void SetPlagueCounter(int iValue) Method for JFDLC.
void SetPlagueTurns(int iValue) Method for JFDLC.
void SetPlagueType(int iValue) Method for JFDLC.
void SetProvinceLevel(int iValue) Method for JFDLC.
void SetResistanceCounter(int iValue) Method for JFDLC.
void SetYieldFromCrime(YieldType iYield, int iValue) Method for JFDLC.
void SetYieldFromDevelopment(YieldType iYield, int iValue) Method for JFDLC.
void SetYieldFromHappiness(YieldType iYield, int iValue) Method for JFDLC.
void SetYieldFromHealth(YieldType iYield, int iValue) Method for JFDLC.
void SetYieldModifierFromCrime(YieldType iYield, int iValue) Method for JFDLC.
void SetYieldModifierFromDevelopment(YieldType iYield, int iValue) Method for JFDLC.
void SetYieldModifierFromHappiness(YieldType iYield, int iValue) Method for JFDLC.
void SetYieldModifierFromHealth(YieldType iYield, int iValue) Method for JFDLC.
void SetYieldPerTurnFromMinors(YieldType iYield, int iValue) Set the yields in the city due to city state alliances.