Female Missionaries ModComp

There is a minor bug with the code for this that has been bothering me for awhile.
The problem is that if missionaries are not automated and are built in a city with a rally point the male missionaries go to that point but the female ones don't.

Here is the fix.

Code:
if oldunit.getGroup().isAutomated():
	pFemaleUnit.getGroup().setAutomateType(AutomateTypes.AUTOMATE_RELIGION)
[B]## If city has a rally point send the female missionary there
else:
	rallyPlot = city.getRallyPlot()
	if not (rallyPlot == None):
		pFemaleUnit.getGroup().pushMission(MissionTypes.MISSION_MOVE_TO, rallyPlot.getX(), rallyPlot.getY(), 0, False, True, MissionAITypes.NO_MISSIONAI, pFemaleUnit.plot(), pFemaleUnit)[/B]

Just add in the bold code into the Python for this mod. Remember to add the correct indentation for your version of the code.;)
 
Many thanks for that, never thought that there might be problems with rally points to be honest.

I have uploaded the updated mod and changed the credits accordingly.

Thanks again. :)
 
Oops! That code I posted can sometimes cause a CTD. It should be


Code:
if oldunit.getGroup().isAutomated():
	pFemaleUnit.getGroup().setAutomateType(AutomateTypes.AUTOMATE_RELIGION)
[B]## If city has a rally point send the female missionary there
else:
	rallyPlot = city.getRallyPlot()
	[COLOR="Red"]if rallyPlot.getX() > -1 and rallyPlot.getY() > -1:
[/COLOR]		pFemaleUnit.getGroup().pushMission(MissionTypes.MISSION_MOVE_TO, rallyPlot.getX(), rallyPlot.getY(), 0, False, True, MissionAITypes.NO_MISSIONAI, pFemaleUnit.plot(), pFemaleUnit)[/B]
 
Oops! That code I posted can sometimes cause a CTD. It should be


Code:
if oldunit.getGroup().isAutomated():
	pFemaleUnit.getGroup().setAutomateType(AutomateTypes.AUTOMATE_RELIGION)
[B]## If city has a rally point send the female missionary there
else:
	rallyPlot = city.getRallyPlot()
	[COLOR="Red"]if rallyPlot.getX() > -1 and rallyPlot.getY() > -1:
[/COLOR]		pFemaleUnit.getGroup().pushMission(MissionTypes.MISSION_MOVE_TO, rallyPlot.getX(), rallyPlot.getY(), 0, False, True, MissionAITypes.NO_MISSIONAI, pFemaleUnit.plot(), pFemaleUnit)[/B]
Thanks for the fix, I have uploaded the new version now. :)
 
Top Bottom