[Solved] Modify tile yields

Joined
Feb 20, 2017
Messages
820
Location
Kepler-22b
I'm still struggling with a simple tile plot modifier.
I've copied all of the code I think I need from the base game "Mother Russia" trait and I am trying to make it work for any tiles that have the Iron resource on it (+1 culture and +1 faith for all Iron tiles in your empire. [Eventually it will be for all strategic resources all the way form Horses up to Uranium])

This dificulty carries on from this post: https://forums.civfanatics.com/threads/advice-on-how-to-start-a-mod.614465/#post-14731807 but I've scrapped the Coastal production for strategic resources)

Any advice for this?:





INSERT INTO TraitModifiers

(TraitType, ModifierId)

VALUES ('TRAIT_LEADER_AVI_RISING_TIDE’, 'TRAIT_AVI_INCREASED_IRON_CULTURE'),

('TRAIT_LEADER_AVI_RISING_TIDE’, 'TRAIT_AVI_INCREASED_IRON_FAITH');

INSERT INTO Modifiers

(ModifierId, ModifierType, SubjectRequirementSetId)

VALUES ('TRAIT_AVI_INCREASED_IRON_CULTURE', 'MODIFIER_PLAYER_ADJUST_PLOT_YIELD', PLOT_HAS_IRON_REQUIREMENTS),

('TRAIT_AVI_INCREASED_IRON_FAITH', 'MODIFIER_PLAYER_ADJUST_PLOT_YIELD', PLOT_HAS_IRON_REQUIREMENTS);

INSERT INTO ModifierArguments

(ModifierId, Name, Value, Extra, Type)

VALUES ('TRAIT_AVI_INCREASED_IRON_CULTURE', YieldType, YIELD_CULTURE, null, 'ARGTYPE_IDENTITY'),

('TRAIT_AVI_INCREASED_IRON_CULTURE', Amount, 1, null 'ARGTYPE_IDENTITY'), ('TRAIT_AVI_INCREASED_IRON_FAITH', YieldType, YIELD_FAITH, null, 'ARGTYPE_IDENTITY'),

('TRAIT_AVI_INCREASED_IRON_FAITH', Amount, 1, null, 'ARGTYPE_IDENTITY');

<RequirementSets>

<Row>

<RequirementSetId>PLOT_HAS_IRON_REQUIREMENTS</RequirementSetId>

<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>

</Row>

</RequirementSets>

<Requirements>

<Row>

<RequirementId>REQUIRES_PLOT_HAS_IRON</RequirementId>

<RequirementType>REQUIREMENT_PLOT_TERRAIN_TYPE_MATCHES</RequirementType>

</Row>

</Requirements>

<RequirementArguments>

<Row>

<RequirementId>REQUIRES_PLOT_HAS_IRON</RequirementId>

<Name>TerrainType</Name>

<Value>TERRAIN_IRON</Value>

</Row>

</RequirementArguments>

<RequirementSetRequirements>

<Row>

<RequirementSetId>PLOT_HAS_IRON_REQUIREMENTS</RequirementSetId>

<RequirementId>REQUIRES_PLOT_HAS_IRON</RequirementId>

</Row>

</RequirementSetRequirements>
 
  1. You are mixing SQL sytnax with XML syntax. One file can only have either SQL syntax or XML syntax, but not both.
  2. xml syntax code must be in an .xml file
  3. sql syntax code must be in an .sql file
  4. Your SQL code has multiple syntax errors. It needs to be
    Code:
    INSERT INTO TraitModifiers (TraitType, ModifierId)
    VALUES	('TRAIT_LEADER_AVI_RISING_TIDE’, 'TRAIT_AVI_INCREASED_IRON_CULTURE'),
    	('TRAIT_LEADER_AVI_RISING_TIDE’, 'TRAIT_AVI_INCREASED_IRON_FAITH'); 
    
    INSERT INTO Modifiers (ModifierId, ModifierType, SubjectRequirementSetId)
    VALUES	('TRAIT_AVI_INCREASED_IRON_CULTURE', 'MODIFIER_PLAYER_ADJUST_PLOT_YIELD', 'PLOT_HAS_IRON_REQUIREMENTS'),
    	('TRAIT_AVI_INCREASED_IRON_FAITH', 'MODIFIER_PLAYER_ADJUST_PLOT_YIELD', 'PLOT_HAS_IRON_REQUIREMENTS');
    
    INSERT INTO ModifierArguments (ModifierId, Name, Value, Extra, Type)
    VALUES	('TRAIT_AVI_INCREASED_IRON_CULTURE', 'YieldType', 'YIELD_CULTURE', null, 'ARGTYPE_IDENTITY'),
    	('TRAIT_AVI_INCREASED_IRON_CULTURE', 'Amount', 1, null 'ARGTYPE_IDENTITY'),
    	('TRAIT_AVI_INCREASED_IRON_FAITH', 'YieldType', 'YIELD_FAITH', null, 'ARGTYPE_IDENTITY'),
    	('TRAIT_AVI_INCREASED_IRON_FAITH', 'Amount', 1, null, 'ARGTYPE_IDENTITY');
    You were missing multiple needed ' for designating text.
  5. There is no such thing as TERRAIN_IRON. Iron is a resource not a terrain. Hence, RESOURCE_IRON
  6. Your xml code needs
    Code:
    <GameData>
    	<RequirementSets>
    		<Row>
    			<RequirementSetId>PLOT_HAS_IRON_REQUIREMENTS</RequirementSetId>
    			<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
    		</Row>
    	</RequirementSets>
    	<Requirements>
    		<Replace>
    			<RequirementId>REQUIRES_PLOT_HAS_IRON</RequirementId>
    			<RequirementType>REQUIREMENT_PLOT_RESOURCE_TYPE_MATCHES</RequirementType>
    		</Replace>
    	</Requirements>
    	<RequirementArguments>
    		<Replace>
    			<RequirementId>REQUIRES_PLOT_HAS_IRON</RequirementId>
    			<Name>ResourceType</Name>
    			<Value>RESOURCE_IRON</Value>
    		</Replace>
    	</RequirementArguments>
    	<RequirementSetRequirements>
    		<Row>
    			<RequirementSetId>PLOT_HAS_IRON_REQUIREMENTS</RequirementSetId>
    			<RequirementId>REQUIRES_PLOT_HAS_IRON</RequirementId>
    		</Row>
    	</RequirementSetRequirements> 
    </GameData>
 
  1. You are mixing SQL sytnax with XML syntax. One file can only have either SQL syntax or XML syntax, but not both.
  2. xml syntax code must be in an .xml file
  3. sql syntax code must be in an .sql file
  4. Your SQL code has multiple syntax errors. It needs to be
    Code:
    INSERT INTO TraitModifiers (TraitType, ModifierId)
    VALUES    ('TRAIT_LEADER_AVI_RISING_TIDE’, 'TRAIT_AVI_INCREASED_IRON_CULTURE'),
        ('TRAIT_LEADER_AVI_RISING_TIDE’, 'TRAIT_AVI_INCREASED_IRON_FAITH'); 
    
    INSERT INTO Modifiers (ModifierId, ModifierType, SubjectRequirementSetId)
    VALUES    ('TRAIT_AVI_INCREASED_IRON_CULTURE', 'MODIFIER_PLAYER_ADJUST_PLOT_YIELD', 'PLOT_HAS_IRON_REQUIREMENTS'),
        ('TRAIT_AVI_INCREASED_IRON_FAITH', 'MODIFIER_PLAYER_ADJUST_PLOT_YIELD', 'PLOT_HAS_IRON_REQUIREMENTS');
    
    INSERT INTO ModifierArguments (ModifierId, Name, Value, Extra, Type)
    VALUES    ('TRAIT_AVI_INCREASED_IRON_CULTURE', 'YieldType', 'YIELD_CULTURE', null, 'ARGTYPE_IDENTITY'),
        ('TRAIT_AVI_INCREASED_IRON_CULTURE', 'Amount', 1, null 'ARGTYPE_IDENTITY'),
        ('TRAIT_AVI_INCREASED_IRON_FAITH', 'YieldType', 'YIELD_FAITH', null, 'ARGTYPE_IDENTITY'),
        ('TRAIT_AVI_INCREASED_IRON_FAITH', 'Amount', 1, null, 'ARGTYPE_IDENTITY');
    You were missing multiple needed ' for designating text.
  5. There is no such thing as TERRAIN_IRON. Iron is a resource not a terrain. Hence, RESOURCE_IRON
  6. Your xml code needs
    Code:
    <GameData>
        <RequirementSets>
            <Row>
                <RequirementSetId>PLOT_HAS_IRON_REQUIREMENTS</RequirementSetId>
                <RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
            </Row>
        </RequirementSets>
        <Requirements>
            <Replace>
                <RequirementId>REQUIRES_PLOT_HAS_IRON</RequirementId>
                <RequirementType>REQUIREMENT_PLOT_RESOURCE_TYPE_MATCHES</RequirementType>
            </Replace>
        </Requirements>
        <RequirementArguments>
            <Replace>
                <RequirementId>REQUIRES_PLOT_HAS_IRON</RequirementId>
                <Name>ResourceType</Name>
                <Value>RESOURCE_IRON</Value>
            </Replace>
        </RequirementArguments>
        <RequirementSetRequirements>
            <Row>
                <RequirementSetId>PLOT_HAS_IRON_REQUIREMENTS</RequirementSetId>
                <RequirementId>REQUIRES_PLOT_HAS_IRON</RequirementId>
            </Row>
        </RequirementSetRequirements> 
    </GameData>
Is there a way to convert all of that XML into SQL or can it only be written as XML?
 
SOLVED

here is the code I needed:
GameDefines.sql file:

INSERT INTO TraitModifiers

(TraitType, ModifierId)

VALUES ('TRAIT_LEADER_AVI_RISING_TIDE', 'TRAIT_AVI_INCREASED_IRON_CULTURE'),

('TRAIT_LEADER_AVI_RISING_TIDE', 'TRAIT_AVI_INCREASED_IRON_FAITH');

INSERT INTO Modifiers

(ModifierId, ModifierType, SubjectRequirementSetId)

VALUES ('TRAIT_AVI_INCREASED_IRON_CULTURE', 'MODIFIER_PLAYER_ADJUST_PLOT_YIELD', 'PLOT_HAS_IRON_REQUIREMENTS'),

('TRAIT_AVI_INCREASED_IRON_FAITH', 'MODIFIER_PLAYER_ADJUST_PLOT_YIELD', 'PLOT_HAS_IRON_REQUIREMENTS');

INSERT INTO ModifierArguments

(ModifierId, Name, Value, Extra, Type)

VALUES ('TRAIT_AVI_INCREASED_IRON_CULTURE', 'YieldType', 'YIELD_CULTURE', null, 'ARGTYPE_IDENTITY'),

('TRAIT_AVI_INCREASED_IRON_CULTURE', 'Amount', 1, null, 'ARGTYPE_IDENTITY'),

('TRAIT_AVI_INCREASED_IRON_FAITH', 'YieldType', 'YIELD_FAITH', null, 'ARGTYPE_IDENTITY'),

('TRAIT_AVI_INCREASED_IRON_FAITH', 'Amount', 1, null, 'ARGTYPE_IDENTITY');




TileResource_Data.xml:

<GameData>

<RequirementSets>

<Row>

<RequirementSetId>PLOT_HAS_IRON_REQUIREMENTS</RequirementSetId>

<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>

</Row>

</RequirementSets>

<Requirements>

<Replace>

<RequirementId>REQUIRES_PLOT_HAS_IRON</RequirementId>

<RequirementType>REQUIREMENT_PLOT_RESOURCE_TYPE_MATCHES</RequirementType>

</Replace>

</Requirements>

<RequirementArguments>

<Replace>

<RequirementId>REQUIRES_PLOT_HAS_IRON</RequirementId>

<Name>ResourceType</Name>

<Value>RESOURCE_IRON</Value>

</Replace>

</RequirementArguments>

<RequirementSetRequirements>

<Row>

<RequirementSetId>PLOT_HAS_IRON_REQUIREMENTS</RequirementSetId>

<RequirementId>REQUIRES_PLOT_HAS_IRON</RequirementId>

</Row>

</RequirementSetRequirements>

</GameData>
 
Back
Top Bottom