View unanswered posts | View active topics It is currently 2 Dec 2020, o 03:53



Reply to topic  [ 3 posts ] 
 Enhancement: AI City razing only if city size < 8 
Author Message
Trainee

Joined: 11 Apr 2020, o 11:06
Posts: 12
Post Enhancement: AI City razing only if city size < 8
When we play at monarch, the AI almost always raze conquered cities, maybe 80% of the cases. If the city has size 20 and it took lots of time to get to size 20, it would be better if we would have a chance to take it back. As an enhancement as an option in the settings or automatically, the AI should not raze cities that are already too big, e.g. size < 8.

Very good work of you with the mod! It is a pleasure to play it once a week.


5 Sep 2020, o 16:28
Profile
Trainee

Joined: 11 Apr 2020, o 11:06
Posts: 12
Post Re: Enhancement: AI City razing only if city size < 8
In PythonCallbackDefines.xml I changed
<Define>
<DefineName>USE_CAN_RAZE_CITY_CALLBACK</DefineName>
<iDefineIntVal>1</iDefineIntVal>
</Define>


In CvGameUtils.py I changed

def canRazeCity(self,argsList):
iRazingPlayer, pCity = argsList
#Can raze city if size < 6
canRaze = False
if pCity.getPopulation() < 6:
canRaze = True

return canRaze

It seems to work. It has to be tested first. However, it would be nicer that the AI destroys cities, which are closer to its border with a lower probability than cities far away. The purpose is to let the AI consume smaller empires without having to rebuild everything. As humen player rather kepp good cities, especially at the border, the game gets too easy if the AI does not expand in the same tempo.


21 Oct 2020, o 06:41
Profile
Trainee

Joined: 11 Apr 2020, o 11:06
Posts: 12
Post Re: Enhancement: AI City razing only if city size < 8
I noticed that my previous post was not working for changing the canRazeCity method. Here is a corrected version:

In C:\Games\Steam\steamapps\common\Sid Meier's Civilization IV Beyond the Sword\Beyond the Sword\Mods\Realism Invictus\Assets\Python\CvGameUtils.py enhance the method in the way you wish, e.g. that only cities with population < 6 can be destroyed.

def canRazeCity(self,argsList):
iRazingPlayer, pCity = argsList

# Can raze city if size < 6
if pCity.getPopulation() >= 6:
return False

return True

In C:\Games\Steam\steamapps\common\Sid Meier's Civilization IV Beyond the Sword\Beyond the Sword\Mods\Realism Invictus\Assets\Python\Components\BUG\BugGameUtils.py search the following line and replace True with None. The reason can be found here https://forums.civfanatics.com/threads/ ... ar.323808/ . “If your class doesn't define canTrain() BUG will use the one from CvGameUtils. Actually, BUG will use the registered default if there is one to avoid calling the functions in CvGameUtils. This is why it is so very important that you do not modify the original CvGameUtils as your modifications will be ignored.”

self._setDefault("canRazeCity", None)

Additional information: https://forums.civfanatics.com/threads/ ... io.443668/


31 Oct 2020, o 04:18
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.