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

How to import a Civ5 map to Civ6 using Zobtzler's YnABMC and YnAMP

Discussion in 'Civ6 - Modding Tutorials & Reference' started by Gedemon, Sep 30, 2018.

  1. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,296
    Location:
    France
    • Prerequisite

    • 1/ Launch Civ5 and a game with the map you want to convert
    Remember to set "EnableTuner = 1" and "LoggingEnabled = 1" in the "\Documents\My Games\Sid Meier's Civilization 5\config.ini" file first. To quickly switch between civ5 and the FireTuner, I'd suggest you set the game's graphic option in windowed mode.

    Spoiler Set up game :
    Clipboard-1.jpg


    Make sure to really Enter the game after loading (the Firetuner Lua Console is locked until you pass the presentation screen)

    • 2/ Launch Civ5 Firetuner

    Spoiler Firetuner :
    Clipboard-2.jpg


    If it's the first time you launch the Tuner, you may not have the same screen, just the "Lua Console" tab, but the others are not required for the current usage.

    • 3/ Click "New Panel"

    Then find and check InGame (you can resize the "Panel Builder" windows), fill the "Name" (for example "Export Map" and click "OK"
    Spoiler Panel Builder :
    Clipboard-3.jpg


    • 4/ Click "New Control" drop down menu

    Spoiler Action Builder :
    Clipboard-4.jpg


    Select "Action Control", set the name of the button (for example "Export to Lua"), then in the "Action" entry copy and paste the code below:

    Code:
        local g_iW, g_iH = Map.GetGridSize()
        for iY = 0, g_iH - 1 do
            for iX = g_iW - 1, 0, -1  do
                local plot = Map.GetPlot(iX, iY)
                local NEOfRiver = 0
                local WOfRiver = 0
                local NWOfRiver = 0
                if plot:IsNEOfRiver() then NEOfRiver = 1 end -- GetRiverSWFlowDirection()
                if plot:IsWOfRiver() then WOfRiver = 1 end -- GetRiverEFlowDirection()
                if plot:IsNWOfRiver() then NWOfRiver = 1 end -- GetRiverSEFlowDirection()
                local endStr =""
                if plot:IsLake() then endStr = " -- Lake" end
                print("MapToConvert["..plot:GetX().."]["..plot:GetY().."]={"..plot:GetTerrainType()..","..plot:GetPlotType()..","..plot:GetFeatureType()..","..plot:GetContinentArtType()..",{{"..NEOfRiver..","..plot:GetRiverSWFlowDirection().. "},{"..WOfRiver..","..plot:GetRiverEFlowDirection().."},{"..NWOfRiver..","..plot:GetRiverSEFlowDirection().."}},{"..plot:GetResourceType(-1)..","..plot:GetNumResource().."}}"..endStr)
            end
        end
    
    then press "OK" and press the "Export to Lua" button you've just created. The export process can take some time depending on your computer and software, you can follow it in the Lua Console tab.
    Spoiler Lua Console tab :
    Clipboard-6.jpg

    When it's done the last line on the Lua console should show something like
    Code:
    [1259235.656] InGame: MapToConvert[0][79]={5,3,0,4,{{0,-1},{0,-1},{0,-1}},{-1,0}}
    With the first value at [0] and the second value ([79] in this example) a number that should be the map height - 1 (the example map size was 128x80)

    • 5/Exit the game

    That's an important step as the YnABMC tool will need to access civ5 Lua.log and that file is locked when civ5 is running.

    • 6/ Launch YnABMC.exe

    Check the advanced box, then click "Select .log File"

    Navigate to your civ5 logs folder (usually "..\Documents\my games\Sid Meier's Civilization 5\Logs\"), select the Lua.log file and click "Open"

    Fill the "Project Name" and "Author", then input your Mod ID (or generate a new one for a new project)

    Note that if you plan to update a project you've created, you have to use the same Mod ID as the previous export, else you won't be able to load your previously saved game with the old project.

    Check the options you want to see on the map setup screen then press "Generate Map"

    About the TSL option, the tool will create an empty Map.xml file in your project's Map folder if you've checked the "Map Support TSL" box, but you'll need to fill it manually following the instruction here.

    YnABMC can generate cliffs automatically for your map (there is no cliffs on Civ5 maps), you just need to check the "Generated" option in front of "Cliffs"

    Spoiler YnABMC :
    Clipboard-7.jpg


    • 7/ Move your project to the Civilization 6 Mods folder

    You'll find your project folder in the logs folder (usually "..\Documents\my games\Sid Meier's Civilization 5\Logs\"), you need to copy it in the Civ6 mods folder (usually "..\Documents\my games\Sid Meier's Civilization VI\Mods\")

    • 8/ Launch Civilization 6

    Go to the "Additional Content" menu and check that your mod is listed there and enabled. YnAMP should be enabled to.

    Spoiler Additional Content menu :
    Clipboard-8.jpg


    • 9/ Play the map

    Go back to the Main Menu, then Create a new game and select the converted map. Enjoy !

    Spoiler Play ! :
    Clipboard-9.jpg
     
    Last edited: Nov 16, 2018
    Zobtzler likes this.
  2. Zobtzler

    Zobtzler Chieftain

    Joined:
    Oct 21, 2017
    Messages:
    88
    Location:
    Sweden
  3. Hiram

    Hiram XML Plebian

    Joined:
    Dec 14, 2006
    Messages:
    1,093
    Location:
    Where The Streets Have No Name
    Yea boi. Gonna give this a go and convert myself a huge Earth map.

    Are you planning on making a tutorial on how to make tweaks to maps once they're converted?
     
  4. Zobtzler

    Zobtzler Chieftain

    Joined:
    Oct 21, 2017
    Messages:
    88
    Location:
    Sweden
    You can open the maps with the civ 6 worldbuilder, make your changes, the export it from the ESC menu, use the YnABMC tool to import the civ 6 Lua.log file, and recreate the map!
     
  5. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,296
    Location:
    France
    I'm writing the same tutorial for putting civ6 maps in a mod from a running game or the World Builder.
     
  6. Zobtzler

    Zobtzler Chieftain

    Joined:
    Oct 21, 2017
    Messages:
    88
    Location:
    Sweden
  7. _ViKinG_

    _ViKinG_ Chieftain

    Joined:
    Mar 15, 2013
    Messages:
    253
    Here is the logs
     

    Attached Files:

  8. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,296
    Location:
    France
  9. _ViKinG_

    _ViKinG_ Chieftain

    Joined:
    Mar 15, 2013
    Messages:
    253
    Yea that worked. Many thanks for the help :)
     
    Gedemon likes this.
  10. Hiram

    Hiram XML Plebian

    Joined:
    Dec 14, 2006
    Messages:
    1,093
    Location:
    Where The Streets Have No Name
    Got my own conversion of Huge Earth working, however I've run into a problem where city states are relocated to other starting positions when they are unable to use their set one rather than automatically being removed from the game - how do I get this to work on my map?
     
  11. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,296
    Location:
    France
    It's the AlternatePlacement config parameter which control that, it shows as the "Allow random placement for civs without TSL" checkbox in the advanced setup screen.

    I think you can change the default value to be "false" in an XML file in an <UpdateDatabase> in <FrontEndActions> with a <LoadOrder> above 1 using this code:
    Code:
    <GameInfo>
        <Parameters>
            <Update>
                <Where ParameterId="AlternatePlacement"/>
                <Set DefaultValue="0"/>
            </Update>
        </Parameters>
    </GameInfo>
     
  12. Hiram

    Hiram XML Plebian

    Joined:
    Dec 14, 2006
    Messages:
    1,093
    Location:
    Where The Streets Have No Name
    Worked nicely! I'm doing a test game now to see how it plays. Might post it on here for others to use as well.
     
    Gedemon likes this.
  13. Hiram

    Hiram XML Plebian

    Joined:
    Dec 14, 2006
    Messages:
    1,093
    Location:
    Where The Streets Have No Name
  14. Zobtzler

    Zobtzler Chieftain

    Joined:
    Oct 21, 2017
    Messages:
    88
    Location:
    Sweden
    Yes. Hopefully this week
     

Share This Page