AW Arcaeca
Deus Vult
Basically I'd like to make a UA where upon capturing a city, any and all religion is completely removed from that city.
The code currently looks like this:
Basically, I'm just not sure If the latter half is right. It's supposed to see if the city has any religion, and if it does, remove it. Now I couldn't find any kind of City.SetNumFollowers function on the UI reference, so I guessed I was supposed to use ConvertPercentFollowers, the parameters of which are basically (toReligion, fromReligion, %), right?
(UI reference lists the parameters of the first two as "ReligionType arg0" and "ReligionType arg1", which completely clarifies which one is being converted to and which is being converted from.
)
I'm also just unsure whether ConvertPercentFollowers will make the game engine implode trying to "convert" religious followers to a state of nonreligion. Or the whole "for" loop - there's probably a more elegant way of coding that.
So if anyone has any better idea on how to do this I'd love to know!
And TIA.
The code currently looks like this:
Spoiler :
Code:
GameEvents.CityCaptureComplete.Add(
function(oldPlayerID, capital, iX, iY, newPlayerID)
local pPlayer = Players[newPlayerID]
local city = Map.GetPlot(iX, iY):GetPlotCity()
if (pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_SUPAHSECRETCIV) then
for row in GameInfoTypes.Religions do
iReligion = row.ID
end
if city:IsReligionInCity(iReligion) then
city:ConvertPercentFollowers(-1, iReligion, 100)
end
else
return
end
end)
(UI reference lists the parameters of the first two as "ReligionType arg0" and "ReligionType arg1", which completely clarifies which one is being converted to and which is being converted from.

I'm also just unsure whether ConvertPercentFollowers will make the game engine implode trying to "convert" religious followers to a state of nonreligion. Or the whole "for" loop - there's probably a more elegant way of coding that.
So if anyone has any better idea on how to do this I'd love to know!
