omegaflames
Warlord
- Joined
- Sep 21, 2012
- Messages
- 181
I'm doing a bit of modding of the ffh2 mod and I'm having trouble getting a plot change to happen. What I'm trying to do is if a plot has a TERRAIN_PEAK (PLOT_PEAK?) then I want to have a unit be able to change it to TERRAIN_SNOW and TERRAIN_HILL (PLOT_HILLS?). I can get the code to recognize the plot is a peak (or at least I'm 99.9% sure it's recognizing the plot is a peak) but it wont change the peak into the snow/hill. I'm sure some part of this is probably written wrong as I've tweaked this code 10-15 times now trying to get it work. The full code is:
Code:
def reqScorch(caster):
pPlot = caster.plot()
pPlayer = gc.getPlayer(caster.getOwner())
if (pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_PLAINS') or pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_FIELDS_OF_PERDITION')):
if pPlayer.isHuman() == False:
if caster.getOwner() == pPlot.getOwner():
return False
return True
if (pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_GRASS') or pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_BROKEN_LANDS')):
if pPlayer.isHuman() == False:
if caster.getOwner() == pPlot.getOwner():
return False
return True
[COLOR="Red"] if (pPlot.getPlotType() == 0 and pPlot.getFeatureType() != gc.getInfoTypeForString('FEATURE_VOLCANO')):
if pPlayer.isHuman() == False:
if caster.getOwner() == pPlot.getOwner():
return False
return True[/COLOR]
if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_TUNDRA'):
if pPlayer.isHuman() == False:
if caster.getOwner() == pPlot.getOwner():
return False
return True
if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_MARSH'):
if pPlayer.isHuman() == False:
if caster.getOwner() == pPlot.getOwner():
return False
return True
if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_SNOW'):
if pPlayer.isHuman() == False:
if caster.getOwner() != pPlot.getOwner():
return False
if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_DOVIELLO'):
return False
if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_ILLIANS'):
return False
return True
return False
def spellScorch(caster):
pPlot = caster.plot()
if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_PLAINS'):
pPlot.setTerrainType(gc.getInfoTypeForString('TERRAIN_DESERT'),True,True)
if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_GRASS'):
pPlot.setTerrainType(gc.getInfoTypeForString('TERRAIN_PLAINS'),True,True)
if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_BROKEN_LANDS'):
pPlot.setTerrainType(gc.getInfoTypeForString('TERRAIN_FIELDS_OF_PERDITION'),True,True)
[COLOR="Red"] if pPlot.getPlotType() == 0:
pPlot.setTerrainType(gc.getInfoTypeForString('TERRAIN_SNOW'),True,True)
pPlot.setPlotType(1,True,True)[/COLOR]
if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_FIELDS_OF_PERDITION'):
pPlot.setTerrainType(gc.getInfoTypeForString('TERRAIN_BURNING_SANDS'),True,True)
if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_SNOW'):
pPlot.setTerrainType(gc.getInfoTypeForString('TERRAIN_TUNDRA'),True,True)
if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_TUNDRA'):
pPlot.setTerrainType(gc.getInfoTypeForString('TERRAIN_PLAINS'),True,True)
if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_MARSH'):
pPlot.setTerrainType(gc.getInfoTypeForString('TERRAIN_GRASS'),True,True)
if pPlot.isOwned():
cf.startWar(caster.getOwner(), pPlot.getOwner(), WarPlanTypes.WARPLAN_TOTAL)