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
    Orion's Inquisition Mod ver 1.01E has been released.

    Download: See signature link below.

    1. Added an option in the GlobalDefinesAlt.xml file to bypass the religious tech first to discover rule. In limited religions: If a player does not own a Holy City and the religion for the religious tech has not been founded yet, then the player can found the religion. Make sure the Choose Religions game option is unchecked at the start of the game. Special thanks to Modifieda4 for the idea.

    2. Cleaned up the python code and documented where all the changes are to simplify the python conversion process. If you want to add this mod component to your own mod, you will find it a lot easier to convert the code.

    This Inquisition mod should now be complete, pending any unforeseen bugs. Test games all ran smooth. :)

    Please let me know what you think of the final version.

    Enjoy!

    Orion Veteran :cool:
     
  2. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    385
    Location:
    Gold Coast
    i havent tried it but i think the work you've done is excellent.:goodjob:

    I'm in the middle of a gameright now, but I can't wait to try foreign inquisitions.:D
     
  3. glider1

    glider1 Deity

    Joined:
    May 29, 2006
    Messages:
    2,784
    Location:
    Where animals hop not run
    I haven't tried it either, but I really appreciate the work and generosity. Also excellent ideas on limited religions etc :goodjob:
    Cheers.
     
  4. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    The latest version and hopefully the final version of Orions Inquisition Mod is 1.01E. The major difference between your mod and this mod is the function:

    def doInquisitorCore_AI( self, pUnit ):

    Because your function differs from the one in this mod, I would examine this def doInquisitorCore_AI function very thoroughly to find out what the error messages are and then write code to fix them.

    Your function has an inquisitor for each religion, while this mod has one centralized Inquisitor that acts on behalf of the current player. It looks like you have added 7 more religions to choose from. Such a multitude of different religions could be very interesting in a huge game. I'm curious, how big is your mod after adding 7 new religions?

    Orion Veteran :cool:
     
  5. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Well, it'd be hard to tell you exactly how "big" my mod got because there are a lot of new additions to it. There are around thirty new leaders, culturally diverse unit flavors, new map scripts, three new civs (technically two because the Native Americans got changed to the Sioux, but I also added the Iroquois and Israel), superspies, sevopedia, improved graphics, and an enhanced nuclear blast graphic. So its rather big, but it runs/loads up pretty well. And I managed to get it to work in my mod, so thanks for giving suggestions. We have different Inquisitors for each religion and fourteen total religions (although only seven get founded in a given game), and the mod is being made specificially for Diplomacy games, although you can use it for SP games as well.

    While I am making it for a specific group of players (the Diplogame CivGroup at Apolyton), I'll release it publicly, although as I've said, it isn't a huge departure from the normal game.
     
  6. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    I'm pleased to know that you got it to work. :goodjob:

    Hmmm. I was contemplating adding your 7 new religions... If only they could each found a fully capable religion, then we could have a total of 14 to choose from. One can only dream at this point.

    Orion Veteran :cool:
     
  7. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Well, I don't know if I would have fourteen religions in a game with limited religions. The way I have it set up is that the normal seven are available in regular games, and then if you select the 'choose religion' option in the custom game menu it gives you fourteen options. They all have shrines, temples, monasteries, and cathedrals as well as missionaries. So they are totally useable. But if you had limited religions combined with fourteen total per-game (I assume by "fully capable" this is what you mean), you are going to need at least 14 civilizations to achieve your goal. Otherwise it will get ridiculous.

    So I'm not sure this is what you want to do. Although, without limited religions I would still say 14 is too many. I think leaving it at seven seems to be the best option I can think of.
     
  8. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    I was referring to a huge map with 14 or more civs. In limited religions, a civ can found a religion, only if the civ does not have one. With that in mind, I do like the idea of having 14 fully capable religions, with all units and buildings to choose from. Choice is always a good thing.

    I'm also sure I could create a python function to regulate the number of available religions base upon the total number of Civs that start the game. More religions opens up many coding possibilities. Hmmm...I will have to contemplate additional religions and come up with some ideas that make sense. Meanwhile, I think I would like to check out your existing mod.

    Sincerely,

    Orion Veteran @
     
  9. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Let me finish it first so I don't have to upload it twice. I don't have much left to do so I'm hoping it will be ready in a week or so.
     
  10. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    No problem. I can wait, as I need a little break from coding anyway.

    V/R,

    Orion Veteran :cool:
     
  11. tsentom1

    tsentom1 Bubble Dragon

    Joined:
    Jul 24, 2007
    Messages:
    1,000
    Location:
    New York
    I'm surprised that no one ever caught this but there's an error in bmarnz's code under

    def AI_chooseProduction(self,argsList):

    he never defines pPlayer so the the python hits an error and never actually constructs inquisitors.

    adding

    pPlayer = gc.getPlayer( pCity.getOwner( ) )

    should fix this.

    or:

    Code:
    	def AI_chooseProduction(self,argsList):
    		pCity = argsList[0]
    
    ## Inquisitor Production AI ##
    
    		iOwner = pCity.getOwner( )
    		pPlayer = gc.getPlayer( pCity.getOwner( ) )
    		iInquisitor = CvUtil.findInfoTypeNum( gc.getUnitInfo, gc.getNumUnitInfos(), "UNIT_INQUISITOR" )
    		iStateReligion = gc.getPlayer( iOwner ).getStateReligion( )
    
    		#Checks religion percents
    		lReligions = [ ]
    		bestReligionPercent = 0
    		iStateLevel = 0
    		for iReligionLoop in range(gc.getNumReligionInfos( )):
    			if (gc.getGame().getReligionGameTurnFounded(iReligionLoop) > 0):
    				iReligionLevel = gc.getGame().calculateReligionPercent(iReligionLoop)
    				if iStateReligion >= 0:
    					iStateLevel = gc.getGame().calculateReligionPercent(iStateReligion)
    				if iReligionLevel > iStateLevel:
    					lReligions.append( iReligionLoop )
    				if (iReligionLoop != iStateReligion):
    					religionPercent = gc.getGame().calculateReligionPercent(iReligionLoop)
    					if (religionPercent > bestReligionPercent):
    						bestReligionPercent = religionPercent
    
    		if iStateReligion >= 0 or bestReligionPercent >= 60:
    			if pCity.canTrain( iInquisitor, 0, 0 ):
    				lUnits = PyPlayer( pPlayer.getID( ) ).getUnitList( )
    				for iUnit in range( len( lUnits) ):
    					# if there are any Inquisitors, don't Build one
    					if pPlayer.getUnit( lUnits[ iUnit ].getID( ) ).getUnitType( ) == iInquisitor:
    						return False
    				if self.getRandomNumber( 2 ) == 0:
    					gc.getMap( ).plot( pCity.getX( ), pCity.getY( ) ).getPlotCity( ).pushOrder( OrderTypes.ORDER_TRAIN, iInquisitor, -1, False, False, False, True )
    					return True
    
    ## Inquisitor Productions AI ##
    
    		return False
     
  12. glider1

    glider1 Deity

    Joined:
    May 29, 2006
    Messages:
    2,784
    Location:
    Where animals hop not run
    Interesting and thanks. I'm going through OrionVeteran's great coding efforts myself, so will post if I find any possible issues.
    Cheers.
     
  13. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    Thanks for the accolades, but my coding must not be considered as great, if it still has a bug in it. I like perfection and that is what I try to turn out. Sometimes I'm not always successful. Please forgive me. :hammer2:

    I remember this function gave an intermittent failure on the line that used to read:

    so I changed it to read:

    ...which I didn't like much either.

    TSENTOM1: I will test your code and if successful, I will release it in a new version.

    You have my appreciation and thanks,

    Sincerely,

    Orion Veteran :cool:
     
  14. glider1

    glider1 Deity

    Joined:
    May 29, 2006
    Messages:
    2,784
    Location:
    Where animals hop not run
    @OrionVeteran
    Thanks again for the code. It's making my job of merging it with RevolutionDCM so much easier. You've kinda wrapped it all up real nice. :goodjob: I could not replicate the error claimed by tsentom1 a few posts ago.

    If you are interested, this is how I've resolved the issue with holy city status being destroyed by a purge. If the founding religion of the holy city exists in cities around the world in quantities less than a prescribed threshold, the holy city status may be wiped. Otherwise, the buildings of the founding religion can be destroyed by a purge, but the founding faith itself and hence it's holy city status cannot be eliminated.

    Here is the code (thanks to Dresdon for the CvUtil function):

    CvEventManager doInquisitorPersecution:
    Spoiler :

    Code:
    # Loop through all religions, remove them from the city
    			# RevolutionDCM start - holy cities cannot be destroyed
    			# unless their influence falls below the city count threshold
    			holyCityPurgeFail = false
    			holyCityPurgeSuccess = false
    			for iReligionLoop in range(gc.getNumReligionInfos()):
    				if iReligionLoop != pPlayer.getStateReligion( ):
    					if not pCity.isHolyCityByType(iReligionLoop):
    						pCity.setHasReligion(iReligionLoop, 0, 0, 0)
    					else:
    						holycity_influence = CvUtil.getGlobalCityHasReligionCount(iReligionLoop)
    						if holycity_influence < CvUtil.getHOLYCITY_INFLUENCE_THRESHOLD():
    							#holy city religion is globally insignificant so kill it
    							holyCityPurgeSuccess = true
    							gc.getGame( ).clearHolyCity( iReligionLoop )
    							pCity.setHasReligion(iReligionLoop, 0, 0, 0)
    						else:
    							holyCityPurgeFail = true
    			# RevolutionDCM end
    .
    .
    .
    			# RevolutionDCM start
    			if holyCityPurgeFail:
    				CyInterface().addMessage(CyGame().getActivePlayer(),False,25,CyTranslator().getText("TXT_KEY_MESSAGE_INQUISITION_HOLYCITY_FAIL",(pCity.getName(),)),"AS2D_PLAGUE",InterfaceMessageTypes.MESSAGE_TYPE_INFO,pUnit.getButton(),ColorTypes(8),pCity.getX(),pCity.getY(),True,True)
    			else:
    				if holyCityPurgeSuccess:
    					CyInterface().addMessage(CyGame().getActivePlayer(),False,25,CyTranslator().getText("TXT_KEY_MESSAGE_INQUISITION_HOLYCITY_SUCCESS",(pCity.getName(),)),"AS2D_PLAGUE",InterfaceMessageTypes.MESSAGE_TYPE_INFO,pUnit.getButton(),ColorTypes(8),pCity.getX(),pCity.getY(),True,True)
    				else:
    					CyInterface().addMessage(CyGame().getActivePlayer(),False,25,CyTranslator().getText("TXT_KEY_MESSAGE_INQUISITION",(pCity.getName(),)),"AS2D_PLAGUE",InterfaceMessageTypes.MESSAGE_TYPE_INFO,pUnit.getButton(),ColorTypes(8),pCity.getX(),pCity.getY(),True,True)
    			# RevolutionDCM end
    
    

    CvUtil getGlobalCityHasReligionCount:
    Spoiler :

    Code:
    # RevolutionDCM start
    def getHOLYCITY_INFLUENCE_THRESHOLD ():
    	return gc.getDefineINT("OC_HOLYCITY_INFLUENCE_THRESHOLD")
    
    def getGlobalCityHasReligionCount(eReligion):
    	iCount = 0
    	for i in range(gc.getMAX_PLAYERS()):
    		pPlayer = gc.getPlayer(i)	
    		iCount += pPlayer.getHasReligionCount(eReligion)
    	return iCount
    # RevolutionDCM end
    

    Just a suggestion. There's possibly another zillion better ways of doing it.
    Cheers.
     
  15. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    Thanks. I spent a lot of time making the code easier for everyone, who wants to merge this mod in their own mods. I really think Firaxis should consider including this mod in the official game.

    It an intermittent problem. Sometime it happens other times it does not. I'm testing the code provided by tsentom1 now. It may take me two or three more games to confirm a fix. So please be patient.


    Although I'm not really in favor of this kind of purge, I find the code is very interesting, particularly the religious influence count. There was a time in this forum, when we discussed the desire to have a Holy City reappear, if destroyed by razing after capture or abandoned like the capability that exists in Orion's Challenge. I still think that idea has merit. The player with the greatest religious influence for the same religion, as the religion of the razed Holy City, would see one of it's cities become the new Holy City for that religion. A modified version of your code could make the reappearance of a lost Holy City become reality. Thanks for posting the code. :)

    Sincerely,

    Orion Veteran :cool:
     
  16. glider1

    glider1 Deity

    Joined:
    May 29, 2006
    Messages:
    2,784
    Location:
    Where animals hop not run
    No problem at all take your time. It is good to have an Inquisition specialist at work ;) Even stability testing is very valuable work and effort.

    Just to confirm in case I am confused, it is the intended behaviour in this mod that holy city status can be wiped by an Inquisitor via the function call gc.getGame( ).clearHolyCity( iReligionLoop )? in doInquisitorPersecution?

    I'm merging this with the Revolutions mod via RevolutionDCM. People over there are saying that it is unrealistic for a holy city to be wiped by and Inquistor and they do not like it. This is why I have built code to prevent the Inquisitor wiping a holy city except for situations where the holy city has almost insignificant influence globally.

    Cheers :goodjob:
     
  17. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    I agree. The best mods run without any stability problems.

    Since the beginning of this mod, BMARNZ has always intended that the Inquisitor have the capability to remove any non-state religions, including a non-state Holy City. There has been discussion on how difficult that should be.

    Perhaps the idea of the reappearance of a Holy City might be a more realistic compromise. Run the idea by them to see what they think.

    Sincerely,

    Orion Veteran :cool:
     
  18. phungus420

    phungus420 Deity

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    No sir, I don't like it. At least not from the Revolutions perspective. Revolutions significantly increases rebeliousness in cities with non state religions, and this can get really bad with Holy Cities. It is particularliarly interesting cause a Holy City can act as an instigator and draw in other cities with it's religion that are semi rebellious to join a religious civil war. Of course with the normal benifits of holy cities, this adds a very dynamic game play mechanic; is that culture, and shrine income worth it, etc. as far as gameplay goes, it would just harm the interesting dynamics there. Regardless of what bmarz originally intended.

    Add on that the historical importance of cities like Jerusalem, where the Romans tried like mad to purge the Christians and Jews, but couldn't succede. Jerusalem stayed a significantly important holy place. So from a historical perspective, removing Holy cities with a simple inquisitor seems wrong.

    Now it's a game and no one should sacrifice gameplay for historical accuracy. But at least as far as the Revolutions mod component is concerned, purging Holy cities sacrifices both. With no real benifit I can see, other then the fact Bmarz intended it to behave this way.
     
  19. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    OK I hear you and believe I have a good compromise. I will make respawning of Holy Cities a game option in the GlobalDefinesAlt.xml file . That way you can turn the option on or off depending upon how you wish to play the game. :)

    There are 3 different times when respawning of a Holy City can occur:

    1. When an inquisitor removes a Holy City.
    2. When (in Orion's Challenge) a Holy City is abandoned.
    3. When a Holy City is razed.

    Current status for next release: The respawning option is 66% done and works nicely for options 1 and 2. I'm working on the last option now.

    I think I might even add another option to allow or prevent the removal of a Holy City by an Inquisitor. All I need is time to perfect it.

    Very Respectfully,

    Orion Veteran :cool:
     
  20. phungus420

    phungus420 Deity

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    Options are good. If you include an option to dissallow inquisition of the Holy City, that would be great. The fact inquisitors can purge holy cities is the only thing keeping inquisitions from being included by default in the WolfRevolution mod, if this becomes toggleble in the XML, things would be gravy.
     

Share This Page