1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Inquisition

Discussion in 'Civ4 - Mod Components' started by bmarnz, Oct 31, 2007.

  1. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    OK. You can re-download version 1.01C, which has been fixed. :)

    The fix: Rebuilt 2 functions in the CvGameUtils.py file and created a new function in the OcInquisition file to do a centralized Holy City check. :D

    V/R,

    Orion Veteran :cool:
     
  2. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    hmm this is frustrating. i downloaded the new 101c, setup my test game from scratch. i purposely didnt found any religion, the AI founds the first two. still. im using the wolf gamecore. the only thing i can see is that in the cveventmanager.py there is a holy city check as well.

    i wish i knew python.
     
  3. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    figured it out....that was a brain buster. ill post the solution later.
     
  4. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    ok this works.

    Orion : I basically stripped out everything and started from scratch.

    from CvGameUtils.py
    Code:
            def doHolyCity(self):
    
    		return True
    		
    
            def doHolyCityTech(self,argsList):
    		
    		eTeam = argsList[0]
    		ePlayer = argsList[1]
    		eTech = argsList[2]
    		bFirst = argsList[3]
        
    		iPlayer =  argsList[1]
    
    		apCityList = PyPlayer(iPlayer).getCityList()
    		for pCity in apCityList:
    			iReligionLoop=0				
    			for iReligionLoop in range(gc.getNumReligionInfos()):
    				if pCity.isHolyCityByType(iReligionLoop):
    					return True
    					
    			if iReligionLoop == 0:
    				return False	
    
    from CvEventManager.py
    Code:
            def onTechAcquired(self, argsList):
    		'Tech Acquired'
    		iTechType, iTeam, iPlayer, bAnnounce = argsList		
    		rSlotAvailable = False
    		pHolyCity = False
    		# 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)
    
    		#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 bHolyCity == False:
    
    			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))
    
    im going to integrate this into my mod tomorrow. I'll keep the inquisitor and the holy office....finally this is done. :rolleyes:

    (note: i stripped out the choose religion game option section...)
     
  5. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    for future reference: how limited religions 'works' in the python files (behavior noted after extensive testing):


    • def doHolyCity(self): AND def doHolyCityTech(self,argsList): IN CvGameUtils.py must return True in order to block religion from founding. Default is return False, handled in the gamecore DLL
    • def doHolyCityTech(self,argsList): gets called first, and only when a religion tech is discovered for the first time BY ANY PLAYER<----IMPORTANT! Plus its the only one that gets the argsList passed to it, so its the only one that can hold any real code.
    • def doHolyCity(self): gets called second, and is called when any religious tech is discovered by any player. The modded code sets this to return True always
    • !!! Absolutely ANY errors in the above sub routines will cause the routine to return False and thus Default behavior. NO ERRORS will be in the python err log!!!

    Changing only these two sections is a working limited religions variant.

    BUT, unless a player is the first to discover a religion tech, that religion WILL NOT be founded. Hence the need to alter def onTechAcquired(self, argsList): IN CvEventManager.py


    def onTechAcquired(self, argsList): takes care of the above condition by:
    • checking if a religious tech was researched
    • checking if a player has any holy cities
    • checking if corresponding said religion has been founded <--new code
    • founds religion

    so I hope this helps someone in the future. In my test scenarios each AI founded its own religion which creates many factions which is the purpose of limited religions. I even saw an AI switch to a competing religion even though it had founded one.

    I probably will package this code into my own standalone limited religion mod.
     
  6. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    modifieda4,

    My early initial testing shows your version will allow a player to found a religion on any religious tech. Previously, there was a prerequisite to research Theology. I will run this through a new test game and work towards a solution that meets all of the previous requirements. I have developed a new centralized bullet proof function that checks for the existance of a Holy City. It can be called from any function in the game and simplifies the code. I find it very useful. Testing will take some time. So, give me a few days to finish.

    V/R,

    Orion Veteran :cool:
     
  7. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    im not sure why theology comes into play for religion founding. default game action is that the first player to research meditation founds buddism...etc. I like that setup, and with limited religions its easy to mimic the default action simply by adding the holy city check.

    i agree with theology as a useful control on inquisitions, but thats it.

    when you redo your code make sure there are no errors and each loop/if statement is entered by appropriate game play. the previous code had a ton of flaws in it...if statements that were never entered...loops that failed early.
    the real problem is that the computer just skips these logic errors with no warning, and no real noticable change in gameplay.

    i verified each step in my code with game alerts in test games and frequent "world builder" visits.

    by the way, i can't wait to try the foreign inquisitions out. that will be cool. one inquisition 'flaw' i noted:

    well maybe its not a flaw, but an inquisition can remove a holy city. which is ok for me, just something I noticed.
     
  8. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    1. Theology Issue: Without limiting religion founding, when the player is not the first to discover the tech, then there is no rush, whatsoever to go after religion. Theology gives you a strategic choice, while eliminating the religious tech exploit.

    2. Errors? I have python checking on constantly and each version only goes out after many hours of play testing to insure there are no errors. If you run across any errors, that I may have missed, please let me know and I will be more than happy to fix it right away. ;)

    3. Foreign Inquisitions: Remember the 3 prerequisites for conducting a foreign inquisition: Open borders, both civs have the same state religion and the state religion must already exist in the city. The inquisitor can remove only non-state religions including a non-state Holy City religion. :D
     
  9. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    i really dont understand. if you're playing 3 other AIs, two of them found buddism and hinduism. the hindu founder also hits monotheism first. he cant found judism because of limited religions.

    that leaves judism up for grabs for the third AI and myself. there is a perfect exmaple of still needing to rush to get a religion.
     
  10. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    Please forgive me if I have not been clear about the religious tech exploit issue. Definition: It is a strategy of deliberately researching all of the religious techs before any of the other Civs get a chance to found a religion. Goal: Deny all opponent civs both happiness and income.

    Through testing, I discovered that even with limited religions, which prevents the founding of more than one Holy City by any one civ, a player could still execute the exploit strategy by researching all of the religious techs first.

    Clearly, something more needed to be done. The answer was to modify a single tech (Theology) to allow the founding of a religion after another civ has previously discovered it first.

    In your 4 player scenario, there is no rush to get to monotheism, as limited religions prevents the 3 AI Civs from founding any of the remaining 4 religions. I can make a run to research Code of Laws or literally take my time to research Theology, knowing it will give me one of the remaining religions. Thus, for most games played with limited religions; the modified tech Theology, which does not come too early or too late, defeats the exploit.

    Very Respectfully,

    Orion Veteran :cool:
     
  11. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    you are incorrect in your assumption at in regards to my code. It allows any religion to be founded provided you reasearch the founding tech, and it has not already been founded. It does not matter how many other players have already researched the founding tech if they already have a holy city.

    there is no exploit with my code.
     
  12. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    modifieda4,

    I really respect your kind efforts to help sove this problem and think you deserve to see my detailed test results using your code: So here it goes:

    Scenario: There are only 3 players: 1 human and 2 AI.

    1. Turn 39: AI civ (Egypt) discovers Meditation and founds Buddism.
    2. Turn 215: Human player discovers Meditation and no religion is founded.
    3. Turn 222: Verified Egypt has previously discovered Polytheism
    4. Turn 223: Human player discovers Polytheism and Hinduism religion is founded automatically. No popup window came up to select the religion even though the game option to "Choose Religions" was selected.
    5. Turn 223: The second AI civ never discovered a religion.
    End of Test

    This was far enough to convince me the code is not working correctly in at least two areas and needs a little improvement. Don't read me wrong here, as I really appreciate your efforts to fix this tricky code and I am very thankful for your help.

    This weekend, I will return to my 101C code and see if I can find a way to stop the AI from discovering more than one religion.

    V/R,

    Orion Veteran :cool:
     
  13. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    i appreciate your posts, but your results are exactly what should happen. :)

    choosing religions? i disabled that on purpose. I can add it back in. i played test games with it enabled, it worked fine.

    why the second AI never founded a religion...maybe he didnt get to monothesim yet.

    I've played MANY test games through Islam. whoever doesnt have a religion, automatically founds an open one when they discover the enabling tech for that religion. This keeps the vanilla game religions discovery order intact. The religion tech Icons correctly show which religions are still open, so its easy to drive towards founding one if that is the religion you want to found.

    it works exactly as I intended.

    btw, in my sig is the stand alone limited religion mod, which might be easier to test with.
     
  14. Trivas

    Trivas Chieftain

    Joined:
    Jan 8, 2008
    Messages:
    39
    I apologize that I have not enough time to read the entire topic, but from what I see, this is more of a mod of sorts that alters more than what I am intending on altering.

    I was wondering if there was a simple way to remove religions from cities you control. Not really foreign cities (though maybe vassals) because I am not wanting to mess with that. I see that you have added other things and possibly made things more complex than I am wanting. Basically, all I want is a simple way to eliminate all non-state religions in a city using a buildable character (even if it is limited, like a missionary, but not like a Great Person) in one move, sort of like how a missionary can bring a religion to a city. I don't care if it has a failure rate, but I would like it to be able to eliminate all other religions except the one that is there. I don't even care if it requires the state religion to be present to start the Inquisition.

    Though, something that could be more interesting is if there were different types of Inquisitors, one for each religion and instead of defaulting to the state religion, it removed all other religions but that Inquisitor's religion. I don't want mods that dictate who can found what religions and if possible, I would like to make it that you could not eliminate a city's religion that founded it, the Holy City of sorts.

    Is this even possible without all the extra mods or can it be done as I am wanting?
     
  15. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    of course it possible to do what you want. the original mod came in two flavors: plain and "limited religions".

    the last few post have been devoted to fixing the "limited religion" part of that flavor.

    in the very least, you sound like you just want the inquisition. you could download the plain version and use that. you could also download a later version of the mod and take the inquisition part out of it.

    as far as changing the way inquisition is implemented, that requires coding..get to it :)
     
  16. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    Orion's Inquisition Mod ver 1.01D has now been released!

    Get it Here: http://forums.civfanatics.com/downloads.php?do=file&id=10325

    Fixed the bug that allowed AI civ to found more than one Holy city when playing limited religions. This was a very difficult bug to fix, but it is finally done. Tested OK in two fully played games. :)

    Enjoy!

    Orion Veteran :cool:
     
  17. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    Hi Trivas,

    This mod gives you two options that allow you to play the game the way you want. The GlobalDefinesAlt.xml file provides you with the game options you can change.

    a. Limited Religions -- If you want to play a game with Limited Religions, then simply change the default value to 1. If not, make sure the value is set to 0.

    b. Foreign inquisitions -- If you want to play a game with foreign inquisitions, then simply change the default value to 1. If not, make sure the value is set to 0.

    Choice is everything in this game. Hope you enjoy it. :)

    Sincerely,

    Orion Veteran :cool:
     
  18. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    orion, I think you might want to detail exactly what your limited religion mod is about, and how it works. Did you still keep the theology requirement? That is a good example of how your interpretation of limited religions is different than what Bmarnz originally had.
     
  19. Trivas

    Trivas Chieftain

    Joined:
    Jan 8, 2008
    Messages:
    39
    Thank you for answering me. I tried to download both links in the first post of this topic, but was unable to do so. It said there was an error and that neither file was found. Is there another area to download them or is it just my computer?
     
  20. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    ah you're right the links are shot. i have the originals saved on my computer which i can repost. at work now, but later ill post them back up.
     

Share This Page