I have been working on a simple map script, but when I try and test it in game, My units are unable to spawn, and just die constantly.
Does anyone know what I am missing?
Code:
Does anyone know what I am missing?
Code:
Spoiler :
Code:
import random
def getDescription():
return "Jehy's Paradise worlds"
def isAdvancedMap():
"This map should show up in simple mode"
return 0
def getWrapX():
return False
def getWrapY():
return False
def getGridSize()
grid_sizes = {
WorldSizeTypes.WORLDSIZE_TINY: (60,60),
WorldSizeTypes.WORLDSIZE_SMALL: (75,75),
WorldSizeTypes.WORLDSIZE_STANDARD: (90,90),
WorldSizeTypes.WORLDSIZE_LARGE: (125,125),
WorldSizeTypes.WORLDSIZE_HUGE: (150,150),
}
if(argsList[0] == -1):
return []
[eWorldSize] = argsList
return grid_sizes[eWorldSize]
def generatePlotTypes():
NiTextOut("Setting Plot Types (Python Paradise) ...")
gc = CyGlobalContext()
map = CyMap()
dice = gc.getGame().getMapRand()
iFlags = 0
iW = map.getGridWidth()
iH = map.getGridHeight()
plotTypes = [PlotTypes.PLOT_LAND] * (iW*iH)
for x in range(iW):
for y in range(iH):
i = y*iW + x
iN = (y + 1)*iW + x
iS = (y - 1)*iW + x
iE = y*iW + (x + 1)
iW = y*iW + (x - 1)
iNE = (y + 1)*iW + (x + 1)
rand = random.random()
if(rand < 0.50 && plotTypes[i] != PlotTypes.PLOT_LAND):
#Create island
plotTypes[i] = PlotTypes.PLOT_LAND
for iDirection in range(CardinalDirectionTypes.NUM_CARDINALDIRECTION_TYPES):
pPlot = plotCardinalDirection(x, y, CardinalDirectionTypes(iDirection))
plotTypes[pPlot] = PlotTypes.PLOT_LAND
## Makes a 3 x 3 filled island
if(rand < 0.50) plotTypes[i]
plotTypes[iN] = PlotTypes.PLOT_OCEAN
else
plotTypes[iS] = PlotTypes.PLOT_OCEAN
#1 Ocean
if(rand < 0.25)
plotTypes[iE] = PlotTypes.PLOT_OCEAN
#2 Ocean
if(rand < 0.10)
plotTypes[iNE] = PlotTypes.PLOT_OCEAN
plotTypes[iE] = PlotTypes.PLOT_OCEAN
#3 Ocean
if(rand < 0.05):
plotTypes[iS] = PlotTypes.PLOT_OCEAN
plotTypes[iN] = PlotTypes.PLOT_OCEAN
plotTypes[iE] = PlotTypes.PLOT_OCEAN
plotTypes[iNE] = PlotTypes.PLOT_OCEAN
#FoodIsland
if(x == 1) plot.setEurope(EUROPE_WEST)
if(x == 1) plotTypes[i] = PlotTypes.PLOT_OCEAN
if(y == 1) plot.setEurope(EUROPE_WEST)
if(y == 1) plotTypes[i] = PlotTypes.PLOT_OCEAN
return plotTypes
def generateTerrain(self):
terrainData = [0]*(self.iWidth*self.iHeight)
for x in range(self.iWidth):
for y in range(self.iHeight):
iI = y*self.iWidth + x
terrain = self.generateTerrainAtPlot(x, y)
terrainData[iI] = terrain
#remove marsh next to desert
for x in range(self.iWidth):
for y in range(self.iHeight):
iIndex = y * self.iWidth + x
for iDirection in range(CardinalDirectionTypes.NUM_CARDINALDIRECTION_TYPES):
pPlot = plotCardinalDirection(x, y, CardinalDirectionTypes(iDirection))
if not pPlot.isNone():
iOtherIndex = pPlot.getY() * self.iWidth + pPlot.getX()
if ((terrainData[iIndex] == self.terrainDesert) and (terrainData[iOtherIndex] == self.terrainMarsh)) or ((terrainData[iIndex] == self.terrainMarsh) and (terrainData[iOtherIndex] == self.terrainDesert)):
terrainData[iIndex] = self.terrainPlains
break
return terrainData