Importing custom model into the map without any cosmetics

edited February 2015 in Tutorials

Many people probably have the idea of using custom models into the map but having a hard time with importing models into the engine, importing animation for the models, importing texture for the model, creating up your hero without cosmetic problem, and especially, doing this with .mdx format which is originally from Warcraft 3 since many people seems to want to port maps from warcraft 3 to source 2. Here is the tutorial on how to do so.

This tutorial will mainly focus on importing .mdx to source 2 engine for hero's use. But the steps are also usable with other models, units, and extensions as well if it has base model and animation ready. If you have any suggestion, question or improvement to this tutorial, do not hesitate send me a message or leave a comment.


- Dun1007, on importing mdx to source 2
- Tailer007, for the model in this example (not sure who was the original modeler)
- BMD, for his timers' file

Required materials:

- Dota 2
- Dota 2 Workshop Tools Alpha
- 3ds max
- timers.lua, can be found here
- model, in this example, I will use Asuna from SAO in this link. Click here
-, this is only required for .mdx format
- Warcraft 3 Model editor, this is only required for .mdx format, can get via this link
- GCFScape, for opening the vpk file

Table of Contents

Step 1: Preparation for mdx format
Step 2: 3ds max importing and exporting
Step 3: Getting the textures
Step 4: Setting up for Source 2 Model Editor
Step 5: Setting up material
Step 6: Setting up the base model
Step 7: Importing Animation
Step 8: Attachment Points
Step 9: Different approaches on Scripting and its pros and cons
Step 10-1A: Space Optimization Part one: Preparing KV Files
Step 10-1B: Space Optimization Part two: Lua scripting
Step 10-2: Performance-based

