2-in-1 map (DLC & no-DLC)

Game Version: FS11 and later
GE Version: ? and later


Modding Index | Map Making Tutorials


This is a step-by-step example of how to set up a map's file-assets and scripts, so one map01.I3D that already contains the DLC2-BGA, can be used for both a 'with-DLC2' and a 'no-DLC2' playable map in-game.

The way it works, is that the map-script that loads the no-DLC2 will delete the BGA scenegraph node and everything it contains, thereby removing it from the map when it is loaded in-game.

The tools needed are;

  • FileExplorer  (comes with MS-Windows)
  • Notepad++

A - Preparing Asset Files

A.1) The root-folder of your map should contain these files. Please note that 'SampleModMap' could be whatever you have already renamed the files to;

  • modDesc.XML
  • map01.I3D
  • defaultVehicles.XML
  • SampleModMap_briefing1.DDS
  • SampleModMap_briefing2.DDS
  • SampleModMap_briefing3.DDS
  • SampleModMap.LUA

A.2) Copy only these files mentioned below (i.e not modDesc.XML nor map01.I3D), and paste into the same folder, so you get a duplicate of the files;

  • defaultVehicles.XML
  • SampleModMap_briefing1.DDS
  • SampleModMap_briefing2.DDS
  • SampleModMap_briefing3.DDS
  • SampleModMap.LUA

A.3) The folder should now contain these files, depending on how the copy-paste duplication named the new files;

  • modDesc.XML
  • map01.I3D
  • defaultVehicles.XML
  • SampleModMap_briefing1.DDS
  • SampleModMap_briefing2.DDS
  • SampleModMap_briefing3.DDS
  • SampleModMap.LUA
  • defaultVehicles - Copy.XML
  • SampleModMap_briefing1 - Copy.DDS
  • SampleModMap_briefing2 - Copy.DDS
  • SampleModMap_briefing3 - Copy.DDS
  • SampleModMap - Copy.LUA

A.4) Now rename the files, so you end up with a set for '…_WithDLC2' and a set for '…_NoDLC2';

defaultVehicles.XML                →  defaultVehicles_WithDLC2.XML
SampleModMap_briefing1.DDS         →  SampleModMap_WithDLC2_briefing1.DDS
SampleModMap_briefing2.DDS         →  SampleModMap_WithDLC2_briefing2.DDS
SampleModMap_briefing3.DDS         →  SampleModMap_WithDLC2_briefing3.DDS
SampleModMap.LUA                   →  SampleModMap_WithDLC2.LUA

defaultVehicles - Copy.XML         →  defaultVehicles_NoDLC2.XML
SampleModMap_briefing1 - Copy.DDS  →  SampleModMap_NoDLC2_briefing1.DDS
SampleModMap_briefing2 - Copy.DDS  →  SampleModMap_NoDLC2_briefing2.DDS
SampleModMap_briefing3 - Copy.DDS  →  SampleModMap_NoDLC2_briefing3.DDS
SampleModMap - Copy.LUA            →  SampleModMap_NoDLC2.LUA

A.5) The result is that the root-folder of your map should now contain these files;

  • modDesc.XML
  • map01.I3D
  • defaultVehicles_NoDLC2.XML
  • defaultVehicles_WithDLC2.XML
  • SampleModMap_NoDLC2_briefing1.DDS
  • SampleModMap_NoDLC2_briefing2.DDS
  • SampleModMap_NoDLC2_briefing3.DDS
  • SampleModMap_NoDLC2.LUA
  • SampleModMap_WithDLC2_briefing1.DDS
  • SampleModMap_WithDLC2_briefing2.DDS
  • SampleModMap_WithDLC2_briefing3.DDS
  • SampleModMap_WithDLC2.LUA

A.6) Go to the map01 folder, and take a duplicate of the map_preview.DDS and pda_map.DDS files;

  • map_preview.DDS
  •  map_preview - Copy.DDS
  •  pda_map.DDS
  •  pda_map - Copy.DDS

A.7) Rename these like so;

 map_preview.DDS          →  map_preview_WithDLC2.DDS
 map_preview - Copy.DDS   →  map_preview_NoDLC2.DDS
 pda_map.DDS              →  pda_map_WithDLC2.DDS
 pda_map - Copy.DDS       →  pda_map_NoDLC2.DDS


B - Modifying modDesc.XML

B.1) Now that the files have been duplicated and renamed, you need to modify modDesc.XML - so open up modDesc.XML in Notepad++, and start by removing the extra-source-file DLC2Bga.LUA, either delete the line, or comment it out using XML-comment tags:

    <extraSourceFiles>
