chooseTech (free Tech popup) for the AI?

Cybah

Emperor
Joined
Jun 22, 2007
Messages
1,481
This does not work for the AI:

PHP:
## free tech testing start ##
		if pPlayer.isHuman():
			pPlayer.chooseTech(1, '', False)
		if not pPlayer.isHuman():
			pPlayer.AI_chooseFreeTech()
## free tech testing end ##

For the human player everything is fine.

The AI won't select any new tech with "pPlayer.chooseTech(1, '', False)" and "pPlayer.AI_chooseFreeTech()" does not seem to work either. I've tried both.

Any ideas? How can I give free techs to AI players?
 
this seems to work:

PHP:
## free tech testing start ##
		if pPlayer.isHuman:
			pPlayer.chooseTech(1,'',True)
		if not pPlayer.isHuman():
			techs = []
			team = gc.getTeam(pPlayer.getTeam())
			for iTech in range(gc.getNumTechInfos()):
				if pPlayer.canResearch(iTech, false):
					iCost = team.getResearchLeft(iTech)
					if iCost > 0:
						techs.append((-iCost, iTech))
			if techs:
				techs.sort()
				iTech = techs[0][1]
				team.setHasTech(iTech, True, iPlayer, false, false)
## free tech testing end ##

Thanks ² History in the Making. ;)
 
Top Bottom