What does "pPlayer.getStateReligion()" return if they have no state religion?
That shouldn't happen, because the unit needs a state religion.
If not, then something hasn't been merged right.
But seems the be the only possibility

What does "pPlayer.getStateReligion()" return if they have no state religion?
What does "pPlayer.getStateReligion()" return if they have no state religion?
I think it is "-1" (ReligionTypes.NO_RELIGION). The list has no index of -1, it starts at 0 for "JEWISH". You should prefix the last 4 lines with a check for state religion not being -1, something like this:
Code:if (iReligion != -1) : MonasteryName = "BUILDING_"+NumReligion[iReligion]+"_MONASTERY" bMonastery = gc.getInfoTypeForString(MonasteryName) if (city.getNumRealBuilding(bMonastery)==True) : unit.changeExperience(2,100,False,False,False)
If you want to remember why you check for -1, you could use the defined value ReligionTypes.NO_RELIGION instead.
You may need to extend the block (increase the indentation level) for lines after that if they are part of the same general thing.
By the way, the lines in your code all use tabs for indentation except the last one. That one uses spaces. Mixing them is a bad plan. (I changed it to tabs in my version above.)
Edit: Oops. I have to modify that - it looks like the first lines I copied above use a mix of tabs and spaces. The earlier lines use spaces just like the last line did, except for the blank line (which doesnt' matter) and the line before it both of which seem to have some tabs and spaces. This is still a bad idea. Very bad. The level of indentation is important, and mixing the two can make it look like they are indented the same amount when they are not (it is the number of characters, not the visual appearance, which matters).
That shouldn't happen, because the unit needs a state religion.
If not, then something hasn't been merged right.
But seems the be the only possibility.
Are you sure you get the same error?
if (iReligion != -1) :
MonasteryName = "BUILDING_"+NumReligion[iReligion]+"_MONASTERY"
bMonastery = gc.getInfoTypeForString(MonasteryName)
if (city.getNumRealBuilding(bMonastery)==True) :
unit.changeExperience(2,100,False,False,False)
Have you added religions to this mod? If so, you need to add them to that list NumReligion being created just above the breaking line.
###WarriorsOfGod Fanatic Part2 Start ###
strUnit = gc.getUnitInfo(unit.getUnitType()).getType()
CurrentUnit = gc.getInfoTypeForString(strUnit)
if (CurrentUnit == gc.getInfoTypeForString("UNIT_FANATIC")):
iPlayer = city.getOwner()
pPlayer = gc.getPlayer(iPlayer)
iReligion = pPlayer.getStateReligion()
NumReligions = 16
for i in range (NumReligions):
if ((city.isHasReligion(i)==True) and (i<>iReligion)):
unit.changeExperience(2,100,False,False,False)
###WarriorsOfGod Fanatic Part2 End ###
###WarriorsOfGod Monk Part2 Start ###
strUnit = gc.getUnitInfo(unit.getUnitType()).getType()
CurrentUnit = gc.getInfoTypeForString(strUnit)
if (CurrentUnit == gc.getInfoTypeForString("UNIT_MONK")):
NumReligion = []
NumReligion.append('JEWISH')
NumReligion.append('CHRISTIAN')
NumReligion.append('ISLAMIC')
NumReligion.append('HINDU')
NumReligion.append('BUDDHIST')
NumReligion.append('CONFUCIAN')
NumReligion.append('TAOIST')
NumReligion.append('HELLENIC')
NumReligion.append('ZOROASTRIAN')
NumReligion.append('SHINTO')
NumReligion.append('CANNIBALISM')
NumReligion.append('NORSE')
NumReligion.append('EGYPT_MYTHOLOGY')
NumReligion.append('VOODOO')
NumReligion.append('TENGRIISM')
NumReligion.append('LEVANT')
iPlayer = city.getOwner()
pPlayer = gc.getPlayer(iPlayer)
iReligion = pPlayer.getStateReligion()
if (iReligion != -1) :
MonasteryName = "BUILDING_"+NumReligion[iReligion]+"_MONASTERY"
bMonastery = gc.getInfoTypeForString(MonasteryName)
if (city.getNumRealBuilding(bMonastery)==True) :
unit.changeExperience(2,100,False,False,False)
TempleName = "BUILDING_"+NumReligion[iReligion]+"_TEMPLE"
bTemple = gc.getInfoTypeForString(TempleName)
if (city.getNumRealBuilding(bTemple)==True) :
unit.changeExperience(2,100,False,False,False)
CathedralName = "BUILDING_"+NumReligion[iReligion]+"_CATHEDRAL"
bCathedral = gc.getInfoTypeForString(CathedralName)
if (city.getNumRealBuilding(bCathedral)==True) :
unit.changeExperience(2,100,False,False,False)
ShrineName = "BUILDING_"+NumReligion[iReligion]+"_SHRINE"
bShrine = gc.getInfoTypeForString(ShrineName)
if (city.getNumRealBuilding(bShrine)==True) :
unit.changeExperience(4,100,False,False,False)
ApostolicPalace = gc.getInfoTypeForString("DIPLOVOTE_POPE")
if ((pPlayer.isFullMember(ApostolicPalace)==True)and (CyGame().isDiploVote(ApostolicPalace)==True)):
unit.changeExperience(4,100,False,False,False)
###WarriorsOfGod Monk Part2 End ###
def onCultureExpansion(self, argsList):
'City Culture Expansion'
pCity = argsList[0]
iPlayer = argsList[1]
CvUtil.pyPrint("City %s's culture has expanded" %(pCity.getName(),))
def onCityGrowth(self, argsList):
'City Population Growth'
pCity = argsList[0]
iPlayer = argsList[1]
[B]CvUtil.pyPrint("%s has grown" %(pCity.getName(),))[/B]
def onCityDoTurn(self, argsList):
'City Production'
pCity = argsList[0]
iPlayer = argsList[1]
CvAdvisorUtils.cityAdvise(pCity, iPlayer)
def pyPrint(stuff):
stuff = 'PY:' + stuff + "\n"
[B]sys.stdout.write(stuff)[/B]
def pyAssert(cond, msg):
if (cond==False):
sys.stderr.write(msg)
assert(cond, msg)
File "CvWBDesc", line 470, in write
f.write("\tArtStyle=%s\n" %(gc.getArtStyleTypes(gc.getPlayer(idx).getArtStyleType())))
At this line in CvWBDesc.py (in the BtS assets folder, down in python/pyWB) it is trying to write out the civilization's art style type.
Code:f.write("\tArtStyle=%s\n" %(gc.getArtStyleTypes(gc.getPlayer(idx).getArtStyleType())))
It tries to write out this data for any player (over all player slots, not just active players) who has a civilization type set.
I'm not sure how you could get a bad art style type except not having one in the CIV4CivilizationInfos.xml. The UnitArtStyleType tag must have a valid value like UNIT_ARTSTYLE_EUROPEAN. The only other thing I can think of is if you are loading the game from a worldbuilder save that has been edited such that this data is bad for some civ.
So i am just deleting the WarriorsOfGod from the python, sorry The_J it's just giving me too many errors with whitespacing. I dont understand it either cause i used WinMerge only.