1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

How to make a few changes to terrain, features and resources of a YnAMP map using XML

Discussion in 'Yet (not) Another Maps Pack' started by Gedemon, Aug 12, 2017.

  1. Gedemon

    Gedemon Modder Moderator

    Oct 4, 2004
    Note: for the examples in this thread I use the Giant Earth, the other names can be found in the corresponding map's threads or in the Map.xml file in the map's folder.

    If you are a modder:

    You'll need to set this in a SQL file loaded before the file setting the changes to the map (this is to make sure that your XML/SQL file won't fail to load if YnAMP is not activated)
        (    MapName TEXT NOT NULL,
            X INT default 0,
            Y INT default 0,
            ConfigurationId TEXT,
            ConfigurationValue TEXT,
            Civilization TEXT,
            TerrainType TEXT,
            FeatureType TEXT,
            ResourceType TEXT,
            Quantity INT default 0);
    Then see the XML example below to add the code in one of you file loaded after the one creating the table.

    If you are not a modder:

    See How to create custom.xml and custom.sql to make simple changes and add the XML code in the custom.xml file following the examples below.

    • Simple terrain change:
            <Replace MapName="GiantEarth" X="21" Y="75" TerrainType="TERRAIN_GRASS" />
    This one will replace the sea plot at 21,75 by grassland on the giant earth, closing the strait between Denmark and Sweden.

    • Conditional changes, depending of Civilizations:
            <!-- Around Riyadh TSL -->
            <Replace MapName="GiantEarth" X="39" Y="43" Civilization="CIVILIZATION_ARABIA"     TerrainType="TERRAIN_GRASS_HILLS" />
            <Replace MapName="GiantEarth" X="40" Y="45" Civilization="CIVILIZATION_ARABIA"     FeatureType="FEATURE_OASIS" />
            <Replace MapName="GiantEarth" X="39" Y="44" Civilization="CIVILIZATION_ARABIA"     FeatureType="FEATURE_OASIS" />
            <Replace MapName="GiantEarth" X="40" Y="43" Civilization="CIVILIZATION_ARABIA"     FeatureType="FEATURE_OASIS" />
            <Replace MapName="GiantEarth" X="39" Y="45" Civilization="CIVILIZATION_ARABIA"     ResourceType="RESOURCE_STONE" />
            <!-- Copenhaguen TSL -->
            <Replace MapName="GiantEarth" X="21" Y="75" Civilization="CIVILIZATION_DENMARK"    TerrainType="TERRAIN_GRASS" />
    This one will change some terrain, feature and resource around Riyadh position if CIVILIZATION_ARABIA is in the game, and will close the strait between Denmark and Sweden if CIVILIZATION_DENMARK is in the game.

    • Conditional change, depending of setup option (advanced modding):
            <Replace MapName="GiantEarth" X="31" Y="59" ConfigurationId="ClosedBosphorus"     TerrainType="TERRAIN_GRASS_HILLS" />
            <Replace MapName="GiantEarth" X="10" Y="67" ConfigurationId="MontSaintMichel"     FeatureType="FEATURE_MARSH" />
            <Replace MapName="GiantEarth" X="10" Y="73" ConfigurationId="Stonehenge"         ResourceType="RESOURCE_STONE" />
    This code change some terrains, features or resources depending of some configuration options.

    You can't change configuration options using the custom.xml or custom.sql method (I may add code to allow a custom_config.xml file at some point), but you can change the Config.xml file of an existing map, the code above is linked to the following code from Config.xml in the Maps/GiantEarth folder

            <Row Key1="Map" Key2="GiantEarth.lua" ParameterId="GiantEarthBosphorus" Name="LOC_MAP_CLOSED_BOSPHORUS_NAME" Description="" Domain="bool" DefaultValue="0" ConfigurationGroup="Map" ConfigurationId="ClosedBosphorus" GroupId="MapOptions" SortIndex="1000"/>
            <Row Key1="Map" Key2="GiantEarth.lua" ParameterId="GiantEarthMontSaintMichel" Name="LOC_MAP_MONT_SAINT_MICHEL_MARSH_NAME" Description="" Domain="bool" DefaultValue="0" ConfigurationGroup="Map" ConfigurationId="MontSaintMichel" GroupId="MapOptions" SortIndex="1000"/>
            <Row Key1="Map" Key2="GiantEarth.lua" ParameterId="GiantEarthStonehenge" Name="LOC_MAP_STONEHENGE_STONE_NAME" Description="" Domain="bool" DefaultValue="0" ConfigurationGroup="Map" ConfigurationId="Stonehenge" GroupId="MapOptions" SortIndex="1000"/>
    it's the "ConfigurationId" entries which link the setting and the effect on the map.

    For all those changes, you can find the type names in the game's files (Terrains.xml, Features.xml and Resources.xml) in "\Steam\steamapps\common\Sid Meier's Civilization VI\Base\Assets\Gameplay\Data", in the equivalent files for DLC/scenarios or in the corresponding tables if you use a SQL manager.

    Note that while you could potentially use a FeatureType entry to add a one-plot Natural Wonder on the map, I'd advise to follow the How to change or add Natural Wonders position of a YnAMP map tutorial for that, as some additional code is required to unsure placement overriding the game's rules.
  2. Running

    Running Chieftain

    Oct 24, 2016
    Need only custom.xml and the good code here:
    <Replace MapName="GiantEarth" X="154" Y="65" ResourceType="RESOURCE_SUGAR" Quantity="2" />
    <Replace MapName="GiantEarth" X="156" Y="64" ResourceType="RESOURCE_WHALES" Quantity="2" />
    <Replace MapName="GiantEarth" X="157" Y="64" ResourceType="RESOURCE_CRABS" Quantity="2" />
    <Replace MapName="GiantEarth" X="155" Y="64" ResourceType="RESOURCE_HORSES" Quantity="2" />
    <Replace MapName="GiantEarth" X="153" Y="65" TerrainType="TERRAIN_GRASS_HILLS" />
    <Replace MapName="GiantEarth" X="153" Y="65" FeatureType="FEATURE_FOREST" />

Share This Page