Saarlaender
Chieftain
- Joined
- Jan 14, 2006
- Messages
- 60
Hi everyone,
'm working on a religion mod. Already incorporated Protestantism and ancient polytheism, all works fine. Now I was trying to script it so that when a religion is spread to a city where there is already a religion, there is a chance that the people will not be added, but convert - so that the "original" religion disappears on cpnversion. Well, it doesn't seem to work.
2 possibilities:
1) on religion spread doesn't cover missionaries at all?
2) randon function horribly wrong?
3)= I can#t just put it there and it needs to be somewhere completely different?
-2 and 3 both because I don't really know what I'm doing, mainly I'm just playing with the Inquisitor mod's and Kael's scripts without actually knowing the first thing about python....
so here it goes, I hope some gracious soul will spot my mistake and hit me on the head like they shoud for what is certainly a mountain of blatant violations
'm working on a religion mod. Already incorporated Protestantism and ancient polytheism, all works fine. Now I was trying to script it so that when a religion is spread to a city where there is already a religion, there is a chance that the people will not be added, but convert - so that the "original" religion disappears on cpnversion. Well, it doesn't seem to work.
2 possibilities:
1) on religion spread doesn't cover missionaries at all?
2) randon function horribly wrong?
3)= I can#t just put it there and it needs to be somewhere completely different?
-2 and 3 both because I don't really know what I'm doing, mainly I'm just playing with the Inquisitor mod's and Kael's scripts without actually knowing the first thing about python....
so here it goes, I hope some gracious soul will spot my mistake and hit me on the head like they shoud for what is certainly a mountain of blatant violations

