Hi guys, I just found this rather tasty bit of python for changing a unit production speed through civics: (in this case execs and missionaries)
Is it Possible to change this code so that it does the same thing for units of a specific combat type like COMBAT_MELEE or COMBAT_GUN?
If not I can just reprogram the list to do all the units of this COMBAT type, I was just wondering if I could do it in a more general 'quick way' also so if I add more units they would be auto included.
Spoiler :
Code:
## Parlimentary Civic Start ##
iGovernmentCivicOption = CvUtil.findInfoTypeNum(gc.getCivicOptionInfo,gc.getNumCivicOptionInfos(),'CIVICOPTION_GOVERNMENT')
iParliment = CvUtil.findInfoTypeNum(gc.getCivicInfo,gc.getNumCivicInfos(),'CIVIC_PARLIMENTARY')
pUnitInfo = gc.getUnitInfo(iUnit)
pPlayer = gc.getPlayer(iPlayer)
iExecutive1 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_EXECUTIVE_1')
iExecutive2 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_EXECUTIVE_2')
iExecutive3 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_EXECUTIVE_3')
iExecutive4 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_EXECUTIVE_4')
iExecutive5 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_EXECUTIVE_5')
iExecutive6 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_EXECUTIVE_6')
iExecutive7 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_EXECUTIVE_7')
iMissionary1 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_JEWISH_MISSIONARY')
iMissionary2 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_CHRISTIAN_MISSIONARY')
iMissionary3 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_HINDU_MISSIONARY')
iMissionary4 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_BUDDHIST_MISSIONARY')
iMissionary5 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_CONFUCIAN_MISSIONARY')
iMissionary6 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_TAOIST_MISSIONARY')
iMissionary7 = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_ISLAMIC_MISSIONARY')
aiDiplomatList = [iExecutive1, iExecutive2, iExecutive3, iExecutive4, iExecutive5, iExecutive6, iExecutive7, iMissionary1, iMissionary2, iMissionary3, iMissionary4, iMissionary5, iMissionary6, iMissionary7]
iGovernmentCivic = pPlayer.getCivics(iGovernmentCivicOption)
if (iGovernmentCivic == iParliment):
if (iUnit in aiDiplomatList):
return 80 # 80% of normal cost
## Parlimentary Civic End ##
Is it Possible to change this code so that it does the same thing for units of a specific combat type like COMBAT_MELEE or COMBAT_GUN?
If not I can just reprogram the list to do all the units of this COMBAT type, I was just wondering if I could do it in a more general 'quick way' also so if I add more units they would be auto included.