Bad Player
Deity
OK so after working on this for a while (with help from a few ppl!!!) I have encountered a stumbling block... I figured a new thread might attract more attention and also be a lot less confusing than the old thread which had much preliminary work in it.
The program is designed to save the cities of a map and then load them on the next map. Thus, if you destroy one city on a map, when you load the (possibly expanded size) map in the next scenario, that city is remembered as being destroyed. The same applies if a nation conquers a city. This program remembers things such as what buildings are in the city, how many people, how much culture, etc. I've had to divide it into multiple posts because of size.
This goes inside the ffh2 eventmanager.py file. It saves the data to 2 files. I did this and then tried to load it (by commenting out this part of the program of course) onto a new map. I checked it is trying to load onto grass/plains.
The program is designed to save the cities of a map and then load them on the next map. Thus, if you destroy one city on a map, when you load the (possibly expanded size) map in the next scenario, that city is remembered as being destroyed. The same applies if a nation conquers a city. This program remembers things such as what buildings are in the city, how many people, how much culture, etc. I've had to divide it into multiple posts because of size.
This goes inside the ffh2 eventmanager.py file. It saves the data to 2 files. I did this and then tried to load it (by commenting out this part of the program of course) onto a new map. I checked it is trying to load onto grass/plains.
Spoiler :
Code:
def onGameEnd(self, argsList):
'Called at the End of the game'
print("Game is ending")
ToSurvivingLeadersFile = open('D:\SurvivingLeadersFile', 'w')
SurvivingLeadersList = []
for iPlayer in range(gc.getMAX_PLAYERS()):
if gc.getPlayer(iPlayer).isAlive():
pLoopPlayer = gc.getPlayer(iPlayer)
iPlayerNum = iPlayer
iLeader = pLoopPlayer.getLeaderType()
iCiv = pLoopPlayer.getCivilizationType()
iTeam = pLoopPlayer.getTeam()
SurvivingLeadersList.append( [iPlayerNum, iLeader, iCiv, iTeam] )
pickle.dump(SurvivingLeadersList, ToSurvivingLeadersFile)
ToSurvivingLeadersFile.close()
ToFirstCityMapFile = open('D:\FirstCityMapFile', 'w')
CityInfoList = []
#this line calls gc.getMAX_PLAYERS() which is an SDK function.
#iPlayerNum should be the same for each civ in both data files. Here's to hoping!
for iPlayer in range(gc.getMAX_PLAYERS()):
apCityList = PyPlayer(iPlayer).getCityList()
for pCity in apCityList:
iPlayerNum = iPlayer
CityInfoList.append(iPlayerNum)
eCityName = pCity.getName()
#What is the correct prefix for CityName. I used 'e' but that's probably wrong.
CityInfoList.append(eCityName)
iX = pCity.getX()
CityInfoList.append(iX)
iY = pCity.getY()
CityInfoList.append(iY)
iPop = pCity.getPopulation()
CityInfoList.append(iPop)
iCulture = pCity.getCulture()
CityInfoList.append(iCulture)
iBuildingNumValue = 0
# #BTS only while loop.
# for iBuildingValue in range(gc.getNumBuildingInfos()):
# CityInfoList.append(pCity.getNumRealBuilding(iBuildingNumValue))
# CityInfoList.append('endcity')
pickle.dump(CityInfoList, ToFirstCityMapFile)
ToFirstCityMapFile.close()
return