Timed Settler Mod For BtS

shanpooter

Chieftain
Joined
Feb 14, 2006
Messages
14
A long time ago I downloaded a mod that did not allow settlers to be built, but gave one to each civ every so many turns. When Warlords was released a wonderful modder (Stu, I believe was his name) created a new one to be compatible. I would love to have this mod for Beyond the Sword. Would anyone be interested in making one or pointing me toward a tutorial on how to update the current one? I've never modded before, and am a little overwhelmed and wouldn't know where to start.
 
I've tried to adapt the MOD , but i don't understand why my changes in CvGameUtils are not taking in count . Sorry

Tcho !
 
Oh don't be sorry! Thanks for trying. And thanks for the Warlords mod. If you do happen to get it to works, please let me know.
 
Can someone help me please , this begin to drive me crazy . I don't understand why my change in CvGameUtils don't work ( i just prevent settler to be built in cannotTrain ) . But the function is not called at all ( i've tried to change CvGameInterface , change the name and change CvGameInterfaceFile , ... but the function is still not called ) .

Thanks , tcho !
 
In CvEventManager, you want to hook into onBeginPlayerTurn (I recoded a bit too):

Code:
def onBeginPlayerTurn(self, argsList):
	'Called at the beginning of a players turn'
	iGameTurn, iPlayer = argsList
	CvUtil.pyPrint('onBeginPlayerTurn %s' %(iGameTurn))
	
	# Timed Settler MOD Begin
	iFirstTurnSettler =5
	iTurnsBetweenSettlers = 7
	if iGameTurn >= iFirstTurnSettler:
		if (iGameTurn-iFirstTurnSettler)%iTurnsBetweenSettlers == 0:
			if iPlayer != gc.getBARBARIAN_PLAYER():
				pPlayer = gc.getPlayer(iPlayer)
				if pPlayer.isAlive():
					pCity = pPlayer.getCapitalCity()
					if not pCity.isNone():
						pPlayer.initUnit(gc.getCivilizationInfo(pPlayer.getCivilizationType()).getCivilizationUnits(gc.getInfoTypeForString('UNITCLASS_SETTLER')),pCity.getX(),pCity.getY(),UnitAITypes.NO_UNITAI,DirectionTypes.DIRECTION_NORTH)
	# Timed Settler MOD End

Edit: You're right about the AI; it's better to do it the way you did it originally:
Code:
 def cannotTrain(self,argsList):
		pCity = argsList[0]
		eUnit = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		bIgnoreUpgrades = argsList[5]
		# Timed Settler MOD Begin
		if gc.getUnitInfo(eUnit).getUnitClassType() == gc.getInfoTypeForString('UNITCLASS_SETTLER'):
			return True
		# Timed Settler MOD End
		return False
 
Thank you very much , i didn't know that cannotTrain needed to be called in CvMainInterface with BtS :) . I will post the code later for Shanpooter .

Tcho !

Edit : i will make a test tomorrow . Are you sure that AI player can't train settler with this method ?
 
Further reasearch reveals that you have to open the file "PythonCallbackDefines.xml" and change the value of USE_CANNOT_TRAIN_CALLBACK from 0 to 1.
 
Further reasearch reveals that you have to open the file "PythonCallbackDefines.xml" and change the value of USE_CANNOT_TRAIN_CALLBACK from 0 to 1.

Thank you very much , i didn't know that . :)

here the little mod . line 371 , 372 in CvEventManager.py to edit the frequency of the settlers .

Tcho !
 

Attachments

Thank you both so much. I don't know why I like this mod so much. Probably because I'm not a very advanced player, and I like being able to focus on a few things at a time without the AI completely taking over.

Thanks again!
 
Back
Top Bottom