Really Stuck on Civ Trait!

Cagarustus

Prince
Joined
Mar 9, 2017
Messages
386
Hi All,

I've taken another crack at adding a Trait to England. I want to grant England the ability to receive a Great Engineer every time they build an industrial district AFTER researching the Tech Industralization. The code is below:


INSERT INTO Types (Type, Kind) VALUES
('TRAIT_CIVILIZATION_ENGLAND_2', 'KIND_TRAIT');

INSERT INTO CivilizationTraits (CivilizationType, TraitType) VALUES
('CIVILIZATION_ENGLAND', 'TRAIT_CIVILIZATION_ENGLAND_2');

INSERT INTO Traits (TraitType, Name, Description) VALUES
('TRAIT_CIVILIZATION_ENGLAND_2', 'LOC_TRAIT_CIVILIZATION_ENGLAND_2_NAME', 'LOC_TRAIT_CIVILIZATION_ENGLAND_2_DESC');

INSERT INTO TraitModifiers (TraitType, ModifierId) VALUES
('TRAIT_CIVILIZATION_ENGLAND_2', 'TRAIT_INDUSTRIAL_GREAT_PERSON');

INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, SubjectRequirementSetId) VALUES
('TRAIT_INDUSTRIAL_GREAT_PERSON', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 0, 1, 'PLAYER_NEEDS_INDUSTRIALIZATION_TECHNOLOGY'),
('TRAIT_INDUSTRIAL_GREAT_PERSON', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 1, 1, 'PLAYER_ENGINEER_REQUIREMENTS');

INSERT INTO ModifierArguments (ModifierId, Name, Value) VALUES
('TRAIT_INDUSTRIAL_GREAT_PERSON', 'GreatPersonClassType','GREAT_PERSON_CLASS_ENGINEER'),
('TRAIT_INDUSTRIAL_GREAT_PERSON', 'Amount', 1);

INSERT INTO DistrictModifiers (DistrictType, ModifierId) VALUES
('DISTRICT_INDUSTRIAL_ZONE', 'TRAIT_INDUSTRIAL_GREAT_PERSON');

INSERT INTO RequirementSets (RequirementSetId, RequirementSetType) VALUES
('PLAYER_NEEDS_INDUSTRIALIZATION_TECHNOLOGY', 'REQUIREMENTSET_TEST_ALL'),
('PLAYER_ENGINEER_REQUIREMENTS', 'REQUIREMENTSET_TEST_ALL');

INSERT INTO RequirementSetRequirements (RequirementSetId, RequirementId) VALUES
('PLAYER_NEEDS_INDUSTRIALIZATION_TECHNOLOGY', 'REQUIRES_TECHNOLOGY_INDUSTRIALIZATION'),
('PLAYER_ENGINEER_REQUIREMENTS', 'REQUIRES_PLAYER_CAN_EVER_EARN_ENGINEER');

INSERT INTO Requirements (RequirementId, RequirementType) VALUES
('REQUIRES_TECHNOLOGY_INDUSTRIALIZATION', 'REQUIREMENT_PLAYER_HAS_TECHNOLOGY'),
('REQUIRES_PLAYER_CAN_EVER_EARN_ENGINEER', 'REQUIREMENT_PLAYER_CAN_EVER_EARN_GREAT_PERSON_CLASS');

INSERT INTO RequirementArguments (RequirementId, Name, Value) VALUES
('REQUIRES_PLAYER_CAN_EVER_EARN_ENGINEER', 'GreatPersonClass', 'GREAT_PERSON_CLASS_ENGINEER'),
('REQUIRES_TECHNOLOGY_INDUSTRIALIZATION', 'TechnologyType', 'TECH_INDUSTRIALIZATION');
--
Also, how to insert text into the Civ Selection Screen?
 
Are you getting errors loading the game? What errors are showing up in your Database and Modding log?
 
Thank so for the reply.

I actually don't know how to access the log you're talking about. I've looked through the logs file but haven't found anything to do with my mods. How do I do this?
 
Have you loaded the mod into the game to see if it works? If it does not, it should produce an error in the Database and Modding log. It will be under My Documents/My Games/Sid Meier's Civilization VI/Logs/
 
Hi ITCore,

Here is the Database Log:

[3766880.457] [Localization]: Validating Foreign Key Constraints...
[3766880.457] [Localization]: Passed Validation.
[3766880.467] [Configuration]: Validating Foreign Key Constraints...
[3766880.468] [Configuration]: Passed Validation.
[3766906.625] [FullTextSearch]: Initializing FullTextSearch
[3766907.407] [Gameplay]: Validating Foreign Key Constraints...
[3766907.422] [Gameplay]: Passed Validation.
[3766911.196] [Configuration] ERROR: no such table: Types
[3766911.196] [Configuration]: Validating Foreign Key Constraints...
[3766911.197] [Configuration]: Passed Validation.
[3766935.454] [FullTextSearch]: FTS - Creating Context
[3766938.606] [FullTextSearch]: FTS - Creating Context
[3766964.093] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[3766964.120] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId

[3766964.151] [Gameplay]: Validating Foreign Key Constraints...
[3766964.171] [Gameplay]: Passed Validation.
[3766998.769] [FullTextSearch]: FTS - Creating Context
[3767000.478] [FullTextSearch]: FTS - Creating Context
[3767014.141] [FullTextSearch]: FTS - Creating Context
[3767141.987] [FullTextSearch]: FTS - Creating Context
[3767144.990] [Configuration] ERROR: no such table: Types
[3767144.991] [Configuration]: Validating Foreign Key Constraints...
[3767144.992] [Configuration]: Passed Validation.
[3767151.428] [FullTextSearch]: FTS - Creating Context
[3767165.404] [Configuration] ERROR: no such table: Types
[3767167.304] [Configuration]: Validating Foreign Key Constraints...
[3767167.304] [Configuration]: Passed Validation.
[3767212.809] [Configuration] ERROR: no such table: Types
[3767212.809] [Configuration]: Validating Foreign Key Constraints...
[3767212.810] [Configuration]: Passed Validation.
[3767218.244] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[3767218.244] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[3767218.370] [Gameplay]: Validating Foreign Key Constraints...
[3767218.387] [Gameplay]: Passed Validation.
[3767278.401] [FullTextSearch]: FTS - Creating Context
[3767278.814] [FullTextSearch]: FTS - Creating Context
[3767279.515] [FullTextSearch]: FTS - Creating Context
[3767339.775] [FullTextSearch]: FTS - Creating Context
[3767340.168] [Configuration] ERROR: no such table: Types
[3767343.772] [Configuration]: Validating Foreign Key Constraints...
[3767343.773] [Configuration]: Passed Validation.
[3767347.219] [FullTextSearch]: FTS - Creating Context
[3767351.695] [Configuration]: Validating Foreign Key Constraints...
[3767351.695] [Configuration]: Passed Validation.
[3767366.586] [Configuration]: Validating Foreign Key Constraints...
[3767366.586] [Configuration]: Passed Validation.
[3767369.989] [Gameplay]: Validating Foreign Key Constraints...
[3767370.005] [Gameplay]: Passed Validation.
[3767403.874] [FullTextSearch]: FTS - Creating Context
[3767404.234] [FullTextSearch]: FTS - Creating Context
[3767404.914] [FullTextSearch]: FTS - Creating Context
[3767483.373] [FullTextSearch]: FTS - Creating Context
[3767486.237] [Configuration]: Validating Foreign Key Constraints...
[3767486.237] [Configuration]: Passed Validation.
[3767488.914] [FullTextSearch]: FTS - Creating Context
[3767492.165] [Configuration]: Validating Foreign Key Constraints...
[3767492.165] [Configuration]: Passed Validation.
[3767499.101] [Configuration] ERROR: no such table: Types
[3767499.137] [Configuration]: Validating Foreign Key Constraints...
[3767499.137] [Configuration]: Passed Validation.
[3767508.947] [Configuration] ERROR: no such table: Types
[3767508.947] [Configuration]: Validating Foreign Key Constraints...
[3767508.947] [Configuration]: Passed Validation.
[3767511.470] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[3767511.470] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[3767511.694] [Gameplay]: Validating Foreign Key Constraints...
[3767511.710] [Gameplay]: Passed Validation.
[3767526.934] [FullTextSearch]: FTS - Creating Context
[3767527.386] [FullTextSearch]: FTS - Creating Context
[3767528.537] [FullTextSearch]: FTS - Creating Context
[3767605.443] [FullTextSearch]: FullTextSearch - Shutting down
 
Try rearranging the code so that you are defining the new trait (modifiers) first. So do:

Requirements
RequirementArguments
RequirementSets
RequirementSetRequirements
Modifiers
ModifierArguments
Types
Traits
CivilizationTraits
TraitModifiers

But there is another thing I think isn't working. You're inserting the same ModifierId twice into two different locations, Industral Zone and a Civ. Try adding an additional requirement in Modifiers (District is an Industrial Zone) and see if that makes it better. As it stands, the code is telling the game that everyone get's it AND England get it. Which doesn't make sense.
 
I'm not sure what you mean. Are you referring to:

INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, SubjectRequirementSetId) VALUES
('TRAIT_INDUSTRIAL_GREAT_PERSON', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 0, 1, 'PLAYER_NEEDS_INDUSTRIALIZATION_TECHNOLOGY'),
('TRAIT_INDUSTRIAL_GREAT_PERSON', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 1, 1, 'PLAYER_ENGINEER_REQUIREMENTS');

...being the same, and that maybe I should change to:

INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, SubjectRequirementSetId) VALUES
('TRAIT_INDUSTRIAL_GREAT_PERSON', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 0, 1, 'PLAYER_NEEDS_INDUSTRIALIZATION_TECHNOLOGY'),
('TRAIT_INDUSTRIAL_GREAT_PERSON', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 1, 1, 'PLAYER_ENGINEER_REQUIREMENTS'),
('TRAIT_INDUSTRIAL_GREAT_PERSON' , 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 1, 1, 'DISTRICT_IS_AN_INDUSTRIAL_ZONE');
 
I'm referring to "TRAIT_INDUSTRIAL_GREAT_PERSON" being in both DistrictModifiers AND CivilizationTraits. Delete the DistrictModifiers one because that grants it to everyone. But yeah, that's the addition I would make. Add the requirement to the modifier instead of adding it to the district itself.
 
Ah, that explains why the Stonehenge coding doesn't apply, because it applies to everyone. Cheers, I'll try it out.
 
Ok, just tried it again, didn't work. Here is the log:

[3777059.250] [Localization]: Validating Foreign Key Constraints...
[3777059.251] [Localization]: Passed Validation.
[3777059.262] [Configuration]: Validating Foreign Key Constraints...
[3777059.263] [Configuration]: Passed Validation.
[3777076.856] [FullTextSearch]: Initializing FullTextSearch
[3777078.812] [Gameplay]: Validating Foreign Key Constraints...
[3777078.828] [Gameplay]: Passed Validation.
[3777080.164] [Configuration] ERROR: no such table: Requirements
[3777080.164] [Configuration]: Validating Foreign Key Constraints...
[3777080.164] [Configuration]: Passed Validation.
[3777100.916] [FullTextSearch]: FTS - Creating Context
[3777103.281] [FullTextSearch]: FTS - Creating Context
[3777123.681] [Gameplay] ERROR: UNIQUE constraint failed: RequirementSets.RequirementSetId
[3777123.681] [Gameplay] ERROR: UNIQUE constraint failed: RequirementSets.RequirementSetId
[3777123.712] [Gameplay]: Validating Foreign Key Constraints...
[3777123.730] [Gameplay]: Passed Validation.
[3777133.023] [FullTextSearch]: FTS - Creating Context
[3777133.792] [FullTextSearch]: FTS - Creating Context
[3777136.059] [FullTextSearch]: FTS - Creating Context
[3777320.928] [FullTextSearch]: FullTextSearch - Shutting down
--
Seems to be a problem with RequirementSets.....

Here is the Code:

INSERT INTO Requirements (RequirementId, RequirementType) VALUES
('REQUIRES_TECHNOLOGY_INDUSTRIALIZATION', 'REQUIREMENT_PLAYER_HAS_TECHNOLOGY'),
('REQUIRES_PLAYER_CAN_EVER_EARN_ENGINEER', 'REQUIREMENT_PLAYER_CAN_EVER_EARN_GREAT_PERSON_CLASS'),
('REQUIRES_DISTRICT_INDUSTRIAL_ZONE', 'REQUIREMENT_DISTRICT_TYPE_MATCHES');

INSERT INTO RequirementArguments (RequirementId, Name, Value) VALUES
('REQUIRES_PLAYER_CAN_EVER_EARN_ENGINEER', 'GreatPersonClass', 'GREAT_PERSON_CLASS_ENGINEER'),
('REQUIRES_TECHNOLOGY_INDUSTRIALIZATION', 'TechnologyType', 'TECH_INDUSTRIALIZATION'),
('REQUIRES_DISTRICT_INDUSTRIAL_ZONE', 'DistrictType', 'DISTRICT_INDUSTRIAL_ZONE');

INSERT INTO RequirementSets (RequirementSetId, RequirementSetType) VALUES
('PLAYER_NEEDS_INDUSTRIALIZATION_TECHNOLOGY', 'REQUIREMENTSET_TEST_ALL'),
('PLAYER_ENGINEER_REQUIREMENTS', 'REQUIREMENTSET_TEST_ALL'),
('DISTRICT_IS_INDUSTRIAL_ZONE', 'REQUIREMENTSET_TEST_ALL');

INSERT INTO RequirementSetRequirements (RequirementSetId, RequirementId) VALUES
('PLAYER_NEEDS_INDUSTRIALIZATION_TECHNOLOGY', 'REQUIRES_TECHNOLOGY_INDUSTRIALIZATION'),
('PLAYER_ENGINEER_REQUIREMENTS', 'REQUIRES_PLAYER_CAN_EVER_EARN_ENGINEER'),
('DISTRICT_IS_INDUSTRIAL_ZONE', 'REQUIRES_DISTRICT_INDUSTRIAL_ZONE');

INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, SubjectRequirementSetId) VALUES
('TRAIT_INDUSTRIAL_GREAT_PERSON', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 0, 1, 'PLAYER_NEEDS_INDUSTRIALIZATION_TECHNOLOGY'),
('TRAIT_INDUSTRIAL_GREAT_PERSON', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 1, 1, 'PLAYER_ENGINEER_REQUIREMENTS'),
('TRAIT_INDUSTRIAL_GREAT_PERSON', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 0, 1, 'DISTRICT_IS_INDUSTRIAL_ZONE');
 
Rename the RequirementId and RequirementSetId to something more custom. Some of those might be defined elsewhere in the code and it doesn't like getting defined again with the same name.
 
It's not working again.

[3778281.267] [Localization]: Validating Foreign Key Constraints...
[3778281.267] [Localization]: Passed Validation.
[3778281.277] [Configuration]: Validating Foreign Key Constraints...
[3778281.278] [Configuration]: Passed Validation.
[3778298.315] [FullTextSearch]: Initializing FullTextSearch
[3778300.237] [Gameplay]: Validating Foreign Key Constraints...
[3778300.253] [Gameplay]: Passed Validation.
[3778301.731] [Configuration] ERROR: no such table: Requirements
[3778301.731] [Configuration]: Validating Foreign Key Constraints...
[3778301.731] [Configuration]: Passed Validation.
[3778322.521] [FullTextSearch]: FTS - Creating Context
[3778324.473] [FullTextSearch]: FTS - Creating Context
[3778347.015] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[3778347.015] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[3778347.053] [Gameplay]: Validating Foreign Key Constraints...
[3778347.069] [Gameplay]: Passed Validation.
[3778358.248] [FullTextSearch]: FTS - Creating Context
[3778359.428] [FullTextSearch]: FTS - Creating Context
[3778362.915] [FullTextSearch]: FTS - Creating Context
[3778487.956] [FullTextSearch]: FullTextSearch - Shutting down
 
I changed the ModifierId to unique ones. The code changed to:

[3779782.502] [Localization]: Validating Foreign Key Constraints...
[3779782.504] [Localization]: Passed Validation.
[3779782.534] [Configuration]: Validating Foreign Key Constraints...
[3779782.535] [Configuration]: Passed Validation.
[3779799.730] [FullTextSearch]: Initializing FullTextSearch
[3779802.289] [Gameplay]: Validating Foreign Key Constraints...
[3779802.304] [Gameplay]: Passed Validation.
[3779803.580] [Configuration] ERROR: no such table: Requirements
[3779803.581] [Configuration]: Validating Foreign Key Constraints...
[3779803.581] [Configuration]: Passed Validation.
[3779824.170] [FullTextSearch]: FTS - Creating Context
[3779826.829] [FullTextSearch]: FTS - Creating Context
[3779843.719] [Gameplay]: Validating Foreign Key Constraints...
[3779843.738] [Gameplay]: Passed Validation.
[3779853.159] [FullTextSearch]: FTS - Creating Context
[3779854.144] [FullTextSearch]: FTS - Creating Context
[3779856.842] [FullTextSearch]: FTS - Creating Context
[3779989.588] [FullTextSearch]: FullTextSearch - Shutting down
 
INSERT INTO Requirements (RequirementId, RequirementType) VALUES
('REQUIRES_TECHNOLOGY_INDUSTRY', 'REQUIREMENT_PLAYER_HAS_TECHNOLOGY'),
('REQUIRES_PLAYER_BUILDS_BRITISH_ENGINEER', 'REQUIREMENT_PLAYER_CAN_EVER_EARN_GREAT_PERSON_CLASS'),
('REQUIRES_DISTRICT_INDUSTRIAL_BRITISH', 'REQUIREMENT_DISTRICT_TYPE_MATCHES');

INSERT INTO RequirementArguments (RequirementId, Name, Value) VALUES
('REQUIRES_PLAYER_BUILDS_BRITISH_ENGINEER', 'GreatPersonClass', 'GREAT_PERSON_CLASS_ENGINEER'),
('REQUIRES_TECHNOLOGY_INDUSTRY', 'TechnologyType', 'TECH_INDUSTRIALIZATION'),
('REQUIRES_DISTRICT_INDUSTRIAL_BRITISH', 'DistrictType', 'DISTRICT_INDUSTRIAL_ZONE');

INSERT INTO RequirementSets (RequirementSetId, RequirementSetType) VALUES
('PLAYER_NEEDS_INDUSTRYTECH', 'REQUIREMENTSET_TEST_ALL'),
('PLAYER_ENGINEERBRIT_REQUIREMENTS', 'REQUIREMENTSET_TEST_ALL'),
('DISTRICT_IS_INDUSTRIAL_BRITISH', 'REQUIREMENTSET_TEST_ALL');

INSERT INTO RequirementSetRequirements (RequirementSetId, RequirementId) VALUES
('PLAYER_NEEDS_INDUSTRYTECH', 'REQUIRES_TECHNOLOGY_INDUSTRY'),
('PLAYER_ENGINEERBRIT_REQUIREMENTS', 'REQUIRES_PLAYER_BUILDS_BRITISH_ENGINEER'),
('DISTRICT_IS_INDUSTRIAL_BRITISH', 'REQUIRES_DISTRICT_INDUSTRIAL_BRITISH');

INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, SubjectRequirementSetId) VALUES
('TRAIT_INDUSTRIAL_GREAT_PERSON_1', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 0, 1, 'PLAYER_NEEDS_INDUSTRYTECH'),
('TRAIT_INDUSTRIAL_GREAT_PERSON_2', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 1, 1, 'PLAYER_ENGINEERBRIT_REQUIREMENTS'),
('TRAIT_INDUSTRIAL_GREAT_PERSON_3', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 0, 1, 'DISTRICT_IS_INDUSTRIAL_BRITISH');

INSERT INTO ModifierArguments (ModifierId, Name, Value) VALUES
('TRAIT_INDUSTRIAL_GREAT_PERSON_2', 'GreatPersonClassType','GREAT_PERSON_CLASS_ENGINEER'),
('TRAIT_INDUSTRIAL_GREAT_PERSON_2', 'Amount', 1);

INSERT INTO Types (Type, Kind) VALUES
('TRAIT_CIVILIZATION_ENGLAND_2', 'KIND_TRAIT');

INSERT INTO Traits (TraitType, Name, Description) VALUES
('TRAIT_CIVILIZATION_ENGLAND_2', 'LOC_TRAIT_CIVILIZATION_ENGLAND_2_NAME', 'LOC_TRAIT_CIVILIZATION_ENGLAND_2_DESC');

INSERT INTO CivilizationTraits (CivilizationType, TraitType) VALUES
('CIVILIZATION_ENGLAND', 'TRAIT_CIVILIZATION_ENGLAND_2');

INSERT INTO TraitModifiers (TraitType, ModifierId) VALUES
('TRAIT_CIVILIZATION_ENGLAND_2', 'TRAIT_INDUSTRIAL_GREAT_PERSON_1'),
('TRAIT_CIVILIZATION_ENGLAND_2', 'TRAIT_INDUSTRIAL_GREAT_PERSON_2'),
('TRAIT_CIVILIZATION_ENGLAND_2', 'TRAIT_INDUSTRIAL_GREAT_PERSON_3');
 
I don't know why you are getting that error. Do you have any other mods running in the background? I can't think of anything else.
 
This part here makes no sense:

INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, SubjectRequirementSetId) VALUES
('TRAIT_INDUSTRIAL_GREAT_PERSON_1', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 0, 1, 'PLAYER_NEEDS_INDUSTRYTECH'),
('TRAIT_INDUSTRIAL_GREAT_PERSON_2', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 1, 1, 'PLAYER_ENGINEERBRIT_REQUIREMENTS'),
('TRAIT_INDUSTRIAL_GREAT_PERSON_3', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 0, 1, 'DISTRICT_IS_INDUSTRIAL_BRITISH');

and

INSERT INTO TraitModifiers (TraitType, ModifierId) VALUES
('TRAIT_CIVILIZATION_ENGLAND_2', 'TRAIT_INDUSTRIAL_GREAT_PERSON_1'),
('TRAIT_CIVILIZATION_ENGLAND_2', 'TRAIT_INDUSTRIAL_GREAT_PERSON_2'),
('TRAIT_CIVILIZATION_ENGLAND_2', 'TRAIT_INDUSTRIAL_GREAT_PERSON_3');

You are creating three disconnected sets of Traits/Modifiers, only one of which is functional (TRAIT_CIVILIZATION_ENGLAND_2 / TRAIT_INDUSTRIAL_GREAT_PERSON_2), while the other two have no content apart from their Requirements. Set 1 and Set 3 are useless in this setup. So, your Requirements #1 and #3 have no effect and do not limit the Trait that you are creating.

What you have is:

Trait A
Modifier I (No Effect + Requirement 1)
Modifier II (ModifierEffect(Create GPIndividual) IF Requirement 2 IS SATISFIED)
Modifier III (No Effect + Requirement 3)

In order to function the way you intended, Requirements must either (1) be grouped under one RequirementSet linked to a single Modifier, or (2) be stacked through their respective Modifiers, which, in turn, fit inside each other like Russian dolls. So, it's like this:

Approach A

Trait I (Modifier)
Modifier (ModifierEffect(Create GPIndividual) IF ALL OF (or any of/none of/etc.) Requirement 1, Requirement 2, Requirement 3 ARE SATISFIED)

Approach B

Trait A
Modifier I (ModifierEffect(Apply Modifier II) IF Requirement 1 IS SATISFIED)
Modifier II (ModifierEffect(Apply Modifier III) IF Requirement 2 IS SATISFIED)
Modifier III (ModifierEffect(Create GPIndividual) IF Requirement 3 IS SATISFIED)

The only Modifier that has arguments (i.e. functionality) attached to it is the second one. Now, if you were to use separate Modifiers (an approach that, for reasons explained below, actually has a greater chance of success than Approach A, which I have tried ad nauseum and discarded), it would go something like this:

Approach C

(i) England Trait / (Grant Access to a Dummy Building & Dummy Building Alternative)
(ii) Dummy Building / Required Technology + TraitType + Specified District (CAN create GP)
(iii) Dummy Building Alternative / No TechPrereq + TraitType + Specified District (CANNOT create GP)
(iii) Building Modifier / Modifier I (ModifierEffect(Create GPIndividual When Dummy Building Created) IF Requirement 1 (England Has Required Technology) )
(iv) District Modifier / Modifier II (ModifierEffect(Grant Dummy Building in City) IF Requirement 1 (England Has Required Technology) ARE SATISFIED)
(v) District Modifier / Modifier III (ModifierEffect(Grant Dummy Building Alternative in City) IF Requirement 1 in Inverse (England DOES NOT HAVE Required Technology) ARE SATISFIED)

Unfortunately, because we are doing this in XML only, we cannot use EnabledByReligion to "hide" the Dummy Building from the player, but, and I have not tested this, we might still be able to omit specifying the purchase type of yield and make the Dummy Building MustPurchase, which would preclude the player from purchasing or building the building (this does work, as I tested it, and the building does not appear in the build lists).

Part (i) is fairly simple. Just follow any of the examples in the base game (e.g. Poland's TRAIT_CIVILIZATION_BUILDING_SUKIENNICE).
Part (ii) is also fairly simple. You are setting up the Dummy Building and its Alternative (made mutually exclusive via MutuallyExclusiveBuildings table). Active Dummy Building will require TECH_INDUSTRIALIZATION. Dummy Building Alternative will have no tech requirements.

So, for the Modifiers:

ModifierEffect(Create GPIndividual When Dummy Building Created) -- this one is as you have above: MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY. Here is a caveat about this modifier. It is coded as follows:

<Row>
<ModifierType>MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY</ModifierType>
<CollectionType>COLLECTION_OWNER</CollectionType>
<EffectType>EFFECT_GRANT_GREAT_PERSON_CLASS_IN_CITY</EffectType>
</Row>

This means that the Effect of the Modifier is applied to a specific group: COLLECTION_OWNER. This is the owner of the city in question, i.e. CIVILIZATION_ENGLAND. Herein lies the problem with applying Requirements. First of all, I believe only SubjectRequirementSetId column can be used, since there is no Owner to an Owner. Second, you can't use REQUIREMENT_DISTRICT_TYPE_MATCHES, because Civilization Type cannot match a District Type. These are two different tables, columns, and values and are incompatible. Hence, the district Requirement must come somewhere else. Finally, as for the REQUIREMENT_PLAYER_CAN_EVER_EARN_GREAT_PERSON_CLASS, I do not see the need for it. It is superfluous. I believe it is meant to address situations where Kongo builds Stonehenge, or a player builds Stonehenge after getting a great prophet by other means, or the unlikely situation Stonehenge is built after all the great prophets have been distributed and there are none to distribute. So, it seems to me that you can safely discard this requirement, provided that you do not allow Minor Civilizations (City States) to ever build the Dummy Building.

The other modifier we'll need is: MODIFIER_SINGLE_CITY_GRANT_BUILDING_IN_CITY. The only requirement we'll need is: REQUIREMENT_PLAYER_HAS_TECHNOLOGY. Anyways, long story short, here are the two parts of the code in XML:

Code:
-- CIVILIZATION TRAIT

INSERT INTO Types (Type, Kind) VALUES
('TRAIT_BUILDING_GP_GENERATOR', 'KIND_TRAIT');

INSERT INTO Traits (TraitType, Name, Description) VALUES
('TRAIT_BUILDING_GP_GENERATOR', 'Trait Generating GPs', 'Trait that enables GP generation upon certain conditions being reached');

INSERT INTO CivilizationTraits (CivilizationType, TraitType) VALUES
('CIVILIZATION_ENGLAND', 'TRAIT_BUILDING_GP_GENERATOR');

-- ACTIVE DUMMY BUILDING FOR GENERATING A GP

INSERT INTO Types (Type, Kind) VALUES ('BUILDING_GP_GENERATOR', 'KIND_BUILDING');
INSERT INTO Buildings (BuildingType, Name, Description, PrereqTech, PrereqDistrict, Cost, EnabledByReligion, MustPurchase, TraitType) VALUES
('BUILDING_GP_GENERATOR', 'GP Generator Asset', 'Dummy building that generates a GP', 'TECH_INDUSTRIALIZATION', 'DISTRICT_INDUSTRIAL_ZONE', 1, 0, 1, "TRAIT_BUILDING_GP_GENERATOR");

-- ANTI DUMMY BUILDING TO PRECLUDE INVALID GP GENERATION

INSERT INTO Types (Type, Kind) VALUES ('BUILDING_ANTI_GP_GENERATOR', 'KIND_BUILDING');
INSERT INTO Buildings (BuildingType, Name, Description, PrereqDistrict, Cost, EnabledByReligion, MustPurchase) VALUES
('BUILDING_ANTI_GP_GENERATOR', 'GP Generation Limiter', 'Precludes generation of GPs for districts built prior to completing required technology', 'DISTRICT_INDUSTRIAL_ZONE', 1, 0, 1);

INSERT INTO MutuallyExclusiveBuildings (Building, MutuallyExclusiveBuilding) VALUES
('BUILDING_GP_GENERATOR', 'BUILDING_ANTI_GP_GENERATOR'),
('BUILDING_ANTI_GP_GENERATOR', 'BUILDING_GP_GENERATOR');

-- PLACING THE BUILDING IN THE SPECIFIED DISTRICT

INSERT INTO DistrictModifiers (DistrictType, ModifierId) VALUES
('DISTRICT_INDUSTRIAL_ZONE', 'BUILDING_GP_GENERATOR_MODIFIER');

INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, OwnerRequirementSetId, SubjectRequirementSetId) VALUES
('BUILDING_GP_GENERATOR_MODIFIER', 'MODIFIER_SINGLE_CITY_GRANT_BUILDING_IN_CITY', 0, 1, NULL, 'PLAYER_HAS_DESIGNATED_TECH_REQUIREMENTS');

INSERT INTO ModifierArguments (ModifierId, Name, Type, Value, Extra, SecondExtra) VALUES
('BUILDING_GP_GENERATOR_MODIFIER', 'BuildingType', 'ARGTYPE_IDENTITY', 'BUILDING_GP_GENERATOR', NULL, NULL);

INSERT INTO RequirementSets (RequirementSetId, RequirementSetType) VALUES
('PLAYER_HAS_DESIGNATED_TECH_REQUIREMENTS', 'REQUIREMENTSET_TEST_ALL');

INSERT INTO RequirementSetRequirements (RequirementSetId, RequirementId) VALUES
('PLAYER_HAS_DESIGNATED_TECH_REQUIREMENTS', 'REQUIRES_DESIGNATED_TECHNOLOGY');

INSERT INTO Requirements (RequirementId, RequirementType) VALUES
('REQUIRES_DESIGNATED_TECHNOLOGY', 'REQUIREMENT_PLAYER_HAS_TECHNOLOGY');

INSERT INTO RequirementArguments (RequirementId, Name, Value) VALUES
('REQUIRES_DESIGNATED_TECHNOLOGY', 'TechnologyType', 'TECH_INDUSTRIALIZATION');

-- TRIGGERING GP GENERATION WITH THE ACTIVE DUMMY BUILDING

INSERT INTO BuildingModifiers (BuildingType, ModifierId) VALUES
('BUILDING_GP_GENERATOR', 'GP_GENERATOR_MODIFIER');

INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, OwnerRequirementSetId, SubjectRequirementSetId) VALUES
('GP_GENERATOR_MODIFIER', 'MODIFIER_SINGLE_CITY_GRANT_GREAT_PERSON_CLASS_IN_CITY', 0, 1, NULL, 'PLAYER_HAS_DESIGNATED_TECH_REQUIREMENTS');

INSERT INTO ModifierArguments (ModifierId, Name, Type, Value, Extra, SecondExtra) VALUES
('GP_GENERATOR_MODIFIER', 'GreatPersonClassType', 'ARGTYPE_IDENTITY', 'GREAT_PERSON_CLASS_ENGINEER', NULL, NULL),
('GP_GENERATOR_MODIFIER', 'Amount', 'ARGTYPE_IDENTITY', '1', NULL, NULL);

-- PRECLUDING GP GENERATION WITH THE ANTI DUMMY BUILDING

INSERT INTO DistrictModifiers (DistrictType, ModifierId) VALUES
('DISTRICT_INDUSTRIAL_ZONE', 'BUILDING_ANTI_GP_GENERATOR_MODIFIER');

INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, OwnerRequirementSetId, SubjectRequirementSetId) VALUES
('BUILDING_ANTI_GP_GENERATOR_MODIFIER', 'MODIFIER_SINGLE_CITY_GRANT_BUILDING_IN_CITY', 0, 1, NULL, 'PLAYER_LACKS_DESIGNATED_TECH_REQUIREMENTS');

