Need help with some basic modding related to placement restrictions.

Chiya

Chieftain
Joined
Nov 28, 2016
Messages
22
Hey all. I'd appreciate if anyone could offer some input on this.

I'm nowhere near good enough to make my own mod, so I'm using "NewWonders" mod as a base for this but I want to adjust the placement restrictions and wonder boons and yields but it's just not working out. The wonder yields are easy enough to change as you mostly just change values from something to something else .. But the restrictions on placement I just can't figure out no matter what I do if there's no code to refer to from the base game.. And for the thing below, there isn't.

I asked @Magil about having a wonder that must be adjacent to coast, but built on land. They suggested that I'd try adding coast="true" into the code because in buildings.xml there's the sea resort or w/e that must be built adjacent to coast .. Well, I did that but in game it'll always display as if no suitable location to construct this so it's clearly not working. Not sure what to do about it, other than changing it to something like "Must be adjacent to Fish" .. but that'd be kinda dumb since it's not like every coastal tile has fish.

Me and a friend were just wondering it it's possible to add something the code to allow things to be built on mountain tiles? What about a requirement on a wonder or a district that it must be built adjacent to a Natural Wonder? Not sure if that's even plausible but figure'd I'd ask anyway ..

Steam workshop and modding tools are out soon so I'm sure more things will be possible then but I'd like to get these to work now if they are possible?

Any help/input would be greatly appreciated.
 
I suspect the Coast flag in the Buildings table works the way it does in the Districts table (i.e. must be built *in* the water, like the harbour district), instead of like it does in the Improvements table (i.e. must be adjacent to water, like the beach resort). So that's probably not going to help you.

I'd suggest using "must be adjacent to a harbour district" instead, which would put it on a par with the other nautical-themed wonders already in the game.
 
Table <Buildings>:
Code:
<Row BuildingType="BUILDING_GREAT_LIGHTHOUSE" Name="LOC_BUILDING_GREAT_LIGHTHOUSE_NAME" 
	Description="LOC_BUILDING_GREAT_LIGHTHOUSE_DESCRIPTION" PrereqTech="TECH_CELESTIAL_NAVIGATION"
	Cost="290" AdvisorType="ADVISOR_CONQUEST"
	AdjacentDistrict="DISTRICT_HARBOR" MaxWorldInstances="1"
	IsWonder="true" RequiresPlacement="true"
	MustNotBeLake="true" MustBeAdjacentLand="true"
	ObsoleteEra="ERA_RENAISSANCE" Quote="LOC_BUILDING_GREAT_LIGHTHOUSE_QUOTE" QuoteAudio="Play_GREATLIGHTHOUSE_QUOTE"/>

<Row BuildingType="BUILDING_COLOSSUS" Name="LOC_BUILDING_COLOSSUS_NAME"
	Description="LOC_BUILDING_COLOSSUS_DESCRIPTION" PrereqTech="TECH_SHIPBUILDING"
	Cost="400" AdvisorType="ADVISOR_GENERIC"
	AdjacentDistrict="DISTRICT_HARBOR" MaxWorldInstances="1"
	IsWonder="true" RequiresPlacement="true"
	MustNotBeLake="true" MustBeAdjacentLand="true"
	ObsoleteEra="ERA_RENAISSANCE" Quote="LOC_BUILDING_COLOSSUS_QUOTE" QuoteAudio="Play_COLOSSUS_QUOTE"/>

<Row BuildingType="BUILDING_VENETIAN_ARSENAL" Name="LOC_BUILDING_VENETIAN_ARSENAL_NAME"
	Description="LOC_BUILDING_VENETIAN_ARSENAL_DESCRIPTION" PrereqTech="TECH_MASS_PRODUCTION"
	Cost="920" AdvisorType="ADVISOR_CONQUEST"
	AdjacentDistrict="DISTRICT_INDUSTRIAL_ZONE" MaxWorldInstances="1"
	IsWonder="true" RequiresPlacement="true"
	MustNotBeLake="true" MustBeAdjacentLand="true"
	ObsoleteEra="ERA_MODERN" Quote="LOC_BUILDING_VENETIAN_ARSENAL_QUOTE" QuoteAudio="Play_VENETIANARSENAL_QUOTE_01"/>
