Differences

This shows you the differences between two versions of the page.

Link to this comparison view

2n1map [2016/10/18 17:52]
jdmfarms [A - Preparing Asset Files]
2n1map [2017/05/24 14:27]
Line 1: Line 1:
-====== 2-in-1 map (DLC & no-DLC) ======  ​ 
  
-Game Version: ​ FS11 and later\\ 
-GE Version: ​ ? and later 
- 
----- 
- 
-[[modding_tutorials|Modding Index]] | [[map_making|Map Making Tutorials]] 
- 
----- 
- 
-===== Intro ===== 
- 
-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. 
- 
-===== Prep Work ===== 
- 
-The tools needed are; 
- 
-  * FileExplorer  (comes with MS-Windows) 
-  *  Notepad++ 
- 
-===== Full Details ===== 
- 
- 
-==== 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: 
- 
-<​code>​    <​extraSourceFiles>​ 
-!--    <​sourceFile filename="​giantsLS11DLC2SDK/​DLC2Bga.lua"/>​ --> 
-    </​extraSourceFiles></​code>​ 
- 
- 
-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): 
- 
-   <​code><​maps>​ 
- 
-     <!-- WithDLC2 --> 
-       <map... 
-         ... 
-       </​map>​ 
- 
-     <!-- NoDLC2 --> 
-       <map ... 
-         ... 
-       </​map>​ 
- 
-   </​maps></​code>​ 
- 
- 
-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): 
- 
-<​code>​    <​l10n>​ 
- 
-      <!-- WithDLC2 --> 
-        <text ...BriefingText1">​ 
-          ... 
-        </​text>​ 
-        <text ...BriefingText2">​ 
-          ... 
-        </​text>​ 
-        <text ...BriefingText3">​ 
-          ... 
-        </​text>​ 
- 
-      <!-- NoDLC2 --> 
-        <text ...BriefingText1">​ 
-          ... 
-        </​text>​ 
-        <text ...BriefingText2">​ 
-          ... 
-        </​text>​ 
-        <text ...BriefingText3">​ 
-          ... 
-        </​text>​ 
- 
-    </​l10n></​code>​ 
- 
- 
-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): 
- 
-<​code>​    <!-- 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[color=blue]_WithDLC2_</​briefingTextPrefix>​ 
-        <!--                ^^^^^^^^^^^^^^^^^^^^^^                  --> 
-        <​iconFilename>​map01/​map_preview_WithDLC2.DDS</​iconFilename>​ 
- 
-    </​map></​code>​ 
- 
- 
-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: 
- 
-<​code>​      <!-- WithDLC2 --> 
-        <text name="​sampleModMap_WithDLC2_BriefingText1">​ 
-        <!--        ^^^^^^^^^^^^^^^^^^^^^^            --> 
-            <​en>​ 
-                <​![CDATA[Write something here!]]> 
-            </​en>​ 
-        </​text>​ 
-        <text name="​sampleModMap[color=blue]_WithDLC2_[/​color]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></​code>​ 
- 
- 
-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): 
- 
-<​code>​   <!-- 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></​code>​ 
- 
-Example: 
- 
-      <​code><​!-- 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[color=blue]_NoDLC2_[/​color]BriefingText3">​ 
-        <!--        ^^^^^^^^^^^^^^^^^^^^            --> 
-            <​en>​ 
-                <​![CDATA[And even some more, if you want!]]> 
-            </​en>​ 
-        </​text></​code>​ 
- 
- 
----- 
- 
- 
-==== 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:​ 
-    <​code>​... 
-    SampleModMap = {} 
- 
-    local SampleModMap_mt = Class(SampleModMap,​ Mission00); 
- 
-    function SampleModMap:​new(baseDirectory,​ customMt) 
-    ...</​code>​ 
- 
- ​ After:​ 
-    <​code>​... 
-    SampleModMap_WithDLC2 = {} 
- 
-    local SampleModMap_WithDLC2_mt = Class(SampleModMap_WithDLC2,​ Mission00); 
- 
-    function SampleModMap_WithDLC2:​new(baseDirectory,​ customMt) 
-    ...</​code>​ 
- 
- 
-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: 
-<​code>​ 
--- 
--- 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!!                                                                      ^^^^^^^^^^^^ 
--- 
-</​code>​ 
- 
- 
-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; 
-<​code>​ 
-    -- 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. 
--- 
-</​code>​ 
- 
- 
----- 
- 
- 
-==== 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:​ 
-    <​code>​... 
-    SampleModMap = {} 
- 
-    local SampleModMap_mt = Class(SampleModMap,​ Mission00); 
- 
-    function SampleModMap:​new(baseDirectory,​ customMt) 
-    ...</​code>​ 
- 
- ​ After:​ 
-    <​code>​... 
-    SampleModMap_NoDLC2 = {} 
- 
-    local SampleModMap_NoDLC2_mt = Class(SampleModMap_NoDLC2,​ Mission00); 
- 
-    function SampleModMap_NoDLC2:​new(baseDirectory,​ customMt) 
-    ...</​code>​ 
- 
- 
-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: 
-<​code>​ 
--- 
--- 
-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);​ 
--- 
--- 
-</​code>​ 
- 
- 
-D.4) Remember to change the PDA map file-name too. You should be able to find it in the SampleModMap_NoDLC2:​load() function; 
-<​code>​ 
-    -- 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. 
--- 
-</​code>​ 
- 
- 
----- 
- 
-Original Author: ​ Decker_MMIV | Date:  January 30, 2012 
-        ​ 
-[[modding_tutorials|Modding Index]] | [[map_making|Map Making Tutorials]]