Building Districts on Water tiles

Joined
Feb 20, 2017
Messages
782
Location
Kepler-22b
Is there a way to create a trait (or multiple) for a leader ability where they can build any district on Lake, Coast or Ocean tiles without having to recreate every district with just the valid terrain modified?

The Harbour is proof that you can build districts on water tiles but that is coded into the core of the game to do so, is there a way to do something similar to Egypt's Floodplains trait? (Although Floodplains are a "feature" and I believe Coast/Lake/Ocean are terrain)
 
Coastal tiles and Lakes are both "TERRAIN_COAST"

There is no "FEATURE_LAKE". Lakes are determined by water-body size of "TERRAIN_COAST" and the limitation for the max size of a lake is in <GlobalParameters> row
Code:
<Replace Name="LAKE_MAX_AREA_SIZE" Value="9" />
I have not tried upping the setting to see if the game actually pays attention to this setting or if it is also hard-coded within the DLL as some things are that are listed in <GlobalParameters>
 
I should've added that the code enables it for all players. Not quite sure yet how to restrict it to one.
\

Same way you would with any other custom feature... add the TraitType to the Districts table and define the Trait for the Civ or Leader. Here is an example

Code:
-- Types
-------------------------------------  
INSERT INTO Types  
        (Type,                                        Kind)
VALUES    ('TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER',    'KIND_TRAIT');
-------------------------------------          
-- Traits          
-------------------------------------              
INSERT INTO Traits              
        (TraitType,                                    Name,                                                Description)
VALUES    ('TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER',    'LOC_TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER_NAME',    'LOC_TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER_DESCRIPTION');
-------------------------------------
-- CivilizationTraits
-------------------------------------  
INSERT INTO CivilizationTraits  
        (TraitType,                                        CivilizationType)
VALUES    ('TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER',        'CIVILIZATION_YOUR_CIV_OR_LEADER');
-----------------------------------------------------------------------------------
-- Districts
-----------------------------------------------------------------------------------
INSERT INTO Districts
            (DistrictType,            Name,                            Description,                            PrereqCivic,            PlunderType,        PlunderAmount,    AdvisorType,        Cost,    CostProgressionModel,                        CostProgressionParam1,    Maintenance,    RequiresPlacement,    RequiresPopulation,    Aqueduct,    NoAdjacentCity,    InternalOnly,    ZOC,    CaptureRemovesBuildings,    CaptureRemovesCityDefenses,    MilitaryDomain, Appeal,    CityStrengthModifier,    TraitType)
VALUES        ('DISTRICT_GA_CHAVON',    'LOC_DISTRICT_GA_CHAVON_NAME',    'LOC_DISTRICT_GA_CHAVON_DESCRIPTION',    'CIVIC_DRAMA_POETRY',    'PLUNDER_CULTURE',    25,                'ADVISOR_CULTURE',    30, '    COST_PROGRESSION_NUM_UNDER_AVG_PLUS_TECH',    25,                        1,                1,                    1,                    0,            0,                0,                0,        0,                            0,                            'NO_DOMAIN',    1,        2,                        'TRAIT_CIVILIZATION_DISTRICT_GA_CHAVON');

I used the CivilizationTraits as base, but you can add this to a leader by using LeaderTraits instead.
 
Actually, I didn't even think that far lol
The easy solution is creating a unique improvement for your civ...
I don't think they would be modifiers that would allow you to build certain improvements on certain tiles.
 
Was thinking of replying in my thread rather than hijacking this dude's, but since this could very well be relevant to his:

How am I getting the adjustment to ValidTerrains in the trait itself if it isn't a unique improvement but just a change to the base farm? I'm sorry if it's in there, but I've went over it five times and can't find the connection, and TraitType doesn't work for just the ValidTerrains argument.

Is that possible, or do I need to make a unique farm improvement?