Code:
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
from CvPythonExtensions import *
import CvUtil
import CvEventManager
import sys
import CustomFunctions
import CvScreensInterface
import CvDebugTools
import CvWBPopups
import PyHelpers
import Popup as PyPopup
import CvCameraControls
import CvTopCivs
import CvWorldBuilderScreen
import CvAdvisorUtils
import CvTechChooser
gc = CyGlobalContext()
cf = CustomFunctions.CustomFunctions()
# globals
###################################################
class CvCustomEventManager(CvEventManager.CvEventManager):
def __init__(self):
# initialize base class
self.parent = CvEventManager.CvEventManager
self.parent.__init__(self)
def onBuildingBuilt(self, argsList):
'Building Completed'
pCity, iBuildingType = argsList
game = CyGame()
if ((not self.bMultiPlayer) and (pCity.getOwner() == CyGame().getActivePlayer()) and isWorldWonderClass(gc.getBuildingInfo(iBuildingType).getBuildingClassType())):
# If this is a wonder...
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
popupInfo.setData1(iBuildingType)
popupInfo.setData2(pCity.getID())
popupInfo.setData3(0)
popupInfo.setText(u"showWonderMovie")
popupInfo.addPopup(pCity.getOwner())
Inquisition = gc.getInfoTypeForString('BUILDING_INQUISITION')
if iBuildingType == Inquisition:
cf.Inquisit(pCity)
pCity.setHasRealBuilding(Inquisition, False)
def onReligionSpread(self, argsList):
'Religion Has Spread to a City'
iReligion, iOwner, pSpreadCity, iCatholic, iProtestant, iJewish, iHindu, iPolytheism, iIslam = argsList
iCatholic = gc.getInfoTypeForString('RELIGION_CHRISTIANITY')
iProtestant = gc.getInfoTypeForString('RELIGION_PROTESTANTISM')
iJewish = gc.getInfoTypeForString('RELIGION_JUDAISM')
iHindu = gc.getInfoTypeForString('RELIGION_HINDUISM')
iPolytheism = gc.getInfoTypeForString('RELIGION_POLYTHEISM')
iIslam = gc.getInfoTypeForString('RELIGION_ISLAM')
rand = CyGame().getSorenRandNum(100, "Bob")
player = PyPlayer(iOwner)
pPlayer = gc.getPlayer(iOwner)
if iReligion == iCatholic:
if (rand <= 40):
if (pSpreadCity.isHasReligion(iProtestant) and pSpreadCity.isHolyCityByType(iCatholic) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Katholiken sind zum Protestantismus konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iCatholic:
if (rand <= 20):
if (pSpreadCity.isHasReligion(iIslam) and pSpreadCity.isHolyCityByType(iCatholic) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Katholiken haben den Propheten Mohammed erkannt!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iCatholic:
if (rand <= 15):
if (pSpreadCity.isHasReligion(iHinduism) and pSpreadCity.isHolyCityByType(iCatholic) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Katholiken sind zum Hinduismus konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iCatholic:
if (rand <= 15):
if (pSpreadCity.isHasReligion(iJewish) and pSpreadCity.isHolyCityByType(iCatholic) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Katholiken sind zum Judentum konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iProtestant:
if (rand <= 20):
if (pSpreadCity.isHasReligion(iIslam) and pSpreadCity.isHolyCityByType(iProtestant) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Protestanten sind zum Islam konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Polytheism.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iProtestant:
if (rand <= 30):
if (pSpreadCity.isHasReligion(iHinduism) and pSpreadCity.isHolyCityByType(iProtestant) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Protestanten sind zum Hinduismus konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Polytheism.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iProtestant:
if (rand <= 30):
if (pSpreadCity.isHasReligion(iCatholic) and pSpreadCity.isHolyCityByType(iProtestant) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Protestanten sind in den Schoß der Kirche zurückgekehrt!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Polytheism.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iProtestant:
if (rand <= 30):
if (pSpreadCity.isHasReligion(iJewish) and pSpreadCity.isHolyCityByType(iProtestant) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Protestanten sind zum Judentum konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Polytheism.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iPolytheism:
if (rand <= 80):
if (pSpreadCity.isHasReligion(iIslam) and pSpreadCity.isHolyCityByType(iPolytheism) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Heiden sind zum Islam konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iPolytheism:
if (rand <= 80):
if (pSpreadCity.isHasReligion(iCatholic) and pSpreadCity.isHolyCityByType(iPolytheism) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Heiden sind zur Heiligen Kirche konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iPolytheism:
if (rand <= 80):
if (pSpreadCity.isHasReligion(iProtestantism) and pSpreadCity.isHolyCityByType(iPolytheism) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Heiden haben Jesus als ihren persönlichen Erlöser erkannt!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iPolytheism:
if (rand <= 40):
if (pSpreadCity.isHasReligion(iHinduism) and pSpreadCity.isHolyCityByType(iPolytheism) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Heiden sind zum Hinduismus konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iPolytheism:
if (rand <= 60):
if (pSpreadCity.isHasReligion(iJewish) and pSpreadCity.isHolyCityByType(iPolytheism) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Heiden sind zum Judentum konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iIslam:
if (rand <= 25):
if (pSpreadCity.isHasReligion(iCatholic) and pSpreadCity.isHolyCityByType(iIslam) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Muslime sind zur Heiligen Kirche konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iIslam:
if (rand <= 25):
if (pSpreadCity.isHasReligion(iProtestant) and pSpreadCity.isHolyCityByType(iIslam) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Muslime sind zum Protestantismus konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iIslam:
if (rand <= 15):
if (pSpreadCity.isHasReligion(iHinduism) and pSpreadCity.isHolyCityByType(iIslam) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Muslime sind zum Hinduismus konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iIslam:
if (rand <= 10):
if (pSpreadCity.isHasReligion(iPolytheism) and pSpreadCity.isHolyCityByType(iIslam) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Muslime haben die Opfer für Zeus wiederaufgenommen!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iIslam:
if (rand <= 10):
if (pSpreadCity.isHasReligion(iJewish) and pSpreadCity.isHolyCityByType(iIslam) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Muslime sind zum Judentum konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iJewish:
if (rand <= 10):
if (pSpreadCity.isHasReligion(iIslam) and pSpreadCity.isHolyCityByType(iJewish) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Juden sind zum Islam konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iJewish:
if (rand <= 30):
if (pSpreadCity.isHasReligion(iCatholic) and pSpreadCity.isHolyCityByType(iJewish) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Juden sind zum Katholizismus konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iJewish:
if (rand <= 30):
if (pSpreadCity.isHasReligion(iProtestant) and pSpreadCity.isHolyCityByType(iJewish) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Juden sind zum Protestantismus konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)
if iReligion == iJewish:
if (rand <= 10):
if (pSpreadCity.isHasReligion(iHinduism) and pSpreadCity.isHolyCityByType(iJewish) == False):
pSpreadCity.setHasReligion(iReligion, False, False, False)
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Die Juden sind zum Hinduismus konvertiert!','AS2D_RELIGION_CONVERT',1,'Art/Interface/Buttons/Religions/Catholic.dds',ColorTypes(8),pSpreadCity.getX(),pSpreadCity.getY(),True,True)