NMS:Tutorials/Merging two mods

From STEP Modding Wiki
BannerLogo
Tutorials // Merging two mods

Contents

Introduction

This is a tutorial on combining two mods which alter the same files. We’ll be merging two basebuilding mods as an example:

Tools

Steps involved

  1. Unpacking and decompiling the files.
  2. Editing DEFAULTSAVEDATA, DEFAULTSAVEDATACREATIVE, BASEBUILDINGTABLE, NMS_REALITY_GCPRODUCTTABLE.
  3. Compiling the files.
  4. Repacking the files.

(Step 1) Unpacking & decompiling

  1. Create a working folder (C:\Merge UltraBase-Star Trek Flags).
  2. Copy MBINCompiler and PSArcTool to this folder.
  3. Extract the mod archives into this folder.
  4. Unpack zz-UltraBaseBuilding.pak by dragging over PSArcTool.exe.
  5. Rename METADATA to METADATA2.
  6. Unpack _MOD.ST.PlayerFlagsFull.pak
  7. Delete the two .pak files, they are no longer needed. The folder should now look like the image below...
  8. Drag METADATA and METADATA2 folders over MBINCompiler.exe to decompile all the inner files

(Step 2) Editing

Open BASEBUILDINGTABLE.EXML from both mods in Notepad++. They are shown in 2 tabs for easy copying.

Now locate "TREKFLAG1”:

   <Property value="GcBaseBuildingEntry.xml">
     <Property name="ID" value="TREKFLAG1" />
     <Property name="HasProduct" value="True" />
     <Property name="IsTemporary" value="False" />
     <Property name="SnapPoints" value="TkModelResource.xml">
       <Property name="Filename" value="MODELS/PLANETS/BIOMES/COMMON/BUILDINGS/PARTS/BUILDABLEPARTS/DECORATION/CUSTOM/FLAGPOLE.SCENE.MBIN" />
     </Property>
     <Property name="Model" value="TkModelResource.xml">
       <Property name="Filename" value="MODELS/PLANETS/BIOMES/COMMON/BUILDINGS/PARTS/BUILDABLEPARTS/DECORATION/CUSTOM/FLAGPOLE.SCENE.MBIN" />
     </Property>
     <Property name="InactiveModel" value="TkModelResource.xml">
       <Property name="Filename" value="MODELS/PLANETS/BIOMES/COMMON/BUILDINGS/PARTS/BUILDABLEPARTS/DECORATION/CUSTOM/FLAGPOLE_LOD.SCENE.MBIN" />
     </Property>
     <Property name="DecorationType" value="GcBaseBuildingObjectDecorationTypes.xml">
       <Property name="BaseBuildingDecorationType" value="Normal" />
     </Property>
     <Property name="IsPlaceable" value="True" />
     <Property name="IsDecoration" value="True" />
     <Property name="IsConnection" value="False" />
     <Property name="PlacementNormalOffset" value="0" />
     <Property name="Biome" value="GcBiomeType.xml">
       <Property name="Biome" value="Lush" />
     </Property>
     <Property name="BuildableOnPlanetBase" value="True" />
     <Property name="BuildableOnSpaceBase" value="False" />
     <Property name="BuildableOnFreighter" value="False" />
     <Property name="BuildableOnPlanet" value="False" />
     <Property name="BuildableOnPlanetWithProduct" value="False" />
     <Property name="BuildableUnderwater" value="True" />
     <Property name="BuildableAboveWater" value="True" />
     <Property name="GlobalLimit" value="0" />
     <Property name="SystemLimit" value="0" />
     <Property name="PlanetLimit" value="0" />
     <Property name="RegionLimit" value="0" />
     <Property name="PlanetBaseLimit" value="0" />
     <Property name="FreighterBaseLimit" value="0" />
     <Property name="CheckPlaceholderCollision" value="True" />
     <Property name="CollisionScale" value="0.75" />
     <Property name="EnableCollision" value="True" />
     <Property name="CanPlaceOnItself" value="True" />
     <Property name="CanRotate3D" value="True" />
     <Property name="CanScale" value="True" />
     <Property name="Groups">
       <Property value="NMSString0x10.xml">
         <Property name="Value" value="ADDIT" />
       </Property>
     </Property>
     <Property name="StorageContainerIndex" value="-1" />
     <Property name="CanChangeColour" value="True" />
     <Property name="CanChangeMaterial" value="True" />
     <Property name="CanPickUp" value="True" />
     <Property name="ScanRadius" value="0" />
     <Property name="RemovesAttachedDecoration" value="True" />
     <Property name="EditsTerrain" value="False" />
     <Property name="BaseTerrainEditShape" value="Cube" />
     <Property name="TerrainEditBaseYOffset" value="0" />
     <Property name="TerrainEditTopYOffset" value="0" />
     <Property name="TerrainEditBoundsScalar" value="1" />
     <Property name="IsSealed" value="False" />
     <Property name="CloseMenuAfterBuild" value="False" />
     <Property name="LinkGridData" value="GcBaseLinkGridData.xml">
       <Property name="Connection" value="GcBaseLinkGridConnectionData.xml">
         <Property name="Network" value="GcLinkNetworkTypes.xml">
           <Property name="LinkNetworkType" value="Power" />
         </Property>
         <Property name="NetworkSubGroup" value="0" />
         <Property name="NetworkMask" value="0" />
         <Property name="ConnectionDistance" value="0.1" />
         <Property name="UseMinDistance" value="False" />
         <Property name="LinkSocketPositions" />
         <Property name="LinkSocketSubGroups" />
       </Property>
       <Property name="Rate" value="0" />
       <Property name="Storage" value="0" />
       <Property name="DependsOnEnvironment" value="None" />
       <Property name="DependsOnHotspots" value="None" />
       <Property name="DependentConnections" />
     </Property>
     <Property name="GhostsCountOverride" value="0" />
     <Property name="SnappingDistanceOverride" value="0" />
     <Property name="RegionSpawnLOD" value="1" />
   </Property>

Select this whole GcBaseBuildingEntry section. Copy this to the other mod’s BASEBUILDINGTABLE.EXML, right below <Property name="Objects">. Repeat this for the other flags. Save.

Next, locate “Star Trek Flags A”:

   <Property value="GcBaseBuildingGroup.xml">
     <Property name="ID" value="ADDIT" />
     <Property name="ParentGroup" value="DECORATION" />
     <Property name="Name" value="Star Trek Flags A" />
     <Property name="Icon" value="TkTextureResource.xml">
       <Property name="Filename" value="TEXTURES/UI/FRONTEND/ICONS/BUILDABLE/GROUPS/BUILDGROUP.STFLAGS.DDS" />
     </Property>
     <Property name="DefaultColourIdx" value="0" />
     <Property name="DefaultItem" value="" />
   </Property>
   <Property value="GcBaseBuildingGroup.xml">
     <Property name="ID" value="ADDIT2" />
     <Property name="ParentGroup" value="DECORATION" />
     <Property name="Name" value="Star Trek Flags B" />
     <Property name="Icon" value="TkTextureResource.xml">
       <Property name="Filename" value="TEXTURES/UI/FRONTEND/ICONS/BUILDABLE/GROUPS/BUILDGROUP.STFLAGS2.DDS" />
     </Property>
     <Property name="DefaultColourIdx" value="0" />
     <Property name="DefaultItem" value="" />
   </Property>

Select this section and copy it into the other mod’s BASEBUILDINGTABLE.EXML. Save. You’re done with this file.

Open NMS_REALITY_GCPRODUCTTABLE.EXML from both mods in Notepad++. Locate TREKFLAG1:

   <Property value="GcProductData.xml">
     <Property name="Id" value="TREKFLAG1" />
     <Property name="Name" value="ANDORIA" />
     <Property name="NameLower" value="Andoria" />
     <Property name="Subtitle" value="VariableSizeString.xml">
       <Property name="Value" value="Andoria" />
     </Property>
     <Property name="Description" value="VariableSizeString.xml">
       <Property name="Value" value="The Andorian Mining Consortium runs from no one." />
     </Property>
     <Property name="Hint" value="" />
     <Property name="GroupID" value="" />
     <Property name="DebrisFile" value="TkModelResource.xml">
       <Property name="Filename" value="MODELS/EFFECTS/DEBRIS/TERRAINDEBRIS/TERRAINDEBRIS4.SCENE.MBIN" />
     </Property>
     <Property name="BaseValue" value="1" />
     <Property name="Level" value="0" />
     <Property name="Icon" value="TkModelResource.xml">
       <Property name="Filename" value="TEXTURES/UI/FRONTEND/ICONS/BUILDABLE/DECORATION.STFLAG1.DDS" />
     </Property>
     <Property name="HeroIcon" value="TkModelResource.xml">
       <Property name="Filename" value="" />
     </Property>
     <Property name="Colour" value="Colour.xml">
       <Property name="R" value="0.172549" />
       <Property name="G" value="0.4862745" />
       <Property name="B" value="0.6235294" />
       <Property name="A" value="1" />
     </Property>
     <Property name="SubstanceCategory" value="GcRealitySubstanceCategory.xml">
       <Property name="SubstanceCategory" value="BuildingPart" />
     </Property>
     <Property name="Type" value="GcProductCategory.xml">
       <Property name="ProductCategory" value="BuildingPart" />
     </Property>
     <Property name="Rarity" value="GcRarity.xml">
       <Property name="Rarity" value="Common" />
     </Property>
     <Property name="Legality" value="GcLegality.xml">
       <Property name="Legality" value="Legal" />
     </Property>
     <Property name="Consumable" value="False" />
     <Property name="ChargeValue" value="0" />
     <Property name="StackMultiplier" value="0" />
     <Property name="DefaultCraftAmount" value="1" />
     <Property name="CraftAmountStepSize" value="1" />
     <Property name="CraftAmountMultiplier" value="1" />
     <Property name="Requirements">
       <Property value="GcTechnologyRequirement.xml">
         <Property name="ID" value="LAND2" />
         <Property name="InventoryType" value="GcInventoryType.xml">
           <Property name="InventoryType" value="Substance" />
         </Property>
         <Property name="Amount" value="5" />
       </Property>
       <Property value="GcTechnologyRequirement.xml">
         <Property name="ID" value="FUEL1" />
         <Property name="InventoryType" value="GcInventoryType.xml">
           <Property name="InventoryType" value="Substance" />
         </Property>
         <Property name="Amount" value="5" />
       </Property>
     </Property>
     <Property name="AltRequirements" />
     <Property name="Cost" value="GcItemPriceModifiers.xml">
       <Property name="SpaceStationMarkup" value="0" />
       <Property name="LowPriceMod" value="0" />
       <Property name="HighPriceMod" value="0" />
       <Property name="BuyBaseMarkup" value="0" />
       <Property name="BuyMarkupMod" value="0" />
     </Property>
     <Property name="RecipeCost" value="1" />
     <Property name="SpecificChargeOnly" value="False" />
     <Property name="NormalisedValueOnWorld" value="0" />
     <Property name="NormalisedValueOffWorld" value="0" />
     <Property name="TradeCategory" value="GcTradeCategory.xml">
       <Property name="TradingClass" value="None" />
     </Property>
     <Property name="WikiCategory" value="Construction" />
     <Property name="IsCraftable" value="True" />
     <Property name="DeploysInto" value="" />
     <Property name="EconomyInfluenceMultiplier" value="0" />
     <Property name="PinObjeective" value="" />
     <Property name="PinObjeectiveTip" value="" />
     <Property name="CookingIngredient" value="False" />
     <Property name="CookingValue" value="0" />
   </Property>

Select this whole GcProductData.xml section and paste this into the other mod’s NMS_REALITY_GCPRODUCTTABLE.EXML. Do this for all the flags. Save. You’re done with this file.

Open DEFAULTSAVEDATA.EXML for both mods. Locate "KnownProducts":

     <Property value="NMSString0x10.xml">
       <Property name="Value" value="TREKFLAG1" />
     </Property>

Copy this section for all 40 flags to the other mod's DEFAULTSAVEDATA.EXML. Save. Repeat this for the file DEFAULTSAVEDATACREATIVE.EXML.

(Step 3) Compiling

  1. Delete METADATA
  2. Rename METADATA2 to METADATA
  3. Drag all .EXML files over MBINCompiler.exe. You'll get new .MBINs.
  4. Delete or move all .EXML files.
  5. Delete MBINCompiler.exe and MBINCompiler.log

(Step 4) Packing

Select METADATA, MODELS and TEXTURES folders and GDDEBUGOPTIONS.GLOBALS.MBIN and drag them all over PSArcTool.exe.
A psarc.pak file has been created. This is your final mod. Give it a proper name and copy it to the NMS MODS folder.