j045ua
Chieftain
help?
function CityTransfer()
local America
local pAmerica
local Denmark
local pDenmark
if Game.GetElapsedGameTurns() == 0 then
-- Set up Denmark Player
for iPlayer=0, GameDefines.MAX_MAJOR_CIVS-1 do
local pDenmark = Players[iPlayer]
if (GameInfo.Civilizations.CIVILIZATION_DENMARK.ID == pDenmark:GetCivilizationType()) then
Denmark = pDenmark
end
end
-- Set up America Player
for iPlayer=0, GameDefines.MAX_MAJOR_CIVS-1 do
local pAmerica = Players[iPlayer]
if (GameInfo.Civilizations.CIVILIZATION_AMERICA.ID == pAmerica:GetCivilizationType()) then
America = pAmerica
end
end
--city transfer
for iCity in Denmark:Cities() do
if iCity ~= nil and iCity:GetName() == "Lund" then
print("Transferring...", iCity:GetName(), "to" , America:GetName(), "from", Denmark:GetName() )
America:AcquireCity(iCity, false, true);
if iCity ~= nil and iCity:IsRazing() then
iCity:DoTask(TaskTypes.TASK_UNRAZE);
end
end
end
end
end
Events.SequenceGameInitComplete.Add(CityTransfer)
function CaptureReligion (iOldOwner, bIsCapital, iCityX, iCityY, iNewOwner, iPop, bConquest)
print ("Attempting to change religion founder")
local newOwner = Players[iNewOwner]
local oldOwner = Players[iOldOwner]
local targetReligionID = oldOwner:GetReligionCreatedByPlayer()
local newOwnerHasFoundedReligion = newOwner:GetReligionCreatedByPlayer()
local targetCityID = (Map.GetPlot(iCityX, iCityY):GetPlotCity()):GetID()
local holyCityID = (Game.GetHolyCityForReligion(targetReligionID, -1)):GetID()
print("Conquered City ID:" .. targetCityID)
print("Religion's Holy City ID:" .. holyCityID)
if (targetCityID == holyCityID) then
if newOwnerHasFoundedReligion < 1 then
print("Religion Founder Changed")
Game.SetFounder(targetReligionID , iNewOwner)
end
end
end
GameEvents.CityCaptureComplete.Add(CaptureReligion);
There's nothing in the DLL that stops a civ from founding more than one religion with different Holy Cities and it should be possibly from Lua - you'll need to adjust some aspects of the UI though.
Edit: There's also nothing that stops a pantheon from having multiple beliefs, although without a DLL mod, only the first will be copied to a newly founded religion
-- Find Berlin 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], -1, -1, pCity)
Game.EnhanceReligion(iPlayer, iReligion, GameInfoTypes[followerBelief2], GameInfoTypes[enhancerBelief]);
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() == "Berlin" then
CreateChristianHolyCity(pCity, "RELIGION_CHRISTIANITY", "BELIEF_GOD_CRAFTSMEN",
"BELIEF_INITIATION_RITES", "BELIEF_CATHEDRALS1", "BELIEF_STATE_CHURCH", "BELIEF_RELIGIOUS_TEXTS");
print ("okay, Berlin is the Catholic holy city")
return pCity
end
end
end
end
end
local pChristianPlot = FoundChristianity():Plot()
end
end
Events.SequenceGameInitComplete.Add(EstablishChristian)
-- relassign
-- Author: dagriggstar
-- DateCreated: 3/17/2014 9:56:16 PM
--------------------------------------------------------------
-- Enumerate Playable Civ Cities with Confucianism
function FollowChristianity()
if Game.GetGameTurn() == 0 then
for iPlayer=0, GameDefines.MAX_CIV_PLAYERS - 1 do
local pPlayer = Players[iPlayer];
if pPlayer:IsEverAlive() then
print (pPlayer:GetName())
-- Enumerate cities
for cityIndex = 0, pPlayer:GetNumCities() - 1, 1 do
local pCity = pPlayer:GetCityByID(cityIndex)
print (pCity:GetName());
-- City exists and has the proper name?
if pCity ~= nil and city:GetName() == "Tong Binh" then
pCity:AdoptReligionFully(GameInfoTypes["RELIGION_TAOISM"]);
elseif pCity ~= nil and pCity:GetName() == "Panyu" then
pCity:AdoptReligionFully(GameInfoTypes["RELIGION_TAOISM"]);
elseif pCity ~= nil and pCity:GetName() == "Chang'an" then
pCity:AdoptReligionFully(GameInfoTypes["RELIGION_TAOISM"]);
elseif pCity ~= nil and pCity:GetName() == "Ganzhou" then
pCity:AdoptReligionFully(GameInfoTypes["RELIGION_TAOISM"]);
elseif pCity ~= nil and pCity:GetName() == "Chengdu" then
pCity:AdoptReligionFully(GameInfoTypes["RELIGION_TAOISM"]);
return pCity
end
end
end
end
end
end
Events.ActivePlayerTurnEnd.Add(FollowChristianity)