Results 1 to 4 of 4

Thread: Adding completely custom weapons to a default figure

  1. #1
    BM309K58SMERCH's Avatar Centenarius
    Join Date
    Feb 2012
    Location
    Gensokyo
    Posts
    879

    Icon1 Adding completely custom weapons to a default figure

    بسم الله الرحمن الرحيم

    Hello, this is my first tutorial on this site (and hopefully not the last). I hope many people benefit from this tutorial as much as I benefitted from these extremely helpful people:
    Ishan, Eothese, Karaİmam, AnthoniusII, PapaRosario, dannyxx30, Alletun, Nakharar, indian_boy90, Mythic_Commodore, and Gigantus.
    If it weren't for their extremely helpful tutorials and their patience with helping me, I wouldn't be writing this tutorial. They deserve every rep from me and more. Thank you all very much!

    Note: This tutorial focuses on how to add your own weapon to the game, not switching the weapon of a unit to the weapon of another unit from the game. Let's say it's like giving Mongol Foot Archers a Yumi bow and/or giving the Hashashin a Kukri. Before reading this tutorial, I suggest you first look over Ishan's Doctoring of M2TW units tutorial, and Alletun's Unit Maker's Tome of Knowledge. Basically, this tutorial is based upon indian_boy90's tutorial. I just wanted to extend it with extra notes, pictures, and to simplify some complications that I found in his tutorial. I have completely no intent of plaigarism.


    ====REQUIREMENTS====



    This tutorial has alot of requirements and steps from Ishan's Doctoring of M2TW Units tutorial, I suggest you read it for the Requirements and the Basic understanding. But I'll repeat some of the requirements here:
    For this tutorial, you'll be also needing
    ====PREFACE====

    For this tutorial, we're going to copy Dismounted Heavy Lancers, and make them use a custom weapon (in this case, a Nodachi). Complete with default animations.

    ====STEPS====
    ---STEP 1: Setting up the Figure---
    I'm going to presume that you already have your weapon modelled (to scale with the size of a regular M2TW unit), and your target figure is already "unarmed" (you already removed the weapon groups off of the model).
    Spoiler Alert, click show to read: 

    (The model in the 3D view looks odd because it has many varieties of heads, and accessories to choose from, it is completely normal, don't worry)

    ---STEP 2: UV Mapping---
    Start LithUnwrap. Then press Model -> Open. Now, select the model of your weapon. Now your weapon is selected.
    Depending on what weapon you're going to UV Map, the number of diagonal lines will change, and the angles..etc. But in general it will always look that that like in the picture.
    On the side, click on that cute + next to groups. These are the groups of the model. Right click on any of them and choose Select. The group is now selected.
    Spoiler Alert, click show to read: 

    Now click on Tools -> UV Mapping ... And there will be a dropdown list of Mapping methods. Generally, for weapons, it is Decal Mapping, but some certain weapons or if you're highly interested in really accurate details, choose Box Mapping. But we're using Decal here. Choose from x-right/x-left or y-top/y-bottom or z-front/z-back. One of them will give you a side view of your weapon. If one doesn't give you, press Undo (Ctrl + Z) and choose another. It will still look expanded, but ignore it for now until you're done with Mapping all the groups.
    Once you're done mapping all the groups, select any one of them, and open Edit -> Scale. Now you can choose Arbitrary, and scale with the use of a dialog box that will appear to whatever dimensions you desire. Or choose free and scale the map to whatever dimensions you desire. (But as long as it doesn't exit the dark gray box!) You might also want to move your maps around. For that, choose Edit -> Move -> Arbitrary.
    Your final Product might be something like this:
    Spoiler Alert, click show to read: 

    Now choose File -> Model -> Save. Save your model AS ms3d. And we're done with the UV Mapping Part.

    (---STEP 3: Texturing type 1---)
    Now, there is two things you can do. You can either continue on with the Merging section.
    OR, while your LithUnwrap is still open, you can also open File -> UV Map -> Save . This way, you can save the wrapping locations into a drawing form, and start texturing from now.
    You can do it this way, or you can do it later on. It's up to you to choose.
    Save it as a Targa (.tga) with these settings.
    Spoiler Alert, click show to read: 

    Test it on the weapon model that you UV Mapped:
    If you followed my steps carefully, the texture should show up on your weapon:

    Spoiler Alert, click show to read: 

    Success!
    Now, let's say you'll skip the Type 2 texturing, if so, then don't forget to save the texture as a DXT5 Interpolated Alpha .DDS file, it is very important later when converting it into the format that the game can accept and read.
    When you save, it should be something like this (in Photoshop):
    Spoiler Alert, click show to read: 


    ---STEP 4: Merging---

    We'll have to merge your weapon with the target figure. Open up GOM and Select Merge ms3d. Choose the figure, first THEN the weapon! (That's what Ishan said, Obey him!) The weapon will be sticking out of the figure's abdomen (or you know what I mean ) , but that's not a problem.
    Spoiler Alert, click show to read: 




    Press proceed, and save the merged model.

    Open up the merged file in MilkShape, and this is what we should get:
    Spoiler Alert, click show to read: 



    We're getting close
    Now, before we get to move the weapon into the figure's hand, I would like to clarify about the weapon's angle. All weapons have a certain way of wielding them. Here, my weapon is a Nodachi, a derivative of the Katana, therefore, it is wielded with the curve facing outwards, towards your enemy. So that means i'll have to rotate my weapon around until the blade/curve is facing away from the figure. When rotating, it's highly recommended that you use the Rotate Options in the Control Panel. The Result should be something like this: Note the very slight curve of the sword in the 3D and Top view (the others don't show of course )
    Spoiler Alert, click show to read: 

    The same goes to every other weapon. Including Warhammers and Battleaxes.

    Now, to move the weapon into the figure's hand. Select the weapon's group, and under the move options, choose from the list: "bone_Rhand", and press move. It will be something like this:
    Spoiler Alert, click show to read: 

    It's moved towards the Right Hand of the Figure. It isn't exactly toward the hand itself, but rather to the joint in the skeleton. Now you can (more) accurately move it towards the hand itself and place it neatly inside the palm. You can move the scabbard (if there is) to wherever you want in the body too.
    Now that it's all set, it's time to Assign the weapon to a Joint. Select the weapon's group, and assign it to bone_Rhand. To make sure that you're doing everything right, Choose flatshaded in the 3D view and check the "Draw Vertices with bone colors" box. Your weapon must be the same color like that of the right hand, like so:
    Spoiler Alert, click show to read: 

    Same goes with the scabbard. But depending on where you set it, you must assign it to the joint accordingly. Just choose bone_pelvis if you're not sure about what to choose. It works either way.
    Select the weapon's group and the scabbard, and assign it to "Attachments".
    Before we close, give your weapon a comment (no! not your own): Because it's a primary weapon, give it this:
    Code:
    primaryactive0
    Nodachi
    0
    And for the scabbard, give it this:
    Code:
    Attachments1
    Saya
    0
    Save the model.
    Now all you have to do is to open GOM's Converter and this time, choose .ms3d to .mesh, click on Proceed and save it. Give it the name of the unit you're going to use and a "_lod0". For example I named mine: nodachi_warrior_lod0
    Click Save and we're almost finished!

    (---STEP 5: Texturing type 2---)
    Let's say you've ignored the first type of texturing. This is the other way.
    Now that your model is all set in one piece, you can get the drawing out by using KnightErrant's WriteUVMaps2DDS script. Simply click on WriteUVMaps2DDS.py, a window will come up, just look for the location of your merged arranged model, and double-click it's name. Leave the script to do the job.


    When it's done, you should get 2 .dds files:
    1. (filename)_figure.dds
    2. (filename)_attachments.dds
    Since we're working on a unit based on Dismounted Heavy Lancers, you wont quite be needing the "(filename)_figure.dds" file. So just texture and draw over the "(filename)_attachments.dds" file. And again, as I said earlier: Don't forget to save the texture as a DXT5 Interpolated Alpha .DDS file, it is very important later when converting it into the format that the game can accept and read. Look at Type 1 Texturing for a picture of what the save window should look like.

    ---STEP 6: Converting .dds into .texture---
    Move your finished .dds file into the folder where Alpaca's Texture / DDS converter is, and simply start the convert_all_dds.bat file. You'll get a .texture version of the .dds file you put into the folder. That is the texture file of your weapon that the game can read. Give yourself a pat on the back, for now, it's the final step.

    ---STEP 7: Making a New unit, BMDB, and the Grand Finale---
    Go to the "_units" folder in your mod's "unit_models" folder. Create a new folder in it. I named mine: 'japanese'. Take your .mesh file and place it there. While it's there, copy it three times and change the "_lod0" in the new ones into "_lod1", "_lod2", and "_lod3". These lod files stand for Level of Detail. It isn't important right now, but just do it anyway.
    Make a new folder and name it 'textures'. Take your weapon's .texture file and place it there.
    Now, presuming you're using the formatted BMDB, look for "Dismounted_Heavy_Lancers". Copy the whole entry:
    Code:
    24 dismounted_heavy_lancers 
    1 4 
    71 unit_models/_Units/AS_Lamellar_Heavy/dismounted_heavy_lancers_lod0.mesh 121 
    71 unit_models/_Units/AS_Lamellar_Heavy/dismounted_heavy_lancers_lod1.mesh 900 
    71 unit_models/_Units/AS_Lamellar_Heavy/dismounted_heavy_lancers_lod2.mesh 2500 
    71 unit_models/_Units/AS_Lamellar_Heavy/dismounted_heavy_lancers_lod3.mesh 6400 
    2 
    7 mongols 
    73 unit_models/_Units/AS_Lamellar_Heavy/textures/AS_Lamellar_mongols.texture 
    72 unit_models/_Units/AS_Lamellar_Heavy/textures/AS_Lamellar_normal.texture 
    56 unit_sprites/mongols_Dismounted_Heavy_Lancers_sprite.spr 
    8 timurids 
    74 unit_models/_Units/AS_Lamellar_Heavy/textures/AS_Lamellar_timurids.texture 
    72 unit_models/_Units/AS_Lamellar_Heavy/textures/AS_Lamellar_normal.texture 
    57 unit_sprites/timurids_Dismounted_Heavy_Lancers_sprite.spr 
    2 
    7 mongols 
    59 unit_models/AttachmentSets/Final Asian_mongols_diff.texture 
    59 unit_models/AttachmentSets/Final Asian_mongols_norm.texture 0  
    8 timurids 
    60 unit_models/AttachmentSets/Final Asian_timurids_diff.texture 
    60 unit_models/AttachmentSets/Final Asian_timurids_norm.texture 0  
    1 
    4 None 
    10 MTW2_Spear 0  
    2 
    18 MTW2_Spear_primary 
    14 fs_test_shield 0 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    ...And paste it at the bottom end of everything. Now, since our unit is wielding a 2-handed nodachi, you must definitely remove the Spear and Shield Animations. Do so by deleting the latter portion of the entry, replace this:
    Code:
    1 
    4 None 
    10 MTW2_Spear 0 
    2 
    18 MTW2_Spear_primary 
    14 fs_test_shield 0
    With this:
    Code:
    1 
    4 None 
    16 MTW2_2HSwordsman 0  
    1 
    24 MTW2_2HSwordsman_Primary 0
    Now it's time to replace everything of the old entry with those of our new ones. This is a critical point in the unit making, so please pay close attention. I have used colors to simplify the process.
    Our entry should be something like this:

    Code:
    24 dismounted_heavy_lancers 
    1 4 
    71 unit_models/_Units/AS_Lamellar_Heavy/dismounted_heavy_lancers_lod0.mesh 121 
    71 unit_models/_Units/AS_Lamellar_Heavy/dismounted_heavy_lancers_lod1.mesh 900 
    71 unit_models/_Units/AS_Lamellar_Heavy/dismounted_heavy_lancers_lod2.mesh 2500 
    71 unit_models/_Units/AS_Lamellar_Heavy/dismounted_heavy_lancers_lod3.mesh 6400 
    2 
    7 mongols 
    73 unit_models/_Units/AS_Lamellar_Heavy/textures/AS_Lamellar_mongols.texture 
    72 unit_models/_Units/AS_Lamellar_Heavy/textures/AS_Lamellar_normal.texture 
    56 unit_sprites/mongols_Dismounted_Heavy_Lancers_sprite.spr 
    8 timurids 
    74 unit_models/_Units/AS_Lamellar_Heavy/textures/AS_Lamellar_timurids.texture 
    72 unit_models/_Units/AS_Lamellar_Heavy/textures/AS_Lamellar_normal.texture 
    57 unit_sprites/timurids_Dismounted_Heavy_Lancers_sprite.spr 
    2 
    7 mongols 
    59 unit_models/AttachmentSets/Final Asian_mongols_diff.texture 
    59 unit_models/AttachmentSets/Final Asian_mongols_norm.texture 0 
    8 timurids 
    60 unit_models/AttachmentSets/Final Asian_timurids_diff.texture 
    60 unit_models/AttachmentSets/Final Asian_timurids_norm.texture 0 
    1 
    4 None 
    16 MTW2_2HSwordsman 0 
    1 
    24 MTW2_2HSwordsman_Primary 0 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    • The name can be changed to whatever you want (no caps!), take care to count the numbers of letters of your new name, and change the number (24) into the new number (of letters) of your new name.
    • Change these directories into that of the directory of your model. Do not touch the 121, 900, 2500, and 6400. And when you count the number of letters, do not count them. And again I remind you, change the numbers after you count into the new numbers.
    • We won't be touching these, because we didn't do anything with the texture of the figure.
    • This is the directory of the attachment's (sword, scabbard) texture. Change it accordingly, and don't forget the numbers into the new numbers.
    For me, the new entry would be:
    Code:
    16 nodachi_warriors
    1 4 
    54 unit_models/_Units/japanese/nodachi_warriors_lod0.mesh 121 
    54 unit_models/_Units/japanese/nodachi_warriors_lod1.mesh 900 
    54 unit_models/_Units/japanese/nodachi_warriors_lod2.mesh 2500 
    54 unit_models/_Units/japanese/nodachi_warriors_lod3.mesh 6400 
    2 
    7 mongols 
    73 unit_models/_Units/AS_Lamellar_Heavy/textures/AS_Lamellar_mongols.texture 
    72 unit_models/_Units/AS_Lamellar_Heavy/textures/AS_Lamellar_normal.texture 
    56 unit_sprites/mongols_Dismounted_Heavy_Lancers_sprite.spr 
    8 timurids 
    74 unit_models/_Units/AS_Lamellar_Heavy/textures/AS_Lamellar_timurids.texture 
    72 unit_models/_Units/AS_Lamellar_Heavy/textures/AS_Lamellar_normal.texture 
    57 unit_sprites/timurids_Dismounted_Heavy_Lancers_sprite.spr 
    2 
    7 mongols 
    64 unit_models/_Units/japanese/textures/nodachi_attachments.texture
    59 unit_models/AttachmentSets/Final Asian_mongols_norm.texture 0  
    8 timurids 
    64 unit_models/_Units/japanese/textures/nodachi_attachments.texture
    60 unit_models/AttachmentSets/Final Asian_timurids_norm.texture 0  
    1 
    4 None 
    16 MTW2_2HSwordsman 0  
    1 
    24 MTW2_2HSwordsman_Primary 0 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    Eh...Looks good to go for me.
    Now this is an important part that people forget, and get a CTD (Crash-To-Desktop) for. At the very top of the BMDB, there is a certain number that is 700 and something. Just add +1 to it. (For me, it was 705, I made it 706.) Save, and close.
    Now for the EDU (Export_Descr_Units). Just copy the entry of the Dismounted Heavy Lancers.
    Spoiler Alert, click show to read: 
    Code:
    type             Dismounted Heavy Lancers
    dictionary       Dismounted_Heavy_Lancers      ; Dismounted Heavy Lancers
    category         infantry
    class            spearmen
    voice_type       Heavy
    banner faction   main_spear
    banner holy      crusade
    soldier          Dismounted_Heavy_Lancers, 48, 0, 1.2
    attributes       sea_faring, hide_forest, hardy, can_withdraw
    formation        1.2, 1.2, 2.4, 2.4, 4, square
    stat_health      1, 0
    stat_pri         12, 4, no, 0, 0, melee, melee_blade, piercing, spear, 25, 0.6
    ;stat_pri_ex      0, 0, 0
    stat_pri_attr    spear, spear_bonus_8
    stat_sec         0, 0, no, 0, 0, no, melee_simple, blunt, none, 25, 1
    ;stat_sec_ex      0, 0, 0
    stat_sec_attr    no
    stat_pri_armour  5, 5, 3, metal
    ;stat_armour_ex   5, 7, 0, 0, 5, 3, 3, metal
    stat_sec_armour  0, 0, flesh
    stat_heat        2
    stat_ground      0, 0, -6, 1
    stat_mental      11, disciplined, highly_trained
    stat_charge_dist 30
    stat_fire_delay  0
    stat_food        60, 300
    stat_cost        1, 560, 150, 100, 75, 560, 4, 140
    armour_ug_levels 2, 3
    armour_ug_models Dismounted_Heavy_Lancers, Dismounted_Heavy_Lancers_ug1
    ownership        mongols, timurids
    era 1            mongols, timurids
    era 2            mongols, timurids
    ;unit_info        12, 0, 13


    And paste it at the very bottom of the file. Make the changes for the type, dictionary, soldier, stat_pri, stat_pri_attr, and armour_ug_models to the file. In the end, you should get something like this:

    Spoiler Alert, click show to read: 
    Code:
    type             Nodachi Warriors
    dictionary       Nodachi_Warriors      ; Nodachi_Warriors
    category         infantry
    class            spearmen
    voice_type       Heavy
    banner faction   main_spear
    banner holy      crusade
    soldier          nodachi_warriors, 48, 0, 1.2
    attributes       sea_faring, hide_forest, hardy, can_withdraw
    formation        1.2, 1.2, 2.4, 2.4, 4, square
    stat_health      1, 0
    stat_pri         14, 6, no, 0, 0, melee, melee_blade, slashing, sword, 25, 1.3
    ;stat_pri_ex      0, 0, 0
    stat_pri_attr    no
    stat_sec         0, 0, no, 0, 0, no, melee_simple, blunt, none, 25, 1
    ;stat_sec_ex      0, 0, 0
    stat_sec_attr    no
    stat_pri_armour  5, 5, 3, metal
    ;stat_armour_ex   5, 7, 0, 0, 5, 3, 3, metal
    stat_sec_armour  0, 0, flesh
    stat_heat        2
    stat_ground      0, 0, -6, 1
    stat_mental      11, disciplined, highly_trained
    stat_charge_dist 30
    stat_fire_delay  0
    stat_food        60, 300
    stat_cost        1, 560, 150, 100, 75, 560, 4, 140
    armour_ug_levels 2, 3
    armour_ug_models nodachi_warriors
    ownership        mongols, timurids
    era 1            mongols, timurids
    era 2            mongols, timurids
    ;unit_info        12, 0, 13


    Save.
    And now, you can start the game up. And let's test what will we see...
    If your unit becomes into something like this:
    Spoiler Alert, click show to read: 

    Then you should treat yourself to a nice cup of tea, for you have successfully added a custom weapon to a default unit.

    Any questions or problems, please post them and I will gladly help.
    Thank you very much for your patience and your time in reading this tutorial. I hope it works out well for you!

    تمّ بحمد الله رب العلمين
    Last edited by BM309K58SMERCH; July 25, 2012 at 03:29 PM. Reason: Fixing some of the extra spaces I left over.

  2. #2
    karaislam's Avatar Vicarius
    Join Date
    Oct 2009
    Location
    Antalya
    Posts
    2,651

    Default Re: Adding completely custom weapons to a default figure

    this is the best tutorial i ve ever seen.when i was a noob modder if i had a lesson like this it would save my 3-4 months.its so clean.plus u show lithunwrap too.i still dont know about this program.i use other softwares for uv editing.

    i repped you.

  3. #3
    BM309K58SMERCH's Avatar Centenarius
    Join Date
    Feb 2012
    Location
    Gensokyo
    Posts
    879

    Default Re: Adding completely custom weapons to a default figure

    Quote Originally Posted by Karaİmam View Post
    this is the best tutorial i ve ever seen.when i was a noob modder if i had a lesson like this it would save my 3-4 months.its so clean.plus u show lithunwrap too.i still dont know about this program.i use other softwares for uv editing.

    i repped you.
    Thank you very much. You helped in making this by helping me earlier when I had a problem with my bow units. You deserve a rep too.

  4. #4
    Geronimo2006's Avatar TAR Local Moderator
    Join Date
    Oct 2007
    Location
    Ireland
    Posts
    7,405

    Default Re: Adding completely custom weapons to a default figure

    Will this work with ETW?
    Colonialism 1600AD - 2016 Modding Awards for "Compilations and Overhauls".



    Core i7 2600 @ 3.4ghz - NVIDIA GTX950 2GB

    Colonialism 1600 AD blog

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •