Merging a mod with RFC Rand?

bitparity

Chieftain
Joined
Apr 22, 2002
Messages
14
I'm interested in merging this mod that allows you to abandon/raze cities and it leaves behind workers (sorta like what civ 3 did) as I frequently raze cities because they're too closely placed, but would like some slaves.

However, I don't know too much about modding, and my attempts to get it to work have failed.

The mod code is below. It's not long. Pretty much only 2 short python files.
http://forums.civfanatics.com/showthread.php?t=252243&highlight=abandonraze

Any suggestions?
 
Alternately, you could change the GlobalDefines.xml file to increase the required distance between cities. Buried in that is a line that says

<Define>
<DefineName>MIN_CITY_RANGE</DefineName>
<!-- Rhye -->
<iDefineIntVal>1</iDefineIntVal>
</Define>


Just change the 1 to a 2 and you'll be set. I wouldn't recommend this in RFC, but it works fine in RAND
 
This mod would be very, very good for RFC imo. Being able to pick and choose which cities we keep and which we discard could end up being a very useful tool.
 
So I finally managed to figure this out on my own, though it's not ideal, it's workable.

Saved my butt in war where i got nuked repeatedly by a more advanced civ. I managed to evacuate my frontline cities converting my population into workers. It definitely felt more real as hordes of worker refugees fled abandoned cities for the coast away from the encroaching nuclear explosions and city fighting.

So in file CvEventManager.py, add the following to enable you to abandon any one of your cities by pressing Alt X.

Spoiler :
#'Check if city screen is active'
if ( CyInterface().isCityScreenUp() ):
'Check if Alt + X was hit'
if(theKey == int(InputTypes.KB_X) and self.bAlt):
'Make sure the owner is the player!'
if (CyInterface().getHeadSelectedCity().getOwner() == gc.getGame().getActivePlayer()):

pHeadSelectedCity = CyInterface().getHeadSelectedCity()
ipopulation = CyInterface().getHeadSelectedCity().getPopulation()
ix = pHeadSelectedCity.getX()
iy = pHeadSelectedCity.getY()
abandoner = gc.getActivePlayer()

CyAudioGame().Play2DSound("AS2D_DISCOVERBONUS")

if (ipopulation > 2):
iworkers = ipopulation/3
for i in range(0,iworkers):
abandoner.initUnit(5, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)
pHeadSelectedCity.kill()
CyCamera().JustLookAtPlot( CyMap().plot( ix, iy ) )


and this code converts a city into a number of workers based on population size divided by 3.

Spoiler :
ipopulation = city.getPopulation()
if (ipopulation > 2):
iworkers = ipopulation/3
for i in range(0,iworkers):
razor.initUnit(5, city.plot().getX(), city.plot().getY(), UnitAITypes.NO_UNITAI)
CvUtil.pyPrint('Player %d Civilization %s City %s was razed by Player %d' %(owner.getID(), owner.getCivilizationName(), city.getName(), razor.getID()))
CvUtil.pyPrint("City Razed Event: %s" %(city.getName(),))


I don't know enough python to figure out how to turn this into a menu or get the computer to AI this, as it seems it would make sense to evacuate cities about to be lost. Or even to replicate Civ 3's add population to city. But I hope this helps.
 
Top Bottom