!--    <sourceFile filename="giantsLS11DLC2SDK/DLC2Bga.lua"/> -->
    </extraSourceFiles>

B.2) Go duplicate the [font=Courier New]<map>[/font]…[font=Courier New]</map>[/font] block, so you end up with two [font=Courier New]<map>[/font]-blocks within the [font=Courier New]<maps>[/font] section, and add some XML-comment tags;

Example (excluded some lines for clarity):

 

<maps>

     <!-- WithDLC2 -->
       <map...
         ...
       </map>

     <!-- NoDLC2 -->
       <map ...
         ...
       </map>

   </maps>

B.3) Also duplicate the three briefing <text>…</text> blocks, found in the <l10n> section, and add some XML-comment tags;

Example (excluded some lines for clarity):

    <l10n>

      <!-- WithDLC2 -->
        <text ...BriefingText1">
          ...
        </text>
        <text ...BriefingText2">
          ...
        </text>
        <text ...BriefingText3">
          ...
        </text>

      <!-- NoDLC2 -->
        <text ...BriefingText1">
          ...
        </text>
        <text ...BriefingText2">
          ...
        </text>
        <text ...BriefingText3">
          ...
        </text>

    </l10n>

B.4) Now you modify one of the <map> blocks' content, so it refer to the '…_WithDLC2' file-assets and briefing texts.

Please notice that the value enclosed by the <briefingTextPrefix>..</briefingTextPrefix>, contains an extra underscore-character '_'.

Example (lines wrapped for clarity):

    <!-- WithDLC2 -->
    <map id="SampleModMap_WithDLC2"
         className="SampleModMap_WithDLC2"
         filename="SampleModMap_WithDLC2.lua"
         defaultVehiclesXMLFilename="defaultVehicles_WithDLC2.xml">

        <title>
            <en>Sample Mod Map - WithDLC2</en>
        </title>
        
        <description>
            <en>This is the sample mod map - WithDLC2</en>
        </description>
        
        <briefingImagePrefix>sampleModMap_WithDLC2</briefingImagePrefix>
        <briefingTextPrefix>sampleModMap_WithDLC2_</briefingTextPrefix>
        <!--                ^^^^^^^^^^^^^^^^^^^^^^                  -->
        <iconFilename>map01/map_preview_WithDLC2.DDS</iconFilename>

    </map>

B.5) Then modify one of the sets of three briefing <text> blocks, so they contain texts for the '…_WithDLC2' map.

Please notice that there is an underscore-character just before the “BriefingText”.

Example:

      <!-- WithDLC2 -->
        <text name="sampleModMap_WithDLC2_BriefingText1">
        <!--        ^^^^^^^^^^^^^^^^^^^^^^            -->
            <en>
                <![CDATA[Write something here!]]>
            </en>
        </text>
        <text name="sampleModMap_WithDLC2_BriefingText2">
        <!--        ^^^^^^^^^^^^^^^^^^^^^^            -->
            <en>
                <![CDATA[Maybe also write something here too!]]>
            </en>
        </text>
        <text name="sampleModMap_WithDLC2_BriefingText3">
        <!--        ^^^^^^^^^^^^^^^^^^^^^^            -->
            <en>
                <![CDATA[And even some more, if you want!]]>
            </en>
        </text>

B.6) Do step B.4 and B.5 again, but this time modify the other blocks, so they refer to the '…_NoDLC2' file-assets and briefing texts.

Example (lines wrapped for clarity):

   <!-- NoDLC2 -->
    <map id="SampleModMap_NoDLC2"
         className="SampleModMap_NoDLC2"
         filename="SampleModMap_NoDLC2.lua"
         defaultVehiclesXMLFilename="defaultVehicles_NoDLC2.xml">

        <title>
            <en>Sample Mod Map - NoDLC2</en>
        </title>
        
        <description>
            <en>This is the sample mod map - NoDLC2</en>
        </description>
        
        <briefingImagePrefix>sampleModMap_NoDLC2</briefingImagePrefix>
        <briefingTextPrefix>sampleModMap_NoDLC2_</briefingTextPrefix>
        <!--                ^^^^^^^^^^^^^^^^^^^^                  -->
        <iconFilename>map01/map_preview_NoDLC2.DDS</iconFilename>

    </map>

Example:

     

<!-- NoDLC2 -->
        <text name="sampleModMap_NoDLC2_BriefingText1">
        <!--        ^^^^^^^^^^^^^^^^^^^^            -->
            <en>
                <![CDATA[Write something here!]]>
            </en>
        </text>
        <text name="sampleModMap_NoDLC2_BriefingText2">
        <!--        ^^^^^^^^^^^^^^^^^^^^            -->
            <en>
                <![CDATA[Maybe also write something here too!]]>
            </en>
        </text>
        <text name="sampleModMap_NoDLC2_BriefingText3">
        <!--        ^^^^^^^^^^^^^^^^^^^^            -->
            <en>
                <![CDATA[And even some more, if you want!]]>
            </en>
        </text>

C - Changing map-script for With DLC2

C.1) With Notepad++ open the LUA-script file for WithDLC2;

   SampleModMap_WithDLC2.LUA

C.2) Do a search-replace, to change all occurrences of SampleModMap with SampleModMap_WithDLC2

Example (excluded several lines for clarity):  Before:    

...
    SampleModMap = {}

    local SampleModMap_mt = Class(SampleModMap, Mission00);

    function SampleModMap:new(baseDirectory, customMt)
    ...

 After:    

...
    SampleModMap_WithDLC2 = {}

    local SampleModMap_WithDLC2_mt = Class(SampleModMap_WithDLC2, Mission00);

    function SampleModMap_WithDLC2:new(baseDirectory, customMt)
    ...

C.3) Copy these code lines here below and paste them into the LUA-script, just after the copyright notice and before the source-line containing the 'SampleModMap_WithDLC2 = {}' line:

--
-- Instead of using <extraSourceFiles> in modDesc.XML, the needed DLC2Bga.lua script-file is inlined here.
--
source(g_modsDirectory..'/SampleModMap/giantsLS11DLC2SDK/DLC2Bga.lua');
-- IMPORTANT!!            ^^^^^^^^^^^^
-- IMPORTANT!! This folder-name MUST be EXACTLY the same as your archive-name, e.g. SampleModMap.ZIP
-- IMPORTANT!!                                                                      ^^^^^^^^^^^^
--

C.4) As you can see in what you just pasted into the LUA-script, you must remember to change the folder-name to whatever you call your own map-folder or .ZIP file, else it will not work correctly.

C.5) Remember to change the PDA map file-name too. You should be able to find it in the SampleModMap_WithDLC2:load() function;

    -- load the PDA map image
    self.missionPDA:loadMap(Utils.getFilename("map01/pda_map_WithDLC2.png", self.baseDirectory));
--                                                           ^^^^^^^^
-- NOTICE! The PDA map image has a different filename than normal. You can of cause replace it as you like.
--

D - Changing map-script for No DLC2

D.1) With Notepad++ open the LUA-script file for NoDLC2;

   SampleModMap_NoDLC2.LUA

D.2) Do a search-replace, to change all occurrences of SampleModMap with SampleModMap_NoDLC2

Example (excluded several lines for clarity):  Before:    

...
    SampleModMap = {}

    local SampleModMap_mt = Class(SampleModMap, Mission00);

    function SampleModMap:new(baseDirectory, customMt)
    ...

 After:    

...
    SampleModMap_NoDLC2 = {}

    local SampleModMap_NoDLC2_mt = Class(SampleModMap_NoDLC2, Mission00);

    function SampleModMap_NoDLC2:new(baseDirectory, customMt)
    ...

D.3) Copy these code lines here below and paste them into the LUA-script, just after the copyright notice and before the source-line containing the 'SampleModMap_NoDLC2 = {}' line:

--
--
function DLC2BgaOnCreate(id)
    -- Remove the DLC2-BGA scenegraph-node and everything it contains.
    delete(id);
end;
g_onCreateUtil.addOnCreateFunction("dlc2_Bga_onCreate", DLC2BgaOnCreate);

function DLC2BunkerSiloOnCreate(id)
end;
g_onCreateUtil.addOnCreateFunction("dlc2_BunkerSilo_onCreate", DLC2BunkerSiloOnCreate);
--
--

D.4) Remember to change the PDA map file-name too. You should be able to find it in the SampleModMap_NoDLC2:load() function;

    -- load the PDA map image
    self.missionPDA:loadMap(Utils.getFilename("map01/pda_map_NoDLC2.png", self.baseDirectory));
--                                                           ^^^^^^
-- NOTICE! The PDA map image has a different filename than normal. You can of cause replace it as you like.
--

Original Author: Decker_MMIV | Date: January 30, 2012

Modding Index | Map Making Tutorials