• 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.

Accessorizing Units: Custom Weapons and Shields

Accessorizing Units: Custom Weapons and Shields

----------------------------------------------------------------------------------------------------------------------------------------------------

This tutorial attempts to explain how custom items like weapons and shields can be added to your unit models to make them look more interesting like the character below. It will show how to disassemble features of certain models and then paste them onto other models, allowing for endless possibilities in the style of characters. You will be able to take off the pick from the peasant and instead replace it with a hammer of justice, Mountain Giant's Club or just about any other item you could think of. This tutorial is aimed at mappers of any level, since it requires very little knowledge of the editor and relies mostly on third party programs.



The following programs are used in this tutorial and is recommended that you download them:

MDLX Converter
Warcraft 3 viewer
Oinkerwinkle's Vertex Modifier

Overview

The process of accessorizing your units can be summed up in three steps:

1. Remove current items, such as weapons and shields from the model.
2. Find or create the items you wish to put on the model.
3. Attach the item to the unit using triggers.

Step 0

Before we can begin hacking away at the model, we first need a model. In this tutorial I will attempt to recreate the image of the footman I have above, replacing his shield with the Spellbreaker's shield and his sword with the Raider's sword. So the first thing I need is the model of the footman. Fire up Warcraft 3 Viewer! In Warcraft 3 Viewer, go to File>Open MPQ and navigate to the war3.mpq. Then in the tree view, with mdx selected in the radio button, navigate to Units>Human>Footman>Footman.mdx. Now you should see a model of a footman. Navigate to Current File>Extract MDX to extract our model from the mpq.



The model however is still not in any editable form, since .mdx is a compressed format. Now fire up MDLX Converter and click convert and select your model. It should now be in .mdl format, which is human readable and can be edited in a text editing program like notepad, if one wishes to.

Step 1: Removing Unwanted Accessories



Now that we have our editable model, it's time to remove the junk we don't want. In this case, it's the sword, the holstered sword (yes it is a duplicate), and the shield. Recall the Geosets (Meshes) from Warcraft 3 Viewer. By flipping through them, we can see which ones hold the stuff we need to delete. Mesh one holds the interior of the shield, and the unholstered sword as well as the holstered one. Mesh 2 has the exterior of the shield and Mesh 3 is just the hilt all on its own. Knowing this, we know what to edit from what Mesh, which I've indicated in red in the pictures below.



Now fire up Vertex Modifier. Before you use this program, it is wise to read the tutorial Oinkerwinkle provided us for this very purpose here. We begin by loading up our .mdl and then load Geoset 1. Let's first remove the sword, so find the outline that looks like a sword and select one of its verticies. Now we press Ctrl + E and it magically selects all the verticies that are connected to that one. We then press delete and part of the sword is now gone.

The hilt is a separate object, so it was not selected automatically. It may be hard to find it in the side view, so we turn to the front view and zoom in on the hand to find the hilt, which consists of 3 squares, with a rhombus going from one to the other. Select these and delete them. If you still can't find them, refer to the picture below or alternatively, you can select the part of the character and press Ctrl + E and then Ctrl + I and the hilt will be selected in red (along with everything else not physically attached to the character).

With the hilt gone, it's time to remove the shield. It's easily seen in the top view, along with the little spike in front of it. Select them and delete them.

Now its time to take care of the holster, which can be easily spotted in the side view.



With that gone, we are finished with Geoset 1, one down, two to go! Go to File>Switch Geoset and choose Geoset 2. Here, it's obvious what needs to be removed: the rest of the shield. Select it and delete it. Onto Geoset 3!



In Geoset 3, there is only a hilt, so the whole Geoset must be purged. Press Ctrl + A to select everything and press delete to remove the Geoset. Now the model is finished. Save the model and convert it back into .mdx using MDLX Converter. Then import the .mdx into World Editor using the Import Manager.



However, if we use a custom file path for the model, we would need a portrait.mdx under that path too or else the camera would become screwed up, so it's best to overwrite the original path. Do this by right clicking on Footman.mdx and choose "Modify File Properties". Check off "Use custom path" and set the path to "Units\Human\Footman\Footman.mdx". Now if you save the map and reload World Editor, you should end up with footmen that look like the one below. If not, then you did something wrong and must restart.



Step 2: Finding Accessories

Now that we have our model, we need to give it its custom shield and weapon. We can probably find quite a few on several sites like www.hiveworkshop.com or try creating our own with 3D modeling apps. However, much of the time, these may end up looking poor or just not fit into the Warcraft theme. Luckily Warcraft 3 comes with hundreds of ready made accessories, right on every unit! The trick is to extract them from the units, and luckily it's not hard nor as time consuming as creating your own. How exactly do we do it? The same way we removed the weapons from the model, except this time, we remove everything else.

To begin with, we search around for a model that has what we want. I wanted to give my footman a giant sized blade, so I popped out Warcraft 3 Viewer, navigated to Units/Orc/Wolfrider/Wolfrider.mdx and then converted it to .mdl with MDLX Converter. In the Geosets, I find that the Blade only exists in the first Geoset. I then open up Vertex Modifer and Ctrl + A and Delete the other Geosets, leaving only Geoset 1 behind. The sword is composed of two objects again, the blade and the hilt. To delete everything else but this, I begin by selecting a vertex of the blade and pressing Ctrl + E to select the whole object. Then I make sure "Add" to selected, so when I select a vertex of the hilt, it adds it to the selection, and Ctrl + E then selects both sword and hilt. Then press ctrl + I to invert the selection and magically now everything but the sword is selected and you may proceed to delete it, leaving you with the following picture.



However, we're not done here yet. Go to View>Add Marker and make sure all 3 fields are 0. This will add a marker to indicate the origin, which is some way away from where the sword is. Accessories are attached to a unit's body parts at the origin, meaning if we attach this to the unit, it will float above it. To fix this, we can move the sword, so its hilt is right over the origin. Select everything and choose move, allowing you to move the objects by holding down the right mouse button. When finished, the result should look something like this.



You may now save the model. Naturally you'd think we'd just convert the model at this point and import it into the editor, but you'd be wrong; the model still contains much unwanted junk like animations, pivots and attachment points, things that will screw up the model ingame. To remove this, we fire up notepad (Start>Run>"notepad") and open up the .mdl. Although it may seem confusing at first, the .mdl file consists of an ordered structure of groups separated by curled braces {} and items separated by commas. Of the main groups (those NOT indented), the only ones we need are "Version", "Model", "Textures", "Materials" and "Geoset". Delete everything else. Now the file should be many times smaller and it's only going to get smaller. The next large chunk we need to get rid of are inside the geosets and these are all the things that are inside Anim{ } groups (including the actual Anim{ } itself). With this model, there is only 1 Geoset, so remove all the Anim{ } and everything inside of it. Yet again, the file has shrunk by a significant amount. If you look inside the Geoset{ }, you might notice a large listing of Matrices{} inside Groups # # {} (where # is some number). I'm not quite sure what this is, but it has always given me trouble, so I delete every Matrices{}, except the first one and set Groups # # to "Groups 1 1". The model now is complete, but it is good practice to reduce its size to a minimum, and there's one more way we can do this. The second last entry in Geoset{} is MaterialID #, in this case MaterialID 0. This indicates what Material (A material is a texture with properties, whereas a texture is just a picture) this Geoset uses from Materials {}. Materials are numbered starting from 0 (NOT 1) and chances are your new Geosets (since you've deleted a whole bunch) won't use all the Materials. Here, our Geoset uses Material 0, so we can delete all the other Material{} in Materials{} except the first one and also change the number in Materials # {} to 1 (since we only have one now). Each Material is specific to a certain texture too and is specified in the TextureID field. So if TextureID 0 is the only one used, every Bitmap{} in Textures # {} after the first one should be deleted and the # in Textures # {} adjusted. With this done, this model is now ready to be saved and converted to .mdx You'll notice that it will be only 1 or 2 kilobytes in size now now. Import the model into World Editor; it's path can be anything, it doesn't matter.

Step 3: Attaching the Accessories

Now that we have our stripped down Footman, it's time to dress him in our new sword. We do this through one simple action in the Trigger Editor.


Code:
Special Effect - Create a special effect attached to the <attachment point> of <unit> using <model path>The <unit> is simply the unit we want to attach the accessory to and the <model path> is simply the path to the object we want to attach as indicated in the import manager under full path, but what is this <attachment point>? Special effects can only be linked to units at specific points called attachment points and here's most of them:


chest
feet
foot <left/right>
hand <left/right>
head
origin
overhead
sprite (for building attachment points)
weapon
gold
rally
eattree
mount
right
rear
smart


In my particular case I want to attach the blade I have imported as war3imported/Blade.mdx onto the right arm of my preplaced Footman, so I do


Code:
Special Effect - Create a special effect attached to the hand right of Footman 0000 <gen> using war3imported/Blade.mdxNow all my footman needs is a proper shield, which I decided to rip off the Spellbreaker. Unlike the Raider, the Spellbreakers shield is divided into 2 Geosets, which must be rotated and mirrored (spellbreaker has shield on opposite side than footman) separately, while still being aligned. The Geosets could be merged into 1, but I've only met trouble doing so.

once completed, we import this model into world editor and attach it to "hand left" to complete our masterpiece. And here this tutorial comes to a conclusion. I would like to note that this tutorial not only apply to weapons, shield and armor, but to any part of any model that you can find. You can even dress someone with the parts of the frozen Lich King; the possibilities are endless. I would also like to note that if you use many models, they may start to make the map size go significantly up. This can be reduced somewhat by using MDX Squisher on each model you import.

I hope this has helped and inspired, happy mapping!

--------------------------------------------------------------------------------
Last edited by [AiOrT][-][kT] : 09-04-08 at 10:08 AM.
 
Top