Hi,
I was trying to figure how to make buildings change as new technologies are discovered, and created this little mod component.
Maybe someone else can also use it for something.
Here is a download link:
http://forums.civfanatics.com/downloads.php?do=file&id=7892
Technology Affected Buildings (TAB) v0.21
1. What is this?
Technology Affected Buildings (TAB) is a mod component which does nothing on it's own, but allows creating buildings that improve or change as the player discovers new technologies.
It is based on BTS 3.13 + Bhruic 1.21.
2. What bonues can technologies provide?
New techonlogies can modify the following parameters of the buildings:
- yield (food, production, commerce) change
- commerce (gold, research, culture, espionage) change
- max specialists
- yield (food, production, commerce) modifier (%)
- commerce (gold, research, culture, espionage) modifier (%)
Negative numbers are allowed, but they are very local in scope: they affect only the technology affected part of the building.
This means that negative numbers can be used to make previous tech bonuses obsolete, but they can not change the city's yield, commerce or max specialist values.
Example:
Let's say a forge is affected by Banking (+1 gold) and Industrialism (-1 gold, +1 production)
This means that with the discovering of Banking all forges start to produce +1 gold. After researching Industrialism the forges no longer produce gold, but they will provide +1 production.
If the forge is modified that it is only affecetd by Industrialism (-1 gold, +1 production) then with the discovery of Industrialism all forges start to give +1 production and the -1 gold is ignored.
3. Does the AI know about these bonuses?
I tried to make the active bonuses visible in the int CvCityAI::AI_buildingValueThreshold(BuildingTypes eBuilding, int iFocusFlags, int iThreshold) method.
I am not quite sure if I managed to add this to every place where needed so any feeedback is welcome.
The bonuses are not visible when the AI tries to select a new technology to research.
You should consider adjusting the flavors on the buildings and technologies you change in your mod.
4. How can I use TAB in a mod that does not have other SDK changes?
Copy the CvGameCoreDLL.dll to the Assets folder of your mod.
Copy the CvMainInterface.py to the Assets\Python\Screens folder of your mod.
(Or just copy the changes marked by Techology Affected Buildings BEGIN and END blocks.)
Copy the CIV4BuildingsSchema.xml to the Assets\XML\Buildings folder of your mod.
Copy the CIV4GameText_TAB.xml to the Assets\XML\Text folder of your mod.
Edit the BuildingInfos.xml in the Assets\XML\Buildings folder of your mod.
5. How can I use TAB in an SDK mod?
See the previous post and add the changes from the attacjed source files to your source.
(Be sure to apply BTS 3.13 patch and Bhruic's 1.21 patch before using this one).
I put all changes I made into a
//****************************************
// Technology Affected Buildings: BEGIN
//****************************************
//****************************************
// Technology Affected Buildings: END
//****************************************
block.
If instead of adding new content I changed existing lines, I put the original lines in the closing part after a "Was:" word.
//****************************************
// Technology Affected Buildings: END
// Was:
// <Original code.>
//****************************************
Hope it helps.
6. What are the new XML elements available in the Civ4BuildingInfos.xml?
To affect commerce change add a TechCommerceChanges element to the end of a building type definition:
Example:
Add 5 espionage with computers.
To affect yield change add a TechYieldChanges element to the end of a building type definition:
Example:
Add 1 food with refrigeration.
To affect allowed max specialists add TechSpecialistChanges element to the end of a building type definition:
Example:
Can turn 2 citizens to artist with mass media.
To affect commerce modifier add a TechCommerceModifiers element to the end of a building type definition:
Example:
Add 10% espionage with computers.
To affect yield modifier add a TechYieldModifiers element to the end of a building type definition:
Example:
Add 10% food with refrigeration.
7. What about the save files?
The mod adds and looks for new data in the save files, so it is not compatible with other saves, not even with TAB v0.1.
Sorry.
8. What is in the download?
There are three folders in the attached zip file:
TAB
This directory contains the compiled CvGameCoreDLL.dll and the support files. If you are creating a mod that does not have other SDK changes you need only these files to use TAB.
Assets\CvGameCoreDLL.dll
Assets\XML\Buildings\CIV4BuildingsSchema.xml
Assets\XML\Text\CIV4GameText_TAB.xml
Assets\Python\Screens\CvMainInterface.py
Src
The modified source files.
CvCity.cpp
CvCity.h
CvCityAI.cpp
CvDLLWidgetData.cpp
CvDLLWidgetData.h
CvEnums.h
CvGameTextMgr.cpp
CvGameTextMgr.h
CvInfos.cpp
CvInfos.h
CvTeam.cpp
CvTeam.h
CyEnumsInterface.cpp
CyTeam.cpp
CyTeam.h
CyTeamInterface.cpp
Example
Contains an example BuildingInfos.Xml which demonstrates how TAB can be used to modify the science buildings in the following way:
With education universities (seowons) can turn 1 citizen to scientist and 1 citizen to priest (+1 scientist, +1 priest).
With scientific method univerities (seowons) can turn 2 citizens to scientist and 0 to priest (+1 scientist, -1 priest).
With computers libraries (madrasas), observatories (salons) and laboratories (research institutes) provide +2 research.
With computers universities (seowons) provide +10% science.
Libraries (madrasas) can turn only 1 citizen to scientist (This is not TAB, just to balance out the extra scientists the universities add).
X
I was trying to figure how to make buildings change as new technologies are discovered, and created this little mod component.
Maybe someone else can also use it for something.
Here is a download link:
http://forums.civfanatics.com/downloads.php?do=file&id=7892
Technology Affected Buildings (TAB) v0.21
1. What is this?
Technology Affected Buildings (TAB) is a mod component which does nothing on it's own, but allows creating buildings that improve or change as the player discovers new technologies.
It is based on BTS 3.13 + Bhruic 1.21.
2. What bonues can technologies provide?
New techonlogies can modify the following parameters of the buildings:
- yield (food, production, commerce) change
- commerce (gold, research, culture, espionage) change
- max specialists
- yield (food, production, commerce) modifier (%)
- commerce (gold, research, culture, espionage) modifier (%)
Negative numbers are allowed, but they are very local in scope: they affect only the technology affected part of the building.
This means that negative numbers can be used to make previous tech bonuses obsolete, but they can not change the city's yield, commerce or max specialist values.
Example:
Let's say a forge is affected by Banking (+1 gold) and Industrialism (-1 gold, +1 production)
This means that with the discovering of Banking all forges start to produce +1 gold. After researching Industrialism the forges no longer produce gold, but they will provide +1 production.
If the forge is modified that it is only affecetd by Industrialism (-1 gold, +1 production) then with the discovery of Industrialism all forges start to give +1 production and the -1 gold is ignored.
3. Does the AI know about these bonuses?
I tried to make the active bonuses visible in the int CvCityAI::AI_buildingValueThreshold(BuildingTypes eBuilding, int iFocusFlags, int iThreshold) method.
I am not quite sure if I managed to add this to every place where needed so any feeedback is welcome.
The bonuses are not visible when the AI tries to select a new technology to research.
You should consider adjusting the flavors on the buildings and technologies you change in your mod.
4. How can I use TAB in a mod that does not have other SDK changes?
Copy the CvGameCoreDLL.dll to the Assets folder of your mod.
Copy the CvMainInterface.py to the Assets\Python\Screens folder of your mod.
(Or just copy the changes marked by Techology Affected Buildings BEGIN and END blocks.)
Copy the CIV4BuildingsSchema.xml to the Assets\XML\Buildings folder of your mod.
Copy the CIV4GameText_TAB.xml to the Assets\XML\Text folder of your mod.
Edit the BuildingInfos.xml in the Assets\XML\Buildings folder of your mod.
5. How can I use TAB in an SDK mod?
See the previous post and add the changes from the attacjed source files to your source.
(Be sure to apply BTS 3.13 patch and Bhruic's 1.21 patch before using this one).
I put all changes I made into a
//****************************************
// Technology Affected Buildings: BEGIN
//****************************************
//****************************************
// Technology Affected Buildings: END
//****************************************
block.
If instead of adding new content I changed existing lines, I put the original lines in the closing part after a "Was:" word.
//****************************************
// Technology Affected Buildings: END
// Was:
// <Original code.>
//****************************************
Hope it helps.
6. What are the new XML elements available in the Civ4BuildingInfos.xml?
To affect commerce change add a TechCommerceChanges element to the end of a building type definition:
Code:
<ElementType name="TechCommerceChanges" content="eltOnly">
<element type="TechCommerceChange" minOccurs="0" maxOccurs="*"/>
</ElementType>
<ElementType name="TechCommerceChange" content="eltOnly">
<element type="PrereqTech"/>
<element type="TechCommerce"/>
</ElementType>
<ElementType name="PrereqTech" content="textOnly"/>
<ElementType name="TechCommerce" content="eltOnly">
<element type="iCommerce" minOccurs="0" maxOccurs="*"/>
</ElementType>
<ElementType name="iCommerce" content="textOnly" dt:type="int"/>
Example:
Add 5 espionage with computers.
Code:
<TechCommerceChanges>
<TechCommerceChange>
<PrereqTech>TECH_COMPUTERS</PrereqTech>
<TechCommerce>
<iCommerce>0</iCommerce>
<iCommerce>0</iCommerce>
<iCommerce>0</iCommerce>
<iCommerce>5</iCommerce>
</TechCommerce>
</TechCommerceChange>
</TechCommerceChanges>
To affect yield change add a TechYieldChanges element to the end of a building type definition:
Code:
<ElementType name="TechYieldChanges" content="eltOnly">
<element type="TechYieldChange" minOccurs="0" maxOccurs="*"/>
</ElementType>
<ElementType name="TechYieldChange" content="eltOnly">
<element type="PrereqTech"/>
<element type="TechYield"/>
</ElementType>
<ElementType name="PrereqTech" content="textOnly"/>
<ElementType name="TechYield" content="eltOnly">
<element type="iYield" minOccurs="0" maxOccurs="*"/>
</ElementType>
<ElementType name="iYield" content="textOnly" dt:type="int"/>
Example:
Add 1 food with refrigeration.
Code:
<TechYieldChanges>
<TechYieldChange>
<PrereqTech>TECH_REFRIGERATION</PrereqTech>
<TechYield>
<iYield>1</iYield>
</TechYield>
</TechYieldChange>
</TechYieldChanges>
To affect allowed max specialists add TechSpecialistChanges element to the end of a building type definition:
Code:
<ElementType name="TechSpecialistChanges" content="eltOnly">
<element type="TechSpecialistChange" minOccurs="0" maxOccurs="*"/>
</ElementType>
<ElementType name="TechSpecialistChange" content="eltOnly">
<element type="PrereqTech"/>
<element type="SpecialistCounts"/>
</ElementType>
<ElementType name="PrereqTech" content="textOnly"/>
<ElementType name="SpecialistCounts" content="eltOnly">
<element type="SpecialistCount" minOccurs="0" maxOccurs="*"/>
</ElementType>
<ElementType name="SpecialistCount" content="eltOnly">
<element type="SpecialistType"/>
<element type="iSpecialistCount"/>
</ElementType>
<ElementType name="SpecialistType" content="textOnly"/>
<ElementType name="iSpecialistCount" content="textOnly" dt:type="int"/>
Example:
Can turn 2 citizens to artist with mass media.
Code:
<TechSpecialistChanges>
<TechSpecialistChange>
<PrereqTech>TECH_MASS_MEDIA</PrereqTech>
<SpecialistCounts>
<SpecialistCount>
<SpecialistType>SPECIALIST_ARTIST</SpecialistType>
<iSpecialistCount>2</iSpecialistCount>
</SpecialistCount>
</SpecialistCounts>
</TechSpecialistChange>
</TechSpecialistChanges>
To affect commerce modifier add a TechCommerceModifiers element to the end of a building type definition:
Code:
<ElementType name="TechCommerceModifiers" content="eltOnly">
<element type="TechCommerceModifier" minOccurs="0" maxOccurs="*"/>
</ElementType>
<ElementType name="TechCommerceModifier" content="eltOnly">
<element type="PrereqTech"/>
<element type="TechCommerce"/>
</ElementType>
<ElementType name="PrereqTech" content="textOnly"/>
<ElementType name="TechCommerce" content="eltOnly">
<element type="iCommerce" minOccurs="0" maxOccurs="*"/>
</ElementType>
<ElementType name="iCommerce" content="textOnly" dt:type="int"/>
Example:
Add 10% espionage with computers.
Code:
<TechCommerceModifiers>
<TechCommerceModifier>
<PrereqTech>TECH_COMPUTERS</PrereqTech>
<TechCommerce>
<iCommerce>0</iCommerce>
<iCommerce>0</iCommerce>
<iCommerce>0</iCommerce>
<iCommerce>10</iCommerce>
</TechCommerce>
</TechCommerceModifier>
</TechCommerceModifiers>
To affect yield modifier add a TechYieldModifiers element to the end of a building type definition:
Code:
<ElementType name="TechYieldModifiers" content="eltOnly">
<element type="TechYieldModifier" minOccurs="0" maxOccurs="*"/>
</ElementType>
<ElementType name="TechYieldModifier" content="eltOnly">
<element type="PrereqTech"/>
<element type="TechYield"/>
</ElementType>
<ElementType name="PrereqTech" content="textOnly"/>
<ElementType name="TechYield" content="eltOnly">
<element type="iYield" minOccurs="0" maxOccurs="*"/>
</ElementType>
<ElementType name="iYield" content="textOnly" dt:type="int"/>
Example:
Add 10% food with refrigeration.
Code:
<TechYieldModifiers>
<TechYieldModifier>
<PrereqTech>TECH_REFRIGERATION</PrereqTech>
<TechYield>
<iYield>10</iYield>
</TechYield>
</TechYieldModifier>
</TechYieldModifiers>
7. What about the save files?
The mod adds and looks for new data in the save files, so it is not compatible with other saves, not even with TAB v0.1.
Sorry.
8. What is in the download?
There are three folders in the attached zip file:
TAB
This directory contains the compiled CvGameCoreDLL.dll and the support files. If you are creating a mod that does not have other SDK changes you need only these files to use TAB.
Assets\CvGameCoreDLL.dll
Assets\XML\Buildings\CIV4BuildingsSchema.xml
Assets\XML\Text\CIV4GameText_TAB.xml
Assets\Python\Screens\CvMainInterface.py
Src
The modified source files.
CvCity.cpp
CvCity.h
CvCityAI.cpp
CvDLLWidgetData.cpp
CvDLLWidgetData.h
CvEnums.h
CvGameTextMgr.cpp
CvGameTextMgr.h
CvInfos.cpp
CvInfos.h
CvTeam.cpp
CvTeam.h
CyEnumsInterface.cpp
CyTeam.cpp
CyTeam.h
CyTeamInterface.cpp
Example
Contains an example BuildingInfos.Xml which demonstrates how TAB can be used to modify the science buildings in the following way:
With education universities (seowons) can turn 1 citizen to scientist and 1 citizen to priest (+1 scientist, +1 priest).
With scientific method univerities (seowons) can turn 2 citizens to scientist and 0 to priest (+1 scientist, -1 priest).
With computers libraries (madrasas), observatories (salons) and laboratories (research institutes) provide +2 research.
With computers universities (seowons) provide +10% science.
Libraries (madrasas) can turn only 1 citizen to scientist (This is not TAB, just to balance out the extra scientists the universities add).
X