Civic as requirement for promotion???

Code:
def onUnitBuilt(self, argsList):
		'Unit Completed'
		city = argsList[0]
		unit = argsList[1]
		player = PyPlayer(city.getOwner())

## Hereditary Spy Bonus ##

		pPlayer = gc.getPlayer(pUnit.getOwner())

		iGovernmentCivicOption = CvUtil.findInfoTypeNum(gc.getCivicOptionInfo,gc.getNumCivicOptionInfos(),'CIVICOPTION_GOVERNMENT')
		iHereditary = CvUtil.findInfoTypeNum(gc.getCivicInfo,gc.getNumCivicInfos(),'CIVIC_HEREDITARY_RULE')
		
		iGovernmentCivic = pPlayer.getCivics(iGovernmentCivicOption)
			
		if (iGovernmentCivic == iHereditary):
			if unit.getUnitType() == gc.getInfoTypeForString('UNIT_KNIGHT'):
				unit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MORALE'), True)

			if unit.getUnitType() == gc.getInfoTypeForString('UNIT_SPY'):
				unit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MORALE'), True)
					
## Hereditary Spy Bonus ##

This is how I do it (copied from Thomas' War Mod pretty much). This will give units a free promotion (Morale) under a civic (hereditary rule). The units will, however, retain the promotion after you switch from the civic. If you want the civic to disappear when you switch from the civic you can use this SDK mod:

TLOTags v0.40
 
I don't think that's what he wants. He asked for a promotion requiring a civic, not a promotion free with a civic.

This would be easiest to do most correctly done in SDK. You would add a new XML tag, and modify a CvUnit method, and all done. I might actually do it.
 
@Voyhkah, Good point. I totally agree with you on modding the SDK for that one.

@Monaldinio The working SDK code is in the TLOTags v0.40 which adds Prereq civic tag to the promotioninfos. If (like me) you are a somewhat limited programmer you should just copy the parts you need from the source code Be sure to check the threads as there is a bugfix I made written there for this XMLtag.
 
Back
Top Bottom