def onBeginPlayerTurn....does nothing? o.0

omegaflames

Warlord
Joined
Sep 21, 2012
Messages
181
ok so I decided to give the Grigori the ability to spread religions (and still keep in the tradition that they not be actively involved) so I decided to have a small chance that when a unit that has a religion dies it can spawn a disciple in the Grigori lands. Then to make sure that the disciple is used only to spread religions I would at the beginning of every turn for the Grigori have all the disciple units be set to have that mission. My current code for making sure they are used to spread religions is
Code:
	def onBeginPlayerTurn(self, argsList):
		'Called at the beginning of a players turn'
		iGameTurn, iPlayer = argsList
		pPlayer = gc.getPlayer(iPlayer)
		player = PyPlayer(iPlayer)
		CvUtil.pyPrint('check6')
		CyInterface().addImmediateMessage(check6, None)

		if pPlayer.isHuman():
			CvUtil.pyPrint('check5')
			CyInterface().addImmediateMessage(check5, None)
			apUnitList = player.getUnitList()
			for pUnit in apUnitList:
				if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_GRIGORI'):
					CvUtil.pyPrint('check1')
					CyInterface().addImmediateMessage(check1, None)
					if pUnit.getUnitClassType() == gc.getInfoTypeForString('UNITCLASS_DISCIPLE_THE_ASHEN_VEIL'):
						CvUtil.pyPrint('check2')
						CyInterface().addImmediateMessage(check2, None)
						pUnit.setXY(pUnit.getX(), pUnit.getY(), False, False, False)
						pCheck1 == pUnit.getGroup().getAutomateType()
						pCheck2 == pUnit.getGroup().getActivityType()
						CvUtil.pyPrint('check3 Automate is %d and Activity is %d' %(pCheck1, pCheck2))
						CyInterface().addImmediateMessage(check3, None)
						pUnit.getGroup().setAutomateType(gc.getInfoTypeForString('AUTOMATE_RELIGION'))
						pUnit.getGroup().setActivityType(gc.getInfoTypeForString('ACTIVITY_MISSION'))
						pCheck3 == pUnit.getGroup().getAutomateType()
						pCheck4 == pUnit.getGroup().getActivityType()
						CvUtil.pyPrint('check4 Automate is %d and Activity is %d' %(pCheck3, pCheck4))
						CyInterface().addImmediateMessage(check4, None)
						#CvUtil.pyPrint('Team %d has met Team %d' %(iTeamX, iHasMetTeamY))
						pUnit.getGroup().pushMission(MissionTypes.MISSION_SPREAD, iSpread, -1, -1, False, False, MissionAITypes.MISSIONAI_SPREAD, pUnit.plot(), pUnit)
						#pUnit.getGroup().pushMission(MissionTypes.MISSION_BUILD, iBuild, -1, -1, false, true, MissionAITypes.MISSIONAI_BUILD, pUnit.plot(), pUnit)
The thing is even after enabling logging I don't seem to have anything at all running in this code when my turn starts, not even the CyInterface nor CvUtil.pyPrint are doing anything
 
Let this be a lesson to you all...make sure you are editing the actual file being used by the game and not your backup.
 
if you make a new function with python that is called every turn you need to make an entry in the expansion.xml

i have not looked at your code
 
it's not a new function. The problem was I was editing my backup file for CvEventManager.py instead of the one being used by the game so all my changes weren't actually in the game when I went to test the new changes.
 
Top Bottom