Building only buildable in capital

Joined
Oct 5, 2009
Messages
344
Location
Germany
Hello!

I have written (and "published" via steam workshop) a small mod adding a Magrailhub to the game. This should add a +20% modifier to the capital as an compensation for the missing bonus other cities get for a magrail-connection.

Problematicly it can be build in every city once Fabrication is researched. Here is the code:

<GameData>
<Buildings>
<Row>
<Type>BUILDING_MAGRAILHUB</Type>
<BuildingClass>BUILDINGCLASS_MAGRAILHUB</BuildingClass>
<Cost>300</Cost>
<ConquestProbability>0</ConquestProbability>
<PrereqTech>TECH_FABRICATION</PrereqTech>
<Capital>true</Capital> (bold only here)
<EnergyMaintenance>2</EnergyMaintenance>
<Description>TXT_KEY_BUILDING_MAGRAILHUB_DESC</Description>
<Civilopedia>TXT_KEY_BUILDING_MAGRAILHUB_PEDIA</Civilopedia>
<ArtDefineTag>ART_DEF_BUILDING_NETWORK</ArtDefineTag>
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>11</PortraitIndex>
</Row>
</Buildings>
<Building_YieldModifiers>
<Row>
<BuildingType>BUILDING_MAGRAILHUB</BuildingType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>20</Yield>
</Row>
</Building_YieldModifiers>
<Building_Flavors>
<Row>
<BuildingType>BUILDING_MAGRAILHUB</BuildingType>
<FlavorType>FLAVOR_PRODUCTION</FlavorType>
<Flavor>50</Flavor>
</Row>
</Building_Flavors>
</GameData>


Should the capital true line not make sure it can only be built in capital? Is the position of the capital line in the buildings-block important? Or are there other parameters to make a building capital only?

Would be nice if somebody with more modding skill and experience could help me with this. Thanks!:)
 
<Capital> does not mean "can only be built in the capital" but "this building makes the city it is in the capital" (it is only used for the Palace/HQ)

If you want to limit a building only to the capital you'll need to use Lua, specifically the CityCanConstruct() event handler
 
Adding:
Code:
<Building_ClassesNeededInCity>
     <Row>
          <BuildingType>BUILDING_MAGRAILHUB</BuildingType>
          <BuildingClassType>BUILDINGCLASS_HEADQUARTERS</BuildingClassType>
      </Row>
</Building_ClassesNeededInCity>
would make it buildable only in cities which already have a Headquarters building, and since only the capitol has a headquarters that should achive the desired effect.
 
Back
Top Bottom