[Help Request] New District showing wrong values during Placement

Horem

Emperor
Joined
Apr 1, 2010
Messages
1,721
Location
Wales, UK
I created a new District, it all works as intended. But when you go to place it it shows the Housing Icons:-


Code for the District:
Code:
INSERT INTO Districts   (DistrictType,                   Name,                                   PrereqTech,                       Description,                           Cost,   RequiresPlacement,   RequiresPopulation, NoAdjacentCity, Aqueduct,   InternalOnly,   ZOC,   CaptureRemovesBuildings,   CaptureRemovesCityDefenses, PlunderType,   PlunderAmount,   TradeRouteCapacity, MilitaryDomain, CostProgressionModel,                       CostProgressionParam1,   OnePerCity, TravelTime, CityStrengthModifier,   AdvisorType) VALUES
                       ('DISTRICT_SHOPPING_COMPLEX',   'LOC_DISTRICT_SHOPPING_COMPLEX_NAME',   'TECH_Dawn_of_Civilization',   'LOC_DISTRICT_SHOPPING_COMPLEX_DESC',   '84',   '1',               '1',               '0',           '0',       '0',           '0',   '0',                       '0',                       'PLUNDER_GOLD',   '50',           '0',               'NO_DOMAIN',   'COST_PROGRESSION_NUM_UNDER_AVG_PLUS_TECH',   '25',                   '0',       '3',       '2',                   'ADVISOR_GENERIC');

INSERT INTO District_TradeRouteYields   (DistrictType,                   YieldType,           YieldChangeAsOrigin,   YieldChangeAsDomesticDestination,   YieldChangeAsInternationalDestination) VALUES
                                       ('DISTRICT_SHOPPING_COMPLEX',   'YIELD_GOLD',       '0',                   '1',                               '1');

INSERT INTO District_GreatPersonPoints   (DistrictType,                   GreatPersonClassType,           PointsPerTurn) VALUES
                                       ('DISTRICT_SHOPPING_COMPLEX',   'GREAT_PERSON_CLASS_MERCHANT',   '1');

INSERT INTO District_CitizenYieldChanges   (DistrictType,                   YieldType,       YieldChange) VALUES
                                           ('DISTRICT_SHOPPING_COMPLEX',   'YIELD_GOLD',   '2'),
                                           ('DISTRICT_SHOPPING_COMPLEX',   'YIELD_FOOD',   '1');

INSERT INTO District_Adjacencies   (DistrictType,                   YieldChangeId) VALUES
                                   ('DISTRICT_SHOPPING_COMPLEX',   'Harbor_Gold'),
                                   ('DISTRICT_SHOPPING_COMPLEX',   'RoyalDock_Gold'),
                                   ('DISTRICT_SHOPPING_COMPLEX',   'District_Gold');

INSERT INTO TraitModifiers   (TraitType,                                   ModifierId) VALUES
                           ('MINOR_CIV_TRADE_TRAIT',                   'MINOR_CIV_TRADE_SHOPPING_COMPLEX_PRODUCTION'),
                           ('TRAIT_CIVILIZATION_ADJACENT_DISTRICTS',   'TRAIT_ADJACENT_DISTRICTS_SHOPPING_COMPLEX_ADJACENCYGOLD');

INSERT INTO Modifiers   (ModifierId,                                               ModifierType,                                           RunOnce,   Permanent,   OwnerRequirementSetId,   SubjectRequirementSetId) VALUES
                       ('MINOR_CIV_TRADE_SHOPPING_COMPLEX_PRODUCTION',               'MODIFIER_PLAYER_CITIES_ADJUST_DISTRICT_PRODUCTION',   '0',       '0',       null,                   null),
                       ('TRAIT_ADJACENT_DISTRICTS_SHOPPING_COMPLEX_ADJACENCYGOLD',   'MODIFIER_PLAYER_CITIES_DISTRICT_ADJACENCY',           '0',       '0',       null,                   null);

INSERT INTO ModifierArguments   (ModifierId,                                               Name,           Type,               Value,                           Extra) VALUES
                               ('MINOR_CIV_TRADE_SHOPPING_COMPLEX_PRODUCTION',               'DistrictType',   'ARGTYPE_IDENTITY',   'DISTRICT_SHOPPING_COMPLEX',   null),
                               ('MINOR_CIV_TRADE_SHOPPING_COMPLEX_PRODUCTION',               'Amount',       'ARGTYPE_IDENTITY',   '500',                           null),
                               ('TRAIT_ADJACENT_DISTRICTS_SHOPPING_COMPLEX_ADJACENCYGOLD',   'DistrictType',   'ARGTYPE_IDENTITY',   'DISTRICT_SHOPPING_COMPLEX',   null),
                               ('TRAIT_ADJACENT_DISTRICTS_SHOPPING_COMPLEX_ADJACENCYGOLD',   'YieldType',   'ARGTYPE_IDENTITY',   'YIELD_GOLD',                   null),
                               ('TRAIT_ADJACENT_DISTRICTS_SHOPPING_COMPLEX_ADJACENCYGOLD',   'Amount',       'ARGTYPE_IDENTITY',   '1',                           null),
                               ('TRAIT_ADJACENT_DISTRICTS_SHOPPING_COMPLEX_ADJACENCYGOLD',   'Description',   'ARGTYPE_IDENTITY',   'LOC_DISTRICT_DISTRICT_1_GOLD',   null);

INSERT INTO AiFavoredItems   (ListType,               Item,                           Favored,   Value,   StringVal,   MinDifficulty,   MaxDifficulty) VALUES
                           ('MinorCivDistricts',   'DISTRICT_SHOPPING_COMPLEX',   '1',       '0',   null,       null,           null);

As I said the code works, you get the district ingame, you place it and get the required + to Gold (Not housing as in the screenshot). I am guessing it has something to do with the UI rather than the code, in DistrictPlotIconManager.lua or AdjacencyBonusSupport.lua possibly? I have looked at both files but can not see anything that would prevent the game registering the correct adjacencies. Lua is not strong in me :)
 
Can you check if the OnePerCity value in the corresponding row in the Districts table is properly set to 1? It should be, because it's default and you don't set it, but the housing icons suggest it's 0.

It's in GetAdjacentYieldBonusString(), in the lua file you mentioned.
Code:
    -- Special handling for Neighborhoods
    if (GameInfo.Districts[eDistrict].OnePerCity == false) then

        (....)
        iconString = iconString .. " [ICON_Housing]";


edit: just checking, you do have an entry in the big Types table, right?

if not, start the mod with
Code:
INSERT INTO Types (Type,Kind) VALUES ('DISTRICT_SHOPPING_COMPLEX', 'KIND_DISTRICT')
 
Last edited:
Why do you have OnePerCity as 0? I think that's what's brining up the housing icons.

Edit: Fuyu said the same thing thing, but in a different way. He's asking you to check it, I looked at your code and saw you had OnePerCity as 0 :)
 
Yeah I missed that you actually set it to 0 but I still guessed where the housing icon came from. So yay me.

And the missing entry in Types doesn't cause any foreign key constraint error message? Nvm then, glad this was fixed so easily.
 
And the missing entry in Types doesn't cause any foreign key constraint error message? Nvm then, glad this was fixed so easily.
I set the Type in my Types file, if there is no Type it will boot you out to the main menu btw. I will move the rest of the code to the relevant file's now it is all working :)
 
Top Bottom