• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Get your art tools and paintbrushes ready and enter Hive's 34th Texturing Contest: Void! Click here to enter!

[Solved] Mass import assets between campaigns

I currently have two campaigns - C1 and C2 for ease of use further on. Both campaigns work on Reforged 2.0.2.22796 (latest version at this point).
C2 is a copy of C1 with new data and triggers.
I've added some new imported assets to C1, and it took some time to set them up correctly.
Now I want to add them to C2. I've opened C1 with mpq editor, and exported all assets from it (they were in folders at the top of the list).
Then I used mpq editor to open C2, and added these files to it, and saved the mpq.
When I reopen C2 in mpq editor, the files are there. However, in World Editor, these files are not shown in imported files.

I see there are two files with a lot of file names that include imported assets: (listfile) and war3campaign.imp.
How do I copy information from them so I don't break my campaign? (I can open them with Notepad++, but I am not sure if there is some order for them or extra syntax)

EDIT: combining .imp files and adding assets did not work - either I missed something, or it just by default crashes the editor when opening this campaign file. I've also noted that at the top of .imp file is a line with 1 symbol, which is different between campaigns or after stuff has been added.
 
Last edited:
I'll try to give an overview of the files involved:
  1. (listfile) - this is just a list of all the names of the files in the MPQ (or the campaign, in this case). This is purely informational and isn't relevant to the world editor (and wc3 technically doesn't need it). This file will typically gets automatically updated whenever you add new files to the MPQ via an MPQ editor, so you shouldn't need to make any manual changes to this file.
  2. war3campaign.imp - this is the list of custom files imported into the campaign. This file is used by the editor to list the files in the Asset Manager (although it is not used by wc3 itself when you're playing the game). Still, if you want to edit the imports for the campaign in the future via the editor, I recommend updating this so the editor doesn't accidentally remove anything when it is updating the MPQ.
The first step (which you've already done) is to transfer the assets from C1 to C2. So you should be set there. :thumbs_up:

The second step is to merge the two war3campaign.imp files. You won't want to do this with a normal text editor because the file is structured a specific way in binary, so certain sections won't appear correctly and will be hard to modify:
1750192182929.png


You can also just send the files to me if you want me to merge them for you, but I'll outline the process anyway since it is useful as a reference.

Requirements​

Guide​

  1. Before doing anything, I strongly recommend making a backup of C1/C2 somewhere safe. It's easy to make mistakes when doing hex editing and MPQ editing, and that can prevent the editor from opening your map.
  2. Using the MPQ editor, open up C1 and extract all your imported files to a separate folder. Then open up C2 using the MPQ editor and import those files, being sure to maintain the same folder structure (you have already done this step).
  3. Using the MPQ editor, open up C1 and extract the war3campaign.imp file onto your computer, and rename it war3campaign_C1.imp. Open up C2 as well and extract its war3campaign.imp file onto your computer, and rename it war3campaign_C2.imp.
    1750193219577.png
  4. Next, open up ImHex and go to File > Open File and select war3campaign_C1.imp. It looks daunting at first, but I'll try to break it down. When you open up the file, you'll see a bunch of 2-character digits aligned in various columns. That is the hexadecimal representation of the file. When editing a binary file, we'll often work with hex since it is a more compact representation compared to binary (which is just a bunch of 1's and 0's, known as "bits"). There are 8 bits in a byte, and that can be represented as a 2-character hex code (e.g. 01). For this guide, it isn't super important to know all the details of what these numbers mean, but just know that 2-character hex = 1 byte. In the screenshot below, I've highlighted a few different sections of importance for this file:
    1750193600854.png
    1. Yellow Section - these 4 bytes (01 00 00 00) represent the file format version. This will typically be "1". You don't need to modify this.
    2. Blue Section - these 4 bytes (05 00 00 00) represent the number of files in the list. This is important, as it tells the editor how many files are imported in total in order to process the list correctly throughout the editor tools.
    3. Orange Section - these bytes represent the "data" section. This represents the actual list of imports (basically just file paths in the MPQ). You can see the rough structure by looking at the ASCII section (which is typically what you would see if you opened this file in a text editor). However, each import "item" follows a specific format. I'll select the section for the first item war3campaignImported\AlteracAltar.mdx as an example:
      1750194689551.png
      1. Green Section (0D) - this is 1 byte that represents the type of path. This is almost always 0D (13), which represents a "custom" path. I believe the editor always uses "13" nowadays by default, but it technically can accept other values (you shouldn't need to worry about that though).
      2. Purple Section (77 61 ..) - this section is the actual file path for the import (you can see the path in the "ASCII" section). Note that this section doesn't take up a fixed amount of bytes, as it depends on how long the import path is.
      3. Yellow Section (00) - this is a special byte known as a "null terminator". This is used to know when the path in the purple section ends (since it doesn't take up a fixed amount of bytes). After this hex code, the next item will be listed following the same format (version - file path - null terminator).
  5. At this point, we can start the process of transferring the import list from war3campaign_C1.imp to war3campaign_C2.imp. In ImHex, go to File > Open File and select war3campaign_C2.imp. You'll see it open as a new tab in the toolbar. Switch back to war3campaign_C1.imp, and select all the bytes in the "data" section (e.g. after the blue section 05 00 00 00) by clicking on the first byte you want (0D) and then holding down shift and clicking on the last byte in the file (00). Note down the number of imported files for later (e.g. "5" in my case). You should have a selection like this:
    1750195605985.png
  6. Right-click and select "Copy" (Ctrl+C). Now go to your war3campaign_C2.imp tab and then select the last byte in the file (00). Before pasting, we first need to insert one extra byte so that we don't accidentally overwrite the last null-terminator in war3campaign_C2.imp. So with the last byte selected, right-click and choose "Insert". Change the size to "0x1" (so it inserts one byte) and select OK:
    1750196125992.png
  7. Now select the very last byte (00) and right-click, paste:
    1750196203302.png
  8. If done correctly, it should have pasted the whole data section from C1 to the end of C2 (keeping the null terminator 00):
    1750196279852.png
  9. The last thing we need to do is update the import count in C2 to reflect the total files in C1 + C2. In my case, my C1 file had "5" imports (as listed via 05 00 00 00) and my C2 file had "3" imports (03 00 00 00):
    1750196538233.png

    So the final number we'll want is "8" imports. In this case, that will be as simple as changing it to "08". You can do that by double-clicking the byte you want to edit and then putting the value you want:
    1750196686609.png

    For numbers greater than 9, you'll want to google the hexadecimal representation. e.g. if I had 200 imports, I'd google "200 in hex" and it'd give me 0xC8. So I'd put "C8" there instead. If you more than 255 imports though, you'll probably want to use chatgpt to ask something like: "how can i write the number 3000 in hex in a 4-byte int (e.g. if it were "5" then it'd be 05 00 00 00)", and you'll want to use the little endian representation, i.e. B8 0B 00 00.
  10. Save the file and then use the MPQ editor to reimport war3campaign_C2.imp file. Make sure you name it "war3campaign.imp" so the editor will use it properly. If done correctly, you should be able to open it up in the editor now and it should contain all the import files from both campaigns!
    1750197028482.png

Caveats

  • If you have certain files that are imported in both C1 and C2, then this method will still work, but you'll have the same file listed twice in the import list. In my testing, you can open up the campaign in the editor and just manually delete those duplicate imports afterward and it should still keep the file there, but your mileage may vary.
  • It'd be better to use a tool for this since hex editing is clunky and error-prone, but I figured it'd still be worth outlining the manual process for simple cases. :thumbs_up:
 
I'll try to give an overview of the files involved:
  1. (listfile) - this is just a list of all the names of the files in the MPQ (or the campaign, in this case). This is purely informational and isn't relevant to the world editor (and wc3 technically doesn't need it). This file will typically gets automatically updated whenever you add new files to the MPQ via an MPQ editor, so you shouldn't need to make any manual changes to this file.
  2. war3campaign.imp - this is the list of custom files imported into the campaign. This file is used by the editor to list the files in the Asset Manager (although it is not used by wc3 itself when you're playing the game). Still, if you want to edit the imports for the campaign in the future via the editor, I recommend updating this so the editor doesn't accidentally remove anything when it is updating the MPQ.
The first step (which you've already done) is to transfer the assets from C1 to C2. So you should be set there. :thumbs_up:

The second step is to merge the two war3campaign.imp files. You won't want to do this with a normal text editor because the file is structured a specific way in binary, so certain sections won't appear correctly and will be hard to modify:
View attachment 537885

You can also just send the files to me if you want me to merge them for you, but I'll outline the process anyway since it is useful as a reference.

Requirements​

Guide​

  1. Before doing anything, I strongly recommend making a backup of C1/C2 somewhere safe. It's easy to make mistakes when doing hex editing and MPQ editing, and that can prevent the editor from opening your map.
  2. Using the MPQ editor, open up C1 and extract all your imported files to a separate folder. Then open up C2 using the MPQ editor and import those files, being sure to maintain the same folder structure (you have already done this step).
  3. Using the MPQ editor, open up C1 and extract the war3campaign.imp file onto your computer, and rename it war3campaign_C1.imp. Open up C2 as well and extract its war3campaign.imp file onto your computer, and rename it war3campaign_C2.imp.
    View attachment 537887
  4. Next, open up ImHex and go to File > Open File and select war3campaign_C1.imp. It looks daunting at first, but I'll try to break it down. When you open up the file, you'll see a bunch of 2-character digits aligned in various columns. That is the hexadecimal representation of the file. When editing a binary file, we'll often work with hex since it is a more compact representation compared to binary (which is just a bunch of 1's and 0's, known as "bits"). There are 8 bits in a byte, and that can be represented as a 2-character hex code (e.g. 01). For this guide, it isn't super important to know all the details of what these numbers mean, but just know that 2-character hex = 1 byte. In the screenshot below, I've highlighted a few different sections of importance for this file:
    View attachment 537888
    1. Yellow Section - these 4 bytes (01 00 00 00) represent the file format version. This will typically be "1". You don't need to modify this.
    2. Blue Section - these 4 bytes (05 00 00 00) represent the number of files in the list. This is important, as it tells the editor how many files are imported in total in order to process the list correctly throughout the editor tools.
    3. Orange Section - these bytes represent the "data" section. This represents the actual list of imports (basically just file paths in the MPQ). You can see the rough structure by looking at the ASCII section (which is typically what you would see if you opened this file in a text editor). However, each import "item" follows a specific format. I'll select the section for the first item war3campaignImported\AlteracAltar.mdx as an example:
      View attachment 537892
      1. Green Section (0D) - this is 1 byte that represents the type of path. This is almost always 0D (13), which represents a "custom" path. I believe the editor always uses "13" nowadays by default, but it technically can accept other values (you shouldn't need to worry about that though).
      2. Purple Section (77 61 ..) - this section is the actual file path for the import (you can see the path in the "ASCII" section). Note that this section doesn't take up a fixed amount of bytes, as it depends on how long the import path is.
      3. Yellow Section (00) - this is a special byte known as a "null terminator". This is used to know when the path in the purple section ends (since it doesn't take up a fixed amount of bytes). After this hex code, the next item will be listed following the same format (version - file path - null terminator).
  5. At this point, we can start the process of transferring the import list from war3campaign_C1.imp to war3campaign_C2.imp. In ImHex, go to File > Open File and select war3campaign_C2.imp. You'll see it open as a new tab in the toolbar. Switch back to war3campaign_C1.imp, and select all the bytes in the "data" section (e.g. after the blue section 05 00 00 00) by clicking on the first byte you want (0D) and then holding down shift and clicking on the last byte in the file (00). Note down the number of imported files for later (e.g. "5" in my case). You should have a selection like this:
    View attachment 537893
  6. Right-click and select "Copy" (Ctrl+C). Now go to your war3campaign_C2.imp tab and then select the last byte in the file (00). Before pasting, we first need to insert one extra byte so that we don't accidentally overwrite the last null-terminator in war3campaign_C2.imp. So with the last byte selected, right-click and choose "Insert". Change the size to "0x1" (so it inserts one byte) and select OK:
    View attachment 537894
  7. Now select the very last byte (00) and right-click, paste:
    View attachment 537895
  8. If done correctly, it should have pasted the whole data section from C1 to the end of C2 (keeping the null terminator 00):
    View attachment 537896
  9. The last thing we need to do is update the import count in C2 to reflect the total files in C1 + C2. In my case, my C1 file had "5" imports (as listed via 05 00 00 00) and my C2 file had "3" imports (03 00 00 00):
    View attachment 537897
    So the final number we'll want is "8" imports. In this case, that will be as simple as changing it to "08". You can do that by double-clicking the byte you want to edit and then putting the value you want:
    View attachment 537898
    For numbers greater than 9, you'll want to google the hexadecimal representation. e.g. if I had 200 imports, I'd google "200 in hex" and it'd give me 0xC8. So I'd put "C8" there instead. If you more than 255 imports though, you'll probably want to use chatgpt to ask something like: "how can i write the number 3000 in hex in a 4-byte int (e.g. if it were "5" then it'd be 05 00 00 00)", and you'll want to use the little endian representation, i.e. B8 0B 00 00.
  10. Save the file and then use the MPQ editor to reimport war3campaign_C2.imp file. Make sure you name it "war3campaign.imp" so the editor will use it properly. If done correctly, you should be able to open it up in the editor now and it should contain all the import files from both campaigns!
    View attachment 537899

Caveats

  • If you have certain files that are imported in both C1 and C2, then this method will still work, but you'll have the same file listed twice in the import list. In my testing, you can open up the campaign in the editor and just manually delete those duplicate imports afterward and it should still keep the file there, but your mileage may vary.
  • It'd be better to use a tool for this since hex editing is clunky and error-prone, but I figured it'd still be worth outlining the manual process for simple cases. :thumbs_up:
Thanks for the guide. Bookmarking it.

I have added stuff manually in the end, because I had 120 common files and just 20 new files in C1, with 4 different new files in C2.

Note about backing stuff up is quite important - I almost forgot to do it while trying different methods, so I made 5 :xxd:

Hopefully will have to use it at a different time, but this is a good opportunity to learn hex editing.

Sorry for making you go through all this description for (pretty much) nothing.
 
No worries, it'll be a good reference for others who search up this issue! Glad you got it sorted! And yeah the funny thing is I often end up spending hours looking for an automated solution for these types of things when in reality it'd probably be faster to just spend the 20 minutes doing it manually. :grin:
1750199730064.png
 
Top