How can I mod the future tech for a military bonus?

Colon

King
Joined
Sep 25, 2001
Messages
872
I want to mod the game to give the future tech a military bonus aside of the health&happiness bonus it gives, to add some extra incentive to keep science up. I was thinking of say an universal increase in strength (say 5% or so), but I'm open for suggestions if that'd be hard to implement. I'm not looking for anything complicated.
 
There is nothing I can see in the Technology XML which would allow this.

You can't have a building, unit or promotion on that tech either as it would never be available since you have not finished studying it.

I can't think of a simple XML solution.
 
Yeah, I took a look as well and I also didn't see anything that'd qualify. Basically, if I want stronger units, then I'd have to create them all anew with higher values and attach them to a new tech, correct?
 
Well, I've begun to do just that.

Silly question: it isn't possible to insert new techs and units in existing (premodded) save games? When I start a new game things work fine, but when I load an existing save it crashes. I was hoping I could insert the changes in the base game and use the new techs and units in older saves, rather than create a separate mod for it.
 
The only way to use an old save would be to open one without your new changes, enter World Builder, save the game as a WBS file (.CivBeyondSwordWBSave), apply your new changes and play from the created "scenario" (WBS) file.

A bit complicated and you would loose some data in the process (computations for GP, exp for GG, espionage points,...).
 
Well, if new changes imply suppressing units, buildings, resources that are on the WBS, then you will get errors (and crash if you suppress a terrain).

But adding stuff is fine, the WBS file doesn't mind that. :)
 
I've been thinking of going about it another way: would it be possible to to automatically give units a free promotion when the tech is discovered, the way some events give a promotion?
 
I want to mod the game to give the future tech a military bonus aside of the health&happiness bonus it gives, to add some extra incentive to keep science up. I was thinking of say an universal increase in strength (say 5% or so), but I'm open for suggestions if that'd be hard to implement. I'm not looking for anything complicated.

you can catch the Future Tech in the SDK :
void CvTeam::setHasTech
Code:
		if (GC.getTechInfo(eIndex).isRepeat())
		{
			m_paiTechCount[eIndex]++;

			setResearchProgress(eIndex, 0, ePlayer);

			// report event to Python
			CvEventReporter::getInstance().techAcquired(eIndex, getID(), ePlayer, bAnnounce && 1 == m_paiTechCount[eIndex]);

			if (1 == m_paiTechCount[eIndex])
			{
				if (bAnnounce)
				{
					if (GC.getGameINLINE().isFinalInitialized() && !(gDLL->GetWorldBuilderMode()))
					{
						announceTechToPlayers(eIndex);
					}
				}
			}
		}

and get the count. then add a modifier to combat in int CvUnit::maxCombatStr
 
Ok, I can't get it to work, mainly because I'm not sure what you were telling me and this stuff goes over my head.

In CvUnit.cpp, under int CvUnit::baseCombatStr() const, I added the following:

Code:
        if (1 == m_paiTechCount[eIndex])

        {iExtraCombatPercent = 5;
        }

But that didn't seem to obviously change anything.
 
Back
Top Bottom