• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days (this includes any time you see the message "account suspended"). For more updates please see here.

How to set river quantity in a map script

How can I set how many rivers there are in a map, in the python map script?
For hills, I've found they're set in the Climate xml file. But I still haven't found how to set rivers.

It's been a while since I looked at it, but I don't remember any XML variables for rivers. I'm not sure about other map scripters, but in my map scripts I usually have a tuning variable near the beginning to adjust that. I think that most map scripts use a default routine in the SDK that's kinda set in stone.
 
I've found a way to do it.

It's set in the SDK (class CvMapGenerator) and it takes into account these global defines (in the GlobalDefines xml):

PLOTS_PER_RIVER_EDGE (for the number of rivers in a given size of land)
RIVER_SOURCE_MIN_RIVER_RANGE (for the minimum distance between a river source and another river)
RIVER_SOURCE_MIN_SEAWATER_RANGE (for the minimum distance between a river source and the sea)

If you want more rivers, you can simply decrease all these values.
 
I want a map script without rivers. For my Future mod I've created Very High and Very Low sea levels and Harsh climate, but to get really different planets, I need to get rid of rivers. I'm going to try setting PLOTS_PER_RIVER_EDGE to -1 and see what happens. Infinite rivers? No rivers? Crash? It would be nice to have a map script that eliminates rivers while allowing the same mod to run other map scripts that don't. Based on Lakes. So, is it possible to set this variable in a script with Python? I have bad luck with python, but will try that too.

edit:

-As for changing rivers in the mod itself, -1 for Plots per edge didn't get it. This did it.

<Define>
<DefineName>PLOTS_PER_RIVER_EDGE</DefineName>
<iDefineIntVal>10000</iDefineIntVal>
</Define>
<Define>
<DefineName>RIVER_SOURCE_MIN_RIVER_RANGE</DefineName>
<iDefineIntVal>100</iDefineIntVal>
</Define>
<Define>
<DefineName>RIVER_SOURCE_MIN_SEAWATER_RANGE</DefineName>
<iDefineIntVal>100</iDefineIntVal>
</Define>

Almost no rivers. Hah!
 
To get zero rivers is quite easy:
Add

def addRivers:
pass

to your map script and you should be done.
 
Actually, that didn't work. This did.

def generateTerrainTypes():
NiTextOut("Generating Terrain (Python Lakes) ...")
terraingen = TerrainGenerator()
terrainTypes = terraingen.generateTerrain()
return terrainTypes

def addRivers():
iPass=1

def addFeatures():
NiTextOut("Adding Features (Python Lakes) ...")
featuregen = FeatureGenerator()
featuregen.addFeatures()
return 0
 

Attachments

Back
Top Bottom