Can research disabled techs

snarko

DLLer
Joined
Dec 9, 2003
Messages
1,512
Location
Sweden
If you disable a tech and enable a tech requiring the first you can research both by clicking on the second in the science advisor screen. Also the AI can research disabled techs.

However until fixed by firaxis you can fix this yourself. Below is the code I've used including the line before and after to make finding where to put it easy. File is CvTechChooser.py.
Code:
screen.setActivation( szTechID, ActivationTypes.ACTIVATE_MIMICPARENTFOCUS )
#DISABLEFIXHUMAN
if ( gc.getPlayer(g_civSelected).isResearchingTech(i) and not gc.getPlayer(g_civSelected).canEverResearch(i) ):
[tab]gc.getPlayer(g_civSelected).clearResearchQueue()
[tab]self.updateTechRecords()
#ENDDISABLEFIXHUMAN
if ( gc.getTeam(gc.getPlayer(g_civSelected).getTeam()).isHasTech(i) ):
...and this will fix it for the AI (I think). This goes under onTechSelected in CvEventManager. Note that this will also make the AI research a new tech. You can remove that part but the AI seems to research nothing for a few turns then.
Code:
iTechType, iPlayer = argsList
#DISABLEFIXAI
if not gc.getPlayer(iPlayer).canEverResearch(iTechType):
[tab]gc.getPlayer(iPlayer).clearResearchQueue()
[tab]if not gc.getPlayer(iPlayer).isHuman():
[tab][tab]i = gc.getNumTechInfos()
[tab][tab]while i:
[tab][tab][tab]if gc.getPlayer(iPlayer).canResearch(i, False) or gc.getPlayer(iPlayer).canResearch(i, True):
[tab][tab][tab][tab]gc.getPlayer(iPlayer).pushResearch(i, True)
[tab][tab][tab][tab]i = 0
[tab][tab][tab]i -= 1
#ENDDISABLEFIXAI
if (not self.__LOG_TECH):

Below is an attached file with a modified techtree to show the bug aswell as a file with my first fix. Not the AI fix, check again tomorrow.
 

Attachments

Perhaps you can also indicate in your post which .PY file is affected by this? It looks like you edited a Python file.

In addition, you might want to include installation instructions, i.e. instructing people to which local assets directory they can copy the file so they don't destroy their original installation if things go wrong.
 
Included which file it is. As for install instructions I assumed that anyone making techs like this will know how to add things to their mods. Since there are no disabled techs in the original game only mod makers should need this - and even then only if they want to make techs some people can research and others cannot.
 
