Merged Limited Religion MOD strange "Bug"

Liambane

Rome's Praetorian
Joined
Aug 14, 2007
Messages
289
Location
West Roman Empire, Italy.
Hi All. I'm a newbie in Phyton so ask for your help:

I downloaded this Limited Religion Mod (works perfectly with vanilla CIV4)
http://forums.civfanatics.com/showthread.php?p=8233967#post8233967

And I merged the code with WINMERGE in my Earth 35 Civ Mod and had a strange BUG:

Limited Religions worked for Human Player, I can't found a second religion BUT no other players can if I still discovered that religious technology. Got what I mean?

Example i Discovered Meditation (and found 1 religion) then discover Polytheism (and Didn't found) = OK, that's how it should works.

Another civ discovered Polytheism and DIDN'T FOUND A RELIGION TOO!

In Vanilla CIV4 this Limited Religion works perfectly, why not in my mod!

Do I need to change something in the code? :confused::confused:


Limited Religion Mod uses:
-CvEventManager.py
-CvGameUtils.py

In my Phyton are included:
- Jarm MOD (on CvMaininterface and CvReligionscreen, this should not give problem)
- An old Inquisitor mod (This use the same phyton files and all the others you will see)
- Main Screen Interface mod (on CvMaininterface, this should not give problem)

Any help will be very appriciated... I use Modular Civilizations, and a different Gamecore.dll if mean something...

Here's the phyton of my mod:
 

Attachments

I just took a real quick look at the code, so I may be missing something obvious, but it looks like the following code would generate errors.

Lines 724 to 730 in CvEventManager:

Code:
if CyGame().isOption(GameOptionTypes.GAMEOPTION_PICK_RELIGION):
	if gc.getPlayer(iPlayer).isHuman( ):
		self.doPickReligionPopup(iPlayer, iRelCheck)
	else:
		iNewReligion = self.AI_chooseReligion(iPlayer)
		if iNewReligion > -1:
			gc.getPlayer(iPlayer).foundReligion(iNewReligion, iRelCheck, True)

It looks like iRelCheck isn't defined before it is used. I can't find the methods self.doPickReligionPopup and self.AI_chooseReligion either.

Do you have Python error reporting on?
 
Do you have Python error reporting on?

First of all thx for support! I don't have any phyton error. It simply works "for half". Some code missing?

Or am i missing something in the interpretation??

If I still have a Holy City, once I discovered another founding religious tech is like if I DELETE the Opportunity of other CIVS from FOUNDING Religions with that tech.

For example If I found with Meditation and then discover Polytheism i found only one religion, BUT no others civilizations can FOUND RELIGION with POLYTHEISM once researched. Did you understand?
 
It looks like some code is missing. When the AI is supposed to pick a religion it calls self.AI_chooseReligion. I couldn't find that method in your mod. As far as I can tell, that method isn't part of the standard CvEventManager class. If you have Python error reporting turned off, Python will just exit onTechRequired with out finishing things.

If you want to turn on Python error reporting - goto your BTS folder and open the shortcut "_Civ4Config". Then look for this:
; Set to 1 for no python exception popups
HidePythonExceptions = 1

and change it to:
; Set to 1 for no python exception popups
HidePythonExceptions = 0
 
; Set to 1 for no python exception popups
HidePythonExceptions = 0

Thx for support General Tso. I recieved Errors log. Unfortunately I'm not skilled in Phyton so I dunno how to fix them.

Here's the errors:

File "CvEventInferface", line 23, in OnEvent
File "CvEventManager", line 194, in HandelEvent
File "CvEventManager", line 728, in OnTechAcquired

Attribute Error: CvEventManager instance has no attribute "AI_ChooseReligion"

Is hard to fix them? what I need to do? Damn, I'm so noob with Phyton... :mad:
 
That error means that General Tso was correct - you are calling a function that apparently doesn't exist. Either that or it isn't in a place that CvEventManager knows to look at.
 
Liambane, There are several things missing from your code that is located in onTechAcquired. There appears to be at least two seperate problems.
1. iRelCheck isn't defined before it is used. There was probably another line of code in the original code that set that value.
2. The methods self.doPickReligionPopup and self.AI_chooseReligion are not located in your mod, but the code is trying to call them. Some mods extend the CvEventManager class by creating the thier own EventManager class. I'm guessing that the original mod that you started with did this.

Unfortunatley, I'm not familiar with the mods that you started with, so I'm not sure how to help you. Maybe someone else will come along with a little more knowledge and can help you. Otherwise, I would recommend that you look at the original mods before they where merged for the missing code. If you find the missing code, I'm sure myself or somebody else will be glad to help you.

Edit: I forgot to mention. Liambane I couldn't respond to your PM because I can't use most of the features on this board. They stopped working about a month ago.
 
At the end I find the problem. I used:

; Set to 1 for no python exception popups
HidePythonExceptions = 0

on the Basic Limited Religion Mod:

http://forums.civfanatics.com/showthread.php?p=8233967#post8233967

I played a Vanilla game with that mod and THE SAME ERRORS are displayed.
Looks like that mod doesn't work fine, and it's not ME that WRONG MERGED the files... :eek:
 
Using this Orion's mod, all works fine: (He did it just for me) :lol: :goodjob:

http://forums.civfanatics.com/attachment.php?attachmentid=220465&d=1247132691

However I've a general question that regards the phyton:

Seems that the ORION'S LIMITED RELIGION mod (also if loaded just alone) ignore the Leaderinfos <favouritereligion> tag and that choose only religions SELECTED IN ORDER (1st always JUDAISM, 2nd always CHRISTIANITY,3 confucian...)

All I need is a function that doesn't pick always THE FIRST free religion, but that take the Favouritereligion of the leader!
Any chanche to let the <favoritereligion> tag be integrated with this?
What I need to edit?
 
the diagnosis in this thread is correct. I added the missing code and am uploading it shortly.

See the link in my sig for the download thrread.

I'm glad my "strange errors" let you fix the code! :lol::lol::lol:

If you upload the code, don't forget to put in it that the AI Religion Choose should NOT BE 1st always judaism, 2nd always christianity but should look at the civilization's favourite religion... See what I mean on Orion's thread...

:goodjob::goodjob::goodjob:
 
I'm glad my "strange errors" let you fix the code! :lol::lol::lol:

If you upload the code, don't forget to put in it that the AI Religion Choose should NOT BE 1st always judaism, 2nd always christianity but should look at the civilization's favourite religion... See what I mean on Orion's thread...

:goodjob::goodjob::goodjob:

That is an added feature, maybe for the future.:D

Thank you for your help.
 
Don't forget to put in it that the AI Religion Choose should NOT BE 1st always judaism, 2nd always christianity but should look at the civilization's favourite religion.

Looking at the code, if you have Choose Religion enabled, it does look at the leader's favorite religion.

Code:
def AI_chooseReligion(self, iPlayer):
	pPlayer = gc.getPlayer(iPlayer)
	eFavorite = gc.getLeaderHeadInfo(pPlayer.getLeaderType()).getFavoriteReligion()
	if eFavorite > -1 and not CyGame().isReligionFounded(eFavorite):
		return eFavorite
	...

If Choose Religion is disabled, they found the religion specified by the tech.
 
Back
Top Bottom