LUA - Preset Religions

TheMarshmallowBear

Benelovent Chieftain of the Ursu Kingdom
Joined
Dec 27, 2006
Messages
8,616
Location
Inside a Ziggurat
Helo, I have a relatively simple LUA script that works fine but it presents few problems.

THe script is as follows

Code:
-- Find Berlin player and found Christianity in their city, returning the city

function EstablishCatholicism()
if Game.GetElapsedGameTurns() == 0 then

function CreateCatholicHolyCity(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 FoundCatholicism()
  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() == "Vatican City" then

		             CreateCatholicHolyCity(pCity, "RELIGION_CHRISTIANITY", "BELIEF_CATHOLIC_PANTHEON",
					"BELIEF_CATHOLIC_FOUNDER", "BELIEF_CATHOLIC_FOLLOWER_1",  "BELIEF_CATHOLIC_FOLLOWER_2", "BELIEF_CATHOLIC_ENHANCER");
					print ("okay, Vatican is the Catholic holy city")
				return pCity
				end
			end
		end
	end
end

local pCatholicPlot = FoundCatholicism():Plot()

end
end

Events.SequenceGameInitComplete.Add(EstablishCatholicism)

This script works fine (there's 6 additional copies of this one for each religion)

The two issues are as follows :

1. All of the religions should have a "Bonus" belief, but I have no idea how to implement that into the religion (if it's possible). If not I know of a relatively simple workaround (move the Bonus belief and merge it with the Follower ones)

2. Because of the way religion works in my game, I have prevented any nation from founding Pantheons by increasing its cost to 1,000,000. However, because the script calls for founding an actual pantheon it means that any civ with a religion will recieve a deficit of -999,995 because of this. But when I tried to skip the Pantheon foudning and add a Pantheon belief when founding the religion it didn't work (even if its possible to do it in the game if you get a Prophet before a pantheon)

Anybody knows of any simple workarounds or changes I could do?
 
1) Use the Network. versions (see ChooseReligionPopup.lua) to found/enhance a religion, as the former permits 4 beliefs

Code:
Network.SendFoundReligion(iPlayer, iReligion, sCustomName, iBelief1, iBelief2, iBelief3, iBelief4, iHolyCityX, iHolyCityY);
Network.SendEnhanceReligion(iPlayer, iReligion, sCustomName, iBelief5, iBelief6, iHolyCityX, iHolyCityY);
 
1) Use the Network. versions (see ChooseReligionPopup.lua) to found/enhance a religion, as the former permits 4 beliefs

Code:
Network.SendFoundReligion(iPlayer, iReligion, sCustomName, iBelief1, iBelief2, iBelief3, iBelief4, iHolyCityX, iHolyCityY);
Network.SendEnhanceReligion(iPlayer, iReligion, sCustomName, iBelief5, iBelief6, iHolyCityX, iHolyCityY);

:cry: any tips on how to implement that correctly since i have as much experience with LUA as you have with... well you get the gist. I don't know LUA.
 
what does this script do?
I'm trying to give city-states a religion when the game first starts, and that looks like that's what this one does. I assume it makes Vatican City the holy city for Catholicism?

but what does "Find Berlin player and found Christianity in their city, returning the city" mean?
 
what does this script do?
I'm trying to give city-states a religion when the game first starts, and that looks like that's what this one does. I assume it makes Vatican City the holy city for Catholicism?

but what does "Find Berlin player and found Christianity in their city, returning the city" mean?
anything in lua after double dashes -- is a programmer's comment
 
Back
Top Bottom