Note: You don't need to go beyond step 8 if your model will not be used as a hero.



  • edited January 2015 Posts: 96

    If your file is already in FBX format with animation, ignore this part.

    Step one: Preparation for mdx format

    After getting all the required materials, put into C:\...\Autodesk\3ds Max\scripts\Startup. This will serve you as a script for importing your models into 3ds max for mdx format.

    Step two: 3ds max importing and exporting

    For other standard formats, you can simply import it via default import button in the main menu and skip to step 5. For mdx format, you have to import via following:
    1. Launch 3ds max.
    2. click on the hammer button on the far right of the screen.
    3. click on MAXScript.
    4. click on the drop down menu below "Utilities" and select "MDX Importer/Exporter"

    The steps are shown in the image below:


    Use the following setting for before import. It's very important that "Import as M3" is not checked. Otherwise, you might not see skeleton in source 2 model editor.


    5. Click on "Import MDX.." and select your mdx file, in this example, it will be AsunaV1.mdx.
    6. Select all the meshes, bones, and lighting in the scene by dragging the mouse over all of them or press ctrl + A. (If you already have base model from other extensions or sources, this is where you start)
    7. Go to menu bar, and select Export.
    8. Export the file as FBX format. Remember to have "Animation" unchecked. This will serve as a base model for your hero.


    9. Export the file again but this time with "Animation" checked. This will serve as an animation file for your hero. For other extension, you may have to make your own animation within 3ds max or import it from other formats then export it.

  • edited January 2015 Posts: 96

    Step three: Getting the textures

    Now you have your models but you have no texture yet. For other model files beside .mdx, you should already have texture file externally in .tga, .bmp, etc. If you make your own material in 3ds max, then you have to export your UV out in .tga format.

    For .mdx, go through the following steps:

    1. Launch Warcraft 3 Model Editor.
    2. Click on File > Open.
    3. Choose your .mdx file, in this case, AsunaV1.mdx.
    4. Click on Windows > Texture Manager.
    5. Select the texture that you need. In most case, there will be only one. But for this model, it has two. The number of required material can be found in .blp format that comes with your .mdx file.
    6. In the Texture Manager, right click on the material and choose export.
    7. Be sure to save the extension as .tga by renaming texture.blp to texture.tga.

    Now you have texture ready to go with your model, let's head off to source 2 model editor.

  • edited January 2015 Posts: 96

    Step four: Setting up for Source 2 Model Editor

    Source 2 Model Editor will sometimes behave abnormally if you have file path outside of your addon. Therefore, you need to have addon up and running and files in the right path. To do so, you have to do the following: (If you already have your addon, skip to step 3)

    1. Launch up the Dota 2 Workshop Tool Alpha.
    2. Click on "Create Empty Addon" and create your own custom addon.
    3. Click on your custom addon that shows up in the list and press "Launch Dota 2 Workshop Tools"
    4. Now that your addon is ready to be worked on, copy the two .fbx files we made in the previous step into the following path:

    C:\...\Steam\steamapps\common\dota 2 beta\dota_ugc\content\dota_addons\your_addon_name\models\your_model\

    The last sub-directory is not necessary needed but I like to keep my space clean.
    5. Copy your .tga files into the following path:

    C:\...\Steam\steamapps\common\dota 2 beta\dota_ugc\content\dota_addons\your_addon_name\materials\your_model\

    Now your resources are ready to be edited. Let's move on to the next step.

    Step five: Setting up material

    Since source 2 uses its own material extension to work on, we have to convert this for our model first. To do so, you need to do the following:

    1. After you launched the Workshop Tool, click on the material editor button as shown below.image 2. Click on File > New. This will create you an empty material. As soon as it's created, save it right away.
    3. Click on "Open Containing Folder" icon next to big Gray square under Color section. image 4. The file explorer will show up. Change the extension in the dropdown menu on the bottom to "All Images".
    5. Navigate to your .tga files.
    6. Select your file and click ok.
    7. Save your file.
    8. If you have any normal map or specular, you can simply click on the panel on the left of this one and check in the box to make it show on the right. Then choose normal map or specular for it.
    9. For each .tga file, you have to create each separate material for it by simply repeat step 2 to 8 again.

    Now your material is ready to be used inside the source 2 engine. Let's hop to the model.

  • edited January 2015 Posts: 96

    Step six: Setting up the base model

    Now that we have all resources ready to make your model become usable, let's head to Model Editor.

    1. In Asset Browser, launch Model Editor as shown below.


    2. Click on New VMDL From Mesh File on the bottom of the page
    3. Browse to your model in the directory and press OK.
    4. Now you should see your model in red wire-frame with skeleton inside it as shown below. It may happen that the yellow skeleton doesn't show up. Try to go back to 3ds max to import the models again or try with instead, sometimes it works.


    5. Now to get rid of red glowing wire frame, you need to do some material remaps.
    6. Click on Model > Add Material Remap.
    7. Notice that "Material Remap List" will show up under the Outliner section. Click on it.
    8. On the right hand side, you will see "Material Remap List (1 items)". Click on "+" sign on the left to expand it.
    9. Now you will see [0] (CVMaterialRemap) below, click "+" sign on the left to expand again.
    10. There will be 2 fields showing up.

    Field Description
    Search Material This field will tell which piece of meshes that you want to remap. You will need one remap for each entry you see in the dropdown menu.
    Replace Material This field will tell the engine which material you want to use to remap.

    11. In Search Material, select one of the entries in the dropdown list.
    12. In Replace Material, press on the magnify icon to bring up the material explorer.
    13. Select the material that you want it to remap to. One material can remap to many meshes. If you have only 1 .tga for the .mdx mode, you can even remap all of them to the same material.
    14. Repeat step 9 to 13 for all the entries in the drop down menu. To add more remap entry, simply click blue "+" symbol on the right of Material Remap List.

    For the model in the example, it should be looking similar to this.


    15. After you have something similar to above picture, press save.
    16. Now you should see all the textures similar to the image below:


    17. Now you want to attach hit box to the model. This can be easily achieve by clicking Model > Hitboxes > Autopopulate Hitboxes for easiness. This is important. If you don't have hit box attached to your model, you cannot select him/her in game. If you want to be more advanced, please refer to this link.

    It already looks good, isn't it? But we're not quite there yet. If we put the current model into the game, it will only show that pose you see and it's not going to be very useful. To make this usable, let's hop onto importing animation.

  • edited January 2015 Posts: 96

    Step Seven: Importing Animation

    For the model to be fully usable in the game, you need animation attached to it to make it come to live. In order to do so, you should have the animation fbx from step two ready to deploy. If not, scroll back up to take a look at it, or click here. Please note that if you crash during this step, it's normal don't panic.

    Now to import the animation you have to do the following:

    1. In Model Editor, click on Animation > Add Animation. This will bring up the file explorer.
    2. Select the animation fbx and press Open.
    3. This might take a while to open on some computers. Basically, the engine is reading in a lot of keyframes for animation. So low-end pc or laptop like mine would take several minutes to open. Don't panic :)
    4. Now after the animation is done loading into the engine, you should have something similar to this.

    image 5. From here on it's going to require some labor works if you don't know the animation frames in advance. If you already know them, you may skip to step 8. However, I do suggest to do this manually as key frames from .mdl or 3ds max tends to not match with the one in source 2.
    6. If you don't know what animation this model has, you should check them in either 3ds max or in Warcraft 3 Model Editor for each animation.
    7. For Warcraft 3 Model Editor, click Windows > Animation Controller. In there, you can see all the animations for this model. In this example, it should be 11 animations excluding UNANIMATED one.
    8. Now that you know that total number of animations, press "+" symbol next to "Animations" on the right panel to increase the animation sequence to match amount of animations you want in your model.
    9. Click the "+" symbol on the left under Animations to expand each animation out.
    10. In here, you will see two fields that you need to fill out immediately.

    Field Description
    Animation name This can be anything you want since it's only for your own reference.
    File Path Press on the magnify glass on the right, it will bring up the explorer. Simply select your animation fbx and close the explorer.

    11. At the very minimum, you should have one for idle, one for attack, one for movement, and one for dead. For this example, I will do as much as below.


    If you already know the key frames in advance, you don't need to read step 12 and 13.
    12. Go back to the first animation on the list, it should already have Start Frame at 0 and End Frame at the very end. If not, simply put in the number accordingly and save to have it rendered to be able to look at it in real-time. Note that sometimes the animation does not show up in Model Editor. You may have to re-export it from 3ds max and Add animation again.
    13. After it is rendered, you have to find key frames accordingly. For example, I want to do asuna_attack1, I have to scroll over the frames to find the right frames for it. In this case would be:

    Field Value
    Animation name asuna_attack1
    Start Frame 500
    End Frame 542

    14. Under those two fields, you will find "Activities" section. Press blue "+" symbol on the right.
    15. Expand the field that shows up, then in the "Name" field type in ACT_DOTA_ATTACK. This field is very important. It will tell the engine which animation this will serve as in game. The list of full actions can be found here.

    To understand these actions a little, when your unit is not doing anything, it will enter the state of ACT_DOTA_IDLE with rare chance of triggering ACT_DOTA_IDLE_RARE. When your unit is attacking, it will random between ACT_DOTA_ATTACK and ACT_DOTA_ATTACK2. While casting or channeling ability in slot from 1 to 4, it will use ACT_DOTA_CAST_ABILITY_1 or ACT_DOTA_CHANNEL_ABILITY_1 for slot 1 and so on. ACT_DOTA_DIE will trigger when unit dies and ACT_DOTA_SPAWN will trigger when unit spawns, etc. There are many many actions in that pages but most of them will not be usable in dota or some of them are specifically hard coded to hero so it cannot be used.

    16. Now you will want to do step 12 to 15 for every animations you have. This will require some times to find and compile. For any animation that requires loop such as idle or channeling, you can check the box under "Loop" to make it loop over the animation the whole time. For example, if you have idle animation without loop, after the animation is done, your model will freeze at the location and you don't want that.

    The full list of animations in this example is below. This is simply just what I feel like her to be doing. Each person may totally have different sequences. During this process, you should save often or note down the animation key somewhere as it might crash and make you feel like wasting your time.

    Field Value
    Animation name asuna_attack2
    Start Frame 573
    End Frame 626
    Loop False
    Activities Name ACT_DOTA_ATTACK2
    Animation name asuna_spell1
    Start Frame 438
    End Frame 478
    Loop True
    Activities Name ACT_DOTA_CAST_ABILITY_1
    Animation name asuna_spell2
    Start Frame 656
    End Frame 724
    Loop False
    Activities Name ACT_DOTA_CAST_ABILITY_4
    Animation name asuna_spell3
    Start Frame 750
    End Frame 787
    Loop False
    Activities Name ACT_DOTA_CAST_ABILITY_2
    Animation name asuna_channel
    Start Frame 385
    End Frame 407
    Loop True
    Activities Name ACT_DOTA_CHANNEL_ABILITY_1
    Animation name asuna_stand
    Start Frame 11
    End Frame 73
    Loop True
    Activities Name ACT_DOTA_IDLE
    Animation name asuna_die
    Start Frame 895
    End Frame 1020
    Loop False
    Activities Name ACT_DOTA_DIE
    Animation name asuna_walk
    Start Frame 292
    End Frame 323
    Loop True
    Activities Name ACT_DOTA_RUN

    This should cover all basic of importing animation. I will not go in depth about sequence since it's only about fine-tuning and it's not really necessary. It's basically will smooth the transition between each animation. It will not be hard to figure out what it does. Just play around with animation and slider until you are satisfied.

  • edited January 2015 Posts: 96

    Step Eight: Attachment Points

    Now you have a model and animation ready to roll. But you are not quite done yet. The model still lacks one of the most important aspect of the model that many people may look over, attachment points.

    Attachment point will allow you to be able to attach particles to your model. Without this, particles will always show up at your foot and in some cases, it ruins the mood.

    To add the attachment point, follow the steps below:

    1. Click Model > Attachments > Add Attachment.
    2. Put any name of attachment you want. However, I do suggest to keep it along this format.


    3. Select the joint you want to attach it to.
    4. Save the file.

    Now you should see something along this line.


    Now you know how to attach the point. There are some points that you should make for your model as followed:


    You might want to add something fancy like in this example I will add attach_sword to her sword, in case I might use particle coming out of her sword. In this example, I attach the point to following bones:


    With this, it concludes the use of model editor. Now we move on to the next part which is different approaches on scripting.

  • edited January 2016 Posts: 96

    If you are not editing model for hero unit, you can simply stop here.

    Update 2016: Use this method to hide wearables from your heroes.

    The explanation below is outdated.

    Step Nine: Different approaches on Scripting and its pros and cons.

    This is probably the most important part in this tutorial. Although your model is now in the stage that can actually be used in a real game-play, this model will become corrupt in the real game-play due to the default and custom cosmetics equipped on the hero. For example, you can override the Spectre, but all her armors and weapons cosmetics from Spectre will stay on top of your custom model and that definitely is not good. You may think it might be cool to have those cosmetics equipped along with your custom model. That is totally feasible but to make it work, you have to rename all skeletons, bones, joints and their hierarchy to be the same as the original model which is really not a choice when you want to do your own custom model. Without scripting properly, your model may end up as the image below. The cosmetics attach onto your model at the fixed position and your model becomes ghostly.


    Now that you know the importance of properly scripting this, I will explain to you two out of three different approaches since I'm not very familiar with the third approach and not even sure if third approach is feasible via this tutorial since it's involved .mdl, .dds, etc. Each of them has its pros and cons as I will show below.

    Space Optimization


    1. You don't waste any extra space to the model.
    2. You don't have to make changes to the files every time valve makes new cosmetic changes.


    1. You don't see your model during the loadout.
    2. You don't see spawning animation of your model.
    3. You may not have any cosmetic attach to your current model at all.
    4. This approach is Lua heavy.



    1. Your model will work flawlessly despite all the errors popping up in the console.
    2. Compare to the first approach, this should run smoother. (Haven't actually compare them but judging from lua, it should be faster.)
    3. It is possible to attach some cosmetics to the model as long as the bones can be merged properly.


    1. You need extra space in your map for the models which can grow exponentially large if you have many custom models.
    2. You have to make changes to the files every time valve makes new cosmetic changes.

    Override the original models' file

    Note: I don't know how to do this approach, just list it here since I know it exists. If any information is wrong, please correct me.


    1. Your model will work flawlessly under any circumstances.
    2. It requires only little more space which is very acceptable.
    3. This should be the best way to do this.


    1. Heavy knowledge on materials, modelings are required in both 3D application and Source 2 files extensions.

    Those are the three approaches I have learned on the way so far. Let's get to know the first two approaches.

  • edited January 2015 Posts: 96

    Step Ten First Approach: Space Optimization Part one: Preparing KV Files

    This approach is good for someone who has no knowledge to moderate knowledge in modeling but have some programming knowledge. Aside from scripting preparation and the cons I mentioned above, this one should work flawlessly as well.

    Now first part of this, you have to start preparing your key value files.

    You need to browse to the following directory:

    \Steam\steamapps\common\dota 2 beta\dota_ugc\game\dota_addons\your_addon\scripts\npc

    When you get there, you should have following files as they are automatically generated by the engine, and open them. I recommend to open them in Notepad++ if you have one, but normal notepad is suffice.


    Now you have to decide which hero you want to override. As the current engine stands, you cannot completely create new custom hero. The only way to do it is overriding the pre-existing one from the dota. For this example, I will use Spectre.

    Edit your herolist.txt to have something similar to the following:

        "npc_dota_hero_spectre" "1" 

    The key will always follow the following format, and the value will either be -1 (pick as many times as you want), 0 (disable), and 1 (enable)


    There are few exceptions where they use the old name but for most cases, it should work, like these.


    The full list can be found in this link. This will allow your overridden hero to show up on the selection screen. If set to 0, it will not show up.

    Now move on to the npc_heroes_custom.txt. You should have the minimum structure for your file like this.

        "override_hero"  "npc_dota_hero_spectre"
        "Model"          "models/development/invisiblebox.vmdl"

    In the field where I wrote as "npc_dota_hero_asuna_datadriven" can be freely adjust to however you like. However, the other fields have to strictly follow those format where the value can be found in table below. I will not go further into all the fields available since this tutorial is not involved in making hero statuses.

    Field Value
    override_hero This will have the same value you put into herolist.txt earlier
    Model The relative path to the model file

    Due to the nature of this approach, every heroes you entered will have its model set to invisiblebox.vmdl as shown in the example below. I will explain why it should be like this in part two of this approach.

        "override_hero" "npc_dota_hero_sven"
        "Model"         "models/development/invisiblebox.vmdl"
        "override_hero" "npc_dota_hero_juggernaut"
        "Model"         "models/development/invisiblebox.vmdl"

    This, however, will still see your hero as a corrupt hero during the loadout. You can forcefully skip the loadout in different ways (I think?). One way to do this is putting following key value into the hero.

      "override_hero" "npc_dota_hero_juggernaut"
      "Model" "models/development/invisiblebox.vmdl"
      { }

    This will tell the scaleform that you basically don't have any cosmetic to equip, so the HUD will not appear. However, cosmetic will still show up in the game if you don't change the lua script in part two since they are separate component.

  • edited March 2015 Posts: 96

    Step Ten First Approach: Space Optimization Part two: Lua scripting

    This is currently OUTDATED, will be fixed some time soon.

    You are already very close to be able to use your custom model in your map! At this point, you should already have timers.lua downloaded, if not, go back to the first post to get it.

    You are required to go to the following directory.

    \Steam\steamapps\common\dota 2 beta\dota_ugc\game\dota_addons\spell_lib_test\scripts\vscripts

    In there, you should see addon_game_mode.lua which is the core script for your addon. Now let's start scripting.

    1. Copy and paste timers.lua into that directory.
    2. Open addon_game_mode.lua with Notepad++ or Notepad.
    3. On the very first line, put following line to import the timer.


    4. Now you need to precache your model in order for it to show up in game properly. In order to do so, edit the following function to look similar to the following. model_lookup table will serve as global variable so you don't have to edit multiple places to put in your models. Its key will be the name of hero you override, and the value will be the model name that you want to swap in.

    model_lookup = {}
    model_lookup["npc_dota_hero_spectre"] = "models/asuna/asuna.vmdl"
    function Precache( context )
      -- Precache models
      for k, v in pairs( model_lookup ) do
        PrecacheResource( "model", v, context )

    5. Edit your InitGameMode() function to look similar to the following. Make sure you add the listener to the function.

    function CAddonTemplateGameMode:InitGameMode()
      GameRules:GetGameModeEntity():SetThink( "OnThink", self, "GlobalThink", 2 )
      -- Listener 
      ListenToGameEvent( "npc_spawned", Dynamic_Wrap( CAddonTemplateGameMode, "OnNPCSpawned" ), self )

    6. Your addon will now trigger function OnNPCSpawned every time a unit is spawned. But we don't have the function yet. Now we have to create the function.
    7. Put the following function in the very end of the file. I will explain it line by line of what it actually does. Although if you can understand it from the comments, you shouldn't have to read the explanation below and are good to go.

    function CAddonTemplateGameMode:OnNPCSpawned( keys )
      Timers:CreateTimer( 0.05, function()
          -- Setup variables
          local hero = EntIndexToHScript( keys.entindex )
          local model_name = ""
          -- Check if npc is hero
          if not hero:IsHero() then return end
          -- Getting model name
          if model_lookup[ hero:GetName() ] ~= nil and hero:GetModelName() ~= model_lookup[ hero:GetName() ] then
            model_name = model_lookup[ hero:GetName() ]
            return nil
          -- Check if it's correct format
          if hero:GetModelName() ~= "models/development/invisiblebox.vmdl" then return nil end
          -- Never got changed before
          local toRemove = {}
          local wearable = hero:FirstMoveChild()
          while wearable ~= nil do
            if wearable:GetClassname() == "dota_item_wearable" then
              table.insert( toRemove, wearable )
            wearable = wearable:NextMovePeer()
          -- Remove wearables
          for k, v in pairs( toRemove ) do
            v:SetModel( "models/development/invisiblebox.vmdl" )
          -- Set model
          hero:SetModel( model_name )
          hero:SetOriginalModel( model_name )
          hero:MoveToPosition( hero:GetAbsOrigin() )
          return nil

    Now I will explain line by line of what each line does.

    Timers:CreateTimer( 0.05, function()

    This is not completely optimized method but I do think it's easiest to approach. When a unit is spawned into the game and npc_spawned event is fired, the model will not yet be rendered. Therefore, you need small delay before you can actually mess around with the model.

    local hero = EntIndexToHScript( keys.entindex )
    local model_name = ""

    EntIndexToHScript will transform entindex given from npc_spawned event into a handle script which in this case will be your hero so that you can mess around with the model.

    model_name variable is there to pass down the name of the model you need to change to. This variable is initialized as empty string.

    -- Check if npc is hero
    if not hero:IsHero() then return end

    This line is not a requirement but I do like to have a fail-check everywhere I can. Basically, your function should not go beyond this line if it is not a hero.

    -- Getting model name
    if model_lookup[ hero:GetName() ] ~= nil and hero:GetModelName() ~= model_lookup[ hero:GetName() ] then
      model_name = model_lookup[ hero:GetName() ]
      return nil

    This condition is very important. It basically checks if your hero is the correct one and the model hasn't been changed before. It will automatically look up from model_lookup table initialized previously.

    -- Check if it's correct format
    if hero:GetModelName() ~= "models/development/invisiblebox.vmdl" then return nil end

    This is again not a requirement just another fail-check. If the unit's model is not the invisible box, the function will stop here.

    -- Never got changed before
    local toRemove = {}
    local wearable = hero:FirstMoveChild()
    while wearable ~= nil do
      if wearable:GetClassname() == "dota_item_wearable" then
        table.insert( toRemove, wearable ) 
      wearable = wearable:NextMovePeer()

    This is a requirement. This will loop through all the items attached to the model starting from FirstMoveChild() and register each of them into the table called toRemove. Since we check if it's "dota_item_wearable", it will only register the children which is cosmetic only. We will eventually remove all these cosmetics out of model.

    -- Remove wearables
    for k, v in pairs( toRemove ) do
      v:SetModel( "models/development/invisiblebox.vmdl" )

    Now that we have toRemove setup previously, we will actually remove the cosmetics. You may wonder why do I have to set the model to invisiblebox.vmdl first. This is originally caused by bones, skeletons errors in the model when attaching cosmetic.

    What Source 2 engine does when it spawns a hero is that it will attach all the cosmetics automatically to your hero. Those cosmetics will have the same bone name as the original hero one. When you fail to attach that cosmetic to the bone, it will remain an error and stay there forever which is what we saw in the previous error.

    Why does this approach work then? Because if you use your model originally in npc_heroes_custom.txt file, the model you chose will be auto registered to those cosmetics and every time you try to swap the model, it will still be corrupted since it's already registered but never actually attached.

    With this approach, we let them register cosmetics to the "fault" model which is invisible. When swapping the cosmetic out with invisible box in this step, it will not cause bone error since they are the same model with same structure and every thing, therefore, they will be able to merge bones which will cause all the cosmetics to be invisiblebox instead, and then, you will be able to properly remove them from being error in your model (currently an invisiblebox).

    -- Set model
    hero:SetModel( model_name )
    hero:SetOriginalModel( model_name )

    Now that all cosmetics are removed, we have to change the model itself.

    Why do we need SetModel and SetOriginalModel all together? This is because the model will not be changed instantly without SetModel. Therefore, we force change the model instantly by using SetModel to our custom-made model. However, SetModel will not keep its model when your unit's state is changed such as you get stunned, etc. This is where SetOriginalModel comes into play. SetOriginal Model will tell the engine to keep your base model as the model specified so that whenever hero's state is changed, it will still remain that model until the end.

    hero:MoveToPosition( hero:GetAbsOrigin() )

    This is not completely necessary, however, it's somewhat visually required. When you forcefully swap your model with invisiblebox into the game, your model will show up as T-pose (the pose we see in the model editor). In order to forcefully dismiss this, we order the unit to move to its current location so the animation will transit into ACT_DOTA_IDLE one.

    Now that everything is explained and ready to go, head into the game and see the result similar to the following.


    Congratulation, now your hero is ready to use in your addon to your heart content!

  • edited January 2015 Posts: 96

    Step Ten Second Approach: Performance-based

    We have seen in the previous approach that the cosmetics on the model can get a little rough dealing with all the bones and what not in lua. In this approach, you don't have to worry too much about code at all. Basically, this approach will be "Brute Force". For those who don't know what it means, it basically breaks your way through the problem.

    Rough outline for this method would be that you replace all available cosmetics for your hero into invisiblebox, so that every cosmetics you don't want will become invisible, and the cosmetics that you may need to attach can be attach whenever possible.

    Note: If you did not read through the Step Ten First Approach Part one, I encourage to read it now here. Basically you will be editing all those same files except instead of "models/development/invisiblebox.vmdl" as your model, you will put "models/your_model_name.vmdl" such as "models/asuna/asuna.vmdl" instead.

    1. Start up GCFScape. This application will unpack the file directory for dota 2 and allow user to retrieve files in it.
    2. Click File > Open.
    3. Browse to the following path.

    ...\Steam\steamapps\common\dota 2 beta\dota_ugc\game\dota_imported

    4. Once you are in the directory, open the file called "pak01_dir.vpk".
    5. Upon loaded, you will see directory structure showing up. This directory contains most of the core components for dota 2 itself.
    6. In GCFScape, browse to models\development path.
    7. In there, you are going to see the following file.


    8. Extract all those files into any directory you want. This will serve as a core for your invisible cosmetics.
    9. Now that you have the files ready, you have to start replacing the models. In this example, I will replace tr_head for spectre.
    10. Go to Asset Browser in your addon and type "tr_head" in the Name Filter.
    11. You should see something similar to this.


    12. Now right click on the asset and select Asset Info.
    13. On the very top, you will see "Asset Relative Path" which is currently "models/items/spectre/tr_head/tr_head.vmdl".
    14. Now you know the relative path, you browse the normal explorer to the following path:

    ...\Steam\steamapps\common\dota 2 beta\dota_ugc\game\dota_addons\spell_lib_test\models

    15. When you are there, create all the same directory as you saw in the Asset Relative Path, in this, you should be in the following directory:


    16. Once you are in the directory, copy and paste all the invisiblebox files that we extracted earlier into the directory.
    17. Change all the name of the file from "invisiblebox" to "tr_head" which is stated in the last part of Asset Relative Path.
    18. Now you should have the following files in the directory.


    19. If you have Workshop Tool opened at the moment, restart the tool.
    20. After you open workshop tool again, type tr_head into Name Filter again. This time you should see empty helm like this.


    21. As you can see, the previous cosmetic is replaced by the invisiblebox such that your unit will get attached to invisible asset.
    22. Now you have to repeat step 10 to 21 for every assets that hero has, for example, spectre would have around 24 different cosmetics according to the GCFScape, therefore, you have to do the same steps over and over gain for 24 times.

    I haven't tried this method myself since I feel it's kinda insufficient to brute force it. For the in actual dota 2 client, you might need the decompiled invisiblebox.vmdl instead of the cache. Simply just do the same, create directory in the "content" path instead of "game" path and put renamed vmdl file there. If you cannot find it anywhere, it should be possible to grab it via CrowbarTool

    Personally, I prefer method one since it's just a little trade-off rather than having to focus your time into changing the name and stuffs. This concludes my tutorial. I hope you enjoy this tutorial and find it very useful. If you have any comment, question or improvement on this tutorial, feel free to contact me back.

  • Posts: 2

    where do you find mdx models like the asuna model your using

  • edited January 2015 Posts: 96

    @nerd, Ultimately, nothing beats google. Don't forget to credit any model you got it from.

  • edited January 2015 Posts: 2

    @kritth thanks, can i use this method to replace a hero in regular dota 2 games like the saber mod and ee's misaka storm spirit?

  • edited January 2015 Posts: 96

    As far as I know, I'm afraid you can't.

  • DunDun
    Posts: 123

    The method explained here is exclusively for Source 2 engine and you will require different approach for current Dota 2 client.

  • Posts: 184

    Thanks a lot for this guide! I'd love to start getting my hands wet with modeling sometime in the near future.

    By the way, for those who don't know 3DS Max is free for 3 years if you're a student:

    Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.

  • edited February 2015 Posts: 30

    ty for guide, but i have 1 question - is that possible to remove cosmetics from hero in exactly dota2? I make my own hero model for dota2 (like Saber and Misaka mod, ye), but now im trying to find correct way to turn cosmetic's visibility off (delete textures for all cosmetic items is stupid way, but now thats all what i can do)

  • edited February 2015 Posts: 96

    @SanyaBane As stated by Dun, this method is explicitly for Source 2 engine. It is possible to remove cosmetics from the actual Dota 2, however, it is not covered in this tutorial.

  • @krith ok, ty for fast respond. If u have some free time, plz make quick tutorial about my problem (quick - because i have some skills, i just need to know where i must edit "hero info"). Because im delete textures from all cosmetics for my character (stupid solution but thats all what i have now), but when im under invisible/smoke effect, items still visible.

  • Posts: 1,670

    I don't think we wan't to waste our time with source1 cosmetic replacement or -vpk_override modifications in this forum, but you could check Dota 2 No Hats try your luck in /r/Dota2Modding

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • Posts: 96

    @SanyaBane If there is a "quick" tutorial, then someone should probably already do it and many mods would be out there. However, it is NOT quick process when you want to actually put a "working" mod on actual dota 2 client, plus it's not only about Source 2 but a lot of modeling involved and I am not a modeler but a programmer. That's why, there are many request for mods, but only few actually are out there. And what Noya mentioned is also the same mindset I have.

  • edited June 2015 Posts: 30

    Well im not sure that i must write it here, but if someone get same problem as me - i mean searching a way to remove cosmetic items from hero, then u can use that program writed by me (all info inside):

    Sry for OffTopic.

  • edited February 2015 Posts: 96

    @SanyaBane I think you should start a new topic instead since it's related to Source 1 and this topic is for Source 2 engine.

  • Posts: 45

    are there any ways to do this with blender instead of 3dmax?

  • Posts: 96

    @Aerohand as long as blender has OBJ or FBX exporter, I don't see any reason why it shouldn't work when exporting from it.

  • Posts: 45

    @kritth i tried to import some MikuMikuDance models (which are the only source i could find anime models plenty and free) and transfer to fbx, then transfer to smd. but the texture on the models have so many bad black squares and the bones are organized in a weird way. i will try more methods to do this though.

  • Posts: 96

    u meant MMD file? if you said SMD, that means you are importing to source 1? This method is explicitly done for source 2 engine, pretty sure not viable with source 1 engine.

  • Posts: 5

    +commend kritth

    This guide is incredible.

  • DunDun
    Posts: 123

    Another note, have console open while porting model. There are occurences where animations/models would not port because of funky naming on bones(i.e space at the end, null). These errors are generally displayed on console output, so keep a watch.

    This is generally a good practice when you are playing with any assets, be it material or anything.

  • Posts: 1

    can anyone help me? my model is stuck in T-pose.