1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[SOLVED] Problem with theater adjacency bonus from harbors

Discussion in 'Mod Creation Help' started by frutiemax, Dec 30, 2019.

Tags:
  1. frutiemax

    frutiemax Chieftain

    Joined:
    Jan 19, 2015
    Messages:
    53
    I'd like to add a culture adjacency bonus on the theater districts from adjacent harbors. I tried, but the encampment and city center seem to be taken as harbors?

    Here is the database update code:

    Code:
    --harbor district theater adjacency
    INSERT INTO Adjacency_YieldChanges    (ID,                                    Description,         YieldType,   YieldChange,    TilesRequired,    OtherDistrictAdjacent,    AdjacentSeaResource,    AdjacentTerrain,    AdjacentFeature,    AdjacentRiver,    AdjacentWonder,    AdjacentNaturalWonder,    AdjacentImprovement,        AdjacentDistrict,    PrereqCivic,    PrereqTech,    ObsoleteCivic,    ObsoleteTech,    AdjacentResource,    AdjacentResourceClass,             Self)
    VALUES(                                'Harbor_Culture',    'LOC_DISTRICT_HARBOR_CULTURE',    'YIELD_CULTURE',            1,                1,                        0,                        0,                NULL,            NULL,            0,                      0,                    0,                       NULL,       'DISTRICT_HARBOR',        NULL,            NULL,        NULL,            NULL,                0,                'NO_RESOURCECLASS',            0);
    
    INSERT INTO District_Adjacencies (DistrictType, YieldChangeId)
    VALUES                            ('DISTRICT_THEATER','Harbor_Culture');
    Text update code:

    Code:
    INSERT INTO LocalizedText (Language, Tag, Text)
    VALUES                            ('en_US','LOC_DISTRICT_HARBOR_CULTURE','+{1_num} [ICON_Culture] Culture from the adjacent {1_Num : plural 1?Harbor; other?Harbors;}.');
    I am not sure what the AdjacentDistrict field means... Any help would be great!

    HarborAdjacencyBug.PNG
     
  2. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    6,965
    Location:
    Illinois, USA
    Are you running any other mods? If so, shut them all off.
    What if anything is being reported in Database.log ?
    I can't see anything obviously wrong with your code. You are using the AdjacentDistrict correctly. You state a specific district that must be adjacent to the plot where the new district is to be placed.*


    * it will also apply for a district that is later placed adjacent.
     
  3. frutiemax

    frutiemax Chieftain

    Joined:
    Jan 19, 2015
    Messages:
    53
    Thanks for the response. Here is a database.log:

    Code:
    [1507151.698] [Localization]: StartupErrorMessages.xml
    [1507151.698] [Localization]: Input XML does not contain database entry tags. GameData, GameInfo or Database
    [1507155.744] [Localization]: Validating Foreign Key Constraints...
    [1507155.746] [Localization]: Passed Validation.
    [1507155.866] [Configuration]: Validating Foreign Key Constraints...
    [1507155.867] [Configuration]: Passed Validation.
    [1507165.169] [FullTextSearch]: Initializing FullTextSearch
    [1507165.954] [Gameplay]: Validating Foreign Key Constraints...
    [1507165.966] [Gameplay]: Passed Validation.
    [1507167.215] [Configuration]: Validating Foreign Key Constraints...
    [1507167.215] [Configuration]: Passed Validation.
    [1507168.410] [HallofFame]: Database found. Checking versions...
    [1507168.418] [HallofFame]: Database is up-to-date!
    [1507184.491] [FullTextSearch]: FTS - Creating Context
    [1507188.253] [FullTextSearch]: FTS - Creating Context
    [1507203.602] [Configuration]: Validating Foreign Key Constraints...
    [1507203.602] [Configuration]: Passed Validation.
    [1507229.994] [Configuration]: Validating Foreign Key Constraints...
    [1507229.995] [Configuration]: Passed Validation.
    [1507239.029] [Gameplay]: Validating Foreign Key Constraints...
    [1507239.052] [Gameplay]: Passed Validation.
    [1507247.835] [FullTextSearch]: FTS - Creating Context
    [1507247.835] [FullTextSearch]: FTS - Creating Context
    [1507248.283] [FullTextSearch]: FTS - Creating Context
    [1507248.612] [FullTextSearch]: FTS - Creating Context
    [1507250.036] [FullTextSearch]: FTS - Creating Context
    
    I have more SQL insertions in the same mod. I could replicate the same bug with campus districts but not the holy site? I'll try to comment a whole bunch of code and see if I can get this working.

    EDIT - OK I did a quick test with Dido and this code (same logic but for campus and cothon).

    Code:
    INSERT INTO Adjacency_YieldChanges    (ID,                                                            Description,         YieldType,        YieldChange,    TilesRequired,    OtherDistrictAdjacent,    AdjacentSeaResource,    AdjacentTerrain,    AdjacentFeature,    AdjacentRiver,    AdjacentWonder,    AdjacentNaturalWonder,    AdjacentImprovement,        AdjacentDistrict,    PrereqCivic,    PrereqTech,    ObsoleteCivic,    ObsoleteTech,    AdjacentResource,    AdjacentResourceClass,             Self)
    VALUES(                                'Cothon_Science',    'LOC_DISTRICT_COTHON_SCIENCE',    'YIELD_SCIENCE',                  1,                1,               1,                        0,                NULL,            NULL,            0,            0,                    0,                       NULL,                        'DISTRICT_COTHON',        NULL,            NULL,        NULL,            NULL,                0,                'NO_RESOURCECLASS',            0);
    
    INSERT INTO District_Adjacencies (DistrictType, YieldChangeId)
    VALUES                            ('DISTRICT_CAMPUS','Cothon_Science');
    Here is the localization:
    Code:
    INSERT INTO LocalizedText (Language, Tag, Text)
    VALUES                            ('en_US','LOC_DISTRICT_COTHON_SCIENCE','+{1_num} [ICON_Science] Science from the adjacent {1_Num : plural 1?Harbor; other?Harbors;}.');
    I guess the devs never intended this to work???

    EDIT2 - log from example
    Code:
    [1508471.127] [Localization]: StartupErrorMessages.xml
    [1508471.127] [Localization]: Input XML does not contain database entry tags. GameData, GameInfo or Database
    [1508473.784] [Localization]: Validating Foreign Key Constraints...
    [1508473.784] [Localization]: Passed Validation.
    [1508473.797] [Configuration]: Validating Foreign Key Constraints...
    [1508473.797] [Configuration]: Passed Validation.
    [1508482.667] [FullTextSearch]: Initializing FullTextSearch
    [1508483.051] [Gameplay]: Validating Foreign Key Constraints...
    [1508483.067] [Gameplay]: Passed Validation.
    [1508483.633] [Configuration]: Validating Foreign Key Constraints...
    [1508483.634] [Configuration]: Passed Validation.
    [1508484.503] [HallofFame]: Database found. Checking versions...
    [1508484.505] [HallofFame]: Database is up-to-date!
    [1508499.224] [FullTextSearch]: FTS - Creating Context
    [1508508.815] [Configuration]: Validating Foreign Key Constraints...
    [1508508.816] [Configuration]: Passed Validation.
    [1508516.053] [Gameplay]: Validating Foreign Key Constraints...
    [1508516.081] [Gameplay]: Passed Validation.
    [1508524.167] [FullTextSearch]: FTS - Creating Context
    [1508524.167] [FullTextSearch]: FTS - Creating Context
    [1508524.494] [FullTextSearch]: FTS - Creating Context
    [1508524.809] [FullTextSearch]: FTS - Creating Context
    [1508525.947] [FullTextSearch]: FTS - Creating Context
    [1508562.460] [Configuration]: Validating Foreign Key Constraints...
    [1508562.461] [Configuration]: Passed Validation.
    [1508563.161] [FullTextSearch]: FTS - Creating Context
    [1508581.552] [Configuration]: Validating Foreign Key Constraints...
    [1508581.553] [Configuration]: Passed Validation.
    [1508589.034] [Gameplay]: Validating Foreign Key Constraints...
    [1508589.060] [Gameplay]: Passed Validation.
    [1508597.375] [FullTextSearch]: FTS - Creating Context
    [1508597.376] [FullTextSearch]: FTS - Creating Context
    [1508597.663] [FullTextSearch]: FTS - Creating Context
    [1508597.930] [FullTextSearch]: FTS - Creating Context
    [1508599.045] [FullTextSearch]: FTS - Creating Context
    
     

    Attached Files:

    Last edited: Dec 30, 2019
  4. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    6,965
    Location:
    Illinois, USA
    Try changing from
    Code:
    +{1_num} [ICON_Science] Science from the adjacent {1_Num : plural 1?Harbor; other?Harbors;}.
    to
    Code:
    +{1_num} [ICON_Science] Science from adjacent Cothons.
    I've never had any trouble like you are having getting District Adjacencies to work correctly, but for adjacent district designations I've never specified the text-string in the manner you are, I've always used as in the example test code. Only when I've used map elements such as mountains or forests have I used the text-string method you are using.

    Trying the text-string this way will validate whether it is a graphical text-string bug with the District-Placement lua file or if you are having an actual gameplay bug.
     
  5. frutiemax

    frutiemax Chieftain

    Joined:
    Jan 19, 2015
    Messages:
    53
    Thanks for the help LeeS. I tried what you recommended.

    Code:
    --cothon tile adjacency descriptions
    INSERT INTO LocalizedText (Language, Tag, Text)
    --VALUES                            ('en_US','LOC_DISTRICT_COTHON_SCIENCE','+{1_num} [ICON_Science] Science from the adjacent {1_Num : plural 1?Harbor; other?Harbors;}.');
    VALUES                            ('en_US','LOC_DISTRICT_COTHON_SCIENCE','+{1_num} [ICON_Science] Science from the adjacent Cothons.');
    However I have the same behavior. I guess it's a bug?
     

    Attached Files:

  6. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    6,965
    Location:
    Illinois, USA
    Sure looks to be a bug. I had not noticed any with GS before but one may have been inadvertently been added in a recent patch.
    You could zip the folder of your mod as it currently is in the game's Mods folder, and attach the zip to a forum post so I can run it on my end to verify if I get the same thing,
     
  7. frutiemax

    frutiemax Chieftain

    Joined:
    Jan 19, 2015
    Messages:
    53
    Sure, here it is. In the sql file, you can also replicate the same problem with theater districts and industrial zones I think. Holy sites and commercial hubs seem to work fine with the harbor adjacency bonus.
     

    Attached Files:

  8. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    6,965
    Location:
    Illinois, USA
    The bug is in your code
    Code:
    --cothon campus adjacency
    INSERT INTO Adjacency_YieldChanges	(ID,			Description,			YieldType,		YieldChange,	TilesRequired,	OtherDistrictAdjacent,	AdjacentSeaResource,	AdjacentTerrain,	AdjacentFeature,	AdjacentRiver,		AdjacentWonder,		AdjacentNaturalWonder,	AdjacentImprovement,	AdjacentDistrict,	PrereqCivic,	PrereqTech,	ObsoleteCivic,	ObsoleteTech,	AdjacentResource,	AdjacentResourceClass,	Self)
    VALUES(					'Cothon_Science',	'LOC_DISTRICT_COTHON_SCIENCE',	'YIELD_SCIENCE',	1,		1,		1,			0,			NULL,			NULL,			0,			0,			0,			NULL,			'DISTRICT_COTHON',	NULL,		NULL,		NULL,		NULL,		0,			'NO_RESOURCECLASS',	0);
    For any one row in the database, both OtherDistrictAdjacent and AdjacentDistrict cannot be used. It has to be one or the other. Since OtherDistrictAdjacent is set to Boolean "true" by the integer value "1" in that column, it over-rides the setting of 'DISTRICT_COTHON' within the same inserted row, and the game adds the +1 adjacency for any and all districts adjacent to the target tile. The text reference of 'LOC_DISTRICT_COTHON_SCIENCE' from the inserted row is used, thereby leading you to think the game believes the adjacent districts are "Cothons" when in fact the game does not believe any such thing: it is just using the text it has been instructed to use when there is one or more districts adjacent to the target tile.

    Alter the "1" in the quoted insert for OtherDistrictAdjacent to integer 0 and the problem should go away. Double-check you do not have the same mistake elsewhere within file "HarborAdjacency.sql"
     
    frutiemax likes this.
  9. frutiemax

    frutiemax Chieftain

    Joined:
    Jan 19, 2015
    Messages:
    53
    You are right, there were still some places where OtherDistrictAdjacent was set to 1. Now it works.
     

Share This Page