Civciv5
Grand Emperor
Hello again. I'm trying to use platyping's python component "Leaning Tower" in my mod. However, there is no Leaning Tower in my mod. I would like to use it for another wonder "Jetavanaramaya". So I tried replacing the python code.
This is part 1 of the original.
This is what I tried replacing it with.
And this is part 2 of the original code.
And I tried to replace it with this.
But apparently that doesn't work. Any idea how I could fix this?
This is part 1 of the original.
Code:
## Leaning Tower Start ##
pPlayer = gc.getPlayer(iPlayer)
if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_LEANING_TOWER")) == 1:
sScript = pPlayer.getScriptData()
for i in xrange(sScript.count("Pisa")):
iCityIDLength = int(sScript[sScript.find("Pisa") +4])
iCityID = int(sScript[sScript.find("Pisa") +5: sScript.find("Pisa") +5 + iCityIDLength])
pPlayer.getCity(iCityID).changeGreatPeopleProgress(pPlayer.greatPeopleThreshold(false)/4)
pPlayer.setScriptData(pPlayer.getScriptData().replace("Pisa", "", 1))
pPlayer.setScriptData(pPlayer.getScriptData().replace(str(iCityIDLength), "", 1))
pPlayer.setScriptData(pPlayer.getScriptData().replace(str(iCityID), "", 1))
## Leaning Tower End ##
Code:
## Leaning Tower Start ##
pPlayer = gc.getPlayer(iPlayer)
if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_JETAVANARAMAYA")) == 1:
sScript = pPlayer.getScriptData()
for i in xrange(sScript.count("Jetavanaramaya")):
iCityIDLength = int(sScript[sScript.find("Jetavanaramaya") +4])
iCityID = int(sScript[sScript.find("Jetavanaramaya") +5: sScript.find("Jetavanaramaya") +5 + iCityIDLength])
pPlayer.getCity(iCityID).changeGreatPeopleProgress(pPlayer.greatPeopleThreshold(false)/2)
pPlayer.setScriptData(pPlayer.getScriptData().replace("Jetavanaramaya", "", 1))
pPlayer.setScriptData(pPlayer.getScriptData().replace(str(iCityIDLength), "", 1))
pPlayer.setScriptData(pPlayer.getScriptData().replace(str(iCityID), "", 1))
## Leaning Tower End ##
Code:
## Leaning Tower Start ##
pPlayer = gc.getPlayer(iPlayer)
if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_LEANING_TOWER")) == 1:
if pUnit.getUnitType() != gc.getInfoTypeForString("UNIT_GREAT_GENERAL"):
iGreatPeopleThresholdIncrease = gc.getDefineINT("GREAT_PEOPLE_THRESHOLD") * gc.getGameSpeedInfo(CyGame().getGameSpeedType()).getGreatPeoplePercent() /100
if pCity.getGreatPeopleProgress() >= pPlayer.greatPeopleThreshold(True) - iGreatPeopleThresholdIncrease:
pPlayer.setScriptData(pPlayer.getScriptData() + "Pisa" + str(len(str(pCity.getID()))) + str(pCity.getID()))
## Leaning Tower End ##
Code:
## Leaning Tower Start ##
pPlayer = gc.getPlayer(iPlayer)
if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_LEANING_TOWER")) == 1:
if pUnit.getUnitType() != gc.getInfoTypeForString("UNIT_GREAT_GENERAL"):
iGreatPeopleThresholdIncrease = gc.getDefineINT("GREAT_PEOPLE_THRESHOLD") * gc.getGameSpeedInfo(CyGame().getGameSpeedType()).getGreatPeoplePercent() /100
if pCity.getGreatPeopleProgress() >= pPlayer.greatPeopleThreshold(True) - iGreatPeopleThresholdIncrease:
pPlayer.setScriptData(pPlayer.getScriptData() + "Pisa" + str(len(str(pCity.getID()))) + str(pCity.getID()))
## Leaning Tower End ##