wc3edit.net

United Warcraft 3 map hacking!
It is currently October 25th, 2021, 4:28 pm

All times are UTC




Post new topic Reply to topic  [ 56 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Map Restoration - Done
PostPosted: July 22nd, 2007, 11:57 pm 
Offline
Old Wrinkly Member
User avatar

Joined: January 27th, 2007, 4:46 pm
Posts: 272
Location: Denver, Colorado
Title: OxyContin
I thought that many people would like a tutorial on map restoration, so here it is.

Preplaced Units


As many of you guys know a lot of people like to use xdep on their target map, but when they open it 99% of the time there is no preplaced units. Why? It is because xdep creates a war3mapunits.doo file with only the start location units placed and nothing else. In this section we will discover on how to put these units back so they are viewable in the editor and playable in the game. So why should I do this and where do I start? First of all, you shouldn't really do it unless you are planning on moving things or unless you plan on releasing the map to the public to make it look more professional.

Slower Method

To start out, deprotect your favorite map (in my case DotA) and open it in world editor. Save the map somewhere, and make sure it gives you no compile errors or anything. After you do that, I suggest you make a backup or something just incase anything happens. Now for this part you have to know what you are looking for, so I will post screenshots on what looks right and what doesn't. Select the Init tirgger and lets begin. Use the find tool and search for "createunit" without quotes.

BAD:
Image

The above picture is not the right kind of create unit, because it does not give any coordinates.

GOOD:
Image

The above picture is good because it gives coordinates. To make sure these are the units that get placed on the map, I can go into object editor and hit view and then scroll down and select display values as raw data. I would then expand all the folders by hitting the plus sign next to them. After I have done that, I can check by selecting any unit and then type nfoh. Next to the raw data value in parenthesis should be the name of the unit (in this case Well of Life), I know this is right because there is a Well of Life in DotA.

Now that we know that, lets find out what what this is telling us to do. In most cases it won't be as advanced as this, but I will go ahead and go with it anyway because its good for learning. Take a look at this line:

set udg_unit11=CreateUnit(udg_players03[0],'nfoh',-6720,-5920,270)

Incase you can't read JASS, it is telling use to create a nfoh at those coordinates in (x,y,rotation) format. The set udg_unit11 mean that we MUST set this unit with a variable to unit11 given from the global variables in the map. The udg_players03[0] is a player array variable, which in DotA represents the Sentinel. Usually the line you are looking at will have something less complex or instead of udg_players03[0] will have something much eaiser to read and doesn't need much work to figure out what player it belongs too. For example in many maps it would look something like this:

local player p=Player(15)
CreateUnit(p,'nfoh',-6720,-5920,270)

As you can see, it usually is eaiser. Now that you found your unit, select it from the object edit and place it at those coordinates if you want to keep the map normal (or any that you want for some fun). Now that you have done that, you have to have to give it its variable. In my case it was unit11. Make a new trigger and name it any thing you'd like it doesn't matter. After you have done that, disable the trigger. Make a new action and in my case set unit11 equal to the unit that I just placed. To select you unit that you placed hit select unit and click on the unit I just placed. If it goes well, you should end up with something looking similar to this:
Image

We are almost done now, just one more little step. Make a copy of your disbaled trigger and paste it into the tigger sections. You should now have another copy of your disabled trigger. Select the copied one, scroll up to edit and go down and hit Convert to Custom Text. It will give you a warning, hit yes. This will turn the trigger from GUI into JASS. Now that its converted you will want to copy what you see under actions. In my case it is:

set udg_unit11 = gg_unit_nfoh_0000

Once it is copied, go ahead and delete the copied disbaled trigger you have and go back to your Init trigger. Now we must find the line:

set udg_unit11=CreateUnit(udg_players03[0],'nfoh',-6720,-5920,270)

Once you have found it replaced it with :

set udg_unit11 = gg_unit_nfoh_0000

You should end up with something like this:
Image

Save your map and all should work well! Once you get the hang of it the work starts to get a lot faster.


Faster Method

So you came up with a map with like a billion preplaced units, but you don't want to do it by hand. So what do we do? The faster method of course. Keep in mind though, you need a few tools and a bit of know-how. First we will need this program called UnProtect. We can find this here: http://rveach.romhack.org/WC3/Unprotect ... ect104.rar (thanks rveach). If you can't open .rar files, I suggest you get winrar. A simple google search should come up with it. After you have that, you should get a MPQ editor if you don't already have one. If your map has a obfuscated J file, you will also need some sort of JASS syntax checker to undo it.

Using UnProtect, open your map and hit extract files. It may take a little while depending on the map and number of files in it. Once it gives you the message saying all main files were extracted, hit the fix button. After that is done, finally hit the reinsert button. UnProtect will save the map in the same directory as the original, but with the prefix "unprotect_" without quotes. Try opening that map in the editor and see if you have preplaced units on the map. If you do have them, open the "unprotect_" map with a MPQ editor extract it and add if to you xdep map and set the variables if needed. If you do not have preplaced units on the map don't fret, I have more ticks up my sleve.

So it didn't work no worries, now we will pull out the big guns and do some sneaky code swaping :twisted:. What I did was first make a new map in the editor the same size as the map that I used xdep on and then placed a few units here and there. I saved the map and opened it with a MPQ editor. Then opened the J in notepad for exaple. Here is what it looked like:
Image

Now that we have done that, do the same with with your xdep'd map. Be sure to keep the notepad windows open. In my map, I have to set variables to the units placed on the map. I can tell beacuse if I look under gloabals I see units (if it doesn't skip this part and go to B), take a gander:
Image

