[Mod Component]Policies grant buildings

Machiavelli24

Mod creator
Joined
May 9, 2012
Messages
818
Mod name: Policies grant buildings

Description:
This mod provides a simple, flexible, extensible way in xml (no additional lua required) for any Social Policy to grant any buildings, including new buildings that can not be constructed.

By adding rows in the new Policy_FreeBuildingClass you can create Social Policies that grant Specialists or let food be kept between population growth.
Code:
<Table name="Policy_FreeBuildingClass">
	<Column name="PolicyType" reference="Policies(Type)" type="text"/>
	<Column name="BuildingClassType" reference="BuildingClasses(Type)" type="text"/>
	<Column name="IsRemovedWhenPolicyBlocked" type="boolean" default="true"/>
</Table>

This mod does not alter any existing files (with the sole exception of adding an 'Unbuildable_pb' column to the Buildings table) ensuring it will not require a manual merge to work with your mod.

The mod's xml folder contains 'Policy_FreeBuildingClassExample.xml' which has examples of what can be done.
 
I've extended the functionality of this mod. There is now a BuildingInCapitalOnly column in the table. By setting this boolean true or false you can control if you want the building to be given to all cities or only one. This is useful, for example, if you wanted to make a social policy that used the Building_SpecialistYieldChanges table to give all engineers +2 hammers. Since entries Building_SpecialistYieldChanges effects engineers in every city using the BuildingInCapitalOnly will ensure that engineers only get +2 hammers once.

The table format is now:
Code:
<Table name="Policy_FreeBuildingClass">
    <Column name="PolicyType" reference="Policies(Type)" type="text"/>
    <Column name="BuildingClassType" reference="BuildingClasses(Type)" type="text"/>
    <Column name="IsRemovedWhenPolicyBlocked" type="boolean" default="true"/>
    <Column name="BuildingInCapitalOnly" type="boolean" default="false"/>
</Table>

Example: Make Freedom grant +10% Culture in every city.

First create a building with "BuildingClass_MyFreedom" that has <CultureRateModifier>10</CultureRateModifier>. This building should also have NeverCapture="true" NukeImmune="true" and Unbuildable_pb="true".

Then create an xml file with:
Code:
<Policy_FreeBuildingClass>
    <Row>
        <PolicyType>POLICY_FREEDOM</PolicyType>
        <BuildingClassType>BuildingClass_MyFreedom</BuildingClassType>
    </Row>
</Policy_FreeBuildingClass>
 
I have a question for the creator of the Mod: You have an example of how to make a policy grant a building in every city. Is it possible to make it create a building in only a limited number of cities, i.e. 4 cities, similar to how Legalism grants you only in your first 4 cities?
 
Could you please download it and re-upload it to CivFanatics (giving credit to the original author of course) for easier access than the horrendously bugged Workshop?
I think you will now find it here.
 
Top Bottom