Thanks for bothering to answer at all, bud!
Yeah, I tried that at first; my mod is an alternative leader with an ability based on CivBE Rising Tide, so my first plan was to have generic farms be buildable on water tiles, which seem impossible for just 1 leader (although it is possible to enable for everyone but the model is invisable on water tiles, too)
So I've resorted to adjacency to coast (which Australia then took) so now I just want the ability to build districts on water tiles (although farms will still be great to build on there too if it is possible!)
 
\

Same way you would with any other custom feature... add the TraitType to the Districts table and define the Trait for the Civ or Leader. Here is an example

Code:
-- Types
-------------------------------------
INSERT INTO Types
        (Type,                                        Kind)
VALUES    ('TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER',    'KIND_TRAIT');
-------------------------------------        
-- Traits        
-------------------------------------            
INSERT INTO Traits            
        (TraitType,                                    Name,                                                Description)
VALUES    ('TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER',    'LOC_TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER_NAME',    'LOC_TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER_DESCRIPTION');
-------------------------------------
-- CivilizationTraits
-------------------------------------
INSERT INTO CivilizationTraits
        (TraitType,                                        CivilizationType)
VALUES    ('TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER',        'CIVILIZATION_YOUR_CIV_OR_LEADER');
-----------------------------------------------------------------------------------
-- Districts
-----------------------------------------------------------------------------------
INSERT INTO Districts
            (DistrictType,            Name,                            Description,                            PrereqCivic,            PlunderType,        PlunderAmount,    AdvisorType,        Cost,    CostProgressionModel,                        CostProgressionParam1,    Maintenance,    RequiresPlacement,    RequiresPopulation,    Aqueduct,    NoAdjacentCity,    InternalOnly,    ZOC,    CaptureRemovesBuildings,    CaptureRemovesCityDefenses,    MilitaryDomain, Appeal,    CityStrengthModifier,    TraitType)
VALUES        ('DISTRICT_GA_CHAVON',    'LOC_DISTRICT_GA_CHAVON_NAME',    'LOC_DISTRICT_GA_CHAVON_DESCRIPTION',    'CIVIC_DRAMA_POETRY',    'PLUNDER_CULTURE',    25,                'ADVISOR_CULTURE',    30, '    COST_PROGRESSION_NUM_UNDER_AVG_PLUS_TECH',    25,                        1,                1,                    1,                    0,            0,                0,                0,        0,                            0,                            'NO_DOMAIN',    1,        2,                        'TRAIT_CIVILIZATION_DISTRICT_GA_CHAVON');

I used the CivilizationTraits as base, but you can add this to a leader by using LeaderTraits instead.
So... I need to add a brand new SQL file that inserts the code you provided into the base-game districts file as apposed to into my Leader's GameDefines SQL file?
I am a noob at this coding malarkey... I've kinda hijacked someone else's mod and coded over that because I had no idea where to start. I don't even know how on Earth I'm going to "package" all of this together and upload as a mod. I kinda want someone to hold my hand... But I'm getting there... slowly... I think...
 
The game does not care how much different stuff you pile into the same file so long as it is correct for the Action-Type the file is being loaded by.

You can put civ, improvement, unit, district, building, traits, etc. all in the same file so long as it all belongs to <InGameActions> and <UpdateDatabase>

What you cannot do is mix stuff that needs to be <FrontEndActions> with <InGameActions> in the same file nor stuff that needs to be <UpdateDatabase> in the same file as stuff that needs to be <UpdateIcons> or <UpdateText>

Nor do the file names you use matter when the file is loaded from any of <UpdateDatabase>, <UpdateIcons> or <UpdateText>. You can call the file Cheeseburger.sql if you want to.
 
\

Same way you would with any other custom feature... add the TraitType to the Districts table and define the Trait for the Civ or Leader. Here is an example

Code:
-- Types
-------------------------------------
INSERT INTO Types
        (Type,                                        Kind)
VALUES    ('TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER',    'KIND_TRAIT');
-------------------------------------        
-- Traits        
-------------------------------------            
INSERT INTO Traits            
        (TraitType,                                    Name,                                                Description)
