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

New to modding and looking for some help with farm yield changes

Discussion in 'Mod Creation Help' started by G Ü N T H A R, May 26, 2020.

  1. G Ü N T H A R

    G Ü N T H A R Chieftain

    Joined:
    May 25, 2020
    Messages:
    7
    Gender:
    Male
    Location:
    Antwerp, Belgium
    So I'm new to modding and would like to make a mod for me and my friends but also people intersted in my civ I guess. I have been told not to link my code as it comes over as suspicios.. whoops.

    Thus here is my problem. I want to make my civ get science from farms. 1 science when the game starts and when Astronomy is researched I want farms to put out 2 science but lose 1 food yield. I have been struggling to find a way or even just a modifier to change improvement yields.

    Below you can find what I have so far but this fails to load. It does build however.
    If anyone knows what is wrong or even just a way to approach this differently that would be very kind!
     
  2. G Ü N T H A R

    G Ü N T H A R Chieftain

    Joined:
    May 25, 2020
    Messages:
    7
    Gender:
    Male
    Location:
    Antwerp, Belgium
    It has already come to my attention that there is a missing "," under the second "ModifierArguments" and I have changed this however this leads me to believe the issue lies in the UI

    As found here.. same question..
     
  3. maconnolly

    maconnolly Warlord Supporter

    Joined:
    Jun 3, 2019
    Messages:
    143
    Gender:
    Male
    Would you be happy to zip up and share your entire mod? Either built or the ModBuddy project/solution.

    If it's specifically syntax errors you are trying to isolate (or indeed invalid references), the two files that are your best friends are: Database.log and Modding.log, both of which can be found in the \My Games\Sid Meier's Civilization VI\Logs folder.

    The Database.log file will alert you to syntax errors and invalid references...though it won't tell you wish file they come from. However, entries are 'stamped' with a unique string that looks like: [1234567.890]. This string, in conjunction with the entries in Modding.log, can pinpoint the file in question.

    I'd be happy to take a look at the mod in its entirety if you can share - without the whole thing I don't feel confident troubleshooting your code. There are much brighter minds on these forums that may be able to, though, just by glancing it at what you've provided through your forum post.
     
    G Ü N T H A R likes this.
  4. G Ü N T H A R

    G Ü N T H A R Chieftain

    Joined:
    May 25, 2020
    Messages:
    7
    Gender:
    Male
    Location:
    Antwerp, Belgium
    Thanks for your input I will certainly be checking the log folder from now on!
    I suppose these are the files you are reffering to. If these aren't the right ones tell me.. xD
     

    Attached Files:

  5. maconnolly

    maconnolly Warlord Supporter

    Joined:
    Jun 3, 2019
    Messages:
    143
    Gender:
    Male
    Unfortunately, what you've attached is only the ModBuddy solution file - this is essentially the reference for the project that ModBuddy uses to open the mod so you can edit it etc. It doesn't contain the files themselves that contain the data you'll modify the game with.

    In the location you found that .civ6sln file, if you go up one level and just zip the entire folder that contains the .civ6sln file, that should give us everything we need. Thanks!
     
  6. G Ü N T H A R

    G Ü N T H A R Chieftain

    Joined:
    May 25, 2020
    Messages:
    7
    Gender:
    Male
    Location:
    Antwerp, Belgium
    Whoops my bad, as I said I'm really new to all of this.
    Since my files are in a mess... I gave you all I thought you would need hopefully these are the right one xD.
    If they aren't I'll honestly need a list because I am very lost.

    Again thanks for wanting to help me!
     

    Attached Files:

    Last edited: May 26, 2020
  7. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,130
    Location:
    Illinois, USA
    Your mod name should not contain period symbols in the name of the mod. Computers all interpret anything after the first period sign in a filename as being a file-extension type. The game does not know what to do with a file that has an extension type of ".5.12.modinfo"

    Modbuddy automatically adds ".modinfo" to the "Name" you use for the mod in Modbuddy in order to generate the needed "X.modinfo" file which contains the instructions to the game as to what to do with the files within the mod.

    No file loaded into the game via an UpdateDatabase type of action should ever be loaded in both the FrontEnd and InGame actions. Doing so accomplishes absolutely nothing except to generate spurious and confusing error messages in Database.log.

    Eliminate this file from your FrontEnd UpdateDatabase action -- "Core/Civilization_Config.sql". This file entirely contains code that is only valid in the InGame database and is utterly unusable in the FrontEnd.
    You only need this file in your FrontEnd UpdateDatabase action -- "Leader/Leader_Config.sql" since you have entered everything needed in that file for the pregame set up screens.

    Wrong or error-prone XML or SQL code will have no effect on the Modbuddy "Build" process -- the mod will always build successfully even when the code in your XML or SQL files is entirely rubbish. The only things that modbuddy generates errors for during the "build" process is when it cannot find or cannot read a file or when there is an existing copy of the mod in the game's Mods folder that has an open file (for example) so Modbuddy cannot eliminate the old version of the mod and replace it with the new version.

    This left-over bit is a mess and is confusing anyway
    Code:
    -----------------------------------------------
    -- RequirementSets
    -----------------------------------------------
    
    INSERT INTO RequirementSets
            (RequirementSetId,					RequirementSetType			)
    VALUES	('REQSET_CVS_PLAYER_IS_ROMANIAN',	'REQUIREMENTSET_TEST_ALL'	),
    		('REQSET_CVS_LEADER_IS_ROMANIAN',	'REQUIREMENTSET_TEST_ANY'	);
    
    -----------------------------------------------
    -- RequirementSetRequirements
    -----------------------------------------------
    
    INSERT INTO RequirementSetRequirements
            (RequirementSetId,					RequirementId					)
    VALUES	('REQSET_CVS_PLAYER_IS_ROMANIAN',	'REQ_CVS_PLAYER_IS_ROMANIAN'	);
    
    -----------------------------------------------
    -- Requirements
    -----------------------------------------------
    
    INSERT INTO Requirements
    		(RequirementId,					RequirementType						)
    VALUES	('REQ_CVS_PLAYER_IS_ROMANIAN',	'REQUIREMENT_REQUIREMENTSET_IS_MET'	);
    
    -----------------------------------------------
    -- RequirementArguments
    -----------------------------------------------
    
    INSERT INTO RequirementArguments
    		(RequirementId,					Name,				Value							)
    VALUES	('REQ_CVS_PLAYER_IS_ROMANIAN',	'RequirementSetId', 'REQSET_CVS_LEADER_IS_ROMANIAN'	);
    This is incorrect
    Code:
    INSERT INTO	Types
    	(Type,						Kind			)
    VALUES	('TRAIT_CIVILIZATION_HVTJ2_OBERON_UA',		'KIND_TRAIT'	),
    	('HVTJ2_OBERON_MODIFIER_BUILDERS',		'KIND_MODIFIER'	),
    	('HVTJ2_OBERON_MODIFIER_FARM_PRODUCTION',	'KIND_MODIFIER'	),
    	('HVTJ2_OBERON_MODIFIER_BUILDERS2',		'KIND_MODIFIER'	),
    	('HVTJ2_OBERON_MODIFIER_FARM_PRODUCTION2',	'KIND_MODIFIER'	);
    Because a ModifierId is not a "KIND_MODIFIER" nor any other kind and is never listed in table "Types"
    Code:
    INSERT INTO TraitModifiers           
            (TraitType,					ModifierId)
    VALUES  ('TRAIT_CIVILIZATION_HVTJ2_OBERON_UA',		'HVTJ2_OBERON_MODIFIER_BUILDERS'),
            ('TRAIT_CIVILIZATION_HVTJ2_OBERON_UA',		'HVTJ2_OBERON_MODIFIER_FARM_PRODUCTION'),
    	('TRAIT_CIVILIZATION_HVTJ2_OBERON_UA',		'HVTJ2_OBERON_MODIFIER_BUILDERS2'),
    	('TRAIT_CIVILIZATION_HVTJ2_OBERON_UA',		'HVTJ2_OBERON_MODIFIER_FARM_PRODUCTION2');
    PLOT_HAS_FARM_REQUIREMENTS is already defined for use in the game for Expansion 1 and the Outback Scenario, so you cannot attempt to add yet another RequirementSetId with the exact same designation. Just create your own unique one like I would here:
    Code:
    	<RequirementSets>
    		<Row>
    			<RequirementSetId>PLOT_HAS_FARM_REQUIRMEMENT_SET_LRS</RequirementSetId>
    			<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
    		</Row>
    	</RequirementSets>
    	<RequirementSetRequirements>
    		<Row>
    			<RequirementSetId>PLOT_HAS_FARM_REQUIRMEMENT_SET_LRS</RequirementSetId>
    			<RequirementId>PLOT_HAS_A_FARM_REQUIREMENT_LRS</RequirementId>
    		</Row>
    	</RequirementSetRequirements>
    	<Requirements>
    		<Row>
    			<RequirementId>PLOT_HAS_A_FARM_REQUIREMENT_LRS</RequirementId>
    			<RequirementType>REQUIREMENT_PLOT_IMPROVEMENT_TYPE_MATCHES</RequirementType>
    		</Row>
    	</Requirements>
    	<RequirementArguments>
    		<Row>
    			<RequirementId>PLOT_HAS_A_FARM_REQUIREMENT_LRS</RequirementId>
    			<Name>ImprovementType</Name>
    			<Value>IMPROVEMENT_FARM</Value>
    		</Row>
    	</RequirementArguments>
    Here you just have confusion because you are defining ModfierIds which you then never give arguments for, and you are giving arguments for ModifierId's which you have never defined in table Modifiers so far as I can see
    Code:
    -------------------------------------------------------------------------------------------------------------------------
    -- Modifiers
    -------------------------------------------------------------------------------------------------------------------------
    
    INSERT INTO Modifiers   
            (ModifierId,                                                ModifierType,                                        SubjectRequirementSetId)
    VALUES  ('HVTJ2_OBERON_MODIFIER_BUILDERS2',                        'MODIFIER_PLAYER_UNITS_ADJUST_BUILDER_CHARGES',        'UNIT_IS_BUILDER'),
            ('HVTJ2_OBERON_MODIFIER_FARM_PRODUCTION2',        'MODIFIER_PLAYER_ADJUST_PLOT_YIELD',        'PLAYER_HAS_TECH_REQUIREMENTS');
    
    --------------------------------------------------------------------------------------------------------------------------
    -- ModifierArguments
    --------------------------------------------------------------------------------------------------------------------------
    
    INSERT INTO ModifierArguments
            (ModifierId,                                                Name,                            Value)
    VALUES    ('HVTJ2_OBERON_MODIFIER_BUILDERS2',                        'Amount',            '0'),
            ('HVTJ2_OBERON_MODIFIER_FARM_PRODUCTION_ASTRONOMY',                        'YieldType',            'YIELD_SCIENCE'),
            ('HVTJ2_OBERON_MODIFIER_FARM_PRODUCTION_ASTRONOMY',                        'Amount',            '2'),
            ('HVTJ2_OBERON_MODIFIER_FARM_PRODUCTION_ASTRONOMY2',                        'YieldType',            'YIELD_FOOD'),
            ('HVTJ2_OBERON_MODIFIER_FARM_PRODUCTION_ASTRONOMY2',                        'Amount',            '1');
    and then here you are re-repeating stuff the game already has defined and which you have already defined earlier within the same file
    Code:
    INSERT INTO RequirementSets
            (RequirementSetId,												RequirementSetType)
    VALUES  ('PLOT_HAS_FARM_REQUIREMENTS',									'REQUIREMENTSET_TEST_ALL'),
    		('PLAYER_HAS_TECH_REQUIREMENTS',													'REQUIREMENTSET_TEST_ALL');
    
    
    
    INSERT INTO RequirementSetRequirements
            (RequirementSetId,												RequirementId)
    VALUES  ('PLOT_HAS_FARM_REQUIREMENTS',									'REQUIREMENT_PLOT_HAS_FARM'),
    		('PLAYER_HAS_TECH_REQUIREMENTS',													'PLAYER_HAS_TECH_REQUIREMENTS');
    
    INSERT INTO Requirements
            ('RequirementId',												'RequirementType')
    VALUES  ('REQUIREMENT_PLOT_HAS_FARM',									'REQUIREMENT_PLOT_IMPROVEMENT_TYPE_MATCHES'),
    		('PLAYER_HAS_TECH_REQUIREMENTS',											'REQUIREMENT_PLAYER_HAS_TECH');
    
    INSERT INTO RequirementArguments
            (RequirementId,										Name,						Value)
    VALUES  ('REQUIREMENT_PLOT_HAS_FARM',						'ImprovementType',			'IMPROVEMENT_FARM'),
    		('REQUIREMENT_PLAYER_HAS_TECH',						'TechnologyType',			'TECH_ASTRONOMY');      
     
    G Ü N T H A R likes this.
  8. G Ü N T H A R

    G Ü N T H A R Chieftain

    Joined:
    May 25, 2020
    Messages:
    7
    Gender:
    Male
    Location:
    Antwerp, Belgium
    Hey, LeeS!

    Thanks for your massive input! These mistakes seem so obvious now but I fail to see them when I need to see them... And the predefined rule which I didn't know about makes so much sense now!

    Thanks again
     
  9. G Ü N T H A R

    G Ü N T H A R Chieftain

    Joined:
    May 25, 2020
    Messages:
    7
    Gender:
    Male
    Location:
    Antwerp, Belgium
    Alright. I'm back... I have changed some code to make it more logical. And now for some reason, I can only see the changes from Core/Civilization_localisation...
    And I honestly do not know why because my in game and front end actions should be setup correct.
    If you see what is wrong with the frontend/ingame actions be so kind to tell me! If it is something else let me know too xD!

    Many thanks in advance!
     

    Attached Files:

  10. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,130
    Location:
    Illinois, USA
    What you posted is a Modbuddy project folder rather than a mod. You should really generally only zip the mod:
    • Zip the version of the mod the game is actually trying to use, which will be found as a sub-folder in ~\Documents\My Games\Sid Meier's Civilization VI\Mods. Zip the whole sub-folder for your mod.
    The problem with what you zipped is that the Modbuddy project appears to have more than one "mod" within it, and it cannot directly be placed into the game's Mods folder on our end without needing to copy it into our Modbuddy folder, then opening the project in Modbuddy, then Building the mod before we can make the game execute the mod if we cannot see the issue on our end by looking at the modinfo file. But since what you provided is not a mod the game is attempting to execute, there is no modinfo file to look at. It is far easier to diagnose erroneous code and erroneous procedures by looking at the modinfo file than by trying to make sense of the Modbuddy Solution folder.
     
  11. G Ü N T H A R

    G Ü N T H A R Chieftain

    Joined:
    May 25, 2020
    Messages:
    7
    Gender:
    Male
    Location:
    Antwerp, Belgium
    Alright, got it!
    This should be the correct file!
     

    Attached Files:

  12. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,130
    Location:
    Illinois, USA
    Database.log
    Code:
    [1794993.309] [Localization] ERROR: near ",": syntax error
    ------
    [1794998.497] [Gameplay] ERROR: Database::XMLSerializer (Civilization_UA.xml): 'Row' or 'Delete' expected, got 'Kinds'.
    [1794998.497] [Gameplay]: In XMLSerializer while updating table Row from file Civilization_UA.xml.
    [1794998.498] [Gameplay] ERROR: near "DISTRICT_CAMPUS": syntax error
    [1794998.507] [Gameplay] ERROR: table CivilizationTraits has no column named LeaderType
    [1794998.511] [Localization] ERROR: near ",": syntax error
    Modding.log
    Code:
    [1794993.309] LocalizedText - Loading Leader/Leader_Localisation.sql
    [1794993.309] Warning: LocalizedText - Failed loading SQL.
    …………………….
    [1794998.496] UpdateDatabase - Loading Core/Civilization_UA.xml
    [1794998.497] Warning: UpdateDatabase - Error Loading XML.
    [1794998.497] UpdateDatabase - Loading Core/Civilization_UI.sql
    [1794998.498] Warning: UpdateDatabase - Error Loading SQL.
    [1794998.498] UpdateDatabase - Loading Core/Civilization_UU.sql
    [1794998.501] UpdateDatabase - Loading Leader/Leader_Agenda.sql
    [1794998.504] UpdateDatabase - Loading Leader/Leader_Core.sql
    [1794998.506] UpdateDatabase - Loading Leader/Leader_UA.sql
    [1794998.507] Warning: UpdateDatabase - Error Loading SQL.
    ………………
    [1794998.510] LocalizedText - Loading Leader/Leader_Localisation.sql
    [1794998.511] Warning: LocalizedText - Failed loading SQL.
    The localization file error (or at least the first one I found)
    Code:
    -----------------------------------------------
    -- DOM
    -----------------------------------------------	
    
    	("en_US",	"LOC_LOADING_INFO_LEADER_HVTJ2_BART",
    	"I'm Bart"
    Since you are loading the file into both the FrontEnd and Ingame sides you get two errors in Database.log. It is fine to load the same Text file in both sides, and both error message chunks will go away once the issue is cured.

    Leader_UA.sql
    Code:
    -----------------------------------------------
    -- CivilizationTraits
    -----------------------------------------------
    
    INSERT INTO	CivilizationTraits
    		(LeaderType,				TraitType							)
    VALUES	('LEADER_HVTJ2_BART',	'TRAIT_LEADER_HVTJ2_BART_UA'	);
    Civilization_UI.sql
    Code:
    --------------------------------------------------------------------------------------------------------------------------
    -- Districts
    --------------------------------------------------------------------------------------------------------------------------
    INSERT INTO Districts
    	(DistrictType,			Name,					Description,					TraitType,					Cost,	Maintenance, PrereqTech,	PrereqCivic, Aqueduct, PlunderType, PlunderAmount, AdvisorType, NoAdjacentCity, CostProgressionModel, CostProgressionParam1, RequiresPlacement, InternalOnly, ZOC, CaptureRemovesBuildings, HitPoints, RequiresPopulation,	CaptureRemovesCityDefenses, MilitaryDomain, TravelTime, CityStrengthModifier, Appeal, Housing)
    SELECT	'DISTRICT_HVTJ2_OBERON_UI',	'LOC_DISTRICT_HVTJ2_OBERON_UI_NAME',	'LOC_DISTRICT_HVTJ2_OBERON_UI_DESCRIPTION',	'TRAIT_CIVILIZATION_DISTRICT_HVTJ2_OBERON_UI',	Cost/2, Maintenance, TECH_WRITING',	PrereqCivic, Aqueduct, PlunderType, PlunderAmount, AdvisorType, NoAdjacentCity, CostProgressionModel, CostProgressionParam1, RequiresPlacement, InternalOnly, ZOC, CaptureRemovesBuildings, HitPoints, 0,			CaptureRemovesCityDefenses, MilitaryDomain, TravelTime, CityStrengthModifier, Appeal, 2
    FROM Districts WHERE DistrictType = 'DISTRICT_CAMPUS';
    The problem is here
    Code:
     Maintenance, TECH_WRITING',	PrereqCivic
    Civilization_UA.xml
    Code:
    Completely borked and not formatted correctly for XML
    A couple of observations
    1. As a mod-maker you almost never will need to add anything to table <Kinds> nor alter anything within it. Therefore unless you become crazy skilled at modding Civ6 you should never have anything related to table <Kinds> in any XML or SQL file. So this is a giant "NO!"
      Code:
      <Kinds>
      	<Row Kind="KIND_CIVILIZATION"/>
      	<InsertOrIngore KIND="KIND_TRAIT"/>
      </Kinds>
    2. This is a properly-formatted XML file
      Code:
      <GameData>
      	<Types>
      		<Row Type="BUILDING_CHOCOLATIER_LRS_UNLOCKER" Kind="KIND_BUILDING" />
      		<Row Type="BUILDING_CHOCOLATIER_LRS" Kind="KIND_BUILDING" />
      	</Types>
      	<Building_YieldChanges>
      		<Row BuildingType="BUILDING_CHOCOLATIER_LRS" YieldType="YIELD_GOLD" YieldChange="2"/>
      		<Row BuildingType="BUILDING_CHOCOLATIER_LRS" YieldType="YIELD_CULTURE" YieldChange="1"/>
      	</Building_YieldChanges>
      	<BuildingPrereqs>
      		<Row Building="BUILDING_CHOCOLATIER_LRS" PrereqBuilding="BUILDING_CHOCOLATIER_LRS_UNLOCKER"/>
      	</BuildingPrereqs>
      	<BuildingModifiers>
      		<!--Adjust City Yield-->
      		<Row>
      			<BuildingType>BUILDING_CHOCOLATIER_LRS</BuildingType>
      			<ModifierId>BUILDING_LRS_ADD_COCOA_GOLD_2</ModifierId>
      		</Row>
      	</BuildingModifiers>
      </GameData>
      See the two different ways a row is formatted? Not anything like your file has.

      Your file is formatted more like this
      Code:
      <GameData>
      	<Row>
      		<Types>
      			<Row Type="BUILDING_CHOCOLATIER_LRS_UNLOCKER" Kind="KIND_BUILDING" />
      			<Row Type="BUILDING_CHOCOLATIER_LRS" Kind="KIND_BUILDING" />
      		</Types>
      		<Row>
      			<Building_YieldChanges>
      				<Row BuildingType="BUILDING_CHOCOLATIER_LRS" YieldType="YIELD_GOLD" YieldChange="2"/>
      				<Row BuildingType="BUILDING_CHOCOLATIER_LRS" YieldType="YIELD_CULTURE" YieldChange="1"/>
      			</Building_YieldChanges>
      			<BuildingPrereqs>
      				<Row Building="BUILDING_CHOCOLATIER_LRS" PrereqBuilding="BUILDING_CHOCOLATIER_LRS_UNLOCKER"/>
      			</BuildingPrereqs>
      		</Row>
      		<BuildingModifiers>
      			<!--Adjust City Yield-->
      			<Row>
      				<Row>
      					<BuildingType>BUILDING_CHOCOLATIER_LRS</BuildingType>
      					<ModifierId>BUILDING_LRS_ADD_COCOA_GOLD_2</ModifierId>
      				</Row>
      			</Row>
      		</BuildingModifiers>
      	<Row>
      </GameData>
      These are all improper methods because
      • "Row" is always contained within a Table name, and never the other way around.
      • "Row" is never contained within another "Row"
      • Each opening "Row" command needs a closing "/Row" command before another "Row" can be started. There are two methods to close a "Row", which the example of a proper XML format shows:
        The / symbol just before the > symbol closes the row
        Code:
        <Row BuildingType="BUILDING_CHOCOLATIER_LRS" YieldType="YIELD_GOLD" YieldChange="2"/>
        The </Row> command closes the row
        Code:
        <Row>
        	<BuildingType>BUILDING_CHOCOLATIER_LRS</BuildingType>
        	<ModifierId>BUILDING_LRS_ADD_COCOA_GOLD_2</ModifierId>
        </Row>

    Database.log tells you the story of what is wrong with your mod. If there are error messages in Databases.log that don't show when your mod is not enabled, then the error messages are coming from your mod. You need to learn to read the messages and to fix the errors being reported in Database.log. There was nothing wrong in your modbuddy procedures -- everything was a coding error, which Database.log was specifying and pointing to.
     

Share This Page