• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Help with MPQ Editor

Level 6
Joined
Sep 10, 2022
Messages
67
I am working with Ladik's MPQ Editor and I want to know how to understand or "decipher" map files in the editor.
doo, mmp, j, shd, w3a, w3c, w3d etc...

I opened some files with Notepad++ to see their contents, but I would like more understanding.

Generally, what I am trying to do:
I want to import triggers, object data and files from the import manager from one map to another. So I must know what I am going to extract and then use the data to replace one in another map.

Could anyone tell me something about extensions, or where I can find the information?
 
Level 18
Joined
Oct 17, 2012
Messages
821
TheHelper Guide - Technical information on the various files of a map.
Some basic object data files:
w3u - Units
w3t - Items
w3b - Destructables
w3d - Doodads
w3a - Abilities
w3h - Buffs
w3q - Upgrades

wtg and wts - Trigger Files

war3mapUnits.doo - placement of preplaced items and units
war3map.doo - placement of preplaced trees and doodads
war3map.w3e - Terrain

1.31+: If you turn your maps into folders, transferring files from one map to another will be way easier than using MPQ Editor.
Any version: The World Editor has its own exporter for object data and triggers.
 
Last edited:
Level 6
Joined
Sep 10, 2022
Messages
67
Thank you. Will dive into the link to read more details.

UPD: Well, I know that I can export data with the import manager, just wanted to try with mpq, it seemed to be faster than manually importing each blp and mdx/mdl
 
Last edited:
UPD: Well, I know that I can export data with the import manager, just wanted to try with mpq, it seemed to be faster than manually importing each blp and mdx/mdl
SmithingDevil's solution would be the recommended route. For older versions the mpq-editor is the only alternative as far as I know.
1.31+: If you turn your maps into folders, transferring files from one map to another will be way easier than using MPQ Editor.
 
Level 18
Joined
Oct 17, 2012
Messages
821
By taking advantage of the command-line options for MPQ Editor, the process of transferring files can be streamlined. A bat file can be created to automatically call the command-line options with one click of a button.


MPQEditor command-line reference:​

MPQ Editor Command line​


Opening a single MPQ

MPQEditor.exe MpqName [/listfile ListFileName]

Opens a MPQ. If you enter a listfile name, this listfile
will be used as external listfile to the MPQ. If the MPQ
already has a listfile, then both those listfiles are combined.

Opening a multiple MPQs in multi-document mode

MPQEditor.exe /multi BaseMpq1 BaseMpq2 BaseMpq3 ... BaseMpqN [/patch PatchMpq1 PatchMpq2 ... PatchMpqN] [/listfile ListFileName]
Opens multiple MPQs in multi-document mode. Additional listfile may be added.


Opening a multiple MPQs in merged mode

MPQEditor.exe /merged BaseMpq1 BaseMpq2 BaseMpq3 ... BaseMpqN [/patch PatchMpq1 PatchMpq2 ... PatchMpqN] [/listfile ListFileName]
Opens multiple MPQs in merged mode. The user will only see one tree,
where all the files will be combined. This is how the game sees
all MPQs.


Opening a MPQ in patch mode


MPQEditor.exe /base BaseMpq1 BaseMpq2 /patch PatchMpq1 PatchMpq2 ... PatchMpqN [/listfile ListFileName]
Opens multiple MPQs in patch mode. You have to enter all patches
that belong to a MPQ. When extracting a file in patch mode, then
the extracted file will allways be the latest version, i.e. from base
MPQ with all subsequent patches applied.


Running MPQEditor in console mode


MPQEditor.exe /console [ScriptName]
Opens a MoPaq 2000 console. If a script name is entered, it is executed immediately.

Using MoPaq 2000 commands from command line


MPQEditor supports executing MoPaq 2000 commands directly from command line.
They can be executed either with or without opening console window. The difference
is to use or not to use slash before the command.

This is an example to run a command without opening a console:
MPQEditor.exe extract war3.mpq * C:\Work /fp

This is an example to run a command with opening a console:
MPQEditor.exe /extract war3.mpq * C:\Work /fp

MoPaQ is probably the first MPQ tool that existed:

It was popular, so Ladik's MPQ Editor supports its syntax (I hope so, while writing this). It was possible to write MoPaQ2000 scripts.

How to access its help / interactive menu?
MPQEditor.exe /console then type "help"

Available commands

Code:
new (n)
open (o)
openpatch (op)
add (a)
extract (e)
rename (r)
move (m)
delete (d)
flush (f)
compact
htsize (t)
list (l)
mksvf
close (c)
script (s)
chdir (cd)
exit (x)
quit (q)
help (h)
ver (v)
version
console

MoPaQ script interpreter also supports Windows command line.
For example, type "md /?" for help on the Windows "md" command.


help​

help [command]
Shows basic help about a command.


new​

n[ew] MpqFile [MaxFileCount]

Creates a new MPQ. If the file already exists, it will be converted to MPQ.

MpqFile Name of the MPQ to be used for this operation.
MaxFileCount File limit. Can be a dec or hex number. Default is 0x1000.


open​

o[pen] MpqFile [ListFile]

Opens an existing MPQ. If the file doesn't exist, the function fails.

MpqFile Name of the MPQ to be used for this operation.
ListFile Name of the listfile to be used on open operation


openpatch​

op[enpatch] BaseMpq PatchName1 PatchName2 ... PatchNameN [/listfile|/lf ListFile1 ... ListFileN]

Opens multiple MPQs in patch mode. If any of the MPQs doesn't exist,
the function fails.

BaseMpq Name of the base MPQ.
PatchNameX Name of patch MPQ. Older patch MPQs must come first.
ListFile Name(s) of external listfile(s) to be additionally used.


add​

a[dd] MpqFile [SourceFile] [TargetName] [/wav] [/c] [/auto] [/r]

Adds one or more files into the MPQ. Replaces existing files.

MpqFile Name of the MPQ to be used for this operation.
SourceFile Name of source file. Can contain wildcards.
TargetName Target file name (or directory name) in MPQ.
/wave Add the file as WAVE file
/c Use data file compression
/auto Choose compression by file type
/r Recurse subdirectories


extract​

e[xtract] MpqFile FileName [TargetDir] [/fp]

Extracts one or more files from MPQ Archive.

MpqFile Name of the MPQ to be used for this operation.
FileName Full of file in MPQ.
TargetDir Target dir. If not entered, the current dir will be used.
/fp Forces extraction with the path stored in MPQ file
/lower Creates lowercase path

Currently only supports literal filenames, i.e. "File00000510.xxx" in an obfuscated map, even if it's actually "war3map.j" in MPQ root.
Filename = * (asterisk) will extract all files.

rename​

r[ename] MpqFile OldFileName NewFileName

Renames a file within MPQ.

MpqFile Name of the MPQ to be used for this operation.
OldFileName Name of file to be renamed.
NewFileName New name of the file


move​

m[ove] MpqFile FileName NewDirectory

Moves a file within MPQ into another dir.

MpqFile Name of the MPQ to be used for this operation.
FileName Name of file to be moved.
NewDirectory Target directory within MPQ to move the file to


delete​

d[elete] MpqFile FileName

Deletes a file within MPQ.

MpqFile Name of the MPQ to be used for this operation.
FileName Name of file to be deleted


flush​

f[lush] MpqFile [ListFile]

Compacts the MPQ, removing all empty space.

MpqFile Name of the MPQ to be used for this operation.
ListFile Listfile name. If none, the internal listfile is used.


compact​

compact MpqFile [ListFile]

Compacts the MPQ, removing all empty space.

MpqFile Name of the MPQ to be used for this operation.
ListFile Listfile name. If none, the internal listfile is used.


h[t]size MpqFile HashTableSize

Changes hash table size of the archive.

MpqFile Name of the MPQ to be used for this operation.
HashTableSize File limit. Can be a dec or hex number. Default is 0x1000.


list​

l[ist] MpqFile [FileMask] [OutFile]

Lists files in MPQ.
Can list them to the screen or to a file.

MpqFile Name of the MPQ to be used for this operation.
FileMask File mask to be listed
OutFile Name of text file that contain the file list.


mksv​

mksv

Creates a file that contains MD5 values of each file in the MPQ.


close​

c[lose]

Closes currently open MPQ.
Automatically done at the end of script processing or after "exit" command.


script​

script ScriptFile

Processes a MoPaQ 2000 script.


chdir​

chdir NewDirector

Changes the current directory.


exit | qui​

exit | qui

Closes the script console.
Also closes opened MPQ.


v[er] | versio​

v[er] | versio

Shows version of MPQ Editor.

Bugs:
1. Doesn't support Unicode, e.g. for file names.

As for imported files, check out Drake53's post in this thread for another way to batch import files.
 
Last edited:
Level 19
Joined
Jan 3, 2022
Messages
320
Could anyone tell me something about extensions, or where I can find the information?
Only Drake53 has a good and up to date library to work with file formats. Not complete but enough for most purposes. There are no tools yet.
PS: MPQEditor is unusable as a CLI tool. We need a new dedicated tool too.
 
Level 6
Joined
Sep 10, 2022
Messages
67
Only Drake53 has a good and up to date library to work with file formats. Not complete but enough for most purposes. There are no tools yet.
PS: MPQEditor is unusable as a CLI tool. We need a new dedicated tool too.
Well, several times I used Ladik's MPQ Editor, and it helped me to import all data into the import manager without doing it manually. I am really tired of copying and pasting "Replaceable Textures" and so on. At least it helped me with the function.
 
Top