Aggressive AI and razing cities

justinian66

Chieftain
Joined
Jul 22, 2010
Messages
70
How would I go about disabling the computer opponent's ability to raze cities?

I've been playing Legends of Revolution mod, which has the Aggressive AI incorporated into it, and the computer players are almost always razing cities rather than capturing them. They're even razing cities they've liberated. Ive tried reducing every leader's iRazeCityProb to 0 in the CIV4LeaderHeadInfos.xml file and its still happening.

Disabling my own ability to raze cities would be an acceptable fix for this at this point. Its rather annoying watching the AI destroy its own cities after recapturing them or watching cities with multiple wonders burn to the ground
 
Fwiw, Realism Invictus seems to have had the same problem:
4th quote
I haven't really played either mod. Does LoR remove the "No City Razing" game option?
 
One of Platyping's wonders (sorry, don't remember which one) uses Python to prevent the cities of its owner from being razed. If you know Python, you could extract that code and make it universal ...somehow. I obviously don't really know Python :lol:
 
In case of RI, we eventually traced that back to K-Mod AI component that (among other things) changes the calculation for razing cities. Turned out that 0 was not the limit - we just had to use negative values to make AI more cautious about razing cities. I suppose that if you use some crazy negative value like -300, that AI will never raze.
 
Turned out that 0 was not the limit - we just had to use negative values to make AI more cautious about razing cities. I suppose that if you use some crazy negative value like -300, that AI will never raze.

Are you talking about the iRazeCityProb value in the CIV4LeaderHeadInfos.xml file?
 
In case of RI, we eventually traced that back to K-Mod AI component that (among other things) changes the calculation for razing cities. Turned out that 0 was not the limit - we just had to use negative values to make AI more cautious about razing cities. I suppose that if you use some crazy negative value like -300, that AI will never raze.


Are you talking about the iRazeCityProb value in the CIV4LeaderHeadInfos.xml file?

For anyone out there who was suffering from the same problem, this seems to have fixed it. Changing the iRazeCityProb value in the CIV4LeaderHeadInfos.xml to a negative value has dramatically reduced the times the AI has razed cities now. Thanks to Walter Hakwood for leading me to the answer.
 
Negative values not working for me.

I use notepad++ to change all of them to -999999999 and the AI still razes cities with numerous WWs.

I want to be able to raze Barbarian cities placed poorly near my territory.

I'm using PIG mod, and certain that I have adjusted the values in the correct file. Am I missing something?
 
In CvGameUtils.py there is a function called canRazeCity. The only thing it does in regular BtS is return True. If you just make it return False then there should be no city razing. You can add logic to allow razing some cities (limited by population or culture, barbarian owned, whatever).

If you are using BUG you may need to make sure that this function is being loaded from somewhere and modify what it is using, or add your own modular Python in the BUG configuration to get it to run a function for this callback. Also, some mods add XML for turning off more unused callbacks and may therefore also require you to modify the PythonCallbackDefines.xml file to turn this callback on.
 
That's way more complicated than I thought it would be!

I started the game again and turned off city razing. In the early stages, I positioned a couple of axemen around the map to keep Barbarians from making cities, which almost worked.

The ability to raze mature cities had an interesting affect on the gameplay. The most powerful Civ was able to dominate, because it wasn't forced to defend cities it took, and it then became the team with the most World Wonders.
 
Back
Top Bottom