I have a scenario mod I'd like to try with the CBP and/or some modded civs. Loading the scenario with either enabled, however, breaks the religion spreading mechanic for the scenario. The script, which founds religions in capitals in the scenario, and spreads it to every city where appropriate, looks something like this:
And then it iterates through each city in the world to spread the religion there. using a function that looks like:
Now, it works completely fine without when I play the map and it's the only mod active, but as soon as I add either CBP or modded Civs, the lua simply ceases to fire correctly. In fact there's absolutely no evidence of it at all in the lua output log, not even an error attributed to it. I'm troubleshooting as best I can but coming up blank.
There are a few things I know that aren't causing the problem. It's not caused by an addition of new religions, nor beliefs as far as I can tell. And none of the cities have been renamed by loading the mods. I know it would be exceedingly difficult to pinpoint what mod is specifically causing it and how, so I'd just like some pointers for troubleshooting- what kind of things could cause that script to fail to launch?
Code:
function FoundReligion(pCity, religion, pantheonBelief, founderBelief, followerBelief, followerBelief2, enhancerBelief)
local iPlayer = pCity:GetOwner()
local iReligion = GameInfoTypes[religion]
-- Optional extra beliefs
local iBelief4 = followerBelief2 and GameInfoTypes[followerBelief2] or -1
local iBelief5 = enhancerBelief and GameInfoTypes[enhancerBelief] or -1
Game.FoundPantheon(iPlayer, GameInfoTypes[pantheonBelief])
Game.FoundReligion(iPlayer, iReligion, nil, GameInfoTypes[founderBelief], GameInfoTypes[followerBelief], iBelief4, iBelief5, pCity)
end
-- Set up the religions to be present in the scenario
function SetupReligions()
if Game.GetElapsedGameTurns() == 0 then
for iPlayer=0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
local pPlayer = Players[iPlayer];
print("Iterating players..." .. pPlayer:GetName());
if pPlayer:IsEverAlive() then
for cityIndex = 0, pPlayer:GetNumCities() - 1, 1 do
local pCity = pPlayer:GetCityByID(cityIndex)
-- Found Catholicism
if pCity ~= nil and pCity:GetName() == "Rome" then
FoundReligion(pCity, "RELIGION_CHRISTIANITY", "BELIEF_FERTILITY_RITES", "BELIEF_PAPAL_PRIMACY", "BELIEF_CATHEDRALS", "BELIEF_CHORAL_MUSIC", "BELIEF_HOLY_ORDER");
print("Founding Christianity in " .. pCity:GetName());
--return pCity;
end
-- Found Protestantism
if pCity ~= nil and pCity:GetName() == "Frankfurt" then
FoundReligion(pCity, "RELIGION_PROTESTANTISM", "BELIEF_GOD_CRAFTSMEN", "BELIEF_TITHE", "BELIEF_RELIGIOUS_CENTER", "BELIEF_RELIGIOUS_COMMUNITY", "BELIEF_ITINERANT_PREACHERS");
print("Founding Protestantism in " .. pCity:GetName());
--return pCity;
end
-- Found Orthodoxy
if pCity ~= nil and pCity:GetName() == "Moscow" then
FoundReligion(pCity, "RELIGION_ORTHODOXY", "BELIEF_GOD_KING", "BELIEF_CHURCH_PROPERTY", "BELIEF_MONASTERIES", "BELIEF_FORMAL_LITURGY", "BELIEF_RELIGIOUS_UNITY");
print("Founding Orthodoxy in " .. pCity:GetName());
--return pCity;
end
-- Found Islam
if pCity ~= nil and pCity:GetName() == "Mecca" then
FoundReligion(pCity, "RELIGION_ISLAM", "BELIEF_DESERT_FOLKLORE", "BELIEF_PILGRIMAGE", "BELIEF_MOSQUES", "BELIEF_DIVINE_INSPIRATION", "BELIEF_DEFENDER_FAITH");
print("Founding Islam in " .. pCity:GetName());
--return pCity;
end
-- Found Hinduism
if pCity ~= nil and pCity:GetName() == "Delhi" then
FoundReligion(pCity, "RELIGION_HINDUISM", "BELIEF_SACRED_WATERS", "BELIEF_INTERFAITH_DIALOGUE", "BELIEF_GURUSHIP", "BELIEF_PEACE_GARDENS", "BELIEF_MESSIAH");
print("Founding Hinduism in " .. pCity:GetName());
--return pCity;
end
-- Found Buddhism
if pCity ~= nil and pCity:GetName() == "Lhasa" then
FoundReligion(pCity, "RELIGION_BUDDHISM", "BELIEF_ANCESTOR_WORSHIP", "BELIEF_INITIATION_RITES", "BELIEF_PAGODAS", "BELIEF_FEED_WORLD", "BELIEF_RELIQUARY");
print("Founding Buddhism in " .. pCity:GetName());
--return pCity;
end
-- Found Shintoism
if pCity ~= nil and pCity:GetName() == "Kyoto" then
FoundReligion(pCity, "RELIGION_SHINTO", "BELIEF_GOD_SEA", "BELIEF_CEREMONIAL_BURIAL", "BELIEF_ASCETISM", "BELIEF_SWORD_PLOWSHARES", "BELIEF_JUST_WAR");
print("Founding Shintoism in " .. pCity:GetName());
--return pCity;
end
end
end
end
end
end
Events.SequenceGameInitComplete.Add(SetupReligions);
And then it iterates through each city in the world to spread the religion there. using a function that looks like:
Code:
if pCity ~= nil and pCity:GetName() == "Genoa" then
pCity:AdoptReligionFully(GameInfoTypes["RELIGION_CHRISTIANITY"]);
print("Adding Catholicism to " .. pCity:GetName());
Now, it works completely fine without when I play the map and it's the only mod active, but as soon as I add either CBP or modded Civs, the lua simply ceases to fire correctly. In fact there's absolutely no evidence of it at all in the lua output log, not even an error attributed to it. I'm troubleshooting as best I can but coming up blank.
There are a few things I know that aren't causing the problem. It's not caused by an addition of new religions, nor beliefs as far as I can tell. And none of the cities have been renamed by loading the mods. I know it would be exceedingly difficult to pinpoint what mod is specifically causing it and how, so I'd just like some pointers for troubleshooting- what kind of things could cause that script to fail to launch?