Hmm better fix than nothing... just curious though... what happens if you were researching something else, then clicked on a tech that you were banned from researching... would it stop researching the one you were working on? (granted you don't *lose* anything if so, but it would be a minor annoyance...)

Also, what if you can't research the tech, but then you obtain it by trading? Will this let you develop child-techs if you have the parent techs still?

RH
 
I wonder - will this fix the following problem I have:

I created techs for each religion and used the DisableTech command in the Civ XLM to prevent certain Civs from reseraching certain religions (for exemple only India can research hinduism). And yet after testing various Civs they can still research Hinduism... Seems that command is broken.



G.
 
Yes I believe this will fix your problem. I used that method to disable the tech on a per-civilization scale and tested and it shows up as disabled in the UI (but then lets you research it by clicking on a child tech). So it seems likely that the two flags basically do the same thing, just one is global and the other is civilization level...

Now if only Firaxis had seen fit to add it at the leader level... :sad:

RH
 
RobHunt said:
Yes I believe this will fix your problem. I used that method to disable the tech on a per-civilization scale and tested and it shows up as disabled in the UI (but then lets you research it by clicking on a child tech). So it seems likely that the two flags basically do the same thing, just one is global and the other is civilization level...

Now if only Firaxis had seen fit to add it at the leader level... :sad:

RH

Are you saying that the DisableTech command is aborted for everyone else because Hinduism is allowed to India ? I repeated the same command for every civ.

Many of those techs have prerequisites available to all and that must remain so (for instance Bhuddism is derived from Writing - so writing must remain available to all but only the asian Civs must be able to have Bhuddism as a follow up tech possibility). On the other hand I don't know why I bother since the AI never seem to be researching them anyway... Despite my having jacked up the flavor Religion to 10 for all those religious techs.



G.
 
No you misunderstand me.

bDisableTech appears in the main tech tree file, and if set to 1 there it disables globally -- ie, for all civs. Whatever is at the civilization level would then be ignored.

But if you use it in the civilization file, it will disable for only that one civ. Everybody else still gets it.

RH
 
RobHunt said:
No you misunderstand me.

bDisableTech appears in the main tech tree file, and if set to 1 there it disables globally -- ie, for all civs. Whatever is at the civilization level would then be ignored.

But if you use it in the civilization file, it will disable for only that one civ. Everybody else still gets it.

RH

This is what is written for each Civ:

<FreeTechs>
<FreeTech>
<TechType>TECH_HUNTING</TechType>
<bFreeTech>1</bFreeTech>
</FreeTech>
<FreeTech>
<TechType>TECH_BURIAL_RITUALS</TechType>
<bFreeTech>1</bFreeTech>
</FreeTech>
</FreeTechs>
<DisableTechs>
<DisableTech>
<TechType>TECH_HINDUISM</TechType>
<bDisableTech>1</bDisableTech>
</DisableTech>
<DisableTech>
<TechType>TECH_BUDDHISM</TechType>
<bDisableTech>1</bDisableTech>
</DisableTech>
<DisableTech>
<TechType>TECH_CONFUCIANISM</TechType>
<bDisableTech>1</bDisableTech>
</DisableTech>
</DisableTechs>


I presume the value " 1 " means yes right - sometimes it seem to mean no...


G.
 
Yes, what you have written will disable a tech for a single civilization.

What I was referring to was the fact that there is also a global disable option in the main tech tree file "CIV4TechInfos.xml"

Code:
<Civ4TechInfos xmlns="x-schema:CIV4TechnologiesSchema.xml">
	<TechInfos>
		<TechInfo>
			<Type>TECH_MYSTICISM</Type>
[snip]
			<bRepeat>0</bRepeat>
			<bTrade>1</bTrade>
			<bDisable>0</bDisable>
			<bGoodyTech>1</bGoodyTech>

If you set bDisable here to 1, you disable it for everybody.

Sorry for getting my tag names goofed I was working from memory earlier.

RH
 
RobHunt said:
If you set bDisable here to 1, you disable it for everybody.

Sorry for getting my tag names goofed I was working from memory earlier.

RH


Well they're all at 1 in the Civ file - for everyone - and at 0 in the tech file for each of those religious techs... So it must be another command that isn't working.

Thx anyway.



G.
 
grallon... I'm sorry, I'm not quite sure what you're asking. Is your problem:

A) India cannot research the tech it's supposed to be able to research (your new hinduism tech).

OR

B) You think Germany (for example) can still research hinduism even though you don't want them to.

If B), then the fix above should fix things for you.
If A), then I'm not sure what's going on.

RH
 
That's right - India can research Hinduism but all the others can as well.

*sigh* This modding business is like groping in the dark.



G.
 
Sorry but the fix have no effect on the AI, only humans. I wasn't aware that the AI can research disabled techs too... I'll try to figure out how to fix that.

edit: Think I've managed to fix it. Will put the new fix in the first post. This new fix doesn't fix the first bug so both are needed... one for humans and one for the AI.
 
Cool. One question -- if you want to make it less likely that the AI will research a tech that is disabled, and if you're only going to auto-assign it, never allow it to be researched, do you think a very high cost would help reduce the odds the AI would pick it?

Guess all I need now is to figure out how to give a tech to a person on game start and everything I need for finishing my current mod will be available... I realize it's off topic but if you're bored I'd appreciate it if you could give me some hints...

RH
 
RobHunt said:
Guess all I need now is to figure out how to give a tech to a person on game start and everything I need for finishing my current mod will be available... I realize it's off topic but if you're bored I'd appreciate it if you could give me some hints...

That's really easy, just look in the CIV4CivilizationInfos.xml file and put your tech in the <FreeTechs> spot and that civ will start with it.
 
Sorry Snaitf, by person I meant leader, not civ...

I know it's going to have to go in OnGameStart or something similar as a python script, but I'm just not quite sure how to do it and haven't had the time to dig in just yet...

But thanks for responding anyway...

RH
 
Back
Top Bottom