VALUES    ('TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER',    'LOC_TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER_NAME',    'LOC_TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER_DESCRIPTION');
-------------------------------------
-- CivilizationTraits
-------------------------------------
INSERT INTO CivilizationTraits
        (TraitType,                                        CivilizationType)
VALUES    ('TRAIT_CIVILIZATION_DISTRICT_BUILD_ON_WATER',        'CIVILIZATION_YOUR_CIV_OR_LEADER');
-----------------------------------------------------------------------------------
-- Districts
-----------------------------------------------------------------------------------
INSERT INTO Districts
            (DistrictType,            Name,                            Description,                            PrereqCivic,            PlunderType,        PlunderAmount,    AdvisorType,        Cost,    CostProgressionModel,                        CostProgressionParam1,    Maintenance,    RequiresPlacement,    RequiresPopulation,    Aqueduct,    NoAdjacentCity,    InternalOnly,    ZOC,    CaptureRemovesBuildings,    CaptureRemovesCityDefenses,    MilitaryDomain, Appeal,    CityStrengthModifier,    TraitType)
VALUES        ('DISTRICT_GA_CHAVON',    'LOC_DISTRICT_GA_CHAVON_NAME',    'LOC_DISTRICT_GA_CHAVON_DESCRIPTION',    'CIVIC_DRAMA_POETRY',    'PLUNDER_CULTURE',    25,                'ADVISOR_CULTURE',    30, '    COST_PROGRESSION_NUM_UNDER_AVG_PLUS_TECH',    25,                        1,                1,                    1,                    0,            0,                0,                0,        0,                            0,                            'NO_DOMAIN',    1,        2,                        'TRAIT_CIVILIZATION_DISTRICT_GA_CHAVON');

I used the CivilizationTraits as base, but you can add this to a leader by using LeaderTraits instead.

