Now work.Once more, I saw iPlayer in existing code and assumed that it would be defined. :/
So I guess that's why your code had no effect. Though I think you should've gotten a Python Exception popup from your own use of iPlayer, so it's strange that you had no errors.
Indentation of the print statement looks wrong. Well, perhaps it won't be needed now. Just setting iPlayer = pPlayer.getID() might make your code work.
now I have a doubt about this script, I don't know under which event to insert it, perhaps I should put it under 'cityBuilt' to make it work?The chaining with "and" only works inside conditions. Well, I think, your code is syntactically correct, but only the first call (changeBaseGreatPeopleRate) will get evaluated that way, i.e. the other two will have no effect. With "or" instead of "and" it would probably work, but I'd just put them each on a separate line. And the GP rate is actually supposed to increase ("punishment," you wrote)? For the free specialist, it's probably better to ensure that the specialist count doesn't become negative: -(min(2, pCity.getFreeSpecialistCount(ePriest))) instead of -2 and with ePriest set to getInfoType...
ok so I think it's better to tie it to a building in buildingBuilt, I basically lose the bonuses of religious buildings, until the non-state religion is removedSeems that there is a 'religionRemove' event. I assume that's what an inquisitor accomplishes. Oh, I guess what you actually want is give players a reason to use the Inquisitor. So the 'religionSpread' event then – when an offending religion spreads to the city, the penalties apply.
But you'll also want to remove the penalties when the religion is removed. So the 'religionRemove' handler is still going to be useful. However, when a religion gets removed, you won't be able to tell whether the city had been penalized at the time that the religion was spread. Because its owner's state religion could have been different at that time. Usually, I think, this problem is addressed by tying the effects to a building. So, upon religion spread, if it's not the state religion, the building gets added. And upon religion removal, the building is removed – which will have no effect if the building isn't there. A building can't remove a Priest specialist, however. I guess you could still do that part through Python; will just need to check whether the building exists when undoing the removal of the Priest in the 'religionRemove' handler.
for iReligion
loop should be removed and iStateReligion should be the call parameter of isHasReligion. Hm, no, I think you want to do something with every religion that isn't iStateReligion. In that case, keep the religion loop and check iReligion != iStateReligion and pLoopCity.isHasReligion(iReligion)
.I understood by testing the pantheon script that your idea of tying everything to a building is the best, I sketched out a script, let's hope it goes well, obviously I also did religion remove. So, upon religion spread, if it's not the state religion, the building gets added. And upon religion removal, the building is removed – which will have no effect if the building isn't there. A building can't remove a Priest specialist, however. I guess you could still do that part through Python; will just need to check whether the building exists when undoing the removal of the Priest in the 'religionRemove' handler.
iReligion, iOwner, pSpreadCity = argsList
iStateReligion = gc.getPlayer(iOwner).getStateReligion()
if iStateReligion != ReligionTypes.NO_RELIGION and iStateReligion != iReligion: