Need help for modding -trade route problem

sunny19879394

Chieftain
Joined
Dec 11, 2019
Messages
29
Hi this is my first time to sign up and post things here but I have been browsing this site for years and thanks for the gametips.

Back to the problem. I am new to modding and I am trying to make a mod of my home city Hong Kong, using Keniisu's template. There are some features that I was trying to add but the effect just did not come out during the game.

I was trying to borrow Cleopatra's ability and want to set +4 gold for each international trade route I sent and +2 science, +3 culture for every trade route I receive. Attached are the code. Actually I just borrow heavily from cleopatra but dunno why it doesn't work. I tried to solve it for few days but cannot work T.T

Many thanks if someone can help T.T ( Only the codes related to this ability is shown. Other abilities are working.)

Code:
INSERT INTO    Types
        (Type,                                            Kind            )
VALUES    ('TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA',            'KIND_TRAIT'    ),
        ('MODTYPE_SUNNY_HONGKONG_UA_TRADE_FROMOTHERS',    'KIND_MODIFIER'    ),
        ('MODTYPE_SUNNY_HONGKONG_UA_TRADE_GOLD',    'KIND_MODIFIER'    );
-----------------------------------------------
-- Traits
-----------------------------------------------

INSERT INTO    Traits  
        (TraitType,                                Name,                                            Description                                            )
VALUES    ('TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA',    'LOC_TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA_NAME',    'LOC_TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA_DESCRIPTION'    );
       
-----------------------------------------------
-- CivilizationTraits
-----------------------------------------------

INSERT INTO    CivilizationTraits
        (CivilizationType,                TraitType                            )
VALUES    ('CIVILIZATION_SUNNY_HONGKONG',    'TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA'    );

-----------------------------------------------
-- TraitModifiers
-----------------------------------------------

INSERT INTO    TraitModifiers  
        (TraitType,                                ModifierId                                        )
VALUES  
        ('TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA',    'MODIFIER_SUNNY_HONGKONG_UA_TRADE_SCFROMOTHERS'    ),
        ('TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA',    'MODIFIER_SUNNY_HONGKONG_UA_TRADE_CLFROMOTHERS'    ),
        ('TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA',    'MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD'    );
-----------------------------------------------
-- DynamicModifiers
-----------------------------------------------

INSERT INTO    DynamicModifiers
        (ModifierType,                                    CollectionType,                    EffectType                                        )
VALUES  
        ('MODTYPE_SUNNY_HONGKONG_UA_TRADE_FROMOTHERS',    'COLLECTION_PLAYER_CITIES',        'EFFECT_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS'            ),
        ('MODTYPE_SUNNY_HONGKONG_UA_TRADE_GOLD',    'COLLECTION_OWNER',        'EFFECT_ADJUST_CITY_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL'            );
       
----------------------------------------------
-- Modifiers
-----------------------------------------------

INSERT INTO    Modifiers
        (ModifierId,                                        ModifierType,                                    OwnerRequirementSetId,                SubjectRequirementSetId,            RunOnce,    Permanent    )
VALUES        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_SCFROMOTHERS',        'MODTYPE_SUNNY_HONGKONG_UA_TRADE_FROMOTHERS',    NULL,        NULL,                                0,            1            ),
                ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_CLFROMOTHERS',        'MODTYPE_SUNNY_HONGKONG_UA_TRADE_FROMOTHERS',    NULL,        NULL,                                0,            1            ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD',                'MODTYPE_SUNNY_HONGKONG_UA_GOLD',    NULL,        NULL,                                0,            1    );
       
    -----------------------------------------------
-- ModifierArguments
-----------------------------------------------

INSERT INTO    ModifierArguments
        (ModifierId,                                            Name,                            Value                                    )
VALUES            ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_SCFROMOTHERS',            'Amount',                        2                            ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_SCFROMOTHERS',            'Domestic',                    'FALSE'                        ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_SCFROMOTHERS',            'YieldType',                    'YIELD_SCIENCE'                        ),
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_CLFROMOTHERS',            'Amount',                        3                            ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_CLFROMOTHERS',            'Domestic',                    'FALSE'                        ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_CLFROMOTHERS',            'YieldType',                    'YIELD_CULTURE'                        ),
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD',            'Amount',                        4                            ),
    ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD',            'YieldType',                    'YIELD_GOLD'                        );
 
'FALSE'

SQL does not use nor recognize any of 'FALSE', 'false', 'TRUE', or 'true' for Boolean values.

SQL uses integer 0 instead of Boolean false, and integer 1 instead of Boolean true

XML will accept and properly implement either of 0 or "false" for Boolean false, but not 'FALSE'. XML will accept and properly implement either of 1 or "true" for Boolean true, but not 'TRUE'.

There are already dynamic modifiers with these setups:
Code:
INSERT INTO    DynamicModifiers
        (ModifierType,                                    CollectionType,                    EffectType                                        )
VALUES  
        ('MODTYPE_SUNNY_HONGKONG_UA_TRADE_FROMOTHERS',    'COLLECTION_PLAYER_CITIES',        'EFFECT_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS'            ),
        ('MODTYPE_SUNNY_HONGKONG_UA_TRADE_GOLD',    'COLLECTION_OWNER',        'EFFECT_ADJUST_CITY_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL'            );
They are:
Code:
ModifierType	CollectionType	EffectType
MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS	COLLECTION_PLAYER_CITIES	EFFECT_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS
MODIFIER_SINGLE_CITY_ADJUST_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL	COLLECTION_OWNER	EFFECT_ADJUST_CITY_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL
When an existing ModifierType already exists with the same effect and collection type as you think you need, there is no real need to define another identical one. You just use the one Firaxis has already created. It does not hurt anything to duplicate an existing ModifierType -- it is just not necessary to do so.

The larger problem with this, however is that the "owner" as seen by the game will be the city rather than the player:
Code:
('MODTYPE_SUNNY_HONGKONG_UA_TRADE_GOLD',    'COLLECTION_OWNER',        'EFFECT_ADJUST_CITY_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL'            );
Using this ModifierType in a Modifier that is attached via a Trait to a player will probably never work. The only example of the usage of
Code:
ModifierType	CollectionType	EffectType
MODIFIER_SINGLE_CITY_ADJUST_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL	COLLECTION_OWNER	EFFECT_ADJUST_CITY_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL
is in the Poland DLC with the following:
Code:
	<BuildingModifiers>
		<Row>
			<BuildingType>BUILDING_SUKIENNICE</BuildingType>
			<ModifierId>SUKIENNICE_INTERNATIONALPRODUCTION</ModifierId>
		</Row>
	</BuildingModifiers>
	<Modifiers>
		<Row>
			<ModifierId>SUKIENNICE_INTERNATIONALPRODUCTION</ModifierId>
			<ModifierType>MODIFIER_SINGLE_CITY_ADJUST_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL</ModifierType>
		</Row>
              ……………
The modifier is being directly attached to a city by the creation of the building, and therefore the "owner" of the modifier is the city, not the player.
 
'FALSE'

SQL does not use nor recognize any of 'FALSE', 'false', 'TRUE', or 'true' for Boolean values.

SQL uses integer 0 instead of Boolean false, and integer 1 instead of Boolean true

XML will accept and properly implement either of 0 or "false" for Boolean false, but not 'FALSE'. XML will accept and properly implement either of 1 or "true" for Boolean true, but not 'TRUE'.

There are already dynamic modifiers with these setups:
Code:
INSERT INTO    DynamicModifiers
        (ModifierType,                                    CollectionType,                    EffectType                                        )
VALUES 
        ('MODTYPE_SUNNY_HONGKONG_UA_TRADE_FROMOTHERS',    'COLLECTION_PLAYER_CITIES',        'EFFECT_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS'            ),
        ('MODTYPE_SUNNY_HONGKONG_UA_TRADE_GOLD',    'COLLECTION_OWNER',        'EFFECT_ADJUST_CITY_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL'            );
They are:
Code:
ModifierType    CollectionType    EffectType
MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS    COLLECTION_PLAYER_CITIES    EFFECT_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS
MODIFIER_SINGLE_CITY_ADJUST_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL    COLLECTION_OWNER    EFFECT_ADJUST_CITY_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL
When an existing ModifierType already exists with the same effect and collection type as you think you need, there is no real need to define another identical one. You just use the one Firaxis has already created. It does not hurt anything to duplicate an existing ModifierType -- it is just not necessary to do so.

The larger problem with this, however is that the "owner" as seen by the game will be the city rather than the player:
Code:
('MODTYPE_SUNNY_HONGKONG_UA_TRADE_GOLD',    'COLLECTION_OWNER',        'EFFECT_ADJUST_CITY_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL'            );
Using this ModifierType in a Modifier that is attached via a Trait to a player will probably never work. The only example of the usage of
Code:
ModifierType    CollectionType    EffectType
MODIFIER_SINGLE_CITY_ADJUST_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL    COLLECTION_OWNER    EFFECT_ADJUST_CITY_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL
is in the Poland DLC with the following:
Code:
    <BuildingModifiers>
        <Row>
            <BuildingType>BUILDING_SUKIENNICE</BuildingType>
            <ModifierId>SUKIENNICE_INTERNATIONALPRODUCTION</ModifierId>
        </Row>
    </BuildingModifiers>
    <Modifiers>
        <Row>
            <ModifierId>SUKIENNICE_INTERNATIONALPRODUCTION</ModifierId>
            <ModifierType>MODIFIER_SINGLE_CITY_ADJUST_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL</ModifierType>
        </Row>
              ……………
The modifier is being directly attached to a city by the creation of the building, and therefore the "owner" of the modifier is the city, not the player.
Dear LeeS,

Thank you so much. You are my saviour I will try them out and see
 
Finally have some time in front of the computer to try out. Is it that I shall changed the code as below to use an existing ModifierType? Anyway the game still works with other effect not affected but still the trade bonus did not come out .. may be as LeeS said that the Collection_Owner is the problem. I may try to apply the bonus in other ways....

Just wonder how Firaxis done with cleopatra as I tried to see the code in leader.xml firaxis shall be tiding that to cleoptra's trait as well.....

Code:
-----------------------------------------------
-- Traits
-----------------------------------------------

INSERT INTO    Traits 
        (TraitType,                                Name,                                            Description                                            )
VALUES    ('TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA',    'LOC_TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA_NAME',    'LOC_TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA_DESCRIPTION'    );
      
-----------------------------------------------
-- CivilizationTraits
-----------------------------------------------

INSERT INTO    CivilizationTraits
        (CivilizationType,                TraitType                            )
VALUES    ('CIVILIZATION_SUNNY_HONGKONG',    'TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA'    );

----------------------------------------------
-- Modifiers
-----------------------------------------------

INSERT INTO    Modifiers
        (ModifierId,                                        ModifierType,                                    OwnerRequirementSetId,                SubjectRequirementSetId,            RunOnce,    Permanent    )
VALUES        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_SCFROMOTHERS',        'MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS',    NULL,        NULL,                                0,            1            ),
                ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_CLFROMOTHERS',        'MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHER',    NULL,        NULL,                                0,            1            ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD',                'MODIFIER_SINGLE_CITY_ADJUST_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL',    NULL,        NULL,                                0,            1    );
      
    -----------------------------------------------
-- ModifierArguments
-----------------------------------------------

INSERT INTO    ModifierArguments
        (ModifierId,                                            Name,                            Value                                    )
VALUES            ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_SCFROMOTHERS',            'Amount',                        2                            ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_SCFROMOTHERS',            'Domestic',                    0                        ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_SCFROMOTHERS',            'YieldType',                    'YIELD_SCIENCE'                        ),
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_CLFROMOTHERS',            'Amount',                        3                            ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_CLFROMOTHERS',            'Domestic',                    0                       ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_CLFROMOTHERS',            'YieldType',                    'YIELD_CULTURE'                        ),
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD',            'Amount',                        4                            ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD',            'YieldType',                    'YIELD_GOLD'                        );
 
Code:
	<Modifiers>
		<Row>
			<ModifierId>TRAIT_INTERNATIONAL_TRADE_GAIN_GOLD</ModifierId>
			<ModifierType>MODIFIER_PLAYER_ADJUST_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL</ModifierType>
		</Row>
	</Modifiers>
	<ModifierArguments>
		<Row>
			<ModifierId>TRAIT_INTERNATIONAL_TRADE_GAIN_GOLD</ModifierId>
			<Name>YieldType</Name>
			<Value>YIELD_GOLD</Value>
		</Row>
		<Row>
			<ModifierId>TRAIT_INTERNATIONAL_TRADE_GAIN_GOLD</ModifierId>
			<Name>Amount</Name>
			<Value>4</Value>
		</Row>
		<Row>
			<ModifierId>TRAIT_INTERNATIONAL_TRADE_GAIN_GOLD</ModifierId>
			<Name>Intercontinental</Name>
			<Value>false</Value>
		</Row>
	</ModifierArguments>
------
Code:
	<Modifiers>
		<Row>
			<ModifierId>TRAIT_INCOMING_TRADE_GAIN_GOLD</ModifierId>
			<ModifierType>MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS</ModifierType>
		</Row>
	</Modifiers>
	<ModifierArguments>
		<Row>
			<ModifierId>TRAIT_INCOMING_TRADE_GAIN_GOLD</ModifierId>
			<Name>YieldType</Name>
			<Value>YIELD_GOLD</Value>
		</Row>
		<Row>
			<ModifierId>TRAIT_INCOMING_TRADE_GAIN_GOLD</ModifierId>
			<Name>Amount</Name>
			<Value>2</Value>
		</Row>
	</ModifierArguments>
------
Code:
	<Modifiers>
		<Row>
			<ModifierId>TRAIT_INCOMING_TRADE_OFFER_FOOD</ModifierId>
			<ModifierType>MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_TO_OTHERS</ModifierType>
		</Row>
	</Modifiers>
	<ModifierArguments>
		<Row>
			<ModifierId>TRAIT_INCOMING_TRADE_OFFER_FOOD</ModifierId>
			<Name>YieldType</Name>
			<Value>YIELD_FOOD</Value>
		</Row>
		<Row>
			<ModifierId>TRAIT_INCOMING_TRADE_OFFER_FOOD</ModifierId>
			<Name>Amount</Name>
			<Value>2</Value>
		</Row>
	</ModifierArguments>
 
Code:
    <Modifiers>
        <Row>
            <ModifierId>TRAIT_INTERNATIONAL_TRADE_GAIN_GOLD</ModifierId>
            <ModifierType>MODIFIER_PLAYER_ADJUST_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL</ModifierType>
        </Row>
    </Modifiers>
    <ModifierArguments>
        <Row>
            <ModifierId>TRAIT_INTERNATIONAL_TRADE_GAIN_GOLD</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_GOLD</Value>
        </Row>
        <Row>
            <ModifierId>TRAIT_INTERNATIONAL_TRADE_GAIN_GOLD</ModifierId>
            <Name>Amount</Name>
            <Value>4</Value>
        </Row>
        <Row>
            <ModifierId>TRAIT_INTERNATIONAL_TRADE_GAIN_GOLD</ModifierId>
            <Name>Intercontinental</Name>
            <Value>false</Value>
        </Row>
    </ModifierArguments>
------
Code:
    <Modifiers>
        <Row>
            <ModifierId>TRAIT_INCOMING_TRADE_GAIN_GOLD</ModifierId>
            <ModifierType>MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS</ModifierType>
        </Row>
    </Modifiers>
    <ModifierArguments>
        <Row>
            <ModifierId>TRAIT_INCOMING_TRADE_GAIN_GOLD</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_GOLD</Value>
        </Row>
        <Row>
            <ModifierId>TRAIT_INCOMING_TRADE_GAIN_GOLD</ModifierId>
            <Name>Amount</Name>
            <Value>2</Value>
        </Row>
    </ModifierArguments>
------
Code:
    <Modifiers>
        <Row>
            <ModifierId>TRAIT_INCOMING_TRADE_OFFER_FOOD</ModifierId>
            <ModifierType>MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_TO_OTHERS</ModifierType>
        </Row>
    </Modifiers>
    <ModifierArguments>
        <Row>
            <ModifierId>TRAIT_INCOMING_TRADE_OFFER_FOOD</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_FOOD</Value>
        </Row>
        <Row>
            <ModifierId>TRAIT_INCOMING_TRADE_OFFER_FOOD</ModifierId>
            <Name>Amount</Name>
            <Value>2</Value>
        </Row>
    </ModifierArguments>
So actually by using the modtype from the game direct, and an modifierID to define the values, I shall get what I want?
 
You should, yes. The Game's "Cleopatra" trait modifiers are attached directly at the player level, so the issues with "city-level" implementation should be bypassed. Plus the ModifierTypes used for Cleopatra's TraitModifiers are "pre-baked" to do what you are after.

Just be sure you spell the ModifierType exactly as Firaxis spells it. In your most-recent post you used MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS (correctly spelled) but also MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHER (incorrectly spelled and which would have caused the game to shove you back to the main menu because of an Invalid Reference error).
 
Sad to say that it still doesn't works.....I am not sure if I shall submit some logs( what log to send) and see....anyway I move on to edit other abilities.

To minimize chances of error because of other code I save them in a seperate txt file and erased them in modbuddy and just kept the + gold for international trade route as below, the game can run but nothing happens.........

Hopefully it is not due to some stupid typo errors....

Code:
----------------------------------------------
-- Types
-----------------------------------------------

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

-----------------------------------------------
-- Traits
-----------------------------------------------

INSERT INTO    Traits
        (TraitType,                                Name,                                            Description                                            )
VALUES    ('TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA',    'LOC_TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA_NAME',    'LOC_TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA_DESCRIPTION'    );
      
-----------------------------------------------
-- CivilizationTraits
-----------------------------------------------

INSERT INTO    CivilizationTraits
        (CivilizationType,                TraitType                            )
VALUES    ('CIVILIZATION_SUNNY_HONGKONG',    'TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA'    );

----------------------------------------------
-- Modifiers
-----------------------------------------------

INSERT INTO    Modifiers
        (ModifierId,                                        ModifierType,                                    OwnerRequirementSetId,                SubjectRequirementSetId,            RunOnce,    Permanent    )
VALUES       ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD',                'MODIFIER_PLAYER_ADJUST_TRADE_ROUTE_YIELD_FOR_INTERNATIONAL',    NULL,        NULL,                                0,            1   );
 
        
      
    -----------------------------------------------
-- ModifierArguments
-----------------------------------------------

INSERT INTO    ModifierArguments
        (ModifierId,                                            Name,                            Value                                    )
VALUES     ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD',            'Amount',                        6                           ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD',            'YieldType',                    'YIELD_GOLD'                        ),
        ('MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD',            'Intercontinental',                   0                      );
 
You need to look first in Database.log, next in Modding.log, and if nothing seems to show as an error there you need to enable GameEffects logging to see what is happening with the attachment or failure of attachment of the modifier.

Database.log reports all errors encountered within the code of SQL and XML files as the contents of these files are loaded into the game's SQL database. Fatal errors within SQL files only will show one error-line within Database.log, and within Database.log they do not give a reference as to which SQL file contained the error. You have to compare the timestamps on the error-message line to those found within file Modding.log.

If a mod "Action ID-Name" contains any spaces or starts with any character other than a letter of the English alphabet, this will cause an error loading the Action and all of its files, and will be reported in Database.log as an SQL-type syntax-error.

Modding.log reports both all files that are being loaded into the game as well as if there was an error with loading the file. So modding.log is useful to be sure a given file is even being loaded by the game.

To enable effects logging:
  1. Find and open file UserOptions.txt in folder
    C:\Users\[UserNameHere]\Documents\My Games\Sid Meier's Civilization VI
  2. Search for the following parameter setting within the file:
    Code:
    ;Game Effects logging level, 0 = off, 1 = Minimal, 2 = Normal, Detailed = 3, Diagnostic = 4
    GameEffectsLogLevel 0
    Change the '0' to a '4'. This will cause the game to start generating a new log file in the logs folder. The new file will be called as I recall GameEffects.log though it might be called Effects.log. I cannot remember exactly as I just know which one to open because I've done so enough times by now.
  3. Be sure to save the change to the UserOptions.txt file.
 
Last edited:
I compared database.log and mod.log and see the errors with common timestamps as below (not sure if this is the approach to do so):
database.log :[164069.891] [Localization] ERROR: no such table: Units
mod.log:[164069.891] Warning: LocalizedText - Error Loading SQL.
[164069.891] Successfully released save point.
[164069.891] Applying Component - NubiaGameplay_XP2 (UpdateDatabase)
[164069.891] UpdateDatabase - Loading Data/Nubia_GameplayData.xml

database.log :[164080.704] [Gameplay] ERROR: no such table: BaseGameText
mod.log:[164080.704] Warning: UpdateDatabase - Error Loading SQL.
[164080.704] Applying Component - NewAction (UpdateDatabase)

So I guess I needa enable effects logging, and run the game one more time?
 

Attachments

  • Databaselog.txt
    1.7 KB · Views: 37
  • Moddinglog.txt
    98 KB · Views: 49
  1. Are you trying to load this file into the game via an UpdateText type of action?
    Code:
    [164069.884] LocalizedText - Loading Core/Satsuma_Expansion2_GSEffects.sql
    [164069.891] Warning: LocalizedText - Error Loading SQL.
    • Database.log is telling you you are attempting to load InGame code into the Localization Database, which cannot be done, hence the error in Database.log
      Code:
      [164069.891] [Localization] ERROR: no such table: Units
    • The file Satsuma_Expansion2_GSEffects.sql would seem to be the one that ought to have the issue since the other two files from within the same time-stamp chunk are named "X_Text".
  2. This error message indicates the reverse issue:
    Code:
    [164080.704] [Gameplay] ERROR: no such table: BaseGameText
    • You are attempting to load Localization (ie, Text) code into the InGame "code" database, which is also not allowed.
    • This file would seem to hold the offending code
      Code:
      [164080.653] UpdateDatabase - Loading Core/Satsuma_Expansion2_GSEffects.sql
  3. You appear to be attempting to include code that belongs in an UpdateText Action-type within the same file as code that belongs within an UpdateDatabase type of action. This cannot be done. A single file whether XML or SQL can only contain code that is correct for one of UpdateDatabase, UpdateText, UpdateIcons and can only be included within one type of action. Further, one XML or SQL file cannot be loaded as an Action-Type of UpdateDatabase in both the FrontEndActions and InGameActions since the code that is valid in FrontEnd is not the same as the code which is valid in InGame.
 
  1. Are you trying to load this file into the game via an UpdateText type of action?
    Code:
    [164069.884] LocalizedText - Loading Core/Satsuma_Expansion2_GSEffects.sql
    [164069.891] Warning: LocalizedText - Error Loading SQL.
    • Database.log is telling you you are attempting to load InGame code into the Localization Database, which cannot be done, hence the error in Database.log
      Code:
      [164069.891] [Localization] ERROR: no such table: Units
    • The file Satsuma_Expansion2_GSEffects.sql would seem to be the one that ought to have the issue since the other two files from within the same time-stamp chunk are named "X_Text".
  2. This error message indicates the reverse issue:
    Code:
    [164080.704] [Gameplay] ERROR: no such table: BaseGameText
    • You are attempting to load Localization (ie, Text) code into the InGame "code" database, which is also not allowed.
    • This file would seem to hold the offending code
      Code:
      [164080.653] UpdateDatabase - Loading Core/Satsuma_Expansion2_GSEffects.sql
  3. You appear to be attempting to include code that belongs in an UpdateText Action-type within the same file as code that belongs within an UpdateDatabase type of action. This cannot be done. A single file whether XML or SQL can only contain code that is correct for one of UpdateDatabase, UpdateText, UpdateIcons and can only be included within one type of action. Further, one XML or SQL file cannot be loaded as an Action-Type of UpdateDatabase in both the FrontEndActions and InGameActions since the code that is valid in FrontEnd is not the same as the code which is valid in InGame.
That 's become more tricky now.......I am trying to search where is the so-called "Satsuma_Expansion2_GSEffects.sql" now coz the current template does not have anything called with this name.... may be I needa check whether they are some old template loaded to the game.......
 
If it is not part of your mod then it has to be part of some other mod you currently have enabled. Having other mods which are not 100% necessary in order for your mod to run properly is one of the most common mistakes made by novice mod-makers.

Looking through your modding log again, it would appear that mod Sengoku Monogatari - Satsuma is the culprit mod. You should disable it. It is fundamentally flawed.
 
Disabling all mods except my own one and run the game again with gameeffect.log

Modding log no longer shows about the satsuma mod and the only error shows is about sth about translation (Well, but I always play the game in English)

[509853.796] Warning: Unable to load ../../../DLC/CivRoyaleScenario/Text/CivRoyaleScenario_Translations_ConfigText_China.xml
[509853.796] Warning: LocalizedText - Error Loading XML.

I also check the game effect log , it shows that at turn 1 the modifier shall be valid.
[510093.703] [Turn: 1] Modifier <MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD> is valid.

but I am not sure what else shall check.Anyway I will try hard to check. The modifier no longer appears in the log as well.
 

Attachments

  • Databaselog2.txt
    1.5 KB · Views: 35
  • GameEffectslog2.txt
    10 MB · Views: 43
  • Modding2.txt
    117.5 KB · Views: 39
Zip the mod's entire folder as it is in the game's Mods folder located at ~\Documents\My Games\Sid Meier's Civilization VI\Mods

Attach the resulting zip to a forum post.

If the zip is too large for the website to accept as an attachment, upload the zip of the mod to a file-sharing site such as dropbox or a google drive location and provide the link where the zip can be downloaded. Without the mod itself to look at it is going to be nearly impossible to determine what is not happening that ought to be happening.
 
Zip the mod's entire folder as it is in the game's Mods folder located at ~\Documents\My Games\Sid Meier's Civilization VI\Mods

Attach the resulting zip to a forum post.

If the zip is too large for the website to accept as an attachment, upload the zip of the mod to a file-sharing site such as dropbox or a google drive location and provide the link where the zip can be downloaded. Without the mod itself to look at it is going to be nearly impossible to determine what is not happening that ought to be happening.

Thank you very much T.T...It is so nice to help me to check the problem up to this level. Many Thanks.
 

Attachments

  • Keniisus_Civ_Template.rar
    25.6 KB · Views: 109
Trait-Type TRAIT_CIVILIZATION_SUNNY_HONGKONG_UA is never assigned Modifier-Type MODIFIER_SUNNY_HONGKONG_UA_TRADE_GOLD in table TraitModifiers. Therefore the modifier never takes effect because the game is not being told to do anything with the Modifier.

You had it in the code at one time towards the top of the thread but you inadvertently deleted it, apparently.

The only occurance of table TraitModifiers that I can see is this
Code:
INSERT INTO TraitModifiers
		(TraitType,						ModifierId								)
VALUES	('TRAIT_AGENDA_SUNNY_NOLEADER',	'AGENDA_MODIFIER_SUNNY_NOLEADER_UNHAPPY'	),
		('TRAIT_AGENDA_SUNNY_NOLEADER',	'AGENDA_MODIFIER_SUNNY_NOLEADER_HAPPY'	);
Which is correct because the AgendaTraits table links the Agenda to the Trait for that Agenda, and then the Trait is linked to its needed modifier to implement the effect of the Agenda.

But you need inserts for the Leader and the Civilization traits to their respective Modifiers in table TraitModifiers.
 
Last edited:
Thank you very much. Finally it is working. I will be more careful XDD.

Also it provides me a faster and easier way to copy from the original game by using the games modtype.
 
Top Bottom