Bypassing Map Protection

Back to lessons

Bypassing Map Protection:

This will be a high-level guide on how to edit a protected map. I won't give specific details but I will outline the process enough so that a good coder could do it. This is more of a list of tips than a tutorial, and assumes considerable knowledge of WE.


You need to know some things first.
1: Learn JASS
2: Learn the MPQ Archive details
3: Learn how to use an MPQ editor and a hex editor
If you don't know any of these steps, go do them before continuing or you won't understand this. I made tutorials on several of them.

Ethics on Map Editing:

Some people claim that editing other people's work should never be done. I don't agree with this. There are lots of maps on WC3 that are partially complete or have game breaking bugs in them. These maps have been abandomed for 5+ years and will never again be touched. Is improving on them a bad thing? I don't believe so.

Clearly this doesn't apply to some idiot going in and adding OP characters to a map. But seeing as this takes a lot of effort to do, I really don't think noobies will go through all the effort to do this.

Setting up your environment:

Tools you will definitely need:
- An MPQ editor (I recommend MPQMaster)
- JASSCraft
- A hex editor (I recommend XVI32)
- World Editor

Tools you MIGHT need
- RMPQEx (anti script obfuscator)
- SILK Objects Console (anti widgetizer)
- A corrupt MOQ breaker (like MPQView)
- War3 hex fixer

Download what you need and continue.

Note that a map deprotector is not included. We will not deprotect the map to edit it.

Opening the Map:

For most maps, this is as easy as opening your MPQ editor, then opening the map.

For some maps, the MPQ will be corrupt. Only applications using stormlib.dll will open it.
So you want to first open it in one of those. MPQView of Ladik's mpq editor using stormlib.

Export everything using a comprehensive list file. Construct a new wc3 map and import all of those files.

Or, if you feel like it, open it with a hex editor and fix the mpq. (difficult to do)

Editing the Objects:

Export the .w3u, .w3t, .w3a files and whatever else you need, I usually only do those 3. Make a new WC3 map, import all those files. In most (99%) of maps, you will now see the correct object data. You can now edit the objects.

In some very small amount of maps, the strings will be all messed up. If that happens, you probably just need to run SILK objects console on it to restore those.

Now edit the objects however you want. After you're done, use the Export Objects feature in the world editor. Make sure to export each specific object type separately, not all in one file...

Using your MPQ editor, add the files back into the MPQ, replacing the old files.

Editing the Scripts:

(Optional) run RMPQEx on the map to clean up the JASS script. Use the deobfuscate jass script option.

Export the war3map.j and open it in jasscraft. Run a syntax check right now. There should be **zero** errors. If there are more than zero errors, run hex fixer on it or fix them by hand so that there are zero. This is our regression test now. Whenever you make **ANY** change to the .j, you run a syntax check and if there are zero errors, then you didn't break the map compiling.

Open a notepad, or get out a piece of paper. The script is obfuscated so it's going to be difficult to read. Variables and functions are going to have nonsense names, so write down what they do as you figure them out on this note sheet. Effective use of the Search function is needed here to figure out what they do. Keep your objects files open in the world editor and use them together. For example, if you're trying to find a trigger that activates on a certain ability use, find the ability rawcode and then do a search on it.

Remember that the .wts file will store most strings for the map. If you want to edit a string, check there before the .j file.

You can code new triggers directly into the .j. This is a little more involved than making them in world editor. These are the steps:

1) Create a trigger variable
2) Do an init in the function main. For this, do a CreateTrigger then add the conditions/actions. This is the part I most often forget.
3) Create the actions function.

Editing the Map Name:

The map name appears in the header of the war3map.j. Open it up with XVI32 and you'll see it right away. Edit it if you want but MAKE SURE that you don't add/remove bytes from the header. It needs to be the same size.

The map name will probably also appear in the .wts file or the .j file.

Back to lessons