[MODCOMP] Resource Tech Research Modifier Mod

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
Resource Tech Research Modifier Mod
By: TheLopez

Last Update: 08/25/10

Version: v0.3BtS
Patch Compatibility: Beyond the Sword v3.19
MP Compatible: ?
Download Mod v0.3BtS

Version: v0.2w
Patch Compatibility: Warlords v2.0.8.0
MP Compatible: ?
Download Mod v0.2w

Version: v0.1
Patch Compatibility: v1.61
MP Compatible: ?
Download Mod v0.1

Description:
This mod adds the tags to enable faster research of a technology if the
civilization has access to particular bonuses. So for instance in the sample
included CIV4BonusInfos.XML file copper is now revealed by Mining instead of
Bronze Working and if the civilization has access to copper then researching
Bronze Working will be 15% faster. To achieve this the following XML tag
snippet was added to the copper definition in CIV4BonusInfos.XML following the
<TechObsolete> tag.
Spoiler :
[PRE]
<ResearchPercentModifiers>
<ResearchPercentModifier>
<TechType>TECH_BRONZE_WORKING</TechType>
<iResearchModifer>15</iResearchModifer>
</ResearchPercentModifier>
</ResearchPercentModifiers>
[/PRE]

-----Notes to Modmakers-----

If you want to use this mod component in your mod I have tried to make things
as easy as possible for you. In the SDK files I have added
// < Resource Tech Research Modifier Start > and
// < Resource Tech Research Modifier End > in all of the places where changes
were made.

-----Version Information-----

-----v0.3BtS------

- Updated to be compatible with Beyond the Sword v3.19 patch.

Spoiler :


-----v0.2w------

- Updated to be compatible with Warlords v2.0.8.0 patch.

-----v0.1------

- Setup the Resource Tech Research Modifier Mod infrastructure

- Added the code needed to enable resources to provide a bonus for researching
technologies.


-----===Credits & Thanks===-----

- Exavier
Composite Mod - readme.txt format

- Aussie_Lurker
For providing the idea for the mod
 
Ooo, nothing like waking up and finding somthing neat under the tree. Very cool TheLopez. :)
 
Jeckel said:
Ooo, nothing like waking up and finding somthing neat under the tree. Very cool TheLopez. :)

Well you know me. I like to release something new every week or two.
 
Out of curiousity, would it work to put a negative number in the <iResearchModifer> tag and thereby make the tech slower to research?
 
Jeckel said:
Out of curiousity, would it work to put a negative number in the <iResearchModifer> tag and thereby make the tech slower to research?
Yes, you can :D

Gunner said:
This is a very good idea. You never fail to impress TheLopez :thumbsup:
Thanks, though I can't take all the credit for the idea, Aussie_Lurker proposed the idea to me...
 
Ooohh! The only thing more exciting perhaps than seeing something you wanted put into effect is seeing something you didn't even think of and the subsequent explosion of ideas in your mind when you see it! :D

Great work! :goodjob:
 
A feature request :p

Check if a resource/terrain/feature is inside your border to get bonus on research.

For example:
*If you have forrest in your empire you research woodcutting faster.
*Cheaper mining research if you have hills (and even cheaper with copper/iron resourse inside border).
*Cheaper whinery research if you have whine resource inside border.
 
Lopez,

Ran across an error while compiling:

Code:
CvPlayer.cpp(6127) : warning C4244: '=' : conversion from 'float' to 'int', possible loss of data

Here is the affected code...

Code:
	// < Resource Tech Research Modifier Start >
	[COLOR="Red"]float[/COLOR] fModifier = 0;
	for(int iI = 0; iI < GC.getNumBonusInfos(); iI++)
	{
		if(getNumAvailableBonuses((BonusTypes)iI) > 0 && GC.getBonusInfo((BonusTypes)iI).getResearchPercentModifier(eTech) != 0)
		{
			fModifier += (GC.getBonusInfo((BonusTypes)iI).getResearchPercentModifier(eTech));
		}
	}
	if(fModifier != 0)
	{
		//iTurnsLeft = iTurnsLeft * iModifier;
		[COLOR="red"]iTurnsLeft = iTurnsLeft * ((100 - fModifier)/100);[/COLOR]
	}
	// < Resource Tech Research Modifier End   >

