Hello fellow modmakers,
We all know that the modtools are outdated since April 22nd 2020 for unknown reasons. While this is super annoying, I refused to give up and let my mod die. So after some frustrations I have found a workaround to be able to merge the last patch successfully!
In this small guide I will explain how you
can link vanilla files that are unavailable in the tools. Keep in mind, it will
not be possible to edit the currently missing files.
First of all, always
make a backup of your mod before every major change. Especially now, because we will be messing with the source of the official modding tools.
1. Extract .rgd files:
It is not possible to convert .rgd to readable files for CoH2, but they do have very interesting names that we need. Therefor you need to extract the AttribArchive.sga.
Open the Command Prompt,
- Either open Command Prompt from the start menu and type: cd C:\Program Files (x86)\Steam\steamapps\common\Company of Heroes 2
- Or open the explorer at this path 'C:\Program Files (x86)\Steam\steamapps\common\Company of Heroes 2' and type 'cmd' in the quick access bar.
Then execute this: archive.exe -a CoH2\Archives\AttribArchive.sga -e CoH2\attrib
This can take some time, around 40 seconds in my case.
Go to this folder and there you can see all extracted objects from the live game with specific names: C:\Program Files (x86)\Steam\steamapps\common\Company of Heroes 2\CoH2\attrib\attrib
2. Fool the modding tools:
It is possible to add the names of the .rgd files outside the tools in your .xml files, using any text editor. I tried this first, but once you launch the tools it will validate all paths and immediately remove these links without giving you any choice. That raises the question how it knows these paths. Well... it does not know them, it just loads everything from one folder and compares it. So lets just add some files in there!
Close the tools first. If it detects any change in its files, it will close and you will lose unsaved changes. The modding tools has this folder from which it automatically reads all .xml files: C:\Program Files (x86)\Steam\steamapps\common\Company of Heroes 2 Tools\assets\data\attributes\instances
We are just going to add each file which is missing (or just the ones you need). You have to copy a file from the same folder from which you want to add it to be sure it uses the right template. Rename the new file to one of the filenames that is found in step 1. Each file has an unique ID. We don't need to know which one, but to satisfy the tools give each new file an unique ID. This 'pbgid' is located at the end of the .xml. I started counting at 200000 (highest number I could find was somewhere in 180000).
Once you open the tools it will show this new file without issues and you can link it to your own files. Now you can link any new files: abilities, upgrades and even units to your mod which are not yet officially available in te tools! As long as you
don't clone the new files and
only link them, the game will replace them with the vanilla version.
It can be a challenge to find the new files, here is a short list for the new commander upgrades as a start:
upgrade\aef\commander\ability\m3_halftrack
upgrade\british\commander\passive\tommy_raid_package_unlock
upgrade\british\commander\passive\field_recovery
upgrade\german\commander\passive\vehicle_repair_german
upgrade\german\commander\ability\luftwaffe_field_officer
upgrade\soviet\commander\ability\air_drop_weapon_resupply_soviet
upgrade\soviet\commander\ability\shock_152mm_artillery_mp
upgrade\soviet\commander\ability\supply_truck_zis_6_mp
upgrade\soviet\commander\passive\assault_guard_troops
3. Add new commander abilities
Somehow the new commander abilities for the Wehrmacht and Soviets have been added outside of the ability list in the army category, like the original British commander abilities. This means you don't need to add them in order to have them in your mod, even when you cloned the army category. The new abilities for USF and the Brits on the contrary are added to the ability list in the army file and need to be added:
abilities\aef\modal_ability\dispatch_ability\m3_halftrack_mp
abilities\british\modal_ability\dispatch_ability\raid_section_mp
abilities\british\modal_ability\dispatch_ability\field_recovery
4. Remove commander abilities outside of the army category
In order to remove the new abilities which are linked outside of the army category: Add a requirement action to the HQ in ebps/action_apply. In requirement, add required_player_upgrade which links to a commander upgrade. In actions, add a new custom upgrade with 'player' as owner. Then in this new upgrade add 'upgrade_remove' to remove the commander upgrade which was set in the requirement. As soon as a player selects a commander with this ability, this action will remove it immediately and you won't notice anything ingame.
5. Note
I cannot predict what will happen if the tools will magically finally update some day, but I don't think it this will have any consequences.
This is not ideal, but it is the best I can think of for now. Good luck!