Hi bug team,
ill ask something that is probably been answered here quite a lot.
i have some events i got, in eventmanager file , im currently using platyping code, that has eventmanager,
but i decided to go back to bug based (from kmod).
im not sure how or where to put the code and how to call it,
example - the code for East India Company Start building i added in :
def onEndPlayerTurn(self, argsList):
'Called at the end of a players turn'
iGameTurn, iPlayer = argsList
but where do i out this code then? if bug does not use eventmanager, but thebugevenmanager instead of cvcustommanager.
i dont know how to call or write new python , is there a template i can use for such codes?
cause i have quite a lot of these.
i hope someone will answer
thanks in advance.
ill ask something that is probably been answered here quite a lot.
i have some events i got, in eventmanager file , im currently using platyping code, that has eventmanager,
but i decided to go back to bug based (from kmod).
im not sure how or where to put the code and how to call it,
example - the code for East India Company Start building i added in :
def onEndPlayerTurn(self, argsList):
'Called at the end of a players turn'
iGameTurn, iPlayer = argsList
## East India Company Start ##
pPlayer = gc.getPlayer(iPlayer)
if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_EAST_INDIA_COMPANY")) == 1:
if iGameTurn % 8 == 0:
(loopCity, iter) = pPlayer.firstCity(false)
while(loopCity):
if loopCity.getAddedFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_GREAT_MERCHANT")) > 0:
pNewUnit = pPlayer.initUnit(gc.getInfoTypeForString("UNIT_CARAVAN"), loopCity.getX(), loopCity.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)
(loopCity, iter) = pPlayer.nextCity(iter, false)
## East India Company End ##
i read that i gotta load it vis the init.xml file in the bug folder, pPlayer = gc.getPlayer(iPlayer)
if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_EAST_INDIA_COMPANY")) == 1:
if iGameTurn % 8 == 0:
(loopCity, iter) = pPlayer.firstCity(false)
while(loopCity):
if loopCity.getAddedFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_GREAT_MERCHANT")) > 0:
pNewUnit = pPlayer.initUnit(gc.getInfoTypeForString("UNIT_CARAVAN"), loopCity.getX(), loopCity.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)
(loopCity, iter) = pPlayer.nextCity(iter, false)
## East India Company End ##
but where do i out this code then? if bug does not use eventmanager, but thebugevenmanager instead of cvcustommanager.
i dont know how to call or write new python , is there a template i can use for such codes?
cause i have quite a lot of these.
i hope someone will answer
thanks in advance.