INSERT INTO ModifierArguments (ModifierId, Name, Type, Value, Extra, SecondExtra) VALUES
('BUILDING_ANTI_GP_GENERATOR_MODIFIER', 'BuildingType', 'ARGTYPE_IDENTITY', 'BUILDING_ANTI_GP_GENERATOR', NULL, NULL);

INSERT INTO RequirementSets (RequirementSetId, RequirementSetType) VALUES
('PLAYER_LACKS_DESIGNATED_TECH_REQUIREMENTS', 'REQUIREMENTSET_TEST_ALL');

INSERT INTO RequirementSetRequirements (RequirementSetId, RequirementId) VALUES
('PLAYER_LACKS_DESIGNATED_TECH_REQUIREMENTS', 'REQUIRES_LACK_OF_DESIGNATED_TECHNOLOGY');

INSERT INTO Requirements (RequirementId, RequirementType, Likeliness, Inverse, Triggered) VALUES
('REQUIRES_LACK_OF_DESIGNATED_TECHNOLOGY', 'REQUIREMENT_PLAYER_HAS_TECHNOLOGY', 0, 1, 0);

INSERT INTO RequirementArguments (RequirementId, Name, Value) VALUES
('REQUIRES_LACK_OF_DESIGNATED_TECHNOLOGY', 'TechnologyType', 'TECH_INDUSTRIALIZATION');

I see no other way, but I may well have overlooked something. But this method works and works well.

(As an aside, as to why you are getting the "ERROR: no such table: Requirements" error, I have no clue, because there clearly is such a table in 01_GameplaySchema.xml. However, if this error shows, it probably means that the Requirements table has not been generated for some reason. This is a serious and game-breaking issue. If the table does not exist, all the connections breakdown, and much of the Modifier/Requirement functionality disappears for all the processes in the game).
 
ADDITION: Using LeeS' find here: LINK, it also is now possible to hide the Dummy Building from the Civilopedia as well. So, then, it seems we can also remove from this statement:

INSERT INTO Buildings (BuildingType, Name, Description, PrereqTech, PrereqDistrict, Cost, EnabledByReligion, MustPurchase, TraitType) VALUES
('BUILDING_GP_GENERATOR', 'GP Generator Asset', 'Dummy building that generates a GP', 'TECH_INDUSTRIALIZATION', 'DISTRICT_INDUSTRIAL_ZONE', 1, 0, 1, "TRAIT_BUILDING_GP_GENERATOR");

the Name & Description columns and values. Since the Dummy Building is already rendered invisible in the production & purchase lists, it would now appear as a blank entry when hovering over the district in question and in other instances that refer to it by its Name or Description values:

Code:
INSERT INTO Buildings (BuildingType, Name, Description, PrereqTech, PrereqDistrict, Cost, MustPurchase, TraitType) VALUES
('BUILDING_GP_GENERATOR', NULL, NULL, 'TECH_INDUSTRIALIZATION', 'DISTRICT_INDUSTRIAL_ZONE', 1, 1, "TRAIT_BUILDING_GP_GENERATOR");

INSERT INTO CivilopediaPageExcludes (SectionId, PageId) VALUES ('BUILDINGS', 'BUILDING_GP_GENERATOR');

And do same for the Anti Dummy Building:

Code:
INSERT INTO Buildings (BuildingType, Name, Description, PrereqDistrict, Cost, MustPurchase) VALUES
('BUILDING_ANTI_GP_GENERATOR', NULL, NULL, 'DISTRICT_INDUSTRIAL_ZONE', 1, 1);

INSERT INTO CivilopediaPageExcludes (SectionId, PageId) VALUES ('BUILDINGS', 'BUILDING_ANTI_GP_GENERATOR');

Then, going further, I am pretty sure that if I dig deeper into the UI LUA files, there is a way to block the building from many of the UI functions as well. But this would be superficial. Not sure if there is a way to prevent the Dummy Building from being pillaged/requiring repair through XML alone.
 
Wow! It actually worked. Thank you heaps!

I have to say: that was so complicated. So, is this 'Dummy Building' the way of Modding complicated things in Civ IV now? If I wanted to grant an extra policy slot, or grant a new Unit Ability, then using the Dummy Building is the way, right?

If I might trouble you for one more thing to complete this Mod? I'm looking to add this as a second Trait to England, and I wish for the text to reflect this. When I created a text file, I did: INSERT INTO LocalizedText (Tag, Language, Text)..... When I did this, the writing didn't appear on the Civ Selection Screen BUT on the Civ Loading Screen it appeared as 'LOC_...... NAME' in Bold White, and 'LOC.....DESCRIPTION' in smaller text as though it were following the format of the Trait Name and Description above it.

Any idea as to how to insert the new text and therefore create a Second Civilization Trait for England?
 
Back
Top Bottom