cfkane
Emperor
- Joined
- Feb 7, 2006
- Messages
- 1,196
I just can't get this python function to work. It's supposed to spawn a barbarian world unit, a dragon in this case.
I'm getting the error message:
Argument error: python argument types in
CyGlobalContext.getPlayer(CyGlobalContext, CyPlayer)
did not match C++ signature:
getPlayer(class CyGlobalContext {lvalue}, int)
So, what's my next step?
Code:
def applyDragon(argsList):
iEvent = argsList[0]
kTriggeredData = argsList[1]
iPlayer = gc.getPlayer(kTriggeredData.ePlayer)
pPlayer = gc.getPlayer(iPlayer)
listPlots = []
map = gc.getMap()
for i in range(map.numPlots()):
plot = map.plotByIndex(i)
if (plot.getOwner() == -1 and not plot.isWater() and not plot.isImpassable() and plot.area().getCitiesPerPlayer(kTriggeredData.ePlayer) > 0 and plot.isAdjacentPlayer(kTriggeredData.ePlayer, true)):
listPlots.append(i)
if 0 == len(listPlots):
return
newUnit = iPlayer.initUnit(gc.getInfoTypeForString('UNIT_DRAGON'), UnitAITypes.UNITAI_PILLAGE, DirectionTypes.DIRECTION_SOUTH)
barbPlayer = gc.getPlayer(gc.getBARBARIAN_PLAYER())
for i in range(iNumUnits):
barbPlayer.initUnit(iUnitType, plot.getX(), plot.getY(), UnitAITypes.UNITAI_ATTACK_CITY_LEMMING, DirectionTypes.DIRECTION_SOUTH)
I'm getting the error message:
Argument error: python argument types in
CyGlobalContext.getPlayer(CyGlobalContext, CyPlayer)
did not match C++ signature:
getPlayer(class CyGlobalContext {lvalue}, int)
So, what's my next step?