I'm trying to make my civs unique ability grant a small boost of Faith and Culture upon a new citizen being born in your capital. However, I can't get it to work. This is what I have right now:
I don't really understand if the function "GetCapitalCity" gives the coordinates of the capital, or the ID, or the name, or whatever else... So I think that might be the source of this not working.
EDIT: I realize now that (player:IsHuman()) should be iOwner instead. However, I still can't get it to work.
Code:
-----------------------------------------------------------------------------
-- Descendants of Nanih Waiya
----------------------------------------------------------------------------
local iChoctaw = GameInfoTypes.CIVILIZATION_CHOCTAW
function NanihWaiyaCitizenBorn(iHexX, iHexY, iPopulation, iUnknown )
local pPlot = Map.GetPlot(ToGridFromHex(iHexX, iHexY))
local pCity = pPlot:GetPlotCity()
local iOwner = pCity:GetOwner()
local pCapital = iOwner:GetCapitalCity()
local pCapitalPlot = pCapital:GetPlotCity()
if iOwner ~= iChoctaw then return end
if pCity ~= pCapitalPlot then return end
local choctawFaithBoost = (iPopulation() * 5)
local choctawCultureBoost = (iPopulation() * 5)
player:ChangeFaith(choctawFaithBoost)
player:ChangeJONSCulture(choctawCultureBoost)
if (player:IsHuman() and choctawFaithBoost > 0) then
Events.GameplayAlertMessage(Locale.ConvertTextKey("TXT_KEY_NANIH_WAIYA_BORN", choctawFaithBoost)
end
end
I don't really understand if the function "GetCapitalCity" gives the coordinates of the capital, or the ID, or the name, or whatever else... So I think that might be the source of this not working.
EDIT: I realize now that (player:IsHuman()) should be iOwner instead. However, I still can't get it to work.
Last edited: