[BTS] Basic Limited Religions (mod comp)

I believe it might be. I finished my tests and I'm happy to report that all bugs have been worked out. :) This mod combines Better AI (for testing) and Limited Religions (LR). This BTS 3.19 version includes python code from Modifieda4, EmporerFool and a couple of functions from Inquisitions to produce what I think should be the new standard for LR. I am definitely going to use it, as it is compact, modular and very efficient.

Enjoy!

Orion Veteran :cool:

But it has a dll, which is no good for those who try to keep away from that?:crazyeye:
 
Thanks for the input...would you mind trying the notification code I just posted to see how you see things working?

Well as I said I haven't run the mod. My input is based solely on looking at the code.

so this is a choose religion problem.

Exactly. I believe I was pretty clear on this point, but you said you had that option selected during your test game and it worked. So I dunno.
 
You very easily can rip Better AI out of the mod and not use the DLL.

Orion Veteran :cool:

Thats ok, i think i will have to stick with your 2.10, it works the best for me, i just cant deal with 2.50.:rolleyes:
 
Thats ok, i think i will have to stick with your 2.10, it works the best for me, i just cant deal with 2.50.:rolleyes:

Gee! This is all you have to do! All marked in Red...

Code:
from CvPythonExtensions import *
import CvEventManager
[COLOR="red"]# import AIAutoPlay
# import ChangePlayer
# import Tester[/COLOR]
import InquisitionEvents
#INSERT IMPORTS


gc = CyGlobalContext()
#INSERT DEFINES


#################### INITIALIZER ###########################
class CvCustomEventManager(CvEventManager.CvEventManager, object):
	def __init__(self, *args, **kwargs):

		super(CvCustomEventManager, self).__init__(*args, **kwargs)

		# map the initial EventHandlerMap values into the new data structure
		for eventType, eventHandler in self.EventHandlerMap.iteritems():
			self.setEventHandler(eventType, eventHandler)
				# --> INSERT EVENT HANDLER INITIALIZATION HERE <--
		
[COLOR="Red"]#		AIAutoPlay.AIAutoPlay(self)
#		ChangePlayer.ChangePlayer(self)
#		Tester.Tester(self)[/COLOR]
		InquisitionEvents.InquisitionEvents(self)

...Then discard these files:

CvInfoScreen.py
CvMainInterface.py
AIAutoPlay.py
Tester.py
ChangePlayer.py
CvGameCoreDLL.dll

How much easier can it get! :rolleyes:

Orion Veteran :cool:
 
Well this may be out of date as I've only been using version 1.1 but I ran into a bizarre bug with this mod after updating my BUG files with the latest version. Whenever anyone founded Buddhism, they were immediately given the option to name a second religion like with the Choose Religion option. So rather than limiting a civ to 1 religion, they immediately get 2 of them. This could be a 3.19 issue, though I doubt it. I don't recall it happening until I updated my BUG files. I suspect it has something to do with the changes to the Religious Advisor screen. I'm not sure if this happens with the other religions, though I suspect it does, as I only noticed and tested it with Buddhism.
 
I ran into a bizarre bug with this mod after updating my BUG files with the latest version.

Okay, that answers my question from BUG's Bug Reporting thread. The latest SVN version of BUG supplies its own CvGameUtils class, and this mod's CvGameUtils is what blocks the second religion founding. You'll have to properly merge the two mods to get them to play nice together.
 
Okay, that answers my question from BUG's Bug Reporting thread. The latest SVN version of BUG supplies its own CvGameUtils class, and this mod's CvGameUtils is what blocks the second religion founding. You'll have to properly merge the two mods to get them to play nice together.

But how? The only Python files the mod is using are CvEventManager.py and CvGameUtils.py, neither of which BUG seems to have. So there's really nothing that can be merged as far as I can see.
 
But how? The only Python files the mod is using are CvEventManager.py and CvGameUtils.py, neither of which BUG seems to have. So there's really nothing that can be merged as far as I can see.

BUG has CvGameInterfaceFile which points to BugGameUtils instead of modifying CvGameUtils. Take a look at the documentation for it to see what's required.

Similarly, BUG uses BugEventManager instead of modifying CvEventManager which has its own documentation for merging.

You need to pull out the extra/changed code from BLR's CvEventManager--e.g. onTechAcquired()--and CvGameUtils--e.g. doHolyCityTech()--and move it into a new Python module. Then you create a configuration XML to tell BUG about this new module, events, and game utils callbacks.
 
You need to pull out the extra/changed code from BLR's CvEventManager--e.g. onTechAcquired()--and CvGameUtils--e.g. doHolyCityTech()--and move it into a new Python module. Then you create a configuration XML to tell BUG about this new module, events, and game utils callbacks.

I can't be bothered. I guess I'll have to play the game the old fashoped way.Too bad, I really liked the limited religions.
 
its been awhile, but i implemented the old code above, and it works...no iRelcheck errors.