The files will still compile without terminating, and the game seems to play just fine.

Is it anything to worry about? :confused:
 
It just means that fModifier contains (or rather, could potentially contain) values between whole numbers. If you put that into an integer, it lops off everything after the decimal place. If the game works perfectly dispite this, I would venture to guess that it's supposed to do that.
 
Updated Warlords version to be compatible with the v2.0.8.0 patch.
 
TheLopez said:
Updated Warlords version to be compatible with the v2.0.8.0 patch.

Found a tiny bug:

In CIV4BonusInfos.xml, it shows the following:

Code:
		<BonusInfo>
			<Type>BONUS_COPPER</Type>
			<Description>TXT_KEY_BONUS_COPPER</Description>
			<Civilopedia>TXT_KEY_BONUS_COPPER_PEDIA</Civilopedia>
			<BonusClassType>BONUSCLASS_RUSH</BonusClassType>
			<ArtDefineTag>ART_DEF_BONUS_COPPER</ArtDefineTag>
		[COLOR="Red"]	<TechReveal>TECH_BRONZE_WORKING</TechReveal>[/COLOR]
			<TechCityTrade>TECH_MINING</TechCityTrade>
			<TechObsolete>NONE</TechObsolete>
			<!-- Resource Tech Research Modifier Mod Start -->
			<ResearchPercentModifiers>
				<ResearchPercentModifier>
					<TechType>TECH_BRONZE_WORKING</TechType>
					<iResearchModifer>15</iResearchModifer>
				</ResearchPercentModifier>
			</ResearchPercentModifiers>
			<!-- Resource Tech Research Modifier Mod End   -->
			<YieldChanges>
				<iYieldChange>0</iYieldChange>
				<iYieldChange>1</iYieldChange>
				<iYieldChange>0</iYieldChange>
			</YieldChanges>
			<iAITradeModifier>10</iAITradeModifier>
			<iAIObjective>0</iAIObjective>
			<iHealth>0</iHealth>
			<iHappiness>0</iHappiness>
			<iPlacementOrder>1</iPlacementOrder>
			<iConstAppearance>100</iConstAppearance>
			<iMinAreaSize>3</iMinAreaSize>
			<iMinLatitude>0</iMinLatitude>
			<iMaxLatitude>90</iMaxLatitude>
			<Rands>
				<iRandApp1>10</iRandApp1>
				<iRandApp2>10</iRandApp2>
				<iRandApp3>0</iRandApp3>
				<iRandApp4>0</iRandApp4>
			</Rands>
			<iPlayer>50</iPlayer>
			<iTilesPer>128</iTilesPer>
			<iMinLandPercent>0</iMinLandPercent>
			<iUnique>0</iUnique>
			<iGroupRange>0</iGroupRange>
			<iGroupRand>0</iGroupRand>
			<bArea>0</bArea>
			<bHills>1</bHills>
			<bFlatlands>1</bFlatlands>
			<bNoRiverSide>1</bNoRiverSide>
			<bNormalize>0</bNormalize>
			<TerrainBooleans>
				<TerrainBoolean>
					<TerrainType>TERRAIN_GRASS</TerrainType>
					<bTerrain>1</bTerrain>
				</TerrainBoolean>
				<TerrainBoolean>
					<TerrainType>TERRAIN_PLAINS</TerrainType>
					<bTerrain>1</bTerrain>
				</TerrainBoolean>
				<TerrainBoolean>
					<TerrainType>TERRAIN_DESERT</TerrainType>
					<bTerrain>1</bTerrain>
				</TerrainBoolean>
				<TerrainBoolean>
					<TerrainType>TERRAIN_TUNDRA</TerrainType>
					<bTerrain>1</bTerrain>
				</TerrainBoolean>
				<TerrainBoolean>
					<TerrainType>TERRAIN_SNOW</TerrainType>
					<bTerrain>1</bTerrain>
				</TerrainBoolean>
			</TerrainBooleans>
			<FeatureBooleans/>
			<FeatureTerrainBooleans/>
		</BonusInfo>

According to the Readme, shouldn't the TechReveal be Mining?
 
Cool, too bad I missed this the first time around.
 
Updated with Beyond the Sword v3.19 compatible version
 
Top Bottom