JFD
Kathigitarkh
Basically, I want to check that the player possesses all of the holy cities of the religions listed in a given table. Of course, the way I have it, it will only check for if the player has at least one of the holy cities for one of the religions in the table. I'm not sure how to check for all values. I'm sure the method is simply to someone, so any suggestions would be very helpful. Thanks.
Here's the code, for better clarity:
Here's the code, for better clarity:
Code:
function JFD_HasReligiousHolyCities(player, religionType)
local religions = {}
if religionType == "RELIGION_CHRISTIANITY" then
for loopPlayerID = 0, GameDefines.MAX_MAJOR_CIVS-1 do
local loopPlayer = Players[loopPlayerID]
if loopPlayer:IsAlive() then
if loopPlayer:GetReligionCreatedByPlayer() == GameInfoTypes["RELIGION_CHRISTIANITY"] then
table.insert(religions, "RELIGION_CHRISTIANITY")
end
if loopPlayer:GetReligionCreatedByPlayer() == GameInfoTypes["RELIGION_PROTESTANTISM"] then
table.insert(religions, "RELIGION_PROTESTANTISM")
end
if loopPlayer:GetReligionCreatedByPlayer() == GameInfoTypes["RELIGION_ORTHODOXY"] then
table.insert(religions, "RELIGION_ORTHODOXY")
end
if loopPlayer:GetReligionCreatedByPlayer() == GameInfoTypes["RELIGION_CHRISTIAN_ORIENTAL_ORTHODOX"] then
table.insert(religions, "RELIGION_CHRISTIAN_ORIENTAL_ORTHODOX")
end
if (#religions > 0) then
for i, v in ipairs(religions) do
print(v)
for city in player:Cities() do
if city:IsHolyCityForReligion(GameInfoTypes[v]) then
print("we have all holy cities")
return true
end
end
end
end
end
end
end
return
end