Religions based on Resources?

cynical81

Chieftain
Joined
Jan 12, 2006
Messages
5
Location
Casselberry, FL
I was wondering if it is possible to add a resource as the prerequisite to founding a religion. :confused:
Specifically, I am interested in creating a mod that utilizes animal totems as religions. Thus for example, to found the Boar Totem religion I would like a civ to have access to the pig resource. For the Horse Totem religion a civ must possess the horse resource to found the religion. I'm running Vanillia CivIV if that makes a difference.

Can anybody tell me if such a feat is possible?
If it is easy to accomplish?
How exactly it might be done?
 
You can try that , edit CvGameInterface.py ( or CvGameUtils.py , but i've got some problems with cannotResearch in it so ... ) :

Code:
def cannotResearch(argsList):
	ePlayer = argsList[0]
	eTech = argsList[1]
	pPlayer = gc.getPlayer(ePlayer)

	bonusRequiredForTech = {
                gc.getInfoTypeForString('TECH_Religion1') : gc.getInfoTypeForString('BONUS_Religion1Needed') ,
                gc.getInfoTypeForString('TECH_Religion2') : gc.getInfoTypeForString('BONUS_Religion2Needed') ,
                gc.getInfoTypeForString('TECH_Religion3') : gc.getInfoTypeForString('BONUS_Religion3Needed')
                }

	if eTech in bonusRequiredForTech.keys() :
                if pPlayer.countOwnedBonuses( bonusRequiredForTech[eTech] ) > 0 : return False
                return True

        return False

This piece of code prevent the tech that give the religion to be researched if you have not the required bonus .

Tcho !
 
I don't understand. Where in the CvGameInterface.py do I put that code? Also, where exactly do I specify what bonus is required?

Sorry, as I said I'm a first-time modder, so please excuse my ignorance if I'm asking stupid questions. I kindof need my hand held right now with exact, step-by-step directions. Thanks.
 
I don't understand. Where in the CvGameInterface.py do I put that code? Also, where exactly do I specify what bonus is required?

Sorry, as I said I'm a first-time modder, so please excuse my ignorance if I'm asking stupid questions. I kindof need my hand held right now with exact, step-by-step directions. Thanks.

don't worry for that . First ,you should have created a MOD folder with your changes ( if not, begin to create it with a tutorial and taking example with other MODs )

_ place a copy of CvGameInterface.py in the folder assets/python/entrypoints of your MOD

_ edit CvGameInterface.py with python ,you can find it in the python tutorial ( or with notepad++ )

_ replace the entire function "def cannotResearch(argsList):" with the code below

_ the only thing you have to do is to define "bonusRequiredForTech" , you can copy paste the line for each religion you want to edit . For an example , lets say that you found the religion Horse Totem with the tech "TECH_HORSE_TOTEM" and you want a horse required to found the religion so you edit "bonusRequiredForTech" like that :
Code:
	bonusRequiredForTech = {
                gc.getInfoTypeForString('TECH_HORSE_TOTEM') : gc.getInfoTypeForString('BONUS_HORSE') ,
                gc.getInfoTypeForString('TECH_Religion2') : gc.getInfoTypeForString('BONUS_Religion2Needed') ,
                gc.getInfoTypeForString('TECH_Religion3') : gc.getInfoTypeForString('BONUS_Religion3Needed')
                }

_ once you have created "bonusRequiredForTech" with each religion and bonus required . enable the debugger to make your tests ( i've not tested the code and you can find how to enable the debugger in the python tutorial ) . If you get some errors , do not hesitate to report them , i will help you .

Be carefull , The code prevent the tech that found the religion to be researched . so for an example if you need TECH_HORSE_TOTEM to research TECH_MINING , you will not be able to research TECH_MINING until you get a horse .

Tcho !
 
Top Bottom