A. Now for the swoop and swap as I like to call it, copy all of those and paste those under the globals of the map you just made earlier. This is how mine turned out:
Image

B. The globals are added, now for the units. Go to your xdep'd maps J file and copy all the lines that create the units and paste them over the units created in the maps J file we just pasted the globals into. Mine looks like this:
Image

Save that J file, and add it to the map you just made and overwrite it. Now use UnProtect on that map, and if all goes well it should recover the war3mapunits.doo file. If it does, extract it with a MPQ editor and add it to your xdep map and there you have it. If you don't have to set variables your done, if you have to then you have a bit of work infront of you. I worked on a way to make setting variables to units faster, but at the momemt I won't make it public so you have to do it one unit at a time, that is unless you figure out the pattern on how UnProtect places the units like I did :P. I mean I basically spoon fed you, time to do your homework kiddies. Take the effort like Olreich :D .



Regions




Slower Method

Now that the preplaced units are on my map, its time to move on into restore the regions which is a much easier task. Using the slower method is good for maps with not that many regions, that is unless you want loads of work. Again open your map in your favorite editor, and select the Init tirgger and lets begin. Use the find tool and search for "rect" without quotes. You will come across some that are bad, just as in the Preplaced Units section, keep searching until you find one with coordinates. Here we go! I found what I was looking for:

Image

Now that we have found them, lets add them to the map. Go to the very top right corner of the map and place a new region. Once we have done that, we plug in the numbers we got from the Init trigger into this. The format is as follows:

(left,bottom,right,top)

My rect01 was set udg_rect01=Rect(5600.,2848.,5952.,3168.), so this would translate into this:

Image

Congratulations! Your region is restored! Rinse and repeat for all other regions and your done. You do not need to set it to its variable unless you plan on actually changing the regions in game. This method is just pretty much for information on where regions are on the map and a bit of eye candy too. Now if you want to set your region to run in the map, we will do what we did with the preplaced units by giving its variable now.

In my case the regions variable is rect01. Make a new trigger and name it any thing you'd like it doesn't matter. After you have done that, disable the trigger. Create a new action and select set variable. Find your rect (rect01 for me) and select your region that you just placed. To select your region that you placed hit select a region and click on the the region that you just placed. This covers regions slowly.

Faster Method

Just as in the preplaced units section, we will need the same tools. The method is pretty much exactly the same as the faster method with preplaced units but with regions instead. This method is mainly used for maps with a lot of regions.

Start off by making a new map the same size as your target map and add a region to the very top right corner. Save the map, open it with any MPQ program and open the J file. Now do the same with your map that you want to recover regions on. In your map you want regions restored in most likely there will be regions under the globals, copy all of those and add them to your newly created maps globals. Next what you want to do is go to your target map that you want regions on and search for rect. Keep searching till you find the ones with coordinates, as seen here:
Image

Copy all of those and replace the one found in the newly made map with all of these. If you need pictures, refer to the faster method of preplaced units. Save the J file of the newly created map and overwrite it from the newly created map via a MPQ program. Fire up UnProtect and let it work its magic. Open the unprotected map in the editor and your many regions should be there. After you have confirmed that they are there, open the unprotected map with a MPQ program extract the war3map.w3r file somewhere and add it to your xdep map. As always, variables must be set if you want your changes to be made in gameplay.



Cameras




Cameras are very easy, and there isn't a fast method really. If you want you can choose to use either method for cameras, I do it by hand (slow). This is because most maps don't have many cameras, or any for that matter. Open your xdep map and search the Init trigger for camera. Keep searching until you come up with something looking like this:
Image

Now create a new camera, I always do the very top right and input those vlaues and thats GG for the cameras. The format shouldn't confuse anyone, its in plain text and the only one I can see you would be able to get confused on is CameraSetupSetDestPosition. It is just (x,y) format.

If nothing comes up looking like that, the map has no cameras and your done. Again this is pretty much eye candy for you in the editor, if you actually want to change the camera ingame, you have to asign it its variable and and such just as you did with preplaced units and regions too maybe. I shouldn't need to explain that but if you need it ask.



Trigger Organization



Here it is, finally... There are somethings that you should know before proceeding. Be sure to make a backup of your map BEFORE you do this. Not only that, I am going to asume the your learned things from earlier in this tutorial too, so have a brain or at least part of one. Also be sure that your map has object data viewable in the editor (the maps custom items, abilities and etc...). 95% of the time your map WILL have it, there is that chance that it won't. If it doesn't have it, you will have recover it with this tool: http://xgm.ru/files.php?do=download&id=1569&h=d5dc. I will not go into using this tool at this time, but if you have questions about it just ask me.

Open your map in your favorite editor and lets get started. Once it has loaded and everything, open up the object editor and find an ability that you know is triggered. I choose to use Brain Sap from DotA. View them as raw data, so they will go into their 4 digit JASS names. It should look similar to this:
http://xs.to/xs.php?h=xs218&d=07315&f=rawdata.jpg

The reason I post this picture is because it contains useful information. As you can see what once was your ability turned into something different. Brain Sap for me turned into A0GK:AOcl(Brain Sap). What this means is that A0GK means Brain Sap and AOcl is what the ability Brain Sap is based off of just incase you wanted to know. Now that I know what Brain Sap is called, I will search for A0GK in the Init trigger. Okay so I found it, but how do I know what to copy? Well you need to read the JASS, I can't tell you exatcly what to copy. Here is what mine looks like:
Image

I know to copy all of this highlighted text because I can read JASS. I know that function WG is checking to see if it is infact Brain Sap being cast. I also know that function Wh is Brain Sap's actions because I know what the ability Brain Sap does in DotA. After you have copied what you needed, go ahead and delete your highlighted text and make a new trigger. You can name it anything, but its best to name it what your ability is so you don't get mixed up... Once it is made, convert it into custom text. Delete the actions functions and paste your code. It should look similar to this:
Image

Okay, we are almost done now. What we need to do is make it that so that the trigger will work in the game and give it some events and such. Search the Init for function WG and make sure you match case. I have found what I am looking for:
Image

These are the right lines beacuse they are the functions have the same name as the ones in the Brain Sap trigger. I once again copy those lines, delete them and then paste them into the Brain Sap Trigger. You MUST paste them in the right place though, so I will post more picutures on what is right. Paste over the call TriggerAddAction line. Now mine looks like this:
Image

Now there is one very tiny and easy thing left to do. I read the lines I just pasted and I see udg_trigger130 in them. I want to replace them with my trigger name which is "gg_trg_Brain_Sap" without quotes. I know its name beacuse I can get it from this line:

set gg_trg_Brain_Sap = CreateTrigger( )

Now my bottom lines look like:

call TriggerRegisterAnyUnitEventBJ(gg_trg_Brain_Sap,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Brain_Sap,Condition(function WG))
call TriggerAddAction(gg_trg_Brain_Sap,function Wh)

Everything looks good, now save your map test it out. If you get syntax errors, most likely you did something wrong so check your code again. If your map crashes when you execute the trigger, then there is something more advanced going on. Your trigger might be calling a shared function, in which you need to do further work. Basically more than one function calls on that function to do something. Make sure that nothing else calls your fuction(s) and you should be good to go.




Save your map, if all goes well you shouldn't get any errors and the map should work just fine and look better than ever. It can be tedious work, but this has some of the fast methods and the slower methods of doing it. Sorry if this is/was confusing as I am not very good at explaing things but I hope the pictures will help. As they say, a picture is worth a thousand words. Admins and Mods can feel free to edit it as well. If you have any questions or anything just post here or PM me. If you need help with your map or organizing a function hit me up.

_________________
You know why the Yankees always win, Frank?
'Cause they have Mickey Mantle?
No, it's 'cause the other teams can't stop staring at those damn pinstripes.


Last edited by GhettoChild on August 12th, 2007, 6:13 am, edited 6 times in total.

Top
 Profile  
 
 Post subject: Re: Map Restoration
PostPosted: August 2nd, 2007, 6:00 pm 
Offline
Newcomer
User avatar

Joined: August 2nd, 2007, 4:09 pm
Posts: 14
Title: Im With Stupid ->
Thanx ALOT man,

im going to use this to get add a few extras to BTanks :lol:

Ive never been able to replace missing units before though :?


I_SLAYER_I

_________________
Image


Top
 Profile  
 
 Post subject: Re: Map Restoration
PostPosted: August 2nd, 2007, 6:38 pm 
Offline
Forum Drunk
User avatar

Joined: January 17th, 2007, 4:22 pm
Posts: 2892
Location: Darmstadt, Germany
Title: Proud to be a Kraut!
awesome tutorial... somehow i thought it would be locked, so i didn't post anything :(
even i have learned a few things, so this will get really useful for a lot of people!

_________________
Don't pm me with Warcraft questions, this is a forum so simply post!
Besides I don't even have a Windows PC anymore, so if you want me to hack a map send me a nice rig first!

In the world of thinking we are all immigrants. -Robert Nozick


Top
 Profile  
 
 Post subject: Re: Map Restoration
PostPosted: August 2nd, 2007, 9:17 pm 
Offline
Crusader

Joined: January 27th, 2007, 4:46 pm
Posts: 5093
Location: Greece, Veria
so, how long will it take for the Trigger Organization Section to be completed??? cant wait!

Oh yes! miracles do happen

Edit: Thats the best tutorial ive ever seen.

_________________
http://slowbro.org/
`·.,¸,.·*¯`·.,¸,.·*¯[;::;(。◕‿‿­­​­­­­­◕。)
Image
Image
Image

Spoiler:
(03:36:55) xkiska: im too much of a dumbass to understand this


Last edited by GeorgeMots on August 4th, 2007, 10:10 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: August 3rd, 2007, 1:06 am 
Offline
Old Wrinkly Member
User avatar

Joined: January 27th, 2007, 4:46 pm
Posts: 272
Location: Denver, Colorado
Title: OxyContin
Its just about done, I could add a few things here and there and will get to it soon.

_________________
You know why the Yankees always win, Frank?
'Cause they have Mickey Mantle?
No, it's 'cause the other teams can't stop staring at those damn pinstripes.


Top
 Profile  
 
PostPosted: August 7th, 2007, 3:12 pm 
Offline
V.I.P.
User avatar

Joined: June 13th, 2007, 4:42 pm
Posts: 329
Title: Wc3 is for Nerds!!!!
Wow, This is amazing. Gj

_________________
...................................................................................................................
Image

[blinking]How Do You Like Me Now? Also Im Going To Capitolize Every Word That I Type From Now On Just To Be Annoying.[/blinking]


Top
 Profile  
 
PostPosted: August 12th, 2007, 6:32 am 
Offline
Junior Member
User avatar

Joined: April 3rd, 2007, 11:37 am
Posts: 30
WOW, gg!

_________________
[img]http://www.wc3edit.net/dekar/dekar.php?name=My name is Dekar, not.&rn=250&gn=250&bn=250&line=1[/img]


Top
 Profile  
 
PostPosted: August 12th, 2007, 5:34 pm 
Offline
Newcomer

Joined: August 11th, 2007, 4:08 pm
Posts: 21
good and nice and... :lol:

Preplaced Units/Regions/Cameras/Trigger Organization

The very many encryption deleted these things.

These all are adding own.Very useful.Thanks the share.

But if I must want completely to recover the map,then more trouble. :(


Top
 Profile  
 
PostPosted: August 15th, 2007, 10:32 pm 
Offline
V.I.P.
User avatar

Joined: June 13th, 2007, 4:42 pm
Posts: 329
Title: Wc3 is for Nerds!!!!
Hmm if only i could read jass better id be able too do it too my map

_________________
...................................................................................................................
Image

[blinking]How Do You Like Me Now? Also Im Going To Capitolize Every Word That I Type From Now On Just To Be Annoying.[/blinking]


Top
 Profile  
 
PostPosted: August 16th, 2007, 6:40 am 
Offline
Crusader

Joined: January 27th, 2007, 4:46 pm
Posts: 5093
Location: Greece, Veria
colmo wrote:
Hmm if only i could read jass better id be able too do it too my map


I think you don't need to be so skilled to understand those lines, or get them to work.

Its like a word puzzle where each piece has to placed in the right order.

_________________
http://slowbro.org/
`·.,¸,.·*¯`·.,¸,.·*¯[;::;(。◕‿‿­­​­­­­­◕。)
Image
Image
Image

Spoiler:
(03:36:55) xkiska: im too much of a dumbass to understand this


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 56 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)