Danmacsch
Geheimekabinetsminister
Okay. I'm still trying to figure this out, but I think I'm missing some fundamental understanding of how to use tables. Here's what I think I should do, but without the actual code.
In addition to this I should have a function run with PlayerFoundsCity, that saves all the plots within a 3 tile radius. I could of course also choose to only add the water tiles to the table, thus removing the need to check if the plot is water or not.
I'm sorry, but I don't really understand how to accomplish this.
Code:
function DMS_DetectBorderExpansion(playerID, cityID, plotX, plotY, bGold, bFaithOrCulture)
local pPlayer = Players[playerID]
if (pPlayer and pPlayer:IsAlive() and pPlayer:GetCivilizationType() == civilisationID) then
print("The borders of " .. players[0]:GetName() .. " has expanded")
if bGold == true then
print("bGold was " .. tostring(bGold))
local pPlot = Map.GetPlot(plotX, plotY)
if pPlot:IsWater() and not (pPlot:IsLake()) then
print("plot is water and not lake")
local pCity = GetTargetCity(pPlayer, cityID)
-- run function to convert citizens to pantheon/religion
DMS_ConvertCitizenToCapitalReligion(pPlayer, pCity, plotX, plotY)
print("city found -> start conversion of citizen")
end
elseif bGold == false then
print("bGold was " .. tostring(bGold))
-- iterate through pCity's plots
-- if iPlot doesn't exists in table tDMS_FaroePlots then
-- if iPlot meets specifications then
-- run conversion function
-- add iPlot to table
end
end
end
I'm sorry, but I don't really understand how to accomplish this.