adapt a script

Yes, but as part of the "if" conditions, i.e. connected with another "and".
what I don't understand the building is added whether religion is added by a missionary or whether it is added by influence
edit: give me error. pyplayer is not defined
 

Attachments

  • 1.jpg
    1.jpg
    58.2 KB · Views: 6
Last edited:
I assume that the event handler gets called in both cases. I thought the idea was that the penalties apply wherever a religion other than the state religion is present. There's also this handler, however: 'unitSpreadReligionAttempt' : self.onUnitSpreadReligionAttempt
Python:
def onUnitSpreadReligionAttempt(self, argsList):
	'Unit tries to spread religion to a city'
	pUnit, iReligion, bSuccess = argsList
 
I assume that the event handler gets called in both cases. I thought the idea was that the penalties apply wherever a religion other than the state religion is present. There's also this handler, however: 'unitSpreadReligionAttempt' : self.onUnitSpreadReligionAttempt
Python:
def onUnitSpreadReligionAttempt(self, argsList):
    'Unit tries to spread religion to a city'
    pUnit, iReligion, bSuccess = argsList
yes everywhere, if you have a state religion.
if I remove a religion with an inquisitor there is no error, only if I spread it with a missionary
since there are many missionary units, it is better for me to create a promotion for these units otherwise I would have to post them all
can it work like this?
 

Attachments

  • 2.jpg
    2.jpg
    55.4 KB · Views: 6
Last edited:
If you do want the building regardless of how the religion was spread (missionary or passively from the Holy City), then you should stick with the religionSpread handler. The PyPlayer line can just be deleted – if that's the main issue. If only missionaries are supposed to cause the building to appear, then the unitSpreadReligionAttempt handler won't need to test whether the unit is a missionary – because only missionaries are able to spread religions (unless that's been changed in Realism Invictus). Testing for "None" shouldn't be necessary either. bSuccess should be tested though because the event triggers after both successful and unsuccessful attempts at spreading a religion through a missionary.
 
so I don't need it
def onUnitSpreadReligionAttempt,
just delete the line pyplayer from on religion spread?

if i delete the above line it gives me error c++
 

Attachments

  • 1.jpg
    1.jpg
    58.7 KB · Views: 8
Last edited:
Since you don't use the "player" variable, that whole line should be deleted (rather than corrected by using gc.getPlayer instead of PyPlayer). Other than that, your code looks correct to me. If there's still a C++ error, can you copy the stack trace from PythonErr.log (assuming that LoggingEnabled is set in CivilizationIV.ini) so that we can tell which line of Python code is (indirectly) causing the error?
 
I removed the line, but now it gives me an error: pyplayer nt defined
 

Attachments

  • 1.jpg
    1.jpg
    49.9 KB · Views: 7
Well, because the PyPlayer line is still there. That line needs to go, the iStateReligion line needs to remain. I thought that would be clear from the whole context. Edit: Private message sent.
 
Last edited:
Well, because the PyPlayer line is still there. That line needs to go, the iStateReligion line needs to remain. I thought that would be clear from the whole context.
yes i delete . but give me error . state religion not defined :(
 

Attachments

  • 1.jpg
    1.jpg
    46.4 KB · Views: 6
I could have solved the problem 3 days ago, if I realized that the problem was in the building's .xml file. Excuse me. As always, your help was fundamental, thank you
 
Top Bottom