goody hut having an affair with a python, xml sized.....

cromcrom

Cernu
Joined
Nov 11, 2005
Messages
268
Location
Chateauroux
ok, I am still trying to create the following effect,

that when a tech is researched, another one is randomly discarded from the list of available techs for that civ.

The goody hut sometimes gives a random tech from a list of not yet researched tech for that civ.
Where can I find this random choosing of the tech ?

I guess I would have to create a iSetIsDisabled function, same as a bIsDisabled function exists, that is already used in CvPlayer.

So I hope that by studying the goody hut effect, the python and sdk part, I might come into something....

Anybody could give help or piece of advice, please ?
 
The python function i send you by PM should be OK for trade and goody acquisition . However "that when a tech is researched, another one is randomly discarded from the list of available techs for that civ." should be a little more difficult to do because you need to save the random tech chosen somewhere and i don't know how to do that simply .

Tcho !

Spoiler :
Code:
	def cannotResearch(self,argsList):
		ePlayer = argsList[0]
		eTech = argsList[1]
		bTrade = argsList[2]
		pPlayer = gc.getPlayer(ePlayer)
		pTeam = gc.getTeam(pPlayer.getTeam())

		# if a tech is in the dictionnary keys , the associated tech can't be reasearched if the tech is owned by the team
		# if you want that TECH_1 prevent TECH_2 to be researched and vice versa you need to enter the 2 tech in the list
		# in the example :
		# TECH_MACHIN1 prevent TECH_MACHIN2 to be researched
		# TECH_MACHIN10 and TECH_MACHIN11 prevent each other to be researched
		# TECH_MACHIN20 prevent TECH_MACHIN21 ,TECH_MACHIN22 , TECH_MACHIN23 to be reseached

		dictTech = {
                        "TECH_MACHIN1" : ["TECH_MACHIN2"] ,
                        "TECH_MACHIN10" : ["TECH_MACHIN11"] ,
                        "TECH_MACHIN11" : ["TECH_MACHIN10"] ,
                        "TECH_MACHIN20" : ["TECH_MACHIN21", "TECH_MACHIN22", "TECH_MACHIN23"]
                        }

		for techType in dictTech.keys() :
                        iTech = gc.getInfoTypeForString(techType)
                        if pTeam.isHasTech(iTech) :
                                if eTech in [gc.getInfoTypeForString(item) for item in dictTech[techType]] :
                                        return True
                return False
 
Back
Top Bottom