###circus hagenbeck start part 1
self.oldcity = [-1,-1]
###circus hagenbeck end part 1
### circus hagenbeck start part 2
if (gc.getGame().getGameTurnYear() <> gc.getDefineINT("START_YEAR")):
for iPlayer in range (gc.getMAX_PLAYERS()):
player = gc.getPlayer(iPlayer)
if player.isAlive():
numbuildings = player.countNumBuildings(gc.getInfoTypeForString("BUILDING_CIRCUSHAGENBECK"))
if numbuildings>0:
for iCity in range(player.getNumCities()):
pCity = player.getCity(iCity)
if pCity.getNumBuilding(gc.getInfoTypeForString("BUILDING_CIRCUSHAGENBECK"))>0:
self.oldcity = [iPlayer,iCity]
return
###circus hagenbeck end part 2
Does this problem happen every time?
Does it only happen with ships, or with normal land untis?
Does the owner of the unit have a capital?
I downloaded the j's file and seems that if you did put them in line, your text editor screwed it.
I never had this error before.
In my mod, the Respawn-promotion is not allowed for naval units, so it has to be normal land units.
I suppose every civ has a capital. Babrbs have none. However I checked if I could reproduce the CTD by giving the Respawn-promotion to a barbarian unit, and then destroy it. There was no CTD but only a bunch of Python error pop-ups.
###circus hagenbeck start part 3
if (CyGame().getTurnYear(iGameTurn)>=1890) and ( iGameTurn % 3 ==0 ):
counter = 0
while True:
counter = counter+1
if counter>=100:break
dice = gc.getGame().getMapRand()
iPlayer = dice.get(gc.getMAX_PLAYERS (), "Players")
pPlayer = gc.getPlayer(iPlayer)
if pPlayer.isNone():continue
if pPlayer.isAlive():
iCity = dice.get(pPlayer.getNumCities () , "Cities" )
pCity = pPlayer.getCity(iCity)
if pCity.isNone():continue
if not pCity.isHasBuilding(gc.getInfoTypeForString("BUILDING_COLOSSEUM")):continue
pCity.setNumRealBuilding(gc.getInfoTypeForString("BUILDING_CIRCUSHAGENBECK"),1)
CyInterface().addMessage(iPlayer,false,20,CyTranslator().getText("TXT_KEY_CIRCUS_MOVED",(pCity.getName (),pCity.getName ())),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), pCity.getX(), pCity.getY(), True,True)
if self.oldcity <>[-1,-1]:
otherplayer = gc.getPlayer(self.oldcity[0])
othercity = otherplayer.getCity(self.oldcity[1])
if not othercity.isNone():
othercity.setNumRealBuilding(gc.getInfoTypeForString("BUILDING_CIRCUSHAGENBECK"),0)
CyInterface().addMessage(self.oldcity[0],false,20,CyTranslator().getText("TXT_KEY_CIRCUS_LOST",(othercity.getName (),othercity.getName ())),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_RED")), othercity.getX(), othercity.getY(), True,True)
self.oldcity = [iPlayer,iCity]
MaxPlayers = gc.getMAX_CIV_PLAYERS ()
for iPlayerNum in xrange(MaxPlayers):
CyInterface().addMessage(iPlayerNum,false,20,CyTranslator().getText("TXT_KEY_CIRCUS_ANNOUNCE",(pCity.getName (),pPlayer.getCivilizationAdjective (1) )),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), pCity.getX(), pCity.getY(), True,True)
break
###circus hagenbeck end part 3
Thanks NSG, I also noticed that part three seems to be using spaces rather than tabs, can I get a little help on this part:
###circus hagenbeck start part 3
if (CyGame().getTurnYear(iGameTurn)>=1890) and ( iGameTurn % 3 ==0 ):
counter = 0
while True:
counter = counter+1
if counter>=100:break
dice = gc.getGame().getMapRand()
iPlayer = dice.get(gc.getMAX_PLAYERS (), "Players")
pPlayer = gc.getPlayer(iPlayer)
if pPlayer.isNone():continue
if pPlayer.isAlive():
iCity = dice.get(pPlayer.getNumCities () , "Cities" )
pCity = pPlayer.getCity(iCity)
if pCity.isNone():continue
if not pCity.isHasBuilding(gc.getInfoTypeForString("BUILDING_COLOSSEUM")):continue
pCity.setNumRealBuilding(gc.getInfoTypeForString("BUILDING_CIRCUSHAGENBECK"),1)
CyInterface().addMessage(iPlayer,false,20,CyTranslator().getText("TXT_KEY_CIRCUS_MOVED",(pCity.getName (),pCity.getName ())),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), pCity.getX(), pCity.getY(), True,True)
if self.oldcity <>[-1,-1]:
otherplayer = gc.getPlayer(self.oldcity[0])
othercity = otherplayer.getCity(self.oldcity[1])
if not othercity.isNone():
othercity.setNumRealBuilding(gc.getInfoTypeForString("BUILDING_CIRCUSHAGENBECK"),0)
CyInterface().addMessage(self.oldcity[0],false,20,CyTranslator().getText("TXT_KEY_CIRCUS_LOST",(othercity.getName (),othercity.getName ())),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_RED")), othercity.getX(), othercity.getY(), True,True)
self.oldcity = [iPlayer,iCity]
MaxPlayers = gc.getMAX_CIV_PLAYERS ()
for iPlayerNum in xrange(MaxPlayers):
CyInterface().addMessage(iPlayerNum,false,20,CyTranslator().getText("TXT_KEY_CIRCUS_ANNOUNCE",(pCity.getName (),pPlayer.getCivilizationAdjective (1) )),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), pCity.getX(), pCity.getY(), True,True)
break
###circus hagenbeck end part 3
@Strategyonly: No, no idea what's going on.
I have to remember to download your mod, so that you can give me a savegame and see it myself.
@hrochland:
- In your XML is an error, you have no entry for DCCOURTHOUSE in your BuildingsInfos.xml
- And you should set iConquestProb for the courthouses to 100, else you will sometimes not get a courthouse.
One problem here: The python code can't see, why a capital has been moved.
Example:
- You capture Washington, new capital will be Philadelphia (or so).
- America decides to build the capital new in Philadelphia, because it's just better.
For python, both is the same, it can't see a difference, why it was moved.
It can be made so, that you can only capture the white house, when you capture the first found city, when it is a capital. That can be done relativly easy. So in the second example, you would not get the white house, when you capture one of your cities.
....but man, i have an easier suggestion, with no python.
- Make a new wonder, white house
- And make it a free building class for america, like this here (in CivilizationInfos.xml):
- Then america will start with a palace and the white house. Or you can just make them start with only the white house.PHP:<FreeBuildingClasses> <FreeBuildingClass> <BuildingClassType>BUILDINGCLASS_PALACE</BuildingClassType> <bFreeBuildingClass>1</bFreeBuildingClass> </FreeBuildingClass> </FreeBuildingClasses>
- The white house will at the beginning be in the capital.
- If it's a wonder, it can't be moved
- It will not be moved, when you capture the capital
Is way easier, i think, and will do, what you want.
Another thing: I'm out of modding for the next 2 or 3 weeks.
Semester holidays, and i'll stay for that time at my parents, without my gaming pc. So don't expect anything new from me. I'll sure be here for answering questions, but i can't test anything or fix more complicated errors.
Okay......what python errors do you get, when you disable the line like you described?
It is not working here is my files!
What does not work?
Does just nothing happen?
Do you get a python exception (are python exceptions turned on?)?
Are all the files in the proper place (because it will not work, if they are all in the same folder like in thze .zip).
###spawn a civ part 2 start###
MyFile=open("Mods/The Ancient, Classical, and Dark ages Mod/Assets/XML/CustomXML/CIV4SpawnCivInfos.xml")
SpawnCivUtil.ReadMyFile(MyFile)
MyFile.close()
###spawn a civ part 2 end###
###spawn a civ part 3 start###
MyFile=open("Mods/The Ancient, Classical, and Dark ages Mod/Assets/XML/CustomXML/CIV4SpawnCivInfos.xml")
SpawnCivUtil.ReadMyFile(MyFile)
MyFile.close()
###spawn a civ part 3 end###
Another point, @cybrxkhan: I've looked at the units religion modcomp, and this thing seems way to complicated for me.
It's not really soooo big, but big enough if you don't know, where to begin.
Sorry, i will not update it.
I think I know what the problem is.I am not an Admin on my computer so my Mod is in the MODS
folder!!! Could this be the problem?
Code:###spawn a civ part 2 start### MyFile=open("Mods/The Ancient, Classical, and Dark ages Mod/Assets/XML/CustomXML/CIV4SpawnCivInfos.xml") SpawnCivUtil.ReadMyFile(MyFile) MyFile.close() ###spawn a civ part 2 end###
Code:###spawn a civ part 3 start### MyFile=open("Mods/The Ancient, Classical, and Dark ages Mod/Assets/XML/CustomXML/CIV4SpawnCivInfos.xml") SpawnCivUtil.ReadMyFile(MyFile) MyFile.close() ###spawn a civ part 3 end###
No problem. Although I am a bit sad, it wasn't one of those features where "IF THIS IS NOT IN MY ENTIRE MOD WILL BE A COMPLETE FAILURE! NOOOOO!!!" kind of thing, so don't worry about it, I'm glad that you at least tried and managed to make a modcomp similar to it.
Also thanks for the update to the SpawnACiv modcomp!
Yes, that is definetly the problem.
No real mods should go into My Documents, so i have never thought about it.
If you still want to use it, then you have to put in there the complete path to your mod, meaning C:\Documents and Settings\[UserName]\My Documents\etc.
But it can't be published like that...then the path should be grabbed out of the registry...no, that's a bit complicated.
And it would not work for every experienced user here, because no one of them would put a mod into My Documents.