The commonalities are in the designations for MustNotBeLake, and MustBeAdjacentLand. In addition, these wonders have the following requirements:
Code:
	<Building_ValidTerrains>
		<Row BuildingType="BUILDING_COLOSSUS" TerrainType="TERRAIN_COAST"/>
		<Row BuildingType="BUILDING_GREAT_LIGHTHOUSE" TerrainType="TERRAIN_COAST"/>
		<Row BuildingType="BUILDING_VENETIAN_ARSENAL" TerrainType="TERRAIN_COAST"/>
	</Building_ValidTerrains>
This forces them to be constructed on coastal tiles. ie, in the water as opposed to next to it.

Ocean tiles actually come in two types: "TERRAIN_COAST" and "TERRAIN_OCEAN"
Lakes are actually "TERRAIN_COAST" but with special rules applied to the size of the body of water in terms of number of tiles.

For comparison, the relevant parts of Huey Toecalli:
Code:
<Buildings>
	<Row BuildingType="BUILDING_HUEY_TEOCALLI" Name="LOC_BUILDING_HUEY_TEOCALLI_NAME"
	Description="LOC_BUILDING_HUEY_TEOCALLI_DESCRIPTION" PrereqTech="TECH_MILITARY_TACTICS"
	Cost="710"
	MaxWorldInstances="1" IsWonder="true"
	MustBeLake="true" MustBeAdjacentLand="true"
	RequiresPlacement="true" ObsoleteEra="ERA_INDUSTRIAL"
	Quote="LOC_BUILDING_HUEY_TEOCALLI_QUOTE" QuoteAudio="Play_HUEITEOCALLI_QUOTE"/>
</Buildings>
<Building_ValidTerrains>
	<Row BuildingType="BUILDING_HUEY_TEOCALLI" TerrainType="TERRAIN_COAST"/>
</Building_ValidTerrains>
Note that
Code:
MustBeLake="true"
is used instead of
Code:
MustNotBeLake="true"
 
Last edited:
@LeeS

Assume I'm an idiot because I guess I am when it comes to this stuff. How does what you wrote help me determine how to set a placement restriction on wonder so that it must be adjacent to coast, but built on land? Specifying the valid terrain is easy enough in Building_ValidTerrain. but nowhere I see a way to require a coast tile to be adjacent. In the Buildings.xml they only use MustBeAdjacentLand line, but there's no counterpart for coast like MustBeAdjacentCoast ..
 
sorry, I misread your OP.

I read it as you wanted to force it next to land but be placed in the water.

Your best bet would be as already mentioned and force it to be adjacent to a Harbor district. Like Colossus and Great Lighthouse. But you then state the valid terrains as land terrains.

Something like this:
Code:
<GameInfo>
	<Types>
		<Row Type="BUILDING_NEW_WONDER" Kind="KIND_BUILDING"/>
	</Types>
	<Buildings>
		<Row BuildingType="BUILDING_NEW_WONDER" Name="LOC_BUILDING_NEW_WONDER_NAME"
		Description="LOC_BUILDING_NEW_WONDER_DESCRIPTION" PrereqTech="TECH_MILITARY_TACTICS"
		Cost="210" MaxWorldInstances="1" IsWonder="true"
		AdjacentDistrict="DISTRICT_HARBOR"
		RequiresPlacement="true" ObsoleteEra="ERA_INDUSTRIAL"
		Quote="LOC_BUILDING_NEW_WONDER_QUOTE" />
	</Buildings>
	<Building_ValidTerrains>
		<Row BuildingType="BUILDING_NEW_WONDER" TerrainType="TERRAIN_GRASS_HILLS"/>
		<Row BuildingType="BUILDING_NEW_WONDER" TerrainType="TERRAIN_PLAINS_HILLS"/>
		<Row BuildingType="BUILDING_NEW_WONDER" TerrainType="TERRAIN_TUNDRA_HILLS"/>
		<Row BuildingType="BUILDING_NEW_WONDER" TerrainType="TERRAIN_SNOW_HILLS"/>
		<Row BuildingType="BUILDING_NEW_WONDER" TerrainType="TERRAIN_DESERT_HILLS"/>
		<Row BuildingType="BUILDING_NEW_WONDER" TerrainType="TERRAIN_GRASS"/>
		<Row BuildingType="BUILDING_NEW_WONDER" TerrainType="TERRAIN_PLAINS"/>
		<Row BuildingType="BUILDING_NEW_WONDER" TerrainType="TERRAIN_TUNDRA"/>
		<Row BuildingType="BUILDING_NEW_WONDER" TerrainType="TERRAIN_SNOW"/>
		<Row BuildingType="BUILDING_NEW_WONDER" TerrainType="TERRAIN_DESERT"/>
	</Building_ValidTerrains>
