a guide by Wolf

From Wiki

Jump to: navigation, search

What x2mdl can do[edit]

  • Make an animated model with one or more separate meshes that move independently as solid 'blocks' without being warped or resized.
  • Make non-animated MDLs such as those used for magic spell projectiles or lamp stands.

What x2mdl cannot yet do[edit]

  • Convert a model whose animation makes the mesh warp - like a crawling Slime enemy or an 'NPC wearing a dress.'

Known Animation IDs[edit]

  • An MDL model stores each of its animation sequences separately, unlike some game engines which store all of a model's actions (attacking, dying, talking etc) as one long animation which is then split as needed by the game engine.
  • In an MDL, an animation is linked to an in-game action based on the name you give it. For instance, an NPC's animation which you name '0' will be played by SoM when the NPC is standing 'idle'.
  • Below is a list of the number-names which you will use to decide when an animation will play in game.


4="Opening" 5="Closing"


4="Key in" 5="Key out"


4="Activated first time" 5="Activated second time"


0="Event activated motion"


0 ="Standing Idle" 1 ="Walking" 4 ="Dying" 6 ="Defending" 7 ="Avoiding Attack" 9 ="When Triggered" 10="1st Direct attack" 11="2nd Direct attack" 12="3rd Direct attack" 15="1st Indirect attack" 16="2nd Indirect attack" 17="3rd Indirect attack" 20="Getting hit with an attack"


0="Standing Idle" 1="Walking" 2="Getting hit with an attack" 3="Dying" 4="Standing- Talked to from their Left" 5="Standing- Talked to from their Right" 6="Standing- Talked to from their Front" 16="Seated idle" 17="Standing up from sitting" 18="Getting hit with an attack while seated" 19="Dying while seated" 20="Seated- Talked to from their Left" 21="Seated- Talked to from their Right" 22="Seated- Talked to from their Front"


These are exclusive to data/my/arm.mdl. Ie. the disembodied arms seen from the player point of view in game.

0=Overhead Smash 1=Forward Stab 2=Horizontal Slash

Special Effect[edit]

These are used by explosions for example.

0=Continuous motion

For example[edit]

Make a standard non-animated model in your favorite modeler[edit]

  • Make sure the modeler can export to a format that 'Milkshape' can import. I made my model in Metasequoia and 'saved as' .3DS.
  • Start off with a very simple model. x2mdl is not fully tested and simplicity will increase your chance of success.
  • Use a single 256x256 bmp texture. x2mdl can handle many other texture formats and will automatically downscale other sizes, but using this recommendation will reduce the risk of encountering problems.
  • When you set up the UV alignment for your model's texture, don't use the texture's edges. x2mdl will sometimes flip textures if you do.
  • If you export to 3DS (using MetaSeq.), select 'Direct3D' axis or your model will be sideways when you import to Milkshape.

Import your model to Milkshape[edit]

  • Go to 'Import > Autodesk 3DS' and load you model.
  • Milkshape lets you add animation to your model. It will open/edit/save models in its own ms3d format for free, but it will not import/export models into other formats unless you have purchased a copy.

Add animation to your model[edit]

  • This will follow the basic process used to make a waterwheel, but teaching the ins and outs of making general animated models is beyond the scope of this page.
  • Make sure 'Animate >Operate on selected joints only' is NOT checked.
  • On the 'model' tab, push the 'joints' button.
  • Left Click on the model to place a joint where you want it. The waterwheel will spin in a circle so the joint will go directly in the middle.
  • Select the parts of the model that you want to move with the joint. Then go to the 'Joints' tab and press 'assign' to attach the selected parts of the model to the joint. The waterwheel will spin as a single piece so all the vertices will attach to my single joint.
  • Press the 'Anim' button. The go to 'Animate > Set Key Frame' (in main menu bar). This sets the model's current pose as the first frame in the animation.
  • Drag the animation slider to a different frame, pose your model as you want it to look in that frame of the animation. Then go to 'Animate > Set Key Frame' again to lock the current pose in that frame. Milkshape will automatically fill in the animations between each key frame. The waterwheel will have 360 frames (to make the math easy for a 360 degree rotation). A key frame every 45 frames and rotating the wheel 45 degrees between each key frame works nicely. As said earlier, Milkshape will fill in the empty frames (interpolate) between 'key frames'.
  • If you are making an MDL that will need multiple animation segments (open, close, idle etc), you can create them as one long animation and split them later or you can create them as completely separate files.
  • IMPORTANT!! Save often and in multiple files. Milkshape seems to be a bit buggy and you don't want to lose your hard work. Always exit animation mode in Milkshape before you save your model or your animation will become corrupted.

