1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

From absolute zero knowledge to basic tweaks

Discussion in 'Mod Creation Help' started by xsr, Mar 1, 2018.

  1. xsr

    xsr Chieftain

    Joined:
    Dec 31, 2016
    Messages:
    12
    Gender:
    Male
    [ Please delete this post if worthless, and move to appropriate place if has any value elsewhere. I can also upload the files if that's better. ]

    Purpose for writing: to do this in "non-technical" language, for "absolute dummies" to realize how easy it is to tweak and add basic yields and values, and as a potential stepping-stone for doing more stuff.

    (1) Making simple tweaks via editing base game files

    It's very easy to make basic tweaks.

    - The directory you want is probably Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization VI\Base\Assets\Gameplay\Data

    Spoiler :
    If expansion content, ....\Sid Meier's Civilization VI\DLC\Expansion1(or Australia, or Indonesia_Khmer etc.)\ (Assets) \ Data. For textual description changes, look under \...Text\en_US

    You will be using notepad to open these files (right-click, select "Open With"...)


    Example 1: Scout

    e.g. Say you want the scout to be a little stronger, e.g. from combat strength 10 to 12. You notice a "Units.xml" file in the base game directory, open it, use Ctrl-F to search for "scout", and eventually find a long line that contains ...UNIT_SCOUT" Cost="30" BaseMoves="3" ...Combat="10". Change that 10 to 12, save the changes, and test it by starting a game (you can go to civilopedia and check the info on the right-hand side).

    Example 2: Granary

    e.g. Say you want the granary to give more food, and cost a little more. You notice the file Buildings.xml in the base game directory; you find ..."BUILDING_GRANARY" ...Cost="65" and change that to perhaps 75, and you also find (on another line) ..."BUILDING_GRANARY" YieldType="YIELD_FOOD" YieldChange="1"/> and change that to 2. Save changes, and check if it works by starting/re-loading.

    Example 3: Egypt's riverside production trait

    e.g. Say you want to make Egypt's riverside district/wonder building a little stronger; find Civilizations.xml in the base game directory, Ctrl-F "Iteru", which leads you to both

    - TRAIT_RIVER_FASTER_BUILDTIME_DISTRICT
    - TRAIT_RIVER_FASTER_BUILDTIME_WONDER

    Spoiler :
    Similarly, if you did not know to Ctrl-F "Iteru", Ctrl-Fing "Egypt" would have led you to the "Iteru" keyword, to then Ctrl-F "Iteru" further and see where that leads you.


    Now you Ctrl-F both these things, which leads you to the number 15 for both of them (obviously representing the +15% bonus), and you go ahead and change one or both of them.

    Spoiler :
    It isn't always difficult to tweak fundamental mechanics, e.g. you can browse GlobalParameters.xml and spot the value that controls the food-required-for-growth exponent factor, or locate how and where district and settler costs scale inside Districts.xml and Units.xml. All can be done via simple modding as well (it would only take one line of text).


    (2) Making your own simple mod from scratch instead

    Spoiler Advantages include... :
    A few obvious advantages are:
    - Easy seperation of single player and multiplayer
    - Avoiding the problem of patches and expansions potentially undoing the changes you made in the base game files
    - Eliminating the risk of "corrupting" the game files (besides enabling and disabling your mod under the game menu's "Additional Content", you can temporarily disable faulty lines and individual changes in your mod by adding "--" in front of lines in Notepad)
    - If you continually tweak and re-tweak, then in the long run it is faster to put your changes in a file you create yourself; again, easily changing values and disabling lines via "--" (also making your own notes within the file using "--").



    Setting up the mod

    You need to create a directory and two files.

    - Under ...\Documents\My Games\Sid Meier's Civilization VI\Mods, create a directory, and name it anything you want.

    - Create two text files; you can use Notepad, then save the empty files with any name ending with ".modinfo" and ".sql". ( The name of the .sql file must match the one that the .modinfo file points to though; you can use "mymod.sql" for now )

    - Copy and paste the text in this spoiler into the file ending with .modinfo:

    Spoiler :
    <?xml version="1.0" encoding="utf-8"?>
    <Mod id="My tweaks">
    <Properties>
    <Name>Tweaks</Name>
    <Description>Insert description here</Description>
    </Properties>
    <Files>
    <File>mymod.sql</File>
    </Files>
    <Components>
    <UpdateDatabase id="Idunknowwhatthisdoes">
    <Items>
    <File>mymod.sql</File>
    </Items>
    </UpdateDatabase>
    </Components>
    </Mod>


    Doing the game changes (editing the .sql file)

    Spoiler :
    Text in italics represents text you find and refer to in the base game files; text in bold is text you actually type into your .sql file. ) The parts of the bold text that are in italics are the portions that you are copying from the base game files; therefore the general process is to first look to where you would have changed the base game files, and then find the section (the "table") the line is under, as well as the details of that line, which will guid you in what to type.


    Using the same three examples:

    Example 1: Scout

    After locating the relevant line in Units.xml (i.e. the line that contains Combat="10"), scroll up and you'll realize it is under the <Units> category. [ This is a "table". ]
    So, start with typing this inside your .sql file:
    UPDATE Units

    ( i.e. the "units" here is *not* from the file name Units.xml, but instead from scrolling up within Units.xml from the relevant line and noticing that it is organized under <Units> )

    Next, from the original line's Combat="10":
    SET Combat=12

    Now, from the original line's UnitType="UNIT_SCOUT":
    WHERE UnitType='UNIT_SCOUT'

    and we must end with a semi-colon as a "full stop":
    ;

    So you end up with:

    UPDATE Units SET Combat=12 WHERE UnitType='UNIT_SCOUT';

    Now you can test if it works (with the mod enabled, see if it crashes, and then start a new game to see if Civilopedia updates the information on the right-hand side).

    Spoiler :
    : "Most" changes works on re-loads too.


    Example 2: Granary

    We need two UPDATE lines; one to raise the production cost, the other to raise the food yield; look for the two corresponding relevant lines in Buildings.xml. Put the "full stop" ( ";" ) after each line.

    UPDATE Buildings SET Cost = 75 WHERE BuildingType='BUILDING_GRANARY';
    UPDATE Building_YieldChanges SET YieldChange=1 WHERE BuildingType='BUILDING_GRANARY';


    You can then test again (or test individually for each line).

    Example 3: Egypt's riverside production trait

    As before; but you'll have to scroll further up to find the organization header (the "table"), i.e. you'll realize that both relevant lines (the lines to be changed) are organized under <ModifierArguments>.

    UPDATE ModifierArguments SET Value=20 WHERE ModifierId='TRAIT_RIVER_FASTER_BUILDTIME_DISTRICT';

    UPDATE ModifierArguments SET Value=20 WHERE ModifierId='TRAIT_RIVER_FASTER_BUILDTIME_WONDER';



    (3) More stuff

    We've been using the UPDATE command so far. Now let's say we want to make the Gurdwara give +1 science and +1 culture instead of food.

    - We use a DELETE command to take away the food yield. ( We could use an UPDATE to set the food yield to 0, but the disadvantage of that is that the tooltip and civilopedia will then show a redundant "+0 food". )

    - We use an INSERT command to insert the new culture yield.

    DELETE

    Again, find the relevant line (inside buildings.xml, Ctrl=F "gurdwara", and look for where it goes ..."BUILDING_GURDWARA" YieldType="YIELD_FOOD"..., then scroll up to see where this line is under ( it is under <Building_YieldChanges> ):

    DELETE FROM Building_YieldChanges WHERE BuildingType='BUILDING_GURDWARA' AND YieldType='YIELD_FOOD';

    ( You can make a check to see if the removal was successful before going on. )

    INSERT

    Spoiler :
    The .xml files contain tables, i.e. with rows and columns, i.e. you can try using Excel or some other program to open them instead of notepad).


    To use INSERT, look at the structure of the relevant section(table) in more detail. You'll see that the relevant section(table) here is called <Building_YieldChanges>, and its lines always go BuildingType=something, YieldType=something, YieldChange=something. So you do the first half of the INSERT command like this:
    INSERT INTO Building_YieldChanges
    ('BuildingType', 'YieldType', 'YieldChange')


    Then you continue with
    VALUES
    ('BUILDING_GURDWARA', 'YIELD_CULTURE', 1),
    ('BUILDING_GURDWARA', 'YIELD_SCIENCE', 1);


    i.e. You end up with this:

    INSERT INTO Building_YieldChanges
    ('BuildingType', 'YieldType', 'YieldChange')
    VALUES
    ('BUILDING_GURDWARA', 'YIELD_CULTURE', 1),
    ('BUILDING_GURDWARA', 'YIELD_SCIENCE', 1);


    Spoiler :
    I don't know how to make it display properly on this forum post, but the structure is that there are three columns, with the headings 'BuildingType', 'YieldType', and 'YieldChange'. You can use multiple spaces or tabs to align stuff for your own viewing; i.e. it doesn't matter if you put one space or ten spaces between things, so adjust the spacings for your own visual clarity.


    Spoiler :
    You might also have realized at this point that since both the DELETE and INSERT are going on in the <Building_YieldChanges> table, you could also have, instead of using DELETE, used an UPDATE to convert the 2 food yield into a one culture or one science yield, and then used INSERT for the other yield.


    As another exercise for the INSERT command, let's try adding a relic slot into the gurdwara, like how the temple has a relic slot. Ctrl-F "temple" and find the relevant line as a reference, and you'll be able to produce the following:

    INSERT INTO Building_GreatWorks
    ('BuildingType', 'GreatWorkSlotType', 'NumSlots')
    VALUES
    ('BUILDING_GURDWARA', 'GREATWORKSLOT_RELIC', 1);


    Spoiler Text descriptions :
    Although the yields part of the tooltip and civilopedia (right-hand side) are dynamically changed (e.g. combat strength, district adjacency bonuses, relic slots, etc; this is why you can use civilopedia to check if your changes are taking effect), there are also textual descriptions that do not automatically change. In this case, the Gurdwara building has no additional text description, but the description for the belief that enables the Gurdwara does have a seperate text description. And instead of manually changing the game files (\Text\en_US folders), it can be done through mod also; but you still go to the ...\Data folders to look for relevant lines (not the ...\Text\en_US folders).

    Here we try Ctrl-Fing "description" inside Beliefs.xml. Upon finding the relevant line, we use UPDATE in this fashion:

    UPDATE Beliefs
    SET Description='Allows construction of Gurdwaras (+3 [ICON_Faith], +1 [ICON_Culture], +1 [ICON_Science], +1 [ICON_GreatWork_Relic] slot).'
    WHERE BeliefType='BELIEF_GURDWARA';


    So yes, you don't have to put the whole command on one line; but still only one "full stop" at the end. And you'll probably quickly remember the tables, then you don't have to keep referring to the base game files to do this. (So it's faster in the end too.)


    (4) More

    You can learn how to do a lot more on civfanatics forum and elsewhere (including various tools you can use instead of Notepad I think), and/or look at the files of other mods to see how stuff is done. [ You can also tweak other mods to your liking. ]

    Spoiler A few more notes :
    - Troubleshooting: Every time a game starts, a file called "Database.log" (along many others) will be re-created in ...\Documents\My Games\Sid Meier's Civilization VI\Logs. You can open this file in Wordpad, and Ctrl-F "error"; see if there is anything besides [Localization]: StartupErrorMessages.xml (that first line is normal).

    - There's at least two formats available: "sql" and "xml". [ I've been using SQL, hence the filename ended with .sql, and the files in the /Data folder are indeed in the xml format. ] A couple of differences:

    (1) "Commenting out" (temporarily disabling lines, which can be used to temporarily disable faulty lines, or jotting down notes for yourself or others) is done differently in both. For .sql, any line that starts with "--" will not be processed by the game, whereas in .xml you can disable multiple lines at once, starting with "<!--" and ending with "-->".


    (2) In SQL, instead of using "true", you use "1". [ e.g. Under Units.xml, you'll find MustPurchase="TRUE" for missionaries; so if you wanted to apply this to say traders (so that traders can only be purchased by gold), you would go UPDATE Units SET MustPurchase=1 WHERE UnitType='UNIT_TRADER'; or if you wanted missionaries to be trainable from normal production, you would set MustPurchase=0 for them. ]

    - In Rise and Fall, under ....\Sid Meier's Civilization VI\DLC\Expansion1\Data, there is a file called Expansion1_RemoveData.xml. i.e. Rise and Fall "modded" some stuff out from the base game files. [ e.g. If you are trying to reverse a change made in Rise and Fall, it may be necessary to take out (or "comment out") some of the "delete" lines in that file. ]

    - You can tweak maps from the base game and other modders by using the in-built "WorldBuilder" (...Documents\My Games\Sid Meier's Civilization VI\AppOptions.txt, change EnableWorldBuilder 0 to EnableWorldBuilder 1, now under "Additional Content" you can enable WorldBuilder. Copy the map file you want to edit into My Games\Sid Meier's Civilization VI\Saves\WorldBuilder and you can edit it, then use the new edited file to replace the old one. Currently I think there's a problem with the new Rise and Fall resources (amber/olives/turtles) though? )
     
    Last edited: Mar 5, 2018

Share This Page

Ebates: Get Paid to Shop