View Full Version : Map scripting question


Azziane
Oct 03, 2008, 12:46 PM
Hi,

I was wondering if I could get some help figuring out where in the original map scripts the terrains/features/resources are allocated. I have messed with programming and scripting in the past and I get most of what I sample-read in the python scripts. I just have a hard time reading everything before my eyes start bleeding. If someone knowledgeable could point me at the correct location where this is scripted I would appreciate it.

I would like to try and change 2 things in the A_New_World map script:

1)I want the script to add terrains, features and bonus that I have created. For example I want all terrain to have a 10% chance to be grassland and 90% chance to be "crater". Crater being one of the terrain types I have created. It is a terrain in itself, not a feature. So a plot can only be either grassland OR Crater, not both.

I would be ok if all I can do is have a percentage of the grassland turned into craters. If there is an easy way to edit the WBsave file to randomly change X% of the Terrain_GRASSLAND into TERRAIN_CRATER that actually would work too. I just, obviously, cannot do this by hand. And using the map editor takes too long. Making one map took me about 14 hours, and I need to make another 17...

2)I want all terrains to be able to have a new bonus as well (an "artifact" bonus). I need those to only be available for Crater and Ocean type terrains in a small percentage.

Again, if you could just tell me where exactly all this is determined in the original scripts I should be able to take it from there. Otherwise I will come back :)

cephalo
Oct 03, 2008, 02:30 PM
In the case of the A_New_World, all the terrain chances and such are in a file called CvTerrainInfos.xml. I prefer not to use those values, so I just call CvPlot.setTerrainType() as I see fit. Look at CvMapScriptInterface for some helpful info on the map making process, also look at the dll source code for the CvMapGenerator and CvPlot classes. That will give you more idea of what's easy and what's hard.