Basics
Required tools/Accessories:
Rule #1: Make sure you are not running CoH2 while modding. Once -dev mode is supported again, you'll be able to edit the game in real time as well.
Rule #2: No other rules.
With this guide you will be able to set up your very first CoH2 modding environment. First, before anything else, we need to make sure you have permissions to write in CoH2 install directory.
- Corsix's Mod Studio
- Dummy Archives
- Corsix's Lua Exploit
- Copernicus' SGA Extractor
- Copernicus' SGA Builder
- Notepad. You already have this.
- Administrative privileges
Rule #1: Make sure you are not running CoH2 while modding. Once -dev mode is supported again, you'll be able to edit the game in real time as well.
Rule #2: No other rules.
With this guide you will be able to set up your very first CoH2 modding environment. First, before anything else, we need to make sure you have permissions to write in CoH2 install directory.
Permissions
Your CoH2 installation folder is most likely located under program files folder, which is a protected folder by default. Users with no administrative rights will be unable to edit files in this directory and if UAC (User Account Control) is On, they will get prompted with a warning dialog even though they have writing access.
To ease the modding experience, you will have to either give yourself FULL ACCESS to CoH2 installation folder or turn off UAC. Both of these actions require administrative privileges. Not having writing access to CoH2 install directory will result in a lot of issues with Modding tools and batch files. You should pick either one of the options. If you'd like to have UAC on, use tutorial #2 to edit folder permissions.
1. Turn Off User Account Control
2. Changing folder permissions (Do this for CoH2 install directory)
To ease the modding experience, you will have to either give yourself FULL ACCESS to CoH2 installation folder or turn off UAC. Both of these actions require administrative privileges. Not having writing access to CoH2 install directory will result in a lot of issues with Modding tools and batch files. You should pick either one of the options. If you'd like to have UAC on, use tutorial #2 to edit folder permissions.
1. Turn Off User Account Control
2. Changing folder permissions (Do this for CoH2 install directory)
Mod Studio
You will need Corsix's Mod Studio installed and some dummy archives downloaded to your CoH2 installation folder. Corsix's Mod Studio can be downloaded from Corsix.org.
You can extract the downloaded Mod Studio package to any directory in your computer. For example, you could create a new folder on your desktop and call it "CoH2 Modding tools".
Dummy archives, which are simply some CoH1 files, can be downloaded from here. They are required because Mod Studio relies on the existence of these archives: the tool will not work without them! Extract the dummy archives from the downloaded archive to your CoH2 installation directory. Make sure new folders called "Engine" and "RelicOnline" are now existing in your CoH2 installation directory.
Default path to your CoH2 installation directory:
You can extract the downloaded Mod Studio package to any directory in your computer. For example, you could create a new folder on your desktop and call it "CoH2 Modding tools".
Dummy archives, which are simply some CoH1 files, can be downloaded from here. They are required because Mod Studio relies on the existence of these archives: the tool will not work without them! Extract the dummy archives from the downloaded archive to your CoH2 installation directory. Make sure new folders called "Engine" and "RelicOnline" are now existing in your CoH2 installation directory.
Default path to your CoH2 installation directory:
Code
C:\Program Files (x86)\Steam\SteamApps\common\Company of Heroes 2
.module for Mod Studio
Now that we have Mod Studio installed and the CoH2 installation directory ready, we will create a .module file for your mod which will be used to describe mod properties for Mod Studio.
Start by opening Notepad and pasting in the following content:
Save it to your CoH2 installation directory as FirstMod_dev.module.
What does this file do? Let's go through the lines:
Name of the mod.
Description of the mod.
Version of the mod.
Path to the mod root directory in the CoH2 installation directory.
Path to the folder containing attrib files.
Path to the folder containing data files.
Start by opening Notepad and pasting in the following content:
Code
[global]
UIName = FirstMod
Description = FirstMod
ModVersion = 1.0
ModFolder = FirstMod\
[attrib:common]
folder = FirstMod\attribArchive
[data:common]
folder = FirstMod\data
Save it to your CoH2 installation directory as FirstMod_dev.module.
What does this file do? Let's go through the lines:
Code
UIName
Name of the mod.
Code
Description
Description of the mod.
Code
ModVersion
Version of the mod.
Code
ModFolder
Path to the mod root directory in the CoH2 installation directory.
Code
[attrib:common]
folder = FirstMod\attribArchive
Path to the folder containing attrib files.
Code
[data:common]
folder = FirstMod\data
Path to the folder containing data files.
Folder System
Your mod needs a folder system to hold all its mod files. Create the following folder system in your CoH2 installation directory:
Folder system for FirstMod
Note that this is a very basic folder system.
Folder system for FirstMod
Note that this is a very basic folder system.
Corsix's lua Exploit
You will need Corsix's lua exploit which can be found in this forum post on Relic News forums. Place the downloaded "ignore-unsigned-sga-v2b.fnt" file into FirstMod\data\font\ folder.
This Lua exploit is used to get rid of a protection system in CoH2. This protection system denies the usage of unsigned SGA archives in CoH2. It might look like illegal hacks, but don't worry. Relic has stated that they are not going to block this exploit and will not punish you for using it.
This Lua exploit is used to get rid of a protection system in CoH2. This protection system denies the usage of unsigned SGA archives in CoH2. It might look like illegal hacks, but don't worry. Relic has stated that they are not going to block this exploit and will not punish you for using it.
Locale
Your mod needs a locale file in order to add new locale strings. Even a blank one is required for the Mod Studio to load the mod properly.
Open Notepad and save an empty text file to FirstMod\locale\english as "FirstMod.English.ucs" with Unicode encoding. Do not use any other encoding!
Open Notepad and save an empty text file to FirstMod\locale\english as "FirstMod.English.ucs" with Unicode encoding. Do not use any other encoding!
Loading your mod in Mod Studio
Now, you can load your mod in Mod Studio by doing the following:
You should now see your mod being loaded in Mod Studio, but there is nothing in the file tree view! Don't worry. We'll add files in the next steps. Don't close Mod Studio just yet.
- Launch Mod Studio (ModStudio.exe) and select "Load CoH/OF Mod".
- Browse to CoH2 installation directory and select FirstMod_dev.module.
- Mod Studio will display a window with a label reading "Select a locale to use for this mod:". For this tutorial, select english and put a check mark next to "Remember for this mod".
You should now see your mod being loaded in Mod Studio, but there is nothing in the file tree view! Don't worry. We'll add files in the next steps. Don't close Mod Studio just yet.
Extracting files from SGA archives
In the next step we will be extracting files to your mod folders in order to edit them in Mod Studio. You'll need Copernicus' SGA Extractor for this, which can be found in this thread on Relic News forums.
Extract the downloaded package to any directory on your computer. The folder dedicated to CoH2 modding tools that you created earlier is a great place to put it.
We will now extract AttribArchive.sga. This file can be found in:
Drag and drop AttribArchive.sga on cc2sga.exe, which is located in the folder where you chose to extract Copernicus' SGA extractor. A command prompt will appear to inform you that AttribArchive.sga is being extracted. The command prompt will disappear once the extraction process is finished.
Extract the downloaded package to any directory on your computer. The folder dedicated to CoH2 modding tools that you created earlier is a great place to put it.
We will now extract AttribArchive.sga. This file can be found in:
Code
CoH2 installation directory\CoH2\Archives
Drag and drop AttribArchive.sga on cc2sga.exe, which is located in the folder where you chose to extract Copernicus' SGA extractor. A command prompt will appear to inform you that AttribArchive.sga is being extracted. The command prompt will disappear once the extraction process is finished.
Editing a pioneer squad
Navigate to the newly created directory in:
Then, go further down to:
Copy the "pioneer_squad" folder to your clipboard.
After this, go to:
Create the following structure of folders inside of it:
Paste the copied "pioneer_squad" folder to:
To be able to see the new files in Mod Studio, we have to refresh its file list. You can do that by going to the "Tools" tab and by double clicking "Refresh file list". Return to the "Files" tab after this.
In the file tree view, browse to:
Double click pioneer_squad_mp.rgd to open it for editing.
Opening pioneer_squad_mp.rgd in the file tree view
In the data tree view, navigate to:
Navigating to unit_list\0x4E85AA48\
Select the item called "num". This table contains the number of pioneers in a pioneer squad. Change it to 5 in the properties and click "Save".
Editing properties of unit_list for "pioneer_squad_mp.rgd"
Notice that the item "type" defines the blueprint used for each entity of the pioneer squad. In this case, it is "pioneer_mp".
This entity is located in:
You could also add this to your mod in order to edit it. Make sure to duplicate its folder structure to your mod and copy the "pioneer" folder in there.
The end result should be:
You should now refresh the file list in the Mod Studio and navigate in the file tree view to:
Double click "pioneer_mp.rgd" to open it for editing. Then, navigate to:
In "Properties", change the value in the "manpower" field to 10.
Hit the "Save" button. You can now close pioneer_mp.rgd and pioneer_squad_mp.rgd file tabs, but it is not an absolute necessity.
We have successfully increased the pioneer squad size from 4 to 5 and lowered its cost to 10 manpower per member, which will result in a total unit cost of 50 manpower (5*10).
Code
CoH2 installation directory\CoH2\Archives\AttribArchive\attrib\
Then, go further down to:
Code
sbps\races\german\soldiers\
Copy the "pioneer_squad" folder to your clipboard.
After this, go to:
Code
FirstMod\attribArchive\
Create the following structure of folders inside of it:
Code
attrib\sbps\races\german\soldiers\
Paste the copied "pioneer_squad" folder to:
Code
FirstMod\attribArchive\attrib\sbps\races\german\soldiers\
To be able to see the new files in Mod Studio, we have to refresh its file list. You can do that by going to the "Tools" tab and by double clicking "Refresh file list". Return to the "Files" tab after this.
In the file tree view, browse to:
Code
attrib\attrib\sbps\races\german\soldiers\pioneer_squad\
Double click pioneer_squad_mp.rgd to open it for editing.
Opening pioneer_squad_mp.rgd in the file tree view
In the data tree view, navigate to:
Code
squad_loadout_ext\unit_list\0x4E85AA48\
Navigating to unit_list\0x4E85AA48\
Select the item called "num". This table contains the number of pioneers in a pioneer squad. Change it to 5 in the properties and click "Save".
Editing properties of unit_list for "pioneer_squad_mp.rgd"
Notice that the item "type" defines the blueprint used for each entity of the pioneer squad. In this case, it is "pioneer_mp".
This entity is located in:
Code
CoH2 install directory\CoH2\Archives\AttribArchive\attrib\ebps\races\german\soldiers\pioneer\
You could also add this to your mod in order to edit it. Make sure to duplicate its folder structure to your mod and copy the "pioneer" folder in there.
The end result should be:
Code
FirstMod\attribArchive\attrib\ebps\races\german\soldiers\pioneer\
You should now refresh the file list in the Mod Studio and navigate in the file tree view to:
Code
ebps\races\german\soldiers\pioneer\
Double click "pioneer_mp.rgd" to open it for editing. Then, navigate to:
Code
cost_ext\time_cost\cost\
In "Properties", change the value in the "manpower" field to 10.
Hit the "Save" button. You can now close pioneer_mp.rgd and pioneer_squad_mp.rgd file tabs, but it is not an absolute necessity.
We have successfully increased the pioneer squad size from 4 to 5 and lowered its cost to 10 manpower per member, which will result in a total unit cost of 50 manpower (5*10).
Packing your mod into SGA archives using a batch
The next step is to pack your mod into SGA (this has to be done since -dev is currently not supported). You'll need Copernicus' SGA builder for this process. You can download it from this thread on Relic News forums. Extract the downloaded archive to:
We are extracting the SGA builder directly to the "FirstMod" folder to provide an easy access to executables via the batch file.
Make sure you have these files in your "FirstMod" directory:
We will now create a batch file to pack your mod into SGA archives.
Open Notepad and paste in following content:
What will this do? It will remove any already existing SGA archives to prevent possible issues and then create a data and an attrib archive containing files from FirstMod\data and FirstMod\attribArchive\.
Save this file as PackMod.bat to:
Run it and go to FirstMod\archives\ to see if FirstMod_Data.sga and FirstMod_Attrib.sga files have been created. If so, continue to the next step.
Code
CoH2 installation directory\FirstMod
We are extracting the SGA builder directly to the "FirstMod" folder to provide an easy access to executables via the batch file.
Make sure you have these files in your "FirstMod" directory:
Code
pc2sga.exe
cope.Relic.dll
cope.dll
We will now create a batch file to pack your mod into SGA archives.
Open Notepad and paste in following content:
Code
@echo off
set "location=..\FirstMod\archives\"
del %location%*.sga
pc2sga.exe attribArchive %location%FirstMod_Attrib.sga attrib
pc2sga.exe data %location%FirstMod_Data.sga data
exit
What will this do? It will remove any already existing SGA archives to prevent possible issues and then create a data and an attrib archive containing files from FirstMod\data and FirstMod\attribArchive\.
Save this file as PackMod.bat to:
Code
CoH2 installation drectory\FirstMod
Run it and go to FirstMod\archives\ to see if FirstMod_Data.sga and FirstMod_Attrib.sga files have been created. If so, continue to the next step.
.module for the game
The final step is to create a module to "tell" the game how it should load your mod. Note that the module file we created earlier for Mod Studio is completely different. Do not mix these two up!
Make a copy of RelicCoH2.module and rename the copied file to FirstMod.module. Open it in Notepad.
Scroll down to [attrib:common] and make following changes:
We'll do the same process for [data:common]:
Save changes to FirstMod.module
Make a copy of RelicCoH2.module and rename the copied file to FirstMod.module. Open it in Notepad.
Scroll down to [attrib:common] and make following changes:
- Add the following line to the archive list before any other archives:Code
With this line we are overriding any already existing attribute files, which is pioneer_squad_mp.rgd in this case.archive.01 = FirstMod\Archives\FirstMod_Attrib
- Increase other archives numbers by one. Make sure there are no duplicates. Example result:
Code[attrib:common]
archive.01 = FirstMod\Archives\FirstMod_Attrib
archive.02 = CoH2\Archives\AttribArchive
We'll do the same process for [data:common]:
- Add to the archive list before any other archives:
Code
With this line we are overriding any already existing data files and adding Corsix's Lua exploit, which will allow us to use unsigned SGA archives.archive.01 = FirstMod\Archives\FirstMod_Data
- Increase other archives numbers by one. Make sure there are no duplicates. Example result:
Code
[data:common]
required = 1
folder = CoH2\Data
archive.01 = FirstMod\Archives\FirstMod_Data
archive.02 = CoH2\Archives\Data
archive.03 = CoH2\Archives\Sound
archive.04 = CoH2\Archives\MPScenarios
archive.05 = CoH2\Archives\UI
archive.06 = CoH2\Archives\ArtArmies
archive.07 = CoH2\Archives\ArtEnvironment
archive.08 = CoH2\Archives\ArtGermanEF
archive.09 = CoH2\Archives\ArtSovietEF
Save changes to FirstMod.module
Loading mods to the game
There are many ways to load a mod to CoH2. Here are two working methods:
Method #1 (regular shortcut):
Method #2 (via steam GUI):
Method #1 (regular shortcut):
- Right click on "RelicCoH2.exe" and select Send to -> Desktop (create shortcut)
- Default path to CoH2 installation folder in Windows 7: C:\Program Files (x86)\Steam\steamapps\common\Company of Heroes 2\
- "RelicCoH2.exe" is located in this folder.
- Right click on "RelicCoH2.exe" and select Send to -> Desktop (create shortcut)
- Right click on your newly created shortcut. Select Properties.
- Add the following line after the last quotation mark in field called "Target" under the "Shortcut" tab: Code
Notice the space before the last quotation mark and -mod. You could also add -nomovies to skip intro movies and get directly to the main menu screen. Example:-mod FirstModCode"C:\Program Files (x86)\Steam\steamapps\common\Company of Heroes 2\RelicCoH2.exe" -mod FirstMod
- Press "Apply" and "OK".
- Double click this shortcut to launch CoH2 with FirstMod.
Method #2 (via steam GUI):
- Go to your steam games collection, right click CoH2 and select "Properties".
- Under the "General" tab, click the "Set launch options..." button.
- Enter "-mod FirstMod" without quotation marks and click "OK". You could also add -nomovies to skip intro movies and get directly to the main menu screen.
- Close the game's "Properties" window and launch CoH2.
Testing your mod
Start a custom game vs AI, play as Germans. You should now notice that your starting pioneer squad has 5 members and that you are able to produce a 5 man pioneer squad from your HQ at a cost of 50 manpower.
However, a 5 man pioneer squad shouldn't cost 6 population. Let's fix this and make the population cost match the squad size.
Open pioneer_squad_mp.rgd if don't have it open anymore. Navigate to:
Hit "Save", run PackMod.bat and launch CoH2. Your pioneer squad population cost should now match the squad size.
However, a 5 man pioneer squad shouldn't cost 6 population. Let's fix this and make the population cost match the squad size.
Open pioneer_squad_mp.rgd if don't have it open anymore. Navigate to:
Code
Change the value from 1 to 0 in "Properties".0x72F92888\personnel_pop
Hit "Save", run PackMod.bat and launch CoH2. Your pioneer squad population cost should now match the squad size.
Download a full example
You can download a full example of FirstMod here. Extract it to your CoH2 installation directory.
Thoughts and tips for continuing
The mod you just created with is fully compatible with multiplayer. If you want to play it with friends, just make sure that they all have the same version of the mod!
In this tutorial, you have learned how to edit entity and squad attributes. Feel free to experiment new things: once you get the hang of it, modding is pretty intuitive. I would suggest trying to do the same thing for Soviet combat engineers. You are now perfectly capable of doing it!
You can also read basic and advanced tutorials provided by Corsix on Corsix.org. It is a great source of information to get started with modding. While they were designed for CoH1, they will most likely work with CoH2 as well. The attrib file tree view might be different, but it's nothing you can't handle!
In this tutorial, you have learned how to edit entity and squad attributes. Feel free to experiment new things: once you get the hang of it, modding is pretty intuitive. I would suggest trying to do the same thing for Soviet combat engineers. You are now perfectly capable of doing it!
You can also read basic and advanced tutorials provided by Corsix on Corsix.org. It is a great source of information to get started with modding. While they were designed for CoH1, they will most likely work with CoH2 as well. The attrib file tree view might be different, but it's nothing you can't handle!