Well here she goes...
Adding Basic Attachment Points
This tutorial will teach the fundamentals of adding attachment points to existing models.
Tools needed
TheProphet and KDEWolf's Warcraft 3 Viewer v2.3c
YobGuls War3 File Format Converter v2.1
Oinkerwinkles Object Id Inserter v.99
Text Editor (Notepad, Microsofts only good program)
1.Preface
This is a general solution for models that do not display spell effects and/or lack the ability to "tie" weapons/items to the model via triggers.
2.Preperation
The model we'll be "fixing" is the Shadowcaster unit
Dsparil from TToR, made by SLyrr and animated by RightField. Find that model
here.
Were also going to need a donor model of a similar skeletal layout. If your adding attachment points to a biped unit utilize one to find the necessary attachment point names. I used the chaoswarlock.mdx file extracted from the war3.mpq.
3.Extracting from MPQ
I know this has been covered somewhere but its easy to explain so here we go. Open Warcraft 3 Viewer, click File->Open MPQ and point it to your war3.mpq file. In the Treeview open the plus on the war3.mpq then Units->Demon->Chaoswarlock. Now select the chaoswarlock.mdx, right-click and choose Extract MDX... Place it somewhere familiar.
4.Convert both Models to MDL
Using the War3 File Format Converter Load both Dsparil.mdx and chaoswarlock.mdx and convert to .mdl Saving them somewhere clever with the other files.
5.Research the Battlezone
Attachment points ussually follow Bones/Helpers in the MDL file, alternately they are above PivotPoints. Open the chaoswarlock.mdl and Find... "Attachment". Your first instance is the
Attachment "Foot Left Ref " { Note all the attachment points for this biped. Importantly the difference between Attachment points which point to Parent bone objects like
Parent 49, // "Bone_Foot_L". These attachments are important but will be dealt with later. All we need to copy for now are the bottom two
Attachment "Origin Ref " {
ObjectId 69,
}
Attachment "OverHead Ref " {
ObjectId 70,
}
as these are the points the majority of spell effects attach or will default to.
Now open the Dsparil.mdl file and Find... "PivotPoints". Above this is where attachment points will eventually go, but there are no free ObjectId's to do so. First scroll up until you see the above Helper object
Helper "Bone03" {
ObjectId 30,
Take note of the ObjectId and that you need 2 more spaces in the Dsparil ObjectId chain to accomodate the new attachments.
6.Object Id Insertion
Open up the Object Id Inserter and fill in the fields as follows; Base File:
Dsparil.mdl, Insert After:
30, How Many:
2, Output File:
DsparilAdded.mdl. Now Insert.
7.Attach the Attachment points
Okay open up the new DsparilAdded.mdl file and Find... "PivotPoints" again. Now scroll lower and find the ParticleEmitter2 object. Notice its ObjectId is 33! Excellent we have empty space to drop in attachment points 31 and 32. So back up just above PivotPoints and paste in the above Attachment Origin Ref and Overhead Ref. Just make sure to change the ObjectId's to 31 and 32 respectively.
8.Now Save, Convert and Add it to a Map
Save the DsparilAdded.mdl file and open up the File convertor again. This time load DsparilAdded.mdl and convert it into a .mdx file. Now Import it into a map utilizing the original skins and skin paths! Save and reload the map. Then create a unit specifying the new DsparilAdded.mdx file as the units Art-Model File. Save again and test the map.
Done!
***The following has not been tested, currently there is no suitable model to use as reference.***
Advanced Attachment Points
Extra Tools needed
Fadi Mounir's Animation Importer/Exporter script
3D Studio Max
1.Preface
The advanced attachment point relys upon a bone structure and animation times to denote where and when the attachment takes place. These points are a little more involved to work out but quite achievable. The Dsparil model is a bit of an oddity as it wont load into Max for me and isn't commented as to which bone is which, leaving me only hours of guess work to find and correctly map all the attachment points. Needless to say I'm not going thru the hassle and instead will generalize a solution as follows.
2.Preperation
The below snippet is again from the chaoswarlock.mdl
Attachment "Foot Left Ref " {
ObjectId 62,
Parent 49, // "Bone_Foot_L"
Visibility 3 {
DontInterp,
7067: 1, //Frame #: Visibility Bool (1/0 or Visible/Not or True/False)
41767: 0,
106667: 0,
}
}
If you'll notice the Parent, Visiblity, and Visibility sub fields. The Parent is the ObjectId of the corresponding bone in which the attachment point will represent. Visibility effects at which times through out the animation cycle the attachment points are active (ie. a value of 0 beside a frame number means no attached object shows after that time).
3a.No Decay Animations
Try opening the chaoswarlock.mdl file again and Find... "Decay". In the event the model (or any other your working with) doesn't have this/these animations, no worries just carry on without the time data in Step 4.
***Perhaps mapping each animation for attachment visibility is a safer idea here, but the worst case is a pile of swords on the ground, So it'll do for now.***
3b.Setting the Stage
If you open up the chaoswarlock.mdl file again and Find... "Decay Flesh" you'll notice its interval is
Interval { 7067, 67067 }, also if you Find... "Decay Bone" its interval is
Interval { 106667, 166667 }, these two Animation Start times are represented in the Visibility area of the attachment point. Hark, I digress, it makes sense that when your unit dies its attached spell effects and perhaps weapons need to be removed. Otherwise the ground would become littered with hundreds of swords and twirling spell effects. The visibility value of
7067: 1 represents that when the unit begins to decay the effects are still visible, but midway thru the animation at
41767: 0 the effects/weapons are to disappear. Also subsequently in Decay Bone the effects shouldn't be seen at all resulting in
106667: 0.
Great so how does this help. We'll if a model has these Decay animations you can search the file and find the Decay flesh Start time, Mid Time, as well as the Decay Bone Start time.
3c.Seek and Take Note
To find the Start times for both Decay animations is pretty easy, all you have to do is Find... "Decay Flesh" and read the first number in the following Interval statement.
Anim "Decay Flesh" {
Interval { 7067, 67067 },
Next Find... "Decay Bone" and do the same thing for its Start time. For the Decay Flesh Mid time you must know the Geoset of the main body (or Geoset you'd like the attachments to share Visibility with!) Typically this is the first Geoset (or a quick check in the Warcraft 3 Viewer can help decide). In any case Find... "Geosetanim" of the first (or second,...) and look immediately below in the
Alpha #
{ section to find the decay flesh Start time you saw before, now look right below it. If the next number is within the decay flesh animation range (ie. after the Start time and before the End time) then it is the Mid time and you should note this number as such.
4.Add the Object Id's
Okay with all the numbers in hand we need to make room for all the new attachment points as we did before. This time add however many points you need to facilitate 2 hands, 2 feet, a chest, a head, an origin, an overhead, and a weapon point. Open the Object Id Inserter and fill in the fields as before changing How Many to
9.
5.Attachment Point Insertion
Now simply copy and paste the chaoswarlock.mdl data from
Attachment "Foot Left Ref " {
ObjectId 62,
...to...
Attachment "OverHead Ref " {
ObjectId 70,
}
Go thru each Attachment point ObjectId adjusting each to 31 thru to 39. Past in all time data for Decay Flesh Start time, Mid time, and Decay Bone Start time. If there are no times to insert then delete the Visibility tag all together leaving only ObjectId and Parent in the attachment. Now for the Parent's.
6.Bones Where Art Thou
In most cases its only a matter of loading a model into 3d Studio Max using Fadi Mounir's Importer script and selecting each bone in question (ie. Hand bone for a hand attachment, Center Chest bone for...). With the name of the bone in hand, Find... "Bone "That bone name"" in the MDL file and immediately beneath that will be the ObjectId for that bone. Note the Id and place it in the Parent field for the attachment you are working on.
You can also hope for a courteous modeller who named each bone something clever or commented the bone's name beside it and may simply Find... "Bone Name In Question (or Variation)" in the MDL and be done with it.
7.Rinse, Repeat, Convert and Play
Continue searching, finding, and remapping all relevant Bone ObjectId's to there Attachment point Parent counter-parts. When all the Parents are in place save and convert the file as in Basic Attachments Step 8 and test your unit using the
Special Effect - Create special effect on unit Trigger(filling in the trigger values with the neccesary data, Try attached to the origin, and using Objects\InventoryItems\Rune\Rune.mdl).
Done'sky.
Cheers,
ColdStar