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

Orion's Inquisition Mod

Discussion in 'Civ4 - Mod Components' started by OrionVeteran, Nov 28, 2008.

  1. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    There is a difference between an AP vote vs. religious betrayal. The decision of an AP vote affects every CIV, while religious betrayal only affects those Civs who share the same religion. So the religious betrayal does not make the player a "world" villian, as Civs having different religions couldn't care less about who betrayed who in a non-state religious squabble. But this might just be symantics.

    Basically, you want to add anger to every city having the state religion. My question is: For how long? ...and do you have a python line that would add anger to a city? For example:

    Code:
    # Code to Anger people in City
    pCity.ChangeAnger(-1) ?????  (does this exist?)
    pCity.changeHurryAngerTimer(10)
    
    Any ideas?


    Orion Veteran :cool:
     
  2. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,208
    Location:
    DE/NL/FR
    You should look in here or here.

    You could use
    pCity.changeHappinessTimer(-X) or
    pCity.changeExtraHappiness(-X)
     
  3. Ninja2

    Ninja2 Great Engineer

    Joined:
    Nov 17, 2005
    Messages:
    1,142
    Location:
    Denmarkia
    I like this new idea about religious betrayal. I would add to the "No, we will not declare war" option a lot of unhappyness (like 10 turns of 3 angries per city) and/or Anarchy from forcing you to go to Paganism (to represent the "doves" regime toppled).
     
  4. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    I have the popup menus working and received help on how to add unhappiness to all of a player's cities for a set amount of turns. Tonight I will attempt to slide them into the correct functions. :)

    Orion Veteran :cool:
     
  5. Liambane

    Liambane Rome's Praetorian

    Joined:
    Aug 14, 2007
    Messages:
    288
    Location:
    West Roman Empire, Italy.
    Limited Religion DOESN'T WORK fine with CHOOSE RELIGION OPTION ENABLED.
     
  6. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    Please explain in detail what happened. Are you using the latest version? :confused:

    Orion Veteran :cool:
     
  7. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    I decided to improve the code that founds religions with the CHOOSE RELIGIONS game option enabled. Purpose: Efficiency and to insure Liambane's concern is resolved. A test game with 7 Civs revealed all religions were founded, only one Holy City per civ and they were all precisely founded on the correct techs. Now that's perfection! ...and this improved code will be released in my next update.

    Note: I'm still testing the religious betrayal code. So, it might be a few more days until I am sure it works.

    Orion Veteran :cool:
     
  8. Liambane

    Liambane Rome's Praetorian

    Joined:
    Aug 14, 2007
    Messages:
    288
    Location:
    West Roman Empire, Italy.
    Hi Orion. First of all compliments for your mod.

    Using "Choose Religion" option let the civilization act strange, here's what happened at least 4-5 times in a row:

    1- The First religion founded was ALWAYS judaism
    2- The Second was ALWAYS christian (lots of time in the same turn of judaism)
    3 - The Third was ALWAYS Confucian.

    After that I saw on the technology green bar that a religion was available with MEDITATION... but still 3 religions was founded.

    Hope my experience helped orion.
    Cya
     
  9. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    Under "Choose Religions," human players can pick any religion still available on the popup list. However, the computer must still select a religion for all AI CIVs. The order of discovery is based upon how the function works. The function looks for the first available religion and selects that religion for the AI. It appears that Judaism just so happens to be at the top of the list in the search sequence, followed by Christianity, etc.

    I think the new code will better define if a religious tech can found a religion or not. Last nights' test had no duplicate foundings and the timing was flawless (i.e. Meditation can found a Religion if there are less than 2 religions previously founded).

    Orion Veteran :cool:
     
  10. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    Release of Version 2.00F

    See first post for details on the changes and enhancements made.
    A lot of work went into this update. Now I need some... :sleep:

    Enjoy,

    Orion Veteran :cool:
     
  11. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    This mod has been out there for a long time. It could be nice to have the latest version of this component rated. :trophy:

    Orion Veteran :cool:
     
  12. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,402
    Gender:
    Male
    Location:
    Canberra, Australia
    Hi, while attempting to merge the Abandon City mod with Rise of Mankind 2.6 I need to ensure that I do the same stuff as your mod does to be consistant. However after looking at your code I became confused. It is probably my lack of python that is causing the confusion but in the onCityRazed event the code appears to give bonuses and penalties then if the respawn holy cities is on it applies another bunch of bonuses and penalties. Am I reading the code right or is there something I am missing?

    Also why is there no penalty and bonus for destroying your state religion's holy city? I know that it is unlikely for someone to do this but it happens.

    RoM 2.6 does not use Inqusition 2.00f yet but the code for onCityrazed is the same in the version it does use.

    Btw thanks for making this work for cities which have multiple holy shrines.
     
  13. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    If you look closely at the onCityRazed event in version 2.00F: There are AI attitude adjustments and gold bonuses based upon whether or not a non-state religion, building or Holy City exists. They all have separate checks, affects on the AI and gold yields.

    1. The first part of the code removes all non-state religious buildings from the city (including any non-state Shrines). The removal of a non-state religious building angers AI Theocracies by -1 and yields 250 gold each. If a non-state Shrine is removed, the AI Theocracies are angered by -3 and they will declare total war. The gold yield is 500 for each non-state shrine.

    2. The second part of the code checks for any non-state religions and Holy Cities. Based upon a game option the code will remove the Holy City identifier. This will anger AI Theocracies by -3 and they will declare total war. The gold yield is 500 for each Holy City removed. The removal of a non-state religion angers AI Theocracies by -1 and yields 100 gold for each religion removed.

    The purging or razing of a Holy City and or Shrine does not happen too often. When it does, there is now certainty you will have total war declared against you by any AI Theocracies, who just lost their most Holy City and or Shrine. You will never be at peace with them for the rest of the game. The destruction of Holy Cities is considered to be an unforgiveable act of war. However, with great risk is great reward. When you sum everything up, the gold value of Holy Cities can be significant. :D

    Bottom Line: There is nothing wrong with the code, as it all works perfectly. :)

    On a deep second look, there is a way to improve the code. I'll make the change in the next release.


    Orion Veteran :cool:
     
  14. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,402
    Gender:
    Male
    Location:
    Canberra, Australia
    Thanks for that. I definately missed the difference between holy shrine the building and the holy shrine marker. Now that I type this it clears almost everything up. Yes, I am easily confused. :) It still looks like you are penalising the use of the respawn option.

    Just looking at the angered bit for a single non-state Holy Shrine.

    Part 1. gives -3 and removes the non-state shrine.

    Then part 2 (respawn bit). removes the Holy City marker for another -3.

    As I said I need to understand the reasons behind this to merge the Abandon City mod into Rise of mankind 2.6. In which it is possible to have 10 buildings which require a religion to build; 3 standard buildings, one crusade building, 5 crusade national wonders and a world wonder! Which I think means another -10 attitude adgustment.

    So if I want to safely destroy a holy city I should convert to that religion first then destroy it and then convert back - no money and only small penalties if the city had multiple buildings of multiple religions.:mischief:
     
  15. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    The improvement to this large function will move the check for Respawning to a place much further into the code. Here is the change (in Red) that will be in the next version.

    Code:
    # Removes all non-state Religions and HolyCities
    for iReligionLoop in range(gc.getNumReligionInfos()):
    	# Make sure only non-state religions are selected
    	if iReligionLoop != iStateReligion:
    		# Is this a non-state Holy City?
    		if city.isHolyCityByType( iReligionLoop ):
    			# Increases Anger for all AIs who share the purged Holy City
    			CvUtil.AIAttitudeAdjustment(iPlayer, iReligionLoop, -3, True)
    			# Remove non-state Holy City identifier
    			gc.getGame( ).clearHolyCity( iReligionLoop )
    			# Add gold to treasury for pillaging the non-state Holy City
    			iGoldTotal = iGoldTotal + 500
    			# Increases Anger for all AIs who share the purged religion
    			CvUtil.AIAttitudeAdjustment(iPlayer, iReligionLoop, -1, False)
    			# Remove non-state religion
    			city.setHasReligion(iReligionLoop, 0, 0, 0)
    			# Add gold to treasury to compensate for inquisition costs
    			iGoldTotal = iGoldTotal + 100
    			CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Destruction of a non-state Holy City has angered AI Civs!','AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/TerrainFeatures/Forest.dds',ColorTypes(7),0,0,False,False)
    			# Check default -- Respawn Holy City?
    			[B][COLOR="Red"]if CvUtil.isOC_RESPAWN_HOLY_CITIES():[/COLOR][/B]
    				# Is there at least 1 non Holy City remaining with HC Religion?  
    				if CvUtil.findCityWithXReligion(iReligionLoop):
    					# Set Minimum of Two Cities required for Respawning a Holy City
    					minCitiesForInfluence = 2
    					# Find player with the greatest Religious Influence for Religion 
    					eBestPlayer = CvUtil.getPlayerWithMaxInfluenceForReligion(iReligionLoop, minCitiesForInfluence)	
    					# If there is a player with enough Religious Influence for Religion
    					if eBestPlayer >= 0:
    						XpPlayer = gc.getPlayer(eBestPlayer)
    						# Respawn the Holy City 
    						CvUtil.ReSpawnHolyCity(XpPlayer, iReligionLoop)
    
    
    Any AI Theocracy that shares the state religion of the destroyed Holy City and or Shrine will declare war on the player (aggressor) and the attitude adjustment is at least -7 when a shrine exists in the Holy City. This amounts to 2 full changes in negative attitude towards the player. The intent is to discourage the destruction of a Holy City, as there is certain retaliation by AI Theocracies, who share the religion. Hope that helps.

    Orion Veteran :cool:
     
  16. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,402
    Gender:
    Male
    Location:
    Canberra, Australia
    Yes that clears everything up.

    Thanks for your help and patients.
     
  17. phungus420

    phungus420 Deity

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    Hey OrionVeteran, I'm adding a unit to my mod that should only be buildable under Emancipation. I was wondering how you've set up the Civic dependant buildability of Inquisitors, but wasn't able to find it in a brief scan of the Python. Could you direct me to the specific python file, and some text I could search for that would show how to limit the buildability of a unit to a specific civic?
     
  18. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,208
    Location:
    DE/NL/FR
    You could use ZCivics (needs also ZModularPython).
     
  19. OrionVeteran

    OrionVeteran Deity

    Joined:
    Dec 25, 2003
    Messages:
    2,443
    Location:
    Newport News VA
    Sure: check out the CVGameUtils.py file for these functions:

    Code:
    def canTrain(self,argsList):
    	pCity = argsList[0]
    	eUnit = argsList[1]
    	bContinue = argsList[2]
    	bTestVisible = argsList[3]
    	bIgnoreCost = argsList[4]
    	bIgnoreUpgrades = argsList[5]
    	# Inquisition Mod
    	if self.isInquisitionConditions(pCity.getOwner()):
    		if eUnit == gc.getInfoTypeForString('UNIT_INQUISITOR'):
    			return True
    	# End Inquisition Mod
    	return False
    
    def cannotTrain(self,argsList):
    	pCity = argsList[0]
    	eUnit = argsList[1]
    	bContinue = argsList[2]
    	bTestVisible = argsList[3]
    	bIgnoreCost = argsList[4]
    	bIgnoreUpgrades = argsList[5]
    	# Inquisition Mod
    	if not self.isInquisitionConditions(pCity.getOwner()):
    		if eUnit == gc.getInfoTypeForString('UNIT_INQUISITOR'):
    			return True
    	# End Inquisition Mod
    	return False
    
    
    def isInquisitionConditions(self, playerID):
    	pPlayer = gc.getPlayer(playerID)
    	if not gc.getTeam(pPlayer.getTeam()).isHasTech(gc.getInfoTypeForString('TECH_THEOLOGY')):
    		return False
    	if pPlayer.getStateReligion( ) < 0:
    		return False
    	if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_RELIGION')) == gc.getInfoTypeForString('CIVIC_PACIFISM'):
    		return False
    	if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_RELIGION')) == gc.getInfoTypeForString('CIVIC_FREE_RELIGION'):
    		return False
    	return True
    

    Orion Veteran :cool:
     
  20. phungus420

    phungus420 Deity

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    Thanks Orion Veteran. I'm using your mod too, and I want to keep inquisitors restricted. I can't see an obvious way to add a second unit here, how would I do this?
     

Share This Page