So I tried this with no success (the game didn't crash this time though!):
Code:
INSERT INTO Types  
        (Type,                                                            Kind)
VALUES    ('TRAIT_LEADER_JFD_TRANS_SIBERIAN_RAILWAY',                        'KIND_TRAIT');
              
INSERT INTO Traits              
        (TraitType,                                                        Name,                                                    Description)
VALUES    ('TRAIT_LEADER_JFD_TRANS_SIBERIAN_RAILWAY',                        'LOC_TRAIT_LEADER_JFD_TRANS_SIBERIAN_RAILWAY_NAME',        'LOC_TRAIT_LEADER_JFD_TRANS_SIBERIAN_RAILWAY_DESCRIPTION');

INSERT INTO TraitModifiers          
        (TraitType,                                                        ModifierId)
VALUES   ('TRAIT_LEADER_JFD_TRANS_SIBERIAN_RAILWAY',                        'TRAIT_AVI_COASTAL_CAMPUS');
INSERT INTO Modifiers  
        (ModifierId,                                                    ModifierType,                                                SubjectRequirementSetId)
VALUES  ('TRAIT_AVI_COASTAL_CAMPUS',                                    'MODIFIER_ALL_CITIES_TERRAIN_ADJACENCY',                    null);

INSERT INTO ModifierArguments
        (ModifierId,                                                    Name,                    Value,                                Extra,                Type)
VALUES
        ('TRAIT_AVI_COASTAL_CAMPUS',                                    'DistrictType',            'DISTRICT_CAMPUS',                     null,                'ARGTYPE_IDENTITY'),
        ('TRAIT_AVI_COASTAL_CAMPUS',                                    'Description',            'LOC_TRAIT_AVI_COASTAL_CAMPUS',     null,                'ARGTYPE_IDENTITY'),
        ('TRAIT_AVI_COASTAL_CAMPUS',                                    'District_ValidTerrains',            'TERRAIN_COAST',                         null,                'ARGTYPE_IDENTITY');
And yes, I'm coding over the top of JFD's Nicholas mod, It was the alternative leader mod I could understand at the time and pick up the basics.
 
"MODIFIER_ALL_CITIES_TERRAIN_ADJACENCY" is the wrong ModifierType, that's for sure. That is used to change the adjacency bonuses given by terrain. The closest thing to what you're looking for is "MODIFIER_PLAYER_CITIES_ADJUST_VALID_FEATURES_DISTRICTS", which only affects features. Isn't a direct modifier for terrain. From what I gather, you'll need to either create a custom district, or enable it for everyone on that sort of terrain. These are features, which are all that may work with the modifier I just gave you: http://civilization.wikia.com/wiki/Terrain_(Civ6)#Features

Although I'm not even sure if that'll work, or if there's something else you're missing. Not good enough to pick those things out without context (or even with oftentimes).

By the way, you'll go a long way if you start looking at your Database and Modding logs in Documents\my games\Sid Meier's Civilization VI\Logs. Want to get on that pronto.
Oh, the adjacent stuff was left over from me giving up with trying to build farms and districts on the sea previously so I just made it so I got adjacency bonuses to the coast, but it's not suitable at all. I saw the "VALID FEATURES" part from Egypt, but as I tried at the very beginning, it doesn't work with terrain.
As for custom districts I think I would just give up on the custom districts and just make the custom farms instead, but I tried that too and it didn't work either (even when pulling apart other people's mods' code too).
 
Did you add this to Farms in addition to changing ValidTerrains?

Domain="DOMAIN_SEA"

Not sure if this is the correct way to approach trying to do it, but as a start:

Code:
INSERT INTO Improvements          
        (ImprovementType,               Domain)
VALUES    ('IMPROVEMENT_FARM',      'DOMAIN_SEA');

Edit: Okay. That does not work.
This is the XML code to get farms to be buildable on Coast/Lakes and Ocean for everyone:
Code:
<GameInfo>
    <Improvement_ValidTerrains>
        <Row ImprovementType="IMPROVEMENT_FARM" TerrainType="TERRAIN_COAST"/>
        <Row ImprovementType="IMPROVEMENT_FARM" TerrainType="TERRAIN_OCEAN"/>
    </Improvement_ValidTerrains>
<GameInfo>
But I don't know how to limit it to just a single leader without creating a "unique improvement" (I don't like breaking the status quo in having only 1 unique infustructure, but I guess having a 'sea farm' is just like the Roman Fort in the base game which seems to exist because there was no way of giving Legion unit the ability to build standard Forts).
And everytime I've tried to create or mod an improvement, I fail to do so.

But ideally I would just need to implement a custom improvement which has all of the effects and adjacency of a normal farm which also gets the adjacency from regular land farms and then implement regular farms to have adjacency next to sea farms. (Might need to see if I can mod the Feudalism Inspiration requirement to work for sea farms too) but then an issue is the model, in which the standard farm model is invisible on water tiles so might need to have a unique graphic or the graphic could be replaced with fishing boats or even oil rigs would do.
 
I don't like breaking the status quo in having only 1 unique infustructure...
Who says that's status quo? My custom civ has a Unique District (replaces Theater), Unique Building (replaces Broadcast Center), Unique Improvement (replaces Beachside Resort)... I am working on adding Unique Great People (Musicians, and maybe Writers) in my next update.
 
Who says that's status quo? My custom civ has a Unique District (replaces Theater), Unique Building (replaces Broadcast Center), Unique Improvement (replaces Beachside Resort)... I am working on adding Unique Great People (Musicians, and maybe Writers) in my next update.
Well it seems to be the status quo set by Fraixis so far, only broken by the Romans in the case of the Bath AND "Roman Fort" which is exactly the same as a fort but buildable by Legions.
I like to keep as close to the official standards as possible. ...although my "alternative leader mod" has an [animated] Anthropomorphic leader:
Spoiler Image :
01 Composit.png
 
hahahahaha
Awesome!!!
Wish I had the skills to do the artwork :D
So do I. Unfortunately the model and animation was a paid comission. I kinda wish I could just pay someone to complete my mod for me too right now... :undecide:
 
Just keep at it... you will get the hang of it.
If not by trial and error (like most of us), by copying what someone else has already done (like all of us :D)
 
Top Bottom