</GameInfo>
 
Last edited:
My own testing shows that Coast="true" doesn't appear to do what you want for Wonders (odd that it's not used for the actual coastal wonders based on that), so adjacent to a Harbor district or sea resource is probably the only alternative.
 
EDIT: I actually now do recall coming across them before, and perhaps they are unsuitable. However, at the very least the second one (adjacent to lake) suggests a plot on land, rather than in water.

How about using these requirement formulas to limit the placement?

<Row Type="REQUIREMENT_PLOT_ADJACENT_TO_COAST" Kind="KIND_REQUIREMENT"/>
<Row Type="REQUIREMENT_PLOT_ADJACENT_TO_LAKE" Kind="KIND_REQUIREMENT"/>
<Row Type="REQUIREMENT_PLOT_ADJACENT_TO_RIVER" Kind="KIND_REQUIREMENT"/>

Regards,

GB
 
Thinking about this further, there is a requirement set that can be modified to require land placement adjacent to water. Nan Madol suzerain bonus grants a culture yield to districts placed either on coast in water or on coast on land. So, there must be a way to modify the requirement formula to suit your needs. See Leaders.xml for the Nan Madol example. Partially excerpted below:

Code:
        <Row>
            <ModifierId>MINOR_CIV_NAN_MADOL_DISTRICTS_CULTURE_BONUS</ModifierId>
            <ModifierType>MODIFIER_PLAYER_DISTRICTS_ADJUST_YIELD_CHANGE</ModifierType>
            <SubjectRequirementSetId>PLOT_IS_OR_ADJACENT_TO_COAST</SubjectRequirementSetId>
        </Row>
        <Row>
            <RequirementSetId>PLOT_IS_OR_ADJACENT_TO_COAST</RequirementSetId>
            <RequirementSetType>REQUIREMENTSET_TEST_ANY</RequirementSetType>
        </Row>
        <Row>
            <RequirementSetId>PLOT_IS_OR_ADJACENT_TO_COAST</RequirementSetId>
            <RequirementId>REQUIRES_PLOT_IS_COAST</RequirementId>
        </Row>
        <Row>
            <RequirementSetId>PLOT_IS_OR_ADJACENT_TO_COAST</RequirementSetId>
            <RequirementId>REQUIRES_PLOT_IS_ADJACENT_TO_COAST</RequirementId>
        </Row>
        <Row>
            <RequirementId>REQUIRES_PLOT_IS_COAST</RequirementId>
            <RequirementType>REQUIREMENT_PLOT_IS_COAST</RequirementType>
        </Row>
        <Row>
            <RequirementId>REQUIRES_PLOT_IS_ADJACENT_TO_COAST</RequirementId>
            <RequirementType>REQUIREMENT_PLOT_ADJACENT_TO_COAST</RequirementType>
        </Row>
 
You can absolutely easily make a RequirementSet that works for modifiers using those conditions, which would only function if something was coastal, but that doesn't work as a placement requirement to my knowledge.
 
Top Bottom