Pizza Guy
Chieftain
- Joined
- Jun 29, 2016
- Messages
- 17
Code:
local ROAD_CULTURE = 1
local CivTypeMyCiv = GameInfoTypes.CIVILIZATION_MY_CIV
function RoadCulture(pCity)
local iCulture = 0
local iNumRoads = 0
for iPlot = 0, pCity:GetNumCityPlots() - 1 do
local pPlot = pCity:GetCityIndexPlot(iPlot)
if pPlot and pPlot:IsRoute() and pCity:IsWorkingCityPlot(pPlot) then
iNumRoads = iNumRoads + 1
iRoadCulture = iCulture + ROAD_CULTURE
end
end
return iCulture, iNumRoads
end
function PlayerTurn(iPlayer)
if iPlayer <= iMaxPlayerID then
local pPlayer = Players[iPlayer]
if pPlayer:GetCivilizationType() == CivTypeMyCiv then
local iCulture = 0
for pCity in pPlayer:Cities do
iCulture = iCulture + RoadCulture(pCity)
end
end
end
end
I am making a custom civ, and this is the code for their UA. I used the code from TPangolin's Zapotec mod as an example, since it was very similar to what I am trying to achieve. I guess I screwed up, because this does not work in game. Basically what I am trying to do is make it so that roads provide culture. I bet you could get that from reading the code though. To be honest I am really new to modding with lua, and modding in general.