OrionVeteran
Deity
I currently still have the problem of the tech notice showing up when AIs conquer each others cities, so I'm not sure if I added used the new code correctly. Can anyone take a look for me? Thanks.
Try this:
Code:
def onCityAcquired(self, argsList):
'City Acquired'
iPreviousOwner,iNewOwner,pCity,bConquest,bTrade = argsList
# Tech By Conquest Mod
# The Loser
pPlayer1 = gc.getPlayer(iPreviousOwner)
pTeam1 = gc.getTeam(pPlayer1.getTeam())
# The Winner
pPlayer2 = gc.getPlayer(iNewOwner)
pTeam2 = gc.getTeam(pPlayer2.getTeam())
FoundTransferTech = False
if bConquest:
if not pPlayer1.isNone() and not pPlayer1.isBarbarian():
for iTech in range(gc.getNumTechInfos()):
# Does Player1 have a Tech that Player2 does not have?
if pTeam1.isHasTech(iTech):
if not pTeam2.isHasTech(iTech):
iTechToTransfer = iTech
FoundTransferTech = True
break
if FoundTransferTech:
TechDescription = PyInfo.TechnologyInfo(iTech).getDescription()
#CyInterface().addImmediateMessage("Your scientists have discovered the knowledge of " + str(TechDescription), "")
TechByConquestMessage = "You received the knowledge of " + str(TechDescription) + " from scientists of the city of " + str(pCity.getName())
#CyInterface().addImmediateMessage(str(TechByConquestMessage), "")
if gc.getPlayer(CyGame().getActivePlayer()).isHuman():
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,str(TechByConquestMessage),'AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/TerrainFeatures/Forest.dds',ColorTypes(8),0,0,False,False)
pTeam2.setHasTech(iTech,True,iNewOwner,False,False)
# Show tech splash
if (iNewOwner > -1 and not CyInterface().noTechSplash()):
if (gc.getGame().isFinalInitialized() and not gc.getGame().GetWorldBuilderMode()):
if ((not gc.getGame().isNetworkMultiPlayer()) and (iNewOwner == gc.getGame().getActivePlayer())):
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
popupInfo.setData1(iTech)
popupInfo.setText(u"showTechSplash")
popupInfo.addPopup(iNewOwner)
elif gc.getPlayer(CyGame().getActivePlayer()).isHuman():
CyInterface().addImmediateMessage("The vanquished have no useful scientific knowledge.", "")
# End Tech By Conquest Mod
CvUtil.pyPrint('City Acquired Event: %s' %(pCity.getName()))