Alrik2002
Warlord
Hi,
I would like to allow gunships to cross water and peaks. That works fine but I want to add, that they have to end their turn on "regular" terrain. I know this is python, I believe I have to add it in the eventmanager. Since I´ve only merged some things in python until now, I tried to copy an paste some things of other mods. When I tried to start a new game it didn´t show any interface, so that I couldn´t test it. Please be so kind an help me to develop a code which works. Here my first try:
thx
I would like to allow gunships to cross water and peaks. That works fine but I want to add, that they have to end their turn on "regular" terrain. I know this is python, I believe I have to add it in the eventmanager. Since I´ve only merged some things in python until now, I tried to copy an paste some things of other mods. When I tried to start a new game it didn´t show any interface, so that I couldn´t test it. Please be so kind an help me to develop a code which works. Here my first try:
Code:
def onEndPlayerTurn(self, argsList):
'Called at the end of a players turn'
iGameTurn, iPlayer = argsList
## Hubschrauber Crash Start ##
pPlayer = gc.getPlayer(iPlayer)
pUnit = pPlayer.getUnit(i)
if pUnit.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_GUNSHIP"):
iX = pUnit.getX()
iY = pUnitX.getY()
pPlot = CyMap().plot(iX(),iY())
if pPlot.getTerrainType() == gc.getInfoTypeForString("TERRAIN_OCEAN") or pPlot.getTerrainType() == gc.getInfoTypeForString("TERRAIN_COAST") or pPlot.getTerrainType() == gc.getInfoTypeForString("TERRAIN_PEAK"):
strUnitButton = gc.getUnitInfo(iUnitType).getButton ()
pUnit.kill(False,-1)
CyInterface().addMessage(pPlayer.getID(),False,15,CyTranslator().getText("TXT_ABSTURZ",()),'',0,strUnitButton,ColorTypes(gc.getInfoTypeForString("COLOR_RED")), iX, iY, True,True
## Hubschrauber Crash End ##
thx