View Full Version : Merging a mod with RFC Rand?


bitparity
Oct 02, 2009, 10:30 PM
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?

Arkaeyn
Oct 03, 2009, 12:12 AM
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

killerkebab
Oct 07, 2009, 12:21 PM
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.

Ready_set_go
Dec 05, 2009, 06:45 AM
What does imo mean?

Arkaeyn
Dec 05, 2009, 12:08 PM
in my opinion

Ready_set_go
Dec 05, 2009, 05:09 PM
why not just write it out?

Arkaeyn
Dec 05, 2009, 07:44 PM
Ask the internet?

Ready_set_go
Dec 06, 2009, 05:46 AM
Most people write with grammar in the forums, yet you (as in a couple of people, not just you) still use abbreviations. I'm confused.

Arkaeyn
Dec 06, 2009, 02:06 PM
Widely recognized abbreviations aren't a problem. Do you write out Civilization IV: Beyond the Sword every time?

Ready_set_go
Dec 06, 2009, 05:03 PM
I don't even mention it :P, but your right, I don't.

Arkaeyn
Dec 06, 2009, 10:31 PM
And you also just used an emoticon....

Ready_set_go
Dec 07, 2009, 04:23 AM
Okay, I see your point.

Deon
Dec 09, 2009, 01:34 AM
Do not derail the thread. I personally think that raze/abandon modmod and influence driven war would be cool in this :). Too bad it looks like a lot of work.

bitparity
Feb 16, 2010, 10:26 PM
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.

#'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.

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.