Well to start off with I created 2 new functions in CvTeam (its realy a piece of cake to add new functions, I do it all the time, its cleaner/easier then making a bunch of little changes in other functions and you can often re-use them (or give them to other people
)
The function your using seems kind of crude, your not doing any checking to see if they HAVE the tech being taken away, its just getting any random tech in the whole game. Inorder to be belivable your going to need to focus the effect on the players relitivly resent techs. When a civilization goes into a dark age it the relitivly cutting edge "high" knowlage which is lost, so for example after the fall of Rome, Liturature, Architecture, Philosopy and other such techs are "lost" not things like the wheel or Bronze Working. I'd sugjest you create functions to select these types of techs.
Below are 2 of the functions in my Spy mod. The first one getRandomStealableTech randomly selects a tech that the calling Team (A) could steal from the argument team (B) , this means that either A lacks in and B has it or B simply is ahead of A in researchprogress (on a percetial basis), I hard coded a minimum of 10% greater progress so you wouldn't get situations ware you steal a measly 3 research points. The second function is rather self explamitory, I use it to normalize the AI's progress relitive to the Players as the AI gets its techs for less points depending on the games difficulty.
Code:
int CvTeam::getRandomStealableTech(TeamTypes eTeam)
{
bool* pbTechs = new bool[GC.getNumTechInfos()];
int i;
int counter = 0;
CvWString sTech;
for(i = 0; i < GC.getNumTechInfos(); i++)
{
if (!isHasTech((TechTypes) i))
{
if(GET_TEAM(eTeam).isHasTech((TechTypes) i))
{
if (true /*canStealTech((TechTypes) i)*/ ) // option for additional checking function
{
pbTechs[i] = true;
counter++;
continue;
}
}
if(getPercentResearchProgress((TechTypes) i) + 10 < GET_TEAM(eTeam).getPercentResearchProgress((TechTypes) i))
{
pbTechs[i] = true;
counter++;
continue;
}
pbTechs[i] = false;
}
pbTechs[i] = false;
}
if (counter == 0)
{
SAFE_DELETE_ARRAY(pbTechs);
logMsg("Returning NO_TECH");
return NO_TECH;
}
counter = GC.getGameINLINE().getSorenRandNum(counter, "Random Stealable Tech");
for (i = 0; i < GC.getNumTechInfos(); i++)
{
if (pbTechs[i])
{
if (counter == 0)
{
SAFE_DELETE_ARRAY(pbTechs);
return i;
}
counter--;
}
}
SAFE_DELETE_ARRAY(pbTechs);
return NO_TECH;
}
int CvTeam::getPercentResearchProgress(TechTypes eTech) const
{
if (isHasTech((TechTypes) eTech))
{
return 100;
}
return (getResearchProgress((TechTypes) eTech) * 100 / getResearchCost((TechTypes) eTech)) ;
}
void CvTeam::setResearchProgress(TechTypes eIndex, int iNewValue, PlayerTypes ePlayer)
Is an existing function by Firaxis, its normaly called each turn to roll the players research into their current tech goal, it then checks if your in excess of the tech cost and if so gives the tech by setting the hasTech boolean and giving you overflow. After its given a player a tech it dosn't do anything with the progress resulting in imidate re-aquisition next turn.
If you do this you should be able to wipe out the tech completly with the folowing 2 Python calls or if you want to get into the sourcecode and do something their as well that would also work, depends on what your more comfortable with (but I recomend working in the SDK because of its greater power)
Code:
gc.getTeam(gc.getPlayer(iCiv).getTeam()).setHasTec h(iForgottenTech, False, iCiv, False, False)
gc.getTeam(gc.getPlayer(iCiv).getTeam()).changeResearchProgress(iForgottenTech, 0, iCiv)