<AiFavoredItems>
<Row ListType="DefaultCitySpecialization" Item="BUILD_FOR_FOOD"/>
<Row ListType="DefaultCitySpecialization" Item="BUILD_FOR_PRODUCTION"/>
<Row ListType="DefaultCitySpecialization" Item="BUILD_FOR_GOLD"/>
<Row ListType="DefaultCitySpecialization" Item="BUILD_FOR_SCIENCE"/>
<Row ListType="DefaultCitySpecialization" Item="BUILD_FOR_CULTURE"/>
<Row ListType="DefaultCitySpecialization" Item="BUILD_FOR_FAITH"/>
<Row ListType="DefaultCitySpecialization" Item="BUILD_CITY_DEFENSES" Value="-1"/>
<Row ListType="DefaultCitySpecialization" Item="BUILD_MILITARY_UNITS" Value="1"/>
<Row ListType="DefaultCitySpecialization" Item="BUILD_TRADE_UNITS" Value="2"/>
<Row ListType="DefaultCityBuilds" Item="CITY_EVENT_DEFAULT" StringVal="Simple City Tree"/>
<Row ListType="DefaultCityBuilds" Item="CITY_EVENT_UNIT_OR_BUILDING" StringVal="Build City Building"/>
<Row ListType="DefaultCityBuilds" Item="CITY_EVENT_DISTRICT" StringVal="Build City District"/>
<Row ListType="DefaultCityBuilds" Item="CITY_EVENT_IMPROVEMENT" StringVal="Build City Improvement"/>
<Row ListType="DefaultCityBuilds" Item="CITY_EVENT_WONDER" StringVal="Seek Target Wonder"/>
<Row ListType="DefaultCityBuilds" Item="CITY_UNDER_THREAT" StringVal="City Defense"/>
</AiFavoredItems>
<AiBuildSpecializations>
<Row SpecializationType="BUILD_FOR_FOOD" BuildingYield="YIELD_FOOD" IncludePopulation="true" PrioritizationYield="YIELD_FOOD"/>
<Row SpecializationType="BUILD_FOR_PRODUCTION" BuildingYield="YIELD_PRODUCTION" PrioritizationYield="YIELD_PRODUCTION"/>
<Row SpecializationType="BUILD_FOR_GOLD" BuildingYield="YIELD_GOLD" PrioritizationYield="YIELD_GOLD"/>
<Row SpecializationType="BUILD_FOR_SCIENCE" BuildingYield="YIELD_SCIENCE" PrioritizationYield="YIELD_SCIENCE"/>
<Row SpecializationType="BUILD_FOR_CULTURE" BuildingYield="YIELD_CULTURE" PrioritizationYield="YIELD_CULTURE"/>
<Row SpecializationType="BUILD_FOR_FAITH" BuildingYield="YIELD_FAITH" PrioritizationYield="YIELD_FAITH"/>
<Row SpecializationType="BUILD_CITY_DEFENSES" IncludeDefense="true" PrioritizationYield="YIELD_PRODUCTION"/>
<Row SpecializationType="BUILD_MILITARY_UNITS" IncludeMilitaryUnits="true" PrioritizationYield="YIELD_PRODUCTION"/>
<Row SpecializationType="BUILD_TRADE_UNITS" IncludeTradeUnits="true" PrioritizationYield="YIELD_GOLD"/>
</AiBuildSpecializations>
function PrintAllCityProductionItems(iPlayer, bIsFirstTime)
local pPlayer = Players[iPlayer]
if pPlayer:IsHuman() then
local iNumMajorCivs = PlayerManager.GetAliveMajorsCount();
for iLoopPlayer = 0, iNumMajorCivs - 1 do
local pLoopPlayer = Players[iLoopPlayer]
if pLoopPlayer:IsAlive() then
local sPlayerCivName = PlayerConfigurations[iLoopPlayer]:GetCivilizationTypeName()
local sPlayerLeaderName = PlayerConfigurations[iLoopPlayer]:GetLeaderTypeName()
print("[PrintAllCityProductionItems] Player # " .. iLoopPlayer .. " is being used as " .. sPlayerCivName .. " with leader of " .. sPlayerLeaderName)
local pCities = pLoopPlayer:GetCities();
if pCities:GetCount() > 0 then
for i, pCity in pCities:Members() do
print("[PrintAllCityProductionItems] " .. Locale.Lookup(pCity:GetName()) .. " is producing " .. tostring(pCity:GetBuildQueue():CurrentlyBuilding()))
end
else
print("[PrintAllCityProductionItems] " .. sPlayerLeaderName .. " has no cities")
end
end
end
end
end
Events.PlayerTurnActivated.Add(PrintAllCityProductionItems)
Player # 0 is being used as CIVILIZATION_ROME with leader of LEADER_TRAJAN
Rome is producing BUILDING_HANGING_GARDENS
Arpinum is producing BUILDING_GRANARY
Antium is producing BUILDING_GRANARY
Player # 1 is being used as CIVILIZATION_NORWAY with leader of LEADER_HARDRADA
Nidaros is producing BUILDING_LRS_HOUSING0
Player # 2 is being used as CIVILIZATION_KONGO with leader of LEADER_MVEMBA
Mbanza Kongo is producing UNIT_SLINGER
Player # 3 is being used as CIVILIZATION_GREECE with leader of LEADER_PERICLES
Athens is producing BUILDING_MONUMENT
Player # 4 is being used as CIVILIZATION_ENGLAND with leader of LEADER_VICTORIA
London is producing UNIT_SLINGER
Player # 5 is being used as CIVILIZATION_ARABIA with leader of LEADER_SALADIN
Cairo is producing UNIT_SLINGER
Player # 6 is being used as CIVILIZATION_JAPAN with leader of LEADER_HOJO
Kyoto is producing UNIT_SLINGER
Player # 7 is being used as CIVILIZATION_INDIA with leader of LEADER_GANDHI
Delhi is producing BUILDING_MONUMENT
Player # 8 is being used as CIVILIZATION_RUSSIA with leader of LEADER_PETER_GREAT
St. Petersburg is producing UNIT_SLINGER
Player # 9 is being used as CIVILIZATION_AMERICA with leader of LEADER_T_ROOSEVELT
Washington is producing UNIT_SLINGER
It might be that wonders in general are treated differently. From AI perspective they all should be worth building.
@LeeS I have buildings with housing and amenities in later eras, will try to check if they are built.
Sorry to necro this thread but you seem to be the only person who knows how "Value" works. Is a ranking number? As in, a Value 1's get built before Value 2's? I'm trying to add some AI behavior to my first Civ.Does your building have a direct yield in <Building_YieldChanges> ?
I haven't checked yet whether all standard buildings have an actual yield assigned within the table, but the ones that don't (so far as I have checked) seem to have a housing or entertainment effect, or are wonders. The reason I'm asking is this found in the Leaders.xml:The default Value for <AiFavoredItems> is "0", so military and trade units would appear to be favored higher than just about anything else in the "DefaultCitySpecialization" when that is being applied (and not over-ridden by something like "Build for Defense" or whatever).Spoiler :Code:<AiFavoredItems> <Row ListType="DefaultCitySpecialization" Item="BUILD_FOR_FOOD"/> <Row ListType="DefaultCitySpecialization" Item="BUILD_FOR_PRODUCTION"/> <Row ListType="DefaultCitySpecialization" Item="BUILD_FOR_GOLD"/> <Row ListType="DefaultCitySpecialization" Item="BUILD_FOR_SCIENCE"/> <Row ListType="DefaultCitySpecialization" Item="BUILD_FOR_CULTURE"/> <Row ListType="DefaultCitySpecialization" Item="BUILD_FOR_FAITH"/> <Row ListType="DefaultCitySpecialization" Item="BUILD_CITY_DEFENSES" Value="-1"/> <Row ListType="DefaultCitySpecialization" Item="BUILD_MILITARY_UNITS" Value="1"/> <Row ListType="DefaultCitySpecialization" Item="BUILD_TRADE_UNITS" Value="2"/> <Row ListType="DefaultCityBuilds" Item="CITY_EVENT_DEFAULT" StringVal="Simple City Tree"/> <Row ListType="DefaultCityBuilds" Item="CITY_EVENT_UNIT_OR_BUILDING" StringVal="Build City Building"/> <Row ListType="DefaultCityBuilds" Item="CITY_EVENT_DISTRICT" StringVal="Build City District"/> <Row ListType="DefaultCityBuilds" Item="CITY_EVENT_IMPROVEMENT" StringVal="Build City Improvement"/> <Row ListType="DefaultCityBuilds" Item="CITY_EVENT_WONDER" StringVal="Seek Target Wonder"/> <Row ListType="DefaultCityBuilds" Item="CITY_UNDER_THREAT" StringVal="City Defense"/> </AiFavoredItems> <AiBuildSpecializations> <Row SpecializationType="BUILD_FOR_FOOD" BuildingYield="YIELD_FOOD" IncludePopulation="true" PrioritizationYield="YIELD_FOOD"/> <Row SpecializationType="BUILD_FOR_PRODUCTION" BuildingYield="YIELD_PRODUCTION" PrioritizationYield="YIELD_PRODUCTION"/> <Row SpecializationType="BUILD_FOR_GOLD" BuildingYield="YIELD_GOLD" PrioritizationYield="YIELD_GOLD"/> <Row SpecializationType="BUILD_FOR_SCIENCE" BuildingYield="YIELD_SCIENCE" PrioritizationYield="YIELD_SCIENCE"/> <Row SpecializationType="BUILD_FOR_CULTURE" BuildingYield="YIELD_CULTURE" PrioritizationYield="YIELD_CULTURE"/> <Row SpecializationType="BUILD_FOR_FAITH" BuildingYield="YIELD_FAITH" PrioritizationYield="YIELD_FAITH"/> <Row SpecializationType="BUILD_CITY_DEFENSES" IncludeDefense="true" PrioritizationYield="YIELD_PRODUCTION"/> <Row SpecializationType="BUILD_MILITARY_UNITS" IncludeMilitaryUnits="true" PrioritizationYield="YIELD_PRODUCTION"/> <Row SpecializationType="BUILD_TRADE_UNITS" IncludeTradeUnits="true" PrioritizationYield="YIELD_GOLD"/> </AiBuildSpecializations>
Just spitballing here and I could be full of beans, but I am guessing the item's "Yield" is being looked for in the <Building_YieldChanges> table in order to determine whether the building is good for food, for example, when the AI decides to go for food in a city.