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

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

    Joined:
    Oct 4, 2004
    Messages:
    7,633
    Location:
    France
    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)
    Code:
    CREATE TABLE IF NOT EXISTS ExtraPlacement
        (    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:
    Code:
    <GameInfo>
        <ExtraPlacement>  
            <Replace MapName="GiantEarth" X="21" Y="75" TerrainType="TERRAIN_GRASS" />
        </ExtraPlacement>
    </GameInfo>
    
    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:
    Code:
    <GameInfo>
        <ExtraPlacement>
            <!-- 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" />
        </ExtraPlacement>
    </GameInfo>
    
    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):
    Code:
    
        <ExtraPlacement>
            <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" />
        </ExtraPlacement>
    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

    Code:
            <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 for a placement overriding the game's rules.
     
    Last edited: Feb 23, 2018
  2. Running

    Running Chieftain

    Joined:
    Oct 24, 2016
    Messages:
    4
    Gender:
    Male
    Need only custom.xml and the good code here:
    <GameInfo>
    <ExtraPlacement>
    <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" />
    </ExtraPlacement>
    </GameInfo>
     
  3. historix69

    historix69 Chieftain

    Joined:
    Sep 30, 2008
    Messages:
    1,213
    How can I add Rivers to GiantEarth map via custom.xml/sql?
    Or should I modify the MapToConvert Table in GiantEarth.lua directly?

    I would like to add a few rivers near starting positions of Civs and some Canal Cities ,
    e.g. X="103" Y="10" for Australia.
     
  4. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    7,633
    Location:
    France
    No XML abilities for that, you can modify the table directly, I don't know the values, but I think that you can directly use those in the table:
    Code:
    FlowDirectionTypes.FLOWDIRECTION_NORTH
    FlowDirectionTypes.FLOWDIRECTION_NORTHEAST
    FlowDirectionTypes.FLOWDIRECTION_SOUTHEAST
    FlowDirectionTypes.FLOWDIRECTION_SOUTH
    FlowDirectionTypes.FLOWDIRECTION_SOUTHWEST
    FlowDirectionTypes.FLOWDIRECTION_NORTHWEST
    and 1/0 for true/false at the position for the IsNEOfRiver, IsWOfRiver, ...
     
  5. historix69

    historix69 Chieftain

    Joined:
    Sep 30, 2008
    Messages:
    1,213
    Thanks for the info.
    Placing rivers works fine now.

    I tried placing Coral-Reefs via ExtraPlacement and noticed that they do not feature resources unless I specify the resource, too. Is it possible that placing a feature removes the resource generated before by Map-Generator?
     
  6. historix69

    historix69 Chieftain

    Joined:
    Sep 30, 2008
    Messages:
    1,213
    The Flow-Direction-Definitions for the 3 possible river segments are overcomplicated.
    0-1-2 is for counter-clockwise flow.
    3-4-5 is for clockwise flow.
    Unless I'm missing some info, a single bit would have been sufficient to indicate the flow-direction since the segments itself are separately activated.
    So far the Flow-Direction not only contains the flow direction but also the position of the river segment itself, which is a redundant information.
     

Share This Page

Ebates: Get Paid to Shop