Paolo80
Chieftain
- Joined
- Dec 20, 2019
- Messages
- 85
Hi guys,
is it possible adding a python option which a player can activate at the beginning of the scenario? I wrote a routine which adds some units if a player acquire a city (they represent mercenary enemies which change flag). I would want ask the player if he wants to activate "mercenary" option or not. If he activates this option, the below code would run (in CvEventManager.py):
Any ideas?
Thank you all
is it possible adding a python option which a player can activate at the beginning of the scenario? I wrote a routine which adds some units if a player acquire a city (they represent mercenary enemies which change flag). I would want ask the player if he wants to activate "mercenary" option or not. If he activates this option, the below code would run (in CvEventManager.py):
PHP:
def onCityAcquired(self, argsList):
'City Acquired'
iPreviousOwner,iNewOwner,pCity,bConquest,bTrade = argsList
CvUtil.pyPrint('City Acquired Event: %s' %(pCity.getName()))
pPlayer = gc.getPlayer(iNewOwner)
iTurn = CyGame().getGameTurn()
if iNewOwner != 4 and iTurn > 1:
if iPreviousOwner == 4:
for i in range(3):
[INDENT] pPlayer.initUnit(gc.getInfoTypeForString('UNIT_ARCHER'), pCity.getX(), pCity.getY(), UnitAITypes.NO_UNITAI)
pPlayer.initUnit(gc.getInfoTypeForString('UNIT_CATAPULT'), pCity.getX(), pCity.getY(), UnitAITypes.NO_UNITAI)
pPlayer.initUnit(gc.getInfoTypeForString('UNIT_SPEARMAN'), pCity.getX(), pCity.getY(), UnitAITypes.NO_UNITAI)[/INDENT]
else:
for i in range(2):
pPlayer.initUnit(gc.getInfoTypeForString('UNIT_ROME_PRAETORIAN'), pCity.getX(), pCity.getY(), UnitAITypes.NO_UNITAI)
pPlayer.initUnit(gc.getInfoTypeForString('UNIT_SPEARMAN'), pCity.getX(), pCity.getY(), UnitAITypes.NO_UNITAI)
Any ideas?
Thank you all
Last edited: