Python Error

What does line 598 of your version of CvGameUtils do?
 
What does line 598 of your version of CvGameUtils do?

Code:
#Checks religion percents
		lReligions = [ ]
		bestReligionPercent = 0
		iBestReligion = -1
		for iReligionLoop in range(gc.getNumReligionInfos( )):
			iReligionLevel = gc.getGame().calculateReligionPercent(iReligionLoop)
			[B]if iReligionLevel > gc.getGame().calculateReligionPercent(iStateReligion):[/B]
				lReligions.append( iReligionLoop )
			if (iReligionLoop != iStateReligion):
				religionPercent = gc.getGame().calculateReligionPercent(iReligionLoop)
				if (religionPercent > bestReligionPercent):
					bestReligionPercent = religionPercent
					iBestReligion = iReligionLoop
 
I don't know, which ai has the error, but i can see, that churchill has no state-religion, and you're checking a value against the state-religion.
I can't test it, but i think, there's the problem.
You should first check, if the ai has a state-religion, before you try to get the value.

But this is more guessing, the problem could be somewhere else.
 
I am also guessing, but it looks like The J is on the right track. Where is the value of iStateReligion set, and what is it's value? Most Civ4 functions that return an id number will return a -1 if there is something wrong. Is it possible that iStateReligion equals -1 when the error is occuring?
 
I am also guessing, but it looks like The J is on the right track. Where is the value of iStateReligion set, and what is it's value? Most Civ4 functions that return an id number will return a -1 if there is something wrong. Is it possible that iStateReligion equals -1 when the error is occuring?

I know nothing about python sorry.:blush:

But i kept going and it pop-ed up alot, then all of a sudden it was gone??
 
Code:
#Checks religion percents
		lReligions = [ ]
		bestReligionPercent = 0
		iBestReligion = -1
		for iReligionLoop in range(gc.getNumReligionInfos( )):
			iReligionLevel = gc.getGame().calculateReligionPercent(iReligionLoop)
			[B]if iReligionLevel > gc.getGame().calculateReligionPercent(iStateReligion):[/B]
				lReligions.append( iReligionLoop )
			if (iReligionLoop != iStateReligion):
				religionPercent = gc.getGame().calculateReligionPercent(iReligionLoop)
				if (religionPercent > bestReligionPercent):
					bestReligionPercent = religionPercent
					iBestReligion = iReligionLoop

Code:
		#Checks religion percents
		lReligions = [ ]
		bestReligionPercent = 0
		iStateLevel = 0
		for iReligionLoop in range(gc.getNumReligionInfos( )):
			if (gc.getGame().getReligionGameTurnFounded(iReligionLoop) > 0):
				iReligionLevel = gc.getGame().calculateReligionPercent(iReligionLoop)
				if iStateReligion >= 0:
					iStateLevel = gc.getGame().calculateReligionPercent(iStateReligion)
				if iReligionLevel > iStateLevel:
					lReligions.append( iReligionLoop )
				if (iReligionLoop != iStateReligion):
					religionPercent = gc.getGame().calculateReligionPercent(iReligionLoop)
					if (religionPercent > bestReligionPercent):
						bestReligionPercent = religionPercent

Try this.
 
Code:
		#Checks religion percents
		lReligions = [ ]
		bestReligionPercent = 0
		iStateLevel = 0
		for iReligionLoop in range(gc.getNumReligionInfos( )):
			if (gc.getGame().getReligionGameTurnFounded(iReligionLoop) > 0):
				iReligionLevel = gc.getGame().calculateReligionPercent(iReligionLoop)
				if iStateReligion >= 0:
					iStateLevel = gc.getGame().calculateReligionPercent(iStateReligion)
				if iReligionLevel > iStateLevel:
					lReligions.append( iReligionLoop )
				if (iReligionLoop != iStateReligion):
					religionPercent = gc.getGame().calculateReligionPercent(iReligionLoop)
					if (religionPercent > bestReligionPercent):
						bestReligionPercent = religionPercent

Try this.

Thx, thats all i was asking for, will give it a shot, but now i have two more python errors, anybody want to try and see what these are???????:confused:
 
My guess is that you've merged BUG into your mod, but you used your own event manager called CvModEvents. This won't work. Follow the instructions for using your event manager class with BUG on the wiki that I linked for you in the BUG thread.

The second error looks like it's caused by trying to merge in Next War's event manager class. That class stores the number of nukes as a list in CyGame's script data. However, BUG uses Stone-D's SdToolkit to store all its data in that same place, and not as a list (it's a dictionary). Cammagno posted a version of Next War merged with BUG a while back, and I think he's working on an updated version for BUG 3.6.
 
My guess is that you've merged BUG into your mod, but you used your own event manager called CvModEvents. This won't work. Follow the instructions for using your event manager class with BUG on the wiki that I linked for you in the BUG thread.

The second error looks like it's caused by trying to merge in Next War's event manager class. That class stores the number of nukes as a list in CyGame's script data. However, BUG uses Stone-D's SdToolkit to store all its data in that same place, and not as a list (it's a dictionary). Cammagno posted a version of Next War merged with BUG a while back, and I think he's working on an updated version for BUG 3.6.

Nope didnt merge BUG mod, sorry, i want to but i am not that good at python stuff, sorry.

Infact all i have in python is one religion stuff, subdue animals, mongol camp, some terrain stuff, and the regular Next War stuff, thats it.
 
When you say that you haven't merged BUG and those other Python files, you mean that you haven't modified the files themselves, right? You did copy them into the same Assets folder hierarchy, right? If so, that won't work. You can't load up the trunk of a car and expect it to run like a hybrid. You have to alter the engine. There's just no getting around that, sorry.
 
When you say that you haven't merged BUG and those other Python files, you mean that you haven't modified the files themselves, right? You did copy them into the same Assets folder hierarchy, right? If so, that won't work. You can't load up the trunk of a car and expect it to run like a hybrid. You have to alter the engine. There's just no getting around that, sorry.


Here's all the files i have, nothing else merged??
 
Sorry, I thought this was one of your threads in the BUG forum. I see you didn't pack any BUG files in the RAR you just posted, but the error that CvAppInterface is calling fireEvent is from BUG--not the original game.

So, do you have BUG installed in CustomAssets and are trying to use your mod as a mod? If so, you need to tell your mod to ignore the BUG files. Open your mod's INI file and change NoCustomAssets to 1.
 
Sorry, I thought this was one of your threads in the BUG forum. I see you didn't pack any BUG files in the RAR you just posted, but the error that CvAppInterface is calling fireEvent is from BUG--not the original game.

So, do you have BUG installed in CustomAssets and are trying to use your mod as a mod? If so, you need to tell your mod to ignore the BUG files. Open your mod's INI file and change NoCustomAssets to 1.

Nope i completely erased the Custom Assets folder, but i did just notice in the second attachment the big one, it only happens when a nuke is used??
 
Correct. Next War keeps track of all nukes that are used in the game by storing the value in a list in CyGame's script data. You must have done something to either change that data or are using a game not created using that mod.

As for the first error, can you post your CvAppInterface.py file? I didn't see one in the RAR.
 
Correct. Next War keeps track of all nukes that are used in the game by storing the value in a list in CyGame's script data. You must have done something to either change that data or are using a game not created using that mod.

As for the first error, can you post your CvAppInterface.py file? I didn't see one in the RAR.

I use the one from BtS Standard file.:blush: What i have in that rar file is all i use.
 
Top Bottom