Code:
	def onTechAcquired(self, argsList):
		'Tech Acquired'
		iTechType, iTeam, iPlayer, bAnnounce = argsList
		# Note that iPlayer may be NULL (-1) and not a refer to a player object

		# Show tech splash when applicable
		if (iPlayer > -1 and bAnnounce and not CyInterface().noTechSplash()):
			if (gc.getGame().isFinalInitialized() and not gc.getGame().GetWorldBuilderMode()):
				if ((not gc.getGame().isNetworkMultiPlayer()) and (iPlayer == gc.getGame().getActivePlayer())):
					popupInfo = CyPopupInfo()
					popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
					popupInfo.setData1(iTechType)
					popupInfo.setText(u"showTechSplash")
					popupInfo.addPopup(iPlayer)
		# debug all players recieving techs: CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'%s was finished by Player %d' %(PyInfo.TechnologyInfo(iTechType).getDescription(), iPlayer),'AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/TerrainFeatures/Forest.dds',ColorTypes(8),0,0,False,False)
		#Check if religious tech
		bRTech = False

		if iTechType == gc.getInfoTypeForString("TECH_MEDITATION"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_BUDDHISM")
			if not gc.getGame().isReligionSlotTaken(iRelCheck):
				bRTech = True
		if iTechType == gc.getInfoTypeForString("TECH_POLYTHEISM"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_HINDUISM")
			if not gc.getGame().isReligionSlotTaken(iRelCheck):
				bRTech = True
		if iTechType == gc.getInfoTypeForString("TECH_MONOTHEISM"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_JUDAISM")
			if not gc.getGame().isReligionSlotTaken(iRelCheck):
				bRTech = True
		if iTechType == gc.getInfoTypeForString("TECH_THEOLOGY"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_CHRISTIANITY")
			if not gc.getGame().isReligionSlotTaken(iRelCheck):
				bRTech = True
		if iTechType == gc.getInfoTypeForString("TECH_CODE_OF_LAWS"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_CONFUCIANISM")
			if not gc.getGame().isReligionSlotTaken(iRelCheck):
				bRTech = True
		if iTechType == gc.getInfoTypeForString("TECH_PHILOSOPHY"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_TAOISM")
			if not gc.getGame().isReligionSlotTaken(iRelCheck):
				bRTech = True
		if iTechType == gc.getInfoTypeForString("TECH_DIVINE_RIGHT"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_ISLAM")
			if not gc.getGame().isReligionSlotTaken(iRelCheck):
				bRTech = True	
	
		#Check if player already has Holy City
			
		bHolyCity = False
		lCities = PyPlayer(iPlayer).getCityList()
		for iCity in range(len(lCities)):
			pCity = gc.getPlayer(iPlayer).getCity(lCities[iCity].getID())
			for iReligionLoop in range( gc.getNumReligionInfos()):
				if pCity.isHolyCityByType(iReligionLoop):
					bHolyCity = True
		

		if bRTech == True:			
			if bHolyCity == False:
				if CyGame().isOption(GameOptionTypes.GAMEOPTION_PICK_RELIGION):
					if gc.getPlayer(iPlayer).isHuman():
						return 
						#old code, not needed: self.doPickReligionPopup(iPlayer,iRelCheck)						
					else:
						iNewReligion = self.AI_chooseReligion(iPlayer)
						if iNewReligion > -1:
							gc.getPlayer(iPlayer).foundReligion(iNewReligion,iRelCheck,True)
				else:
					for i in range(gc.getNumReligionInfos()):
						if gc.getReligionInfo(i).getTechPrereq() == iTechType: 
							if gc.getGame().isReligionFounded(i) == False:
								gc.getPlayer(iPlayer).foundReligion(i,i,True)


				
		if (not self.__LOG_TECH):
			return
		CvUtil.pyPrint('%s was finished by Team %d' 
			%(PyInfo.TechnologyInfo(iTechType).getDescription(), iTeam))
 
What might account for the following situation and how might I correct it?

I am working on a custom map for Liambane's Earth 35 Civs. One aspect I want to change has to do with founding religion. The first ai to reach a religion-founding tech can found a religion even when one or more of its cities already has one religion or more present.

This is not possible for human players. If a human city already has a religion, he may not found a new religion. When I play against ai, I usually reach "code of laws" first, which is a late early game tech. This means that there are usually 4 or more religions established by ai civs by the time I reach it. Sometimes, a religion reaches one of my cities before I finish code of laws. When this happens, I can't found a religion when I do achieve code of laws.

What I want for my map is to be able to found a religion even if someone else's religion has already entered one of my cities.

Do you have any suggestions to fix this?
 
What might account for the following situation and how might I correct it?

I am working on a custom map for Liambane's Earth 35 Civs. One aspect I want to change has to do with founding religion. The first ai to reach a religion-founding tech can found a religion even when one or more of its cities already has one religion or more present.

This is not possible for human players. If a human city already has a religion, he may not found a new religion. When I play against ai, I usually reach "code of laws" first, which is a late early game tech. This means that there are usually 4 or more religions established by ai civs by the time I reach it. Sometimes, a religion reaches one of my cities before I finish code of laws. When this happens, I can't found a religion when I do achieve code of laws.

What I want for my map is to be able to found a religion even if someone else's religion has already entered one of my cities.

Do you have any suggestions to fix this?

I am not sure I understand. I routinely play games where I dont found a religion on purpose, and wait. other religions enter my cities. then when I decide to research what-ever tech before anyone else, I found a religion.

I also usually play with the inquisition mod merged in. This allows me to get rid of other religions from my cities later.

I have not had any issues. I do not play with the choose religion option on. Are you playing with choose religions on?
 
Yes, I am making a custom map using Liambane's Earth 35 mod. This mod has choose religion option. I am also surprised that I do not seem to be able to found a religion under this circumstance. Does it matter whether choose religion is on?
 
Yes, I am making a custom map using Liambane's Earth 35 mod. This mod has choose religion option. I am also surprised that I do not seem to be able to found a religion under this circumstance. Does it matter whether choose religion is on?

im still confused, are you using this mod directly or someone else's implementation of this mod?

all I can say is that with choose religions off, i havent noticed this issue with this mod. if you having an issue with this mod packaged into someone else's mod i would start there with the differences.
 
Top Bottom