protestantism

Saarlaender

Chieftain
Joined
Jan 14, 2006
Messages
60
Hi everyone...

First things first, I don't usually work computers, but I got XML figured out rather quickly and I've already played with religions in a mod, which works just fine. Python, still a closed book.

I have minor quirks and major questions, and I hope the people much, much more skilled then me can give me some hints...
For one, where are these symbols that appear next to the leader names in the score list? .. can' get those to work out right... I figured out already that they're called up by number, so if insert a new religion ni the middle in the religion file, that screws it up. Now it's at the end, the symbold ae right, except for the new one - it doesn't load the dds file either for the score list or for the symbol on a city name?
That should be the quicker fix. Here are two things, however, that might be harder, especially since I don't know the first thing about Python (yet.)

I added Protestantism. I would like to imlpement two things. One, once protestantism is founded (with printing press), I would like a loop through all cities, randomly changing christian (catholic) to protestant. I have an idea how to delete a religion and add one; that in itself should work, the inquisitor mod sows how. Now, though, how do I get to that point, how do I loop through the citis and ask its religion (as of course only the ones that have chistianity have a chance to switch), and how do I randomize it (as not all will switch?) Can I do this for the other civs, with a lesser probability?

Then, the civ that has the catholic shrine (renamed the Vatican) should be able to exert influence on other civs that have catholicism as a state religion, maybe even force civics (there's an XML function for that in the UN routine, but that's global. I'm looking for: asking what the state religion is - then forcing a civic on them, or creating extra religious loyalty points in the attitude if it is catholicism or Islam.)

For that matter, is it possible to change the attitude points depending on what religion it is the other civ has, not just disfavor because it's different?

That's a mouthful. I'l post the protestantism mod with the changes as it is (mostly xml) when i got some little bugs worked out, but I'd like to be able to implement further changes. I'll look through the python, but so far it's largely clouds and mist. Some little pointers would be a great help...
 
Saarlaender said:
Hi everyone...

First things first, I don't usually work computers, but I got XML figured out rather quickly and I've already played with religions in a mod, which works just fine. Python, still a closed book.

I have minor quirks and major questions, and I hope the people much, much more skilled then me can give me some hints...
For one, where are these symbols that appear next to the leader names in the score list? .. can' get those to work out right... I figured out already that they're called up by number, so if insert a new religion ni the middle in the religion file, that screws it up. Now it's at the end, the symbold ae right, except for the new one - it doesn't load the dds file either for the score list or for the symbol on a city name?
That should be the quicker fix. Here are two things, however, that might be harder, especially since I don't know the first thing about Python (yet.)

They are in the gamefont.tga and gamefont75.tga files. Check out the files and you will see the religion icons. The first religion will be the first icon in that row, the 2nd is the 2nd etc.

I added Protestantism. I would like to imlpement two things. One, once protestantism is founded (with printing press), I would like a loop through all cities, randomly changing christian (catholic) to protestant. I have an idea how to delete a religion and add one; that in itself should work, the inquisitor mod sows how. Now, though, how do I get to that point, how do I loop through the citis and ask its religion (as of course only the ones that have chistianity have a chance to switch), and how do I randomize it (as not all will switch?) Can I do this for the other civs, with a lesser probability?

This is very doable in python but I don't have any code that does this so I dont have anything to show. Here is some similiar code I use that may point you in the right direction.

First code int he onReligionSpread event that keeps the ORder and the Veil from existing in the same city. Good examples here of .isHasReligion (to see if a city has a religion) and .setHasReligion (to remove a religion from a city).

Code:
	def onReligionSpread(self, argsList):
		'Religion Has Spread to a City'
		iReligion, iOwner, pSpreadCity = argsList
		iOrder = gc.getInfoTypeForString('RELIGION_THE_ORDER')
		iVeil = gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL')
		player = PyPlayer(iOwner)
		pPlayer = gc.getPlayer(iOwner)
		if iReligion == iVeil:
			if (pSpreadCity.isHasReligion(iOrder) and pSpreadCity.isHolyCityByType(iVeil) == False):
				pSpreadCity.setHasReligion(iReligion, False, False, False)
				CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'The Ashen Veil was removed from a city.','AS2D_ORDER_DINK',1,'Art/Interface/Buttons/Religions/Order.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)

		if iReligion == iOrder:
			if (pSpreadCity.isHasReligion(iVeil) and pSpreadCity.isHolyCityByType(iOrder) == False):
				pSpreadCity.setHasReligion(iReligion, False, False, False)
				CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'The Order was removed from a city.','AS2D_ASHEN_DINK',1,'Art/Interface/Buttons/Religions/Ashen.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
			if (pPlayer.getStateReligion() == iOrder and pSpreadCity.isHasReligion(iVeil) == False):
				newUnit = pPlayer.initUnit(gc.getInfoTypeForString('UNIT_CRUSADER'), pSpreadCity.getX(), pSpreadCity.getY(), UnitAITypes.NO_UNITAI)
				CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'A Crusader has joined your cause.','AS2D_UNIT_BUILD_UNIT',1,'Art/Interface/Buttons/Units/Crusader.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)

		if (not self.__LOG_RELIGIONSPREAD):
			return
		CvUtil.pyPrint('%s has spread to Player %d Civilization %s city of %s'
			%(gc.getReligionInfo(iReligion).getDescription(), iOwner, player.getCivilizationName(), pSpreadCity.getName()))

Secondly a simply example of some code that uses a random function. The function is passed a Unit Combat name and a Percentage. From that it cycles through all of the units int he games and has a chance of killing each one that matches the unit class equal to the percentage.

Code:
	def FFHGenocideUnitCombat(self, iUnitCombat, iPercent):

		listPlayers = []
		for iPlayer in range(gc.getMAX_PLAYERS()):
			pPlayer = gc.getPlayer(iPlayer)
			if (pPlayer.isAlive()):
				listPlayers.append(iPlayer)

		for iPlayer in range(len(listPlayers)):
			pPlayer = gc.getPlayer(listPlayers[iPlayer])
			for i in range(pPlayer.getNumUnits(), -1, -1):
				iRand = CyGame().getSorenRandNum(100, "Bob")
				if (iRand <= iPercent):
					pUnit = pPlayer.getUnit(i)
					if (pUnit.getUnitCombatType() == iUnitCombat or iUnitCombat == -1):
						pUnit.kill(False,0)

Then, the civ that has the catholic shrine (renamed the Vatican) should be able to exert influence on other civs that have catholicism as a state religion, maybe even force civics (there's an XML function for that in the UN routine, but that's global. I'm looking for: asking what the state religion is - then forcing a civic on them, or creating extra religious loyalty points in the attitude if it is catholicism or Islam.)

For that matter, is it possible to change the attitude points depending on what religion it is the other civ has, not just disfavor because it's different?

This is much harder. I don't know of any way right now to do this.
 
Back
Top Bottom