bugfix for working team starting techs

Master Lexx

Warlord
Joined
Nov 28, 2005
Messages
187
I tried to mak a bugfix so all players in a team have all their starting techs.

Since civ4 1.52, if you start your game in a team, all team players will start with just the 2 starting techs of one player.
I tried to make a bugfix, but it isn´t working, so maybe somebody can help me?

In this file: \Assets\Python\CvEventManager.py
under: def onGameStart(self, argsList):

PHP:
for iPlayer in range(gc.getMAX_PLAYERS()):
	pPlayer = gc.getPlayer(iPlayer)
	iTeam = pPlayer.getTeam()
	pTeam = gc.getTeam(iTeam)
	iCivType = pPlayer.getCivilizationType()
	for iTech in [25,26,27,56,0,57]:
		if gc.getCivilizationInfo(iCivType).isCivilizationFreeTechs(iTech):
			pTeam.setHasTech(iTech, 1, iPlayer, 0, 0)

I get the following error:

AttributeError: 'CvCivilizationInfo' object has no attribute 'isCivilizationFreeTechs'
ERR: Python function onEvent failed, module CvEventInterface

But it should work according: http://civilization4.net/files/modding/PythonAPI/

I also tried isCivilizationFreeTech (without s), but it doesn´t work.
The idea is, to give the player his starting tech after the game was created.
.
.
.
Okay, I got it working with another way, feel free to us it in a mod.
But this only supports the standard civ4 civilizations.
This goes into \Assets\Python\CvEventManager.py

PHP:
	def onGameStart(self, argsList):
		if (gc.getGame().getGameTurnYear() == gc.getDefineINT("START_YEAR")):
				.
				.
				.
			for iPlayer in range(gc.getMAX_PLAYERS()):
				pPlayer = gc.getPlayer(iPlayer)
				iCivType = pPlayer.getCivilizationType()
				iTeam = pPlayer.getTeam()
				pTeam = gc.getTeam(iTeam)
				#fishing
				for i in [0,5,8,11,15,17]:
					if i == iCivType:
						pTeam.setHasTech(25, 1, iPlayer, 0, 0)
				#the wheel
				for i in [1,4,6,11,12,13]:
					if i == iCivType:
						pTeam.setHasTech(26, 1, iPlayer, 0, 0)
				#agriculture
				for i in [0,3,4,6,9,14]:
					if i == iCivType:
						pTeam.setHasTech(27, 1, iPlayer, 0, 0)
				#hunting
				for i in [2,7,8,13,14,16]:
					if i == iCivType:
						pTeam.setHasTech(56, 1, iPlayer, 0, 0)
				#mysticism
				for i in [1,2,9,10,17]:
					if i == iCivType:
						pTeam.setHasTech(0, 1, iPlayer, 0, 0)
				#mining
				for i in [3,5,7,10,12,15,16]:
					if i == iCivType:
						pTeam.setHasTech(57, 1, iPlayer, 0, 0)
 
Back
Top Bottom