Craig_Sutter
Deity
I have been using the following code to install religions in my scenario... here is one example of the founding of Christianity in Paris...
The code has been working, but there are a couple of problems that I need advice on how to address:
1) My scenario has established via xml that there should be only 4 religions. I use the code above (with changes per each religion) to create holy cities for my scenario for each of the 4 religions. To my mind, that means no more pantheons may be founded in the game since max religions have been reached. In game, the religion panel says available religions=0, but pantheons are still being founded.
2) Even worse, the civilizations with the holy city under their name and having founded the religion are still able to add beliefs to their religion. My Celts, for example, founded the religion "Druidism" with 5 beliefs yet were able to add 2 more beliefs!!
I think that the game is not registering these religions as being founded when they are installed by lua. It is therefore ignoring the restrictions on purchases of beliefs.
This is not a new problem... my previous solution was simply to delete all beliefs but the ones needed for the religions. However, since BNW that seems to lead to a CTD, and I can no longer use that method.
Any suggestions as to how I can tell the game that it no longer needs to spend on pantheons and religions?
Has anyone else run into this problem?
Code:
-- Find Paris player and found Christianity in their city, returning the city
function EstablishChristian()
if Game.GetElapsedGameTurns() == 0 then
function CreateChristianHolyCity(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
function FoundChristianity()
for iPlayer=0, GameDefines.MAX_CIV_PLAYERS - 1 do
local pPlayer = Players[iPlayer]
if (pPlayer:IsEverAlive()) then
for pCity in pPlayer:Cities() do
-- City exists and has the proper name?
if pCity ~= nil and pCity:GetName() == "Paris" then
CreateChristianHolyCity(pCity, "RELIGION_CHRISTIANITY", "BELIEF_FORMAL_LITURGY",
"BELIEF_CHURCH_PROPERTY", "BELIEF_CATHEDRALS", "BELIEF_MOSQUES", "BELIEF_RELIGIOUS_TEXTS");
print ("okay, Paris is the Catholic holy city")
return pCity
end
end
end
end
end
local pChristianPlot = FoundChristianity():Plot()
end
end
Events.SequenceGameInitComplete.Add(EstablishChristian)
The code has been working, but there are a couple of problems that I need advice on how to address:
1) My scenario has established via xml that there should be only 4 religions. I use the code above (with changes per each religion) to create holy cities for my scenario for each of the 4 religions. To my mind, that means no more pantheons may be founded in the game since max religions have been reached. In game, the religion panel says available religions=0, but pantheons are still being founded.
2) Even worse, the civilizations with the holy city under their name and having founded the religion are still able to add beliefs to their religion. My Celts, for example, founded the religion "Druidism" with 5 beliefs yet were able to add 2 more beliefs!!
I think that the game is not registering these religions as being founded when they are installed by lua. It is therefore ignoring the restrictions on purchases of beliefs.
This is not a new problem... my previous solution was simply to delete all beliefs but the ones needed for the religions. However, since BNW that seems to lead to a CTD, and I can no longer use that method.
Any suggestions as to how I can tell the game that it no longer needs to spend on pantheons and religions?
Has anyone else run into this problem?