• 📚 A new project from the admin: Check out PictureBooks.io, an AI storyteller that lets you build custom picture books for kids in seconds. Let me know what you think here!

Angering the AI's Attitude

OrionVeteran

Deity
Joined
Dec 25, 2003
Messages
2,443
Location
Newport News VA
Situation: I’d like to make a negative change to the AI’s attitude or relationship based upon the destruction of a non-state shrine. Only those AI Civs that share the religion of the non-state shrine would become angered by the destruction of their one and only religious shrine building by a successful inquisition. In the next release of my inquisition mod, the Inquisitor will be able to remove a non-state religious shrine building. I have finished that code. What I need is python code to anger the AI’s attitude by two steps.

For example:
If the AI is Pleased, he becomes Annoyed.
If the AI is Cautious, he becomes Furious.
If the AI is Annoyed, he declares War on you.

My question is: Based upon a derived function that determines the religion of the non-state religious shrine, is there a way to anger all Civs (by two steps), who share the same religion as the destroyed shrine?

I think this change would add more realism to the inquisition mod and the game. :)

Sincerely,

Orion Veteran :cool:
 
Each AI has a total attitude value that is the sum of all the diplomatic modifiers and other effects: events, warmonger respect, skill level, etc. This value is then used to determine the AI's attitude level:

  • Friendly: 10 or above
  • Pleased: 3 to 9
  • Cautious: -2 to 2
  • Annoyed: -9 to -3
  • Furious: -10 and below
Some attitude modifiers are hidden, so you can't see the actual value by summing the modifiers you see when hovering over an AI.
 
Does anybody know if the AI's attitude toward a player affects the way that it fights when at war? For example if I where to change the AI attitude towards me to furious whould it do thing differently when at war with me. Or would it just make the AI more likely to declare war, but not change the way it fights?
 
OK I wrote a little function in CvUtils.py that might be useful out there. I used the function twice, with -6 and -1 respectively for a total of -7, which I believe is a good number to simulate 2 changes in attitude for the AI. However, the function allows you to change the number to what ever you want, positive or negative:

Code:
def AIAttitudeAdjustment(iPlayer, iRequiredReligion, intAdjustment):
	# Increases anger for Civs who share the religion purged. 
	for AIPlayer in range(gc.getMAX_PLAYERS()):
		if AIPlayer != iPlayer:
			AIpPlayer = gc.getPlayer(AIPlayer)
			if AIpPlayer.isAlive() and not AIpPlayer.isBarbarian() and not AIpPlayer.isNone() and not AIpPlayer.isHuman( ):
				if AIpPlayer.getStateReligion( ) == iRequiredReligion:
					PyPlayer(AIPlayer).AI_changeAttitude( iPlayer, intAdjustment )

	return

Have fun!

Orion Veteran :cool:
 
Thanks OrionVeteran for the AttitudeAdjustment function. I wouldn't mind having a function like that for some of the people I work with. :lol:
 
It would be cool if this also worked if you razed the holy city.

In my next release of Orion's Inquisition Mod (ver 2.00D), this function will increase AI anger under these conditions:

If a successful inquisition takes out a non-state religion: -1
If a successful inquisition takes out a Holy City: -3
If a successful inquisition takes out a Holy Shrine: -3

If a non-state religion is razed: -1
If a Holy City is razed: -3
If a Holy Shrine is razed: -3
(values subject to change).

This little function is going to vastly improve the game, by making a player think twice about taking out a Holy City and Shrine. The negative diplomacy and increased possibility of war might not be worth the effort. Yet, another strategic decision to make! :D

Orion Veteran :cool:
 
Back
Top Bottom