Export your model in X format[edit]

  • When you have created the desired animation. Go to 'File > export > DirectX(JT)' to save it as an animated x file.
  • Some of the more important settings are listed below.

1. Format:Always select DirectX Retained Mode. 2. Binary: Make sure 'binary' is NOT checked. 3. Position Scaling: This controls the in-game size of your model. You will probably have to set it to .01 since SoM uses a 1:100 scale. 4. Interpolation Count: decides how many extra key frames are added to the model's animation. x2mdl tries to interpolate on its own, but if your final model looks choppy or the animation doesn't convert smoothly, try a larger number here. Too high may cause trouble though. 5. Animation Range: In animation range, set which frames of your animation will be written to the x file. If you made all your animation sequences (walk sit etc) in a single piece, then enter numbers here and export each animation segment separately. The waterwheel will only have one animation (spinning) so all frames are exported. 6. Animation Set Name: You must name the animation set according to where it will be used in the game- as per the numerical chart listed earlier in this document. The waterwheel will be an NPC type object whose idle animation will be a spinning loop so put '0' here since that's the number-name code for an NPC's 'standing idle animation'

Converting to MDL[edit]

  • This x file exporter uses a 'playback speed' tag which x2mdl doesn't recognize so you have to manually add one line to the model's X file. Open the x file in WordPad and add the line: AnimTicksPerSecond{30;} If your model's animation plays too fast in game, you can lower '30' to the desired speed.
  • If your model will have multiple animation sets, you should have multiple x files (one for each animation sequence) and you will need to manually combine them into one x file. Search your x file for "AnimationSet" and copy the animation data (as highlighted in blue below) and add it to the very end of one of your other x files – you should append all your animation sets to a single x file this way.
  • For example, to make an NPC with: 0, 1, and 2 animations, I would: export each animation as a separate x file, open all three x files, then copy the "AnimationSet " data from 1 and 2 onto the end of 0.
  • Drag-and-drop your final .x file onto x2mdl.exe (or you can run X2mdl from a command prompt) and it should create an MDL file.
  • Drag the MDL onto cpgen.exe to make a CP file.

Using the new MDL with Sword of Moonlight[edit]

  • Name your new MDL and CP whatever you want but they must have the same name.
  • Open your MDL in a hex editor. If your MDL has animation, change the very first byte to '01'. If it is not animated (a spell model etc) you can skip this step.
  • In a hex editor, open an existing PRF that corresponds to the animations you have included in your MDL and write your MDL's name over the original MDL name. Save the altered PRF under a new name.
  • Place the MDL/CP in the appropriate directory, and you should be ready to try it out in a game!


  • Once you have animated your joints, you can attach different meshes to them so that you don't have to remake your animations for similar objects. For instance, you could import an additional windmill model into the waterwheel model, delete the waterwheel mesh and attach the joint that made it revolve to the new windmill mesh. The windmill would then spin without having to remake all the animation frames.
  • If you have made your MDL and placed it on a map, then decide to edit and overwrite the MDL, you will usually need to 'Apply' (aka Register) and 'Save' the part again in the Parameter Editor. If you don't, your edits may not show in-game. However, you do not have to 're-compile' (aka re-output) the map every time you edit an MDL.