i did some merge.
btw, i've merged the "warrior of god" with "militia mod" (its prereqs a civic and an improvements instead).![]()
I made a thread about this, but I figured you would probably notice this first:
Is there someway to use python to give random promotions?
def onUnitBuilt(self, argsList):
'Unit Completed'
city = argsList[0]
unit = argsList[1]
player = PyPlayer(city.getOwner())
iOwner = city.getOwner()
# Star Signs by Smeagolheart Start
pCity = argsList[0]
pUnit = argsList[1]
pPlayer = gc.getPlayer(pUnit.getOwner())
iUnitType = pUnit.getUnitType()
promSign1 = gc.getInfoTypeForString("PROMOTION_AQUARIUS")
promSign2 = gc.getInfoTypeForString("PROMOTION_ARIES")
promSign3 = gc.getInfoTypeForString("PROMOTION_CANCER")
promSign4 = gc.getInfoTypeForString("PROMOTION_CAPRICORN")
promSign5 = gc.getInfoTypeForString("PROMOTION_GEMINI")
promSign6 = gc.getInfoTypeForString("PROMOTION_LEO")
promSign7 = gc.getInfoTypeForString("PROMOTION_LIBRA")
promSign8 = gc.getInfoTypeForString("PROMOTION_PISCES")
promSign9 = gc.getInfoTypeForString("PROMOTION_SAGITTARIUS")
promSign10 = gc.getInfoTypeForString("PROMOTION_SCORPIO")
promSign11 = gc.getInfoTypeForString("PROMOTION_TAURUS")
promSign12 = gc.getInfoTypeForString("PROMOTION_VIRGO")
chance = CyGame().getSorenRandNum(100, "Random to get a Sign")
chance2 = CyGame().getSorenRandNum(12, "Random Sign Picker")
signTrue = false
if chance == 7: ### Lucky 7 Lol -> so 1% chance of getting a "sign promotion" ###
signTrue = true
if chance2 == 0:
pUnit.setHasPromotion(promSign1, true)
szIcon = "Art/Interface/Buttons/promotions/AQUARIUS.dds"
elif chance2 == 1:
pUnit.setHasPromotion(promSign2, true)
szIcon = "Art/Interface/Buttons/promotions/ARIES.dds"
elif chance2 == 2:
pUnit.setHasPromotion(promSign3, true)
szIcon = "Art/Interface/Buttons/promotions/CANCER.dds"
elif chance2 == 3:
pUnit.setHasPromotion(promSign4, true)
szIcon = "Art/Interface/Buttons/promotions/CAPRICORN.dds"
elif chance2 == 4:
pUnit.setHasPromotion(promSign5, true)
szIcon = "Art/Interface/Buttons/promotions/GEMINI.dds"
elif chance2 == 5:
pUnit.setHasPromotion(promSign6, true)
szIcon = "Art/Interface/Buttons/promotions/LEO.dds"
elif chance2 == 6:
pUnit.setHasPromotion(promSign7, true)
szIcon = "Art/Interface/Buttons/promotions/LIBRA.dds"
elif chance2 == 7:
pUnit.setHasPromotion(promSign8, true)
szIcon = "Art/Interface/Buttons/promotions/PISCES.dds"
elif chance2 == 8:
pUnit.setHasPromotion(promSign9, true)
szIcon = "Art/Interface/Buttons/promotions/SAGITTARIUS.dds"
elif chance2 == 9:
pUnit.setHasPromotion(promSign10, true)
szIcon = "Art/Interface/Buttons/promotions/SCORPIO.dds"
elif chance2 == 10:
pUnit.setHasPromotion(promSign11, true)
szIcon = "Art/Interface/Buttons/promotions/TAURUS.dds"
elif chance2 == 11:
pUnit.setHasPromotion(promSign12, true)
szIcon = "Art/Interface/Buttons/promotions/VIRGO.dds"
pPID = pPlayer.getID()
iXa = pUnit.getX()
iYa = pUnit.getY()
if ( signTrue == true ):
strMessage = "The stars have favored a unit produced in %s!" %(pCity.getName())
CyInterface().addMessage(pPID, false, 15, strMessage, "", 0, 'art/Interface/Buttons/promotions/stars.dds', ColorTypes(44), iXa, iYa, True,True)
#Uncomment the next line to see the promotion icon instead of the generic stars icon
#CyInterface().addMessage(pPID, false, 15, strMessage, "", 0, szIcon, ColorTypes(44), iXa, iYa, True,True)
# Star Signs by Smeagolheart End
###Militia Start ###
BugUtil.debug("Milita mod.")
if iImprovement == self.improvementForMilitia:
BugUtil.debug("Milita mod - Farm built.")
pPlot = CyMap().plot(iX, iY)
iPlayer = pPlot.getOwner()
pPlayer = gc.getPlayer(iPlayer)
[B]if (pPlayer.isAlive() and pPlayer.isCivic(self.civicForMilitia)):[/B]
iEra = pPlayer.getCurrentEra ()
#~ BugUtil.debug("Milita mod - Farm built, Civic is Caste System, Era is %s.", iEra)
if iEra in self.aiEraToMilitiaUnit:
pNewUnit = pPlayer.initUnit( self.aiEraToMilitiaUnit[iEra], iX, iY, UnitAITypes.UNITAI_RESERVE, DirectionTypes.NO_DIRECTION )
CyInterface().addMessage(iPlayer,False,15,localText.getText("TXT_RECRUITED",()),'',0,'Art/Interface/Buttons/Civics/Serfdom.dds',ColorTypes(44), iX, iY, True,True)
###Militia End###
if (pPlayer.isAlive() and pPlayer.isCivic(self.civicForMilitia)):
if (iPlayer> -1 and pPlayer.isAlive() and pPlayer.isCivic(self.civicForMilitia)):
if (gc.getGame().getGameTurnYear() == gc.getDefineINT("START_YEAR") and not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_ADVANCED_START)):
Does the mod only use advanced start?
In general, you could just delete this line:
PHP:if (gc.getGame().getGameTurnYear() == gc.getDefineINT("START_YEAR") and not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_ADVANCED_START)):
and move every following line of the modded code one backspace back (that might sound stupid, but spaces, tabs, etc. matter in python and moving them back is important, will not work else).