View Full Version : Map Script Request - remove mountains on fractral map for ffh2


Karnja
Feb 06, 2009, 06:59 AM
hello everyone~

i am in need of a script that removes any mountains from a fractal map in ffh2 in mp games. they may be replaced with hills so you can built a mine or something.

for any help thx in advance!

LDiCesare
Feb 06, 2009, 11:15 AM
In the script, add something like this (roughly, untested):

def normalizeRemovePeaks():
map = CyMap()
mapHeight = map.getGridHeight()
width = map.getGridWidth()
height = map.getGridHeight()
for x in range(width):
for y in range(height):
plot = map.plot(x,y)
if (plot.getPlotType() == PlotTypes.PLOT_PEAK):
plot.setPlotType(PlotTypes.PLOT_HILLS)

Karnja
Feb 07, 2009, 03:15 AM
can you tell me exactly in which folder and where i have to add this?

LDiCesare
Feb 08, 2009, 12:41 PM
You need to add this to the .py file corresponding to the map script you want to use. It's one of the .py files in the Public Maps folder in the game installation directory.

Karnja
Feb 09, 2009, 06:04 AM
done as you told me (copy and paste into the fractal.py file, didnt replace anything, just add this) unfortunetly, the mountains are still there. may be even grassland, or grassland hills or plains. just anything (but water) is fine :)

LDiCesare
Feb 09, 2009, 12:05 PM
Mm. The function I told you to use is only called if normalizeStartingPlotLocations() is also defined.
Replace normalizeRemovePeaks() by afterGeneration() and it should work.

Karnja
Feb 10, 2009, 05:38 AM
#
# FILE: Continents.py
# AUTHOR: Soren Johnson
# PURPOSE: Global map script - Civ4's default map script
#-----------------------------------------------------------------------------
# Copyright (c) 2004, 2005 Firaxis Games, Inc. All rights reserved.
#-----------------------------------------------------------------------------
#

from CvPythonExtensions import *
import CvUtil
import CvMapGeneratorUtil
from CvMapGeneratorUtil import FractalWorld
from CvMapGeneratorUtil import TerrainGenerator
from CvMapGeneratorUtil import FeatureGenerator

def getDescription():
return "TXT_KEY_MAP_SCRIPT_FRACTAL_DESCR"

def isAdvancedMap():
"This map should show up in simple mode"
return 0

def generatePlotTypes():
NiTextOut("Setting Plot Types (Python Fractal) ...")
fractal_world = FractalWorld()
fractal_world.initFractal(rift_grain = -1, has_center_rift = False, polar = True)
return fractal_world.generatePlotTypes()

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

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

def afterGeneration():
map = CyMap()
mapHeight = map.getGridHeight()
width = map.getGridWidth()
height = map.getGridHeight()
for x in range(width):
for y in range(height):
plot = map.plot(x,y)
if (plot.getPlotType() == PlotTypes.PLOT_PEAK):
plot.setPlotType(PlotTypes.PLOT_HILLS)

first off all, i really appreciate your work and help! ok that way my fractal.py in the public map folder is looking now. it still doesnt work. i bet im doing something wrong :(

LDiCesare
Feb 10, 2009, 03:25 PM
Two things.
One: Replace the setPlotType line by this:
plot.setPlotType(PlotTypes.PLOT_HILLS,true,true)
Two:
The file chosen by CIV is a bit weird.
I have Civ IV, Warlords and Beyond the Sword installed.
I run Beyond the Sword.
If I select continents, the continents.py file used is the one in the Warlords directory, not the one in the Civ IV (base) directory. I suppose this is your problem.

Karnja
Feb 11, 2009, 09:48 AM
Thank you alot LDiCesare, looks like it works! you made my day by this, thx alot mate :D :D :D