mycophobia
Chieftain
- Joined
- Oct 14, 2017
- Messages
- 32
I dunno if this is part of BUG or if it's been done before or anything but it took me a long time to figure out how to do so I reckon I'll share it!
These modifications will make it so a pop-up will appear whenever a city grows a size, allowing you to zoom to the city screen for that city or dismiss the pop-up. This will only work if the city governor is OFF, so be sure to uncheck it (or just unassign and reassign a worked tile) when you build a city to turn it off and get the popup when it grows.
In either a new mod containing copies of the following two files and their directories, or an existing mod with these files:
Stick this function somewhere in Assets/Python/Entrypoints/CvScreensInterface.py:
And then in Assets/Python/CvEventManager.py, find "def onCityGrowth(self, argsList):", and paste this after pCity and iPlayer are declared:
These modifications will make it so a pop-up will appear whenever a city grows a size, allowing you to zoom to the city screen for that city or dismiss the pop-up. This will only work if the city governor is OFF, so be sure to uncheck it (or just unassign and reassign a worked tile) when you build a city to turn it off and get the popup when it grows.
In either a new mod containing copies of the following two files and their directories, or an existing mod with these files:
Stick this function somewhere in Assets/Python/Entrypoints/CvScreensInterface.py:
Code:
def doCityScreen(args):
if args[0] == 1:
return
else:
CyInterface().selectCity(CyGlobalContext().getActivePlayer().getCity(args[1]), False)
And then in Assets/Python/CvEventManager.py, find "def onCityGrowth(self, argsList):", and paste this after pCity and iPlayer are declared:
Code:
if pCity.getOwner() == CyGame().getActivePlayer() and not pCity.isCitizensAutomated():
popupInfo=CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON)
popupInfo.setText(("%s has grown")%pCity.getName())
popupInfo.setData1(pCity.getID())
popupInfo.setOnClickedPythonCallback("doCityScreen")
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_EXAMINE_CITY", ()), "")
popupInfo.addPythonButton("OK", "")
popupInfo.addPopup(iPlayer)
Last edited: