j_mie6
Deity
finished the second event
here's all my work for today
:
and
you see any problems there?
I am going to have to do some editing of all the mod's events years and coords and indeed fill in the values on this events. When they are tested I will start on player city founding restriction


Code:
##AI Rome City flip/Army##
iRomeYear = 0 #Change!
iRomeYear2 = 0 #Change!
tByzantium = (46, 23) #Change!
romanMessage = "TXT_KEY_MODEVENTS_ROMEQUEST_MESSAGE"
pRome = pointer(eRome)
iNumUnits = 1
x = 0
def eventRomeQuest():
if not isHuman("Rome") and pRome.isAlive():
if isPlotCity(tByzantium) and isDate(iRomeYear):
addMessage(romanMessage, (getPlotCity(tByzantium).getName(),), eWhite) #Blue/Cyan?
for pTile in getCityRadiusTiles(tByzantium):
spawnUnits(eRome, ePraetorian, pTile, iNumUnits)
x += 1
spawnUnits(eRome, getIndex("Unit", "Quintrireme"), getRandomCoords(getCityRadiusTiles(tByzantium, True)), Round((x * iNumUnits)/3, True))
elif isPlotCity(tByzantium) and isDate(iRomeYear2) and not isPlotOwner(tByzantium, eRome):
flipCity(eRome, getPlotCity(tByzantium))
##ERE Reinforce##
iNumCities = 4
iReinforceDate = 0 #Change!
tERETop = (0, 0) #Change!
tEREBottom = (0, 0) #Change!
reinforceMessage = "TXT_KEY_MODEVENTS_REINFORCE_MESSAGE"
pByzantium = instance(eByzantium)
iNumUnits = 3
def eventReinforce():
if getNumPlayerCities(eByzantium) < iNumCities and isDate(iReinforceDate) and pByzantium.isAlive():
for pCity in findAreaCities(tEREBottom, tERETop):
if not pCity.isCapital():
flipCity(eByzantium, pCity)
spawnCityGarrison(pByzantium, pCity, iNumUnits)
addMessage(reinforceMessage, (), eWhite) #Blue/Cyan?
and
Code:
def Round(x, bUp):
"""
Rounds either up or down
"""
if type(x) == type(1):
x = float(x)
iRoundBase = x - round(x)
if iRoundBase < 0.5 and bUp:
return int(round(x) + 1)
elif iRoundBase >= 0.5 and not bUp:
return int(round(x) - 1)
else:
return int(round(x))
def getPlotCity(tCoords):
return getPlot(tCoords).getPlotCity()
def getCityRadiusTiles(pCity, bNaval = False):
lPlots = list()
if type(pCity) == type((0, 0)):
pCity = getPlotCity(pCity)
for iIndex in xrange(19):
pPlot = getPlot(getCoords(pCity.getCityIndexPlot(iIndex)))
if not bNaval:
if isSpawnValid(pPlot) == False or pPlot.isCity(): continue
lPlots.append(pPlot)
else:
if not pPlot.isWater(): continue
lPlots.append(pPlot)
return lPlots
def flipCity(ePlayer, pCity, bConquored = False, bTrade = False):
instance(ePlayer).get(CyPlayer).acquireCity(pCity, bConquored, bTrade)
you see any problems there?
I am going to have to do some editing of all the mod's events years and coords and indeed fill in the values on this events. When they are tested I will start on player city founding restriction
