Having Trouble with def cannotSpreadReligion

tsentom1

Bubble Dragon
Joined
Jul 24, 2007
Messages
1,000
Location
New York
Maybe, I'm not understanding how this actually functions. I assumed it can be used to stop a missionary from spreading a religion and thus wanted to use it to make a wonder that basically gave the non-state religion spread effect of Theocracy.

However, no matter how much I try the code doesn't work.

So then, just to test I changed it to always return True instead of False and it still doesn't stop religion spread.

Does this not function with missionaries? Is it relating to something else maybe natural religion spread chance?

I have the xml pythoncallbackdefines correct so it's not that.

Anyone know how this works or what its used for?

Thanks in advance.
 
Oh wow. That thing is like really broken. :eek:

The first problem is that they named the SDK callback check wrong :rolleyes: so you need to change from this:
Code:
	<Define>
		<DefineName>USE_CANNOT_SPREAD_RELIGION_CALLBACK</DefineName>
		<iDefineIntVal>1</iDefineIntVal>
	</Define>
to this: (note the double "USE_")
Code:
	<Define>
		<DefineName>USE_USE_CANNOT_SPREAD_RELIGION_CALLBACK</DefineName>
		<iDefineIntVal>1</iDefineIntVal>
	</Define>

Once you make that change, the second problem is that the "bridge" function is missing from CvGameInterface.py :hammer2: So you need to add the following at the end of that file:
Code:
def cannotSpreadReligion(argsList):
	return gameUtils().cannotSpreadReligion(argsList)

At that point, the callback in CvGameUtils should finally run but it has an error too :wallbash: with how it processes arguments. You need to change this:
Code:
		iOwner, iUnitID, iReligion, iX, iY = argsList[0]
to this:
Code:
		iOwner, iUnitID, iReligion, iX, iY = argsList

:crazyeye: Congratulations, you can now finally use the callback to disable a missionary's spread ability when necessary. Note that the callback does only affect units; the "auto" spread is unaffected.
 
Thanks a lot for the help! No wonder I couldn't get it to work! No matter if I had the correct code it wouldn't have mattered!

I only wanted it to affect units so that's no problem. I was just worried when I couldn't get it to work in the first place that it was used by something else.

Thanks again!
 
Top Bottom