Psychic_Llamas
Wizard in the Making
Thanks Zebra
i knew it would be blatantly obvious
i knew it would be blatantly obvious
I would think so.I take it that an SDK change would be required to make it multiplayer compatable?
Only if you could make a promotion that did what you want then we give that promotion when they enter the city, and take it away when they leave.Here's another idea: assuming there is a new building class called Radar Station in a city, would it be possible to attach a script that would give air units based in that city a bonus to intercept?
Yes this is very possible, I will get a snippet in the next week.Adding a building to a city after completion of a project.
Only if you could make a promotion that did what you want then we give that promotion when they enter the city, and take it away when they leave.
Ok, I'll see if I find time in the near future. RL is givin me a headache.
<PythonCallback>doMyEvent</PythonCallback>
def doMyEvent(argsList):
iEvent = argsList[0]
kTriggeredData = argsList[1]
## --------- ## MAKE CHANGES HERE ## --------- ##
##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
szEnemyPlayer = "CIVILIZATION_CHINA" # The type tag of the enemy civilization, it will declare war on it's team
resetDiplomacy = True # Resets pTeam's diplomacy with szEnemyPlayer's Team when True, or it leaves the diplomacy the same when False
warPlan = WarPlanTypes.NO_WARPLAN # Used for the AI, it tells the AI what type of war to wage
# Possible entries are:
# WarPlanTypes.NO_WARPLAN The AI decides
# WarPlanTypes.WARPLAN_ATTACKED_RECENT,
# WarPlanTypes.WARPLAN_ATTACKED,
# WarPlanTypes.WARPLAN_PREPARING_LIMITED,
# WarPlanTypes.WARPLAN_PREPARING_TOTAL,
# WarPlanTypes.WARPLAN_LIMITED,
# WarPlanTypes.WARPLAN_TOTAL,
# WarPlanTypes.WARPLAN_DOGPILE,
warn = True # Give a message if the civilization is not found, put False if you want no message
## --------- ## DO NOT CHANGE ANYTHING PAST HERE ## --------- ##
##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
## This looks fo the civilization
iEnemyTeam = -1
for iPlayer in range(gc.getMAX_PLAYERS()):
player = gc.getPlayer(iPlayer)
iType = pPlayergetCivilizationType()
pType = gc.getCivilizationInfo(iType)
sType = pType.getType()
if sType == szEnemyPlayer:
iEnemyTeam = player.getTeam()
break
## If the civilization was not found give the warning
if iEnemyTeam == -1:
if warn:
CyInterface().addImmediateMessage("ERROR: %s was not found, will not declare war!" % szEnemyPlayer, "")
## Otherwise declare war
else:
pTeam.declareWar(iEnemyTeam, resetDiplomacy, warPlan)
return 1
def onProjectBuilt(self, argsList):
'Project Completed'
pCity, iProjectType = argsList
game = gc.getGame()
if ((not gc.getGame().isNetworkMultiPlayer()) and (pCity.getOwner() == gc.getGame().getActivePlayer())):
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
popupInfo.setData1(iProjectType)
popupInfo.setData2(pCity.getID())
popupInfo.setData3(2)
popupInfo.setText(u"showWonderMovie")
popupInfo.addPopup(pCity.getOwner())
## ------------- ## CHANGE HERE ## ------------- ##
sProject = "PROJECT_SDI" # The type tag of the project that gives the building
sBuilding = "BUILDING_BOMB_SHELTER" # The type tag of the building to be given
## ------------- ## DO NOT CHANGE ## ------------- ##
if iProjectType == gc.getInfoTypeForString(sProject):
pCity.setNumRealBuilding(gc.getInfoTypeForString(sBuilding), 1)
def onProjectBuilt(self, argsList):
'Project Completed'
pCity, iProjectType = argsList
## ------------- ## CHANGE HERE ## ------------- ##
sProject = "PROJECT_SDI" # The type tag of the project that gives the building
sBuilding = "BUILDING_BOMB_SHELTER" # The type tag of the building to be given
## ------------- ## DO NOT CHANGE ## ------------- ##
if iProjectType == gc.getInfoTypeForString(sProject):
pCity.setNumRealBuilding(gc.getInfoTypeForString(sBuilding), 1)
def onProjectBuilt(self, argsList):
'Project Completed'
pCity, iProjectType = argsList
game = gc.getGame()
if ((not gc.getGame().isNetworkMultiPlayer()) and (pCity.getOwner() == gc.getGame().getActivePlayer())):
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
popupInfo.setData1(iProjectType)
popupInfo.setData2(pCity.getID())
popupInfo.setData3(2)
popupInfo.setText(u"showWonderMovie")
popupInfo.addPopup(pCity.getOwner())
def onProjectBuilt(self, argsList):
'Project Completed'
pCity, iProjectType = argsList
game = gc.getGame()
if ((not gc.getGame().isNetworkMultiPlayer()) and (pCity.getOwner() == gc.getGame().getActivePlayer())):
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
popupInfo.setData1(iProjectType)
popupInfo.setData2(pCity.getID())
popupInfo.setData3(2)
popupInfo.setText(u"showWonderMovie")
popupInfo.addPopup(pCity.getOwner())
## ------------- ## CHANGE HERE ## ------------- ##
sProject = "PROJECT_ISS" # The type tag of the project that gives the building
sBuilding = "BUILDING_ISS" # The type tag of the building to be given
## ------------- ## DO NOT CHANGE ## ------------- ##
if iProjectType == gc.getInfoTypeForString(sProject):
pCity.setNumRealBuilding(gc.getInfoTypeForString(sBuilding), 1)