The Great Apple said:This shouldn't be too hard to do should it?
I'm going to go have a go! (Although the AI won't be able to handle it, that much I can tell you already)
I won't be able to test it myself (not at home), but I can post up the code, and one of you guys can do it for me!
EDIT: Ok! Done!
The way I've done it is quite crude, but it was the simplest and most effecive I could think of at this time of night. It SHOULD all work. I read it through 3 times for errors.
Basically, if you shove this into the same folder as the main mod, it will give a "General" promotion to any unit on the same square as the general. Default for the promotion gives +25% combat, and uses the Combat I icon.
If you like, I can make a similar script to add a small amount to units around the general.
def onBeginPlayerTurn(self, argsList):
'Called at the beginning of a players turn'
iGameTurn, iPlayer = argsList
player = gc.getActivePlayer()
if (player.isSpecialist(gc.getInfoTypeForString("SPECIALIST_GREAT_GENERAL "))):
for i in range(player.getNumCities()):
player.getCity(i).getFreeExperience(2)
else:
for i in range(player.getNumCities()):
player.getCity(i).getFreeExperience(0)
getMilitaryProductionModifier()
getDefenseModifier()
getCityDefensePercent()
## in onUnitBuilt ##
if gc.getUnitInfo(iUnit).getSpecialUnitType == -1: #Make sure this unit can use exp
GeneralExperience = pCity.getSpecialistCount(gc.getInfoTypeForString("SPECIALIST_GREAT_GENERAL"))
gc.getUnitInfo(iUnit).changeExperience(GeneralExperience, 100) #The second number might work with -1 instead. I don't feel like testing this.
Draax said:Does the AI build military academies? I played with this mod and I love the idea, but I conquered France and none of the cities had a MA. And I know Napoleon had a few GGs.
Has anyone else conquered a city and found a MA in it? If not I think I'm going to drop the mod since it's such a hugely powerful building.
class CvCustomEventManager(CvEventManager.CvEventManager):
def __init__(self):
# initialize base class
self.parent = CvEventManager.CvEventManager
self.parent.__init__(self)
def onBeginPlayerTurn(self, argsList):
'Called at the beginning of a players turn'
iGameTurn, iPlayer = argsList
player = gc.getActivePlayer()
if (player.isSpecialistValid(gc.getInfoTypeForString("SPECIALIST_SOLDIER"))):
for i in range(player.getNumCities()):
player.getCity(i).getCityDefensePercent(5)
else:
for i in range(player.getNumCities()):
player.getCity(i).getCityDefensePercent(0)
player = gc.getActivePlayer()
if (player.isSpecialistValid(gc.getInfoTypeForString("SPECIALIST_SOLDIER"))):
for i in range(player.getNumCities()):
player.getCity(i).getMilitaryProductionModifier(5)
else:
for i in range(player.getNumCities()):
player.getCity(i).getMilitaryProductionModifier(0)
Without actually having tested this (away from home - don't have game), I'm pretty certain it won't work.Aussie_Lurker said:Code:class CvCustomEventManager(CvEventManager.CvEventManager): def __init__(self): # initialize base class self.parent = CvEventManager.CvEventManager self.parent.__init__(self) def onBeginPlayerTurn(self, argsList): 'Called at the beginning of a players turn' iGameTurn, iPlayer = argsList player = gc.getActivePlayer() if (player.isSpecialistValid(gc.getInfoTypeForString("SPECIALIST_SOLDIER"))): for i in range(player.getNumCities()): player.getCity(i).getCityDefensePercent(5) else: for i in range(player.getNumCities()): player.getCity(i).getCityDefensePercent(0) player = gc.getActivePlayer() if (player.isSpecialistValid(gc.getInfoTypeForString("SPECIALIST_SOLDIER"))): for i in range(player.getNumCities()): player.getCity(i).getMilitaryProductionModifier(5) else: for i in range(player.getNumCities()): player.getCity(i).getMilitaryProductionModifier(0)