How to create a custom unit

Sim

Forum Administrator
Staff member
Reaction score
534
So you've read some tutorials on how to get started, the terrain editor was pretty straight-forward, everything is looking great... and yet, you are still left wondering, how do I create a custom unit?

Unfortunately, the Dota 2 Editor does not feature a user-friendly User Interface in order for us to modify the units. Also, the number of unit models available for editing is quite low, due to the nature of Dota 2 and its restricted number of units compared to Warcraft 3 and Starcraft 2, and their numerous, unique campaign units.

That being said, you can still create custom units, but it's done slightly outside of the editor.

If you followed this simple tutorial, which everyone should have by now, you should be in possession of your map, and its addon. With it, are several folders. You will need to find your addon's root directory. First locate your steam directory, and then navigate to:

Steam/SteamApps/common/dota 2 beta/dota_ugc/game/dota_addons/YOUR_ADDON_NAME/

This is your root directory, where YOUR_ADDON_NAME is, well, the name of your addon. Let's name our addon Zergling Madness, for fun. So, under Zergling_madness there should be a list of folders.

addon_directory.jpg

Within these folders are the custom content of your addon, or map. Units are located under scripts/npc/npc_units_custom.txt

Opening this file into your favorite text editor will bring up the dreaded Dota 2 Unit Editor! This is what it should look like:

DefaultCustomUnits.jpg

If you're wondering about the color, follow this link under "What you need".

Editing units is thus a data-driven process, where you list properties for the unit, and define its characteristics. Most of the challenge comes through finding the names of the characteristics you want, and to find proper paths for the various models/particles you want the unit to have.

Custom Unit Example

We're going to create a custom unit named "Guardian of Fire". Let's say we want it to have a fire feel and a small fire ability. Our guardian will be stationed next to an objective and should protect it, so it will be neutral unit.

Here is the code you should paste inside your npc_units_custom.txt file:

JASS:
//=================================================================================
    // Creature: Guardian of Fire
    //=================================================================================
    "npc_dota_creature_guardian_fire"
    {
        // General
        //----------------------------------------------------------------
        "Model"                        "models/items/warlock/golem/doom_of_ithogoaki/doom_of_ithogoaki.vmdl"    // Model.
        "BaseClass"                    "npc_dota_creature"
        "SoundSet"                    "Creep_Bad_Range"
        "GameSoundsFile"            "soundevents/game_sounds_creeps.vsndevts"
        "Level"                        "4"
        "ModelScale"                 "1.0"
        "CanBeDominated"            "0"

        // Abilities
        //----------------------------------------------------------------
        "Ability1"                    "forged_spirit_melting_strike"            // Ability 1
        "Ability2"                    ""            // Ability 2
        "Ability3"                    ""            // Ability 3
        "Ability4"                    ""            // Ability 4

        // Armor
        //----------------------------------------------------------------
        "ArmorPhysical"                "5"            // Physical protection.
        "MagicalResistance"            "25"        // Percentage

        // Attack
        //----------------------------------------------------------------
        "AttackCapabilities"        "DOTA_UNIT_CAP_RANGED_ATTACK"
        "AttackDamageMin"            "55"        // Damage range min.
        "AttackDamageMax"            "100"        // Damage range max.
        "AttackRate"                "1.5"        // Speed of attack.
        "AttackAnimationPoint"        "0.4"        // Normalized time in animation cycle to attack.
        "AttackAcquisitionRange"    "800"        // Range within a target can be acquired.
        "AttackRange"                "600"        // Range within a target can be attacked.
        "ProjectileModel"            "particles/units/heroes/hero_invoker/invoker_forged_spirit_projectile.vpcf" // Particle system model for projectile.
        "ProjectileSpeed"            "1100"        // Speed of projectile.       

        // Bounds
        //----------------------------------------------------------------
        "BoundsHullName"            "DOTA_HULL_SIZE_HERO"            // Hull type used for navigation/locomotion.
        "RingRadius"                "80"
        "HealthBarOffset"            "200"

        // Bounty
        //----------------------------------------------------------------
        "BountyXP"                    "500"        // Experience earn.
        "BountyGoldMin"                "150"        // Gold earned min.
        "BountyGoldMax"                "300"        // Gold earned max.       

        // Status
        //----------------------------------------------------------------
        "StatusHealth"                "2500"        // Base health.
        "StatusHealthRegen"            "3"        // Health regeneration rate.
        "StatusMana"                "200"            // Base mana.
        "StatusManaRegen"            "30.0"        // Mana regeneration rate.     
   
        // Vision
        //----------------------------------------------------------------
        "VisionDaytimeRange"        "1800"        // Range of vision during day light.
        "VisionNighttimeRange"        "800"        // Range of vision at night time.

        // Team
        //----------------------------------------------------------------
        "TeamName"                    "DOTA_TEAM_NEUTRALS"                        // Team name.
        "CombatClassAttack"            "DOTA_COMBAT_CLASS_ATTACK_BASIC"
        "CombatClassDefend"            "DOTA_COMBAT_CLASS_DEFEND_BASIC"
        "UnitRelationshipClass"        "DOTA_NPC_UNIT_RELATIONSHIP_TYPE_DEFAULT"

        // Inventory
        //----------------------------------------------------------------
        "HasInventory"                "0"

        // Movement
        //----------------------------------------------------------------
        "MovementCapabilities"        "DOTA_UNIT_CAP_MOVE_GROUND"
        "MovementSpeed"                "300"        // Speed.

        // Creature Data
        //----------------------------------------------------------------
        "Creature"
        {
            "CanRespawn"                "1"
            "DefaultState"                "Invade"
            "States"
            {
                "Invade"
                {
                    "Name"                "Invade"
                    "Aggression"        "100.0"
                    "Avoidance"            "0.0"
                    "Support"            "0.0"
                }
            }
        }
    }

Let's explain the important lines, shall we, and what we can do with them?

First of all, "npc_dota_creature_guardian_fire" is the in-editor name of your unit. It's the reference to it. Make it an obvious name.

"Model" is the model of the unit. Here, I chose a special warlock golem model. What's really important about this line is that you need to have the full path. One way to find it is to open the asset browser, which is always opened with the editor, and type in at the top "golem". You will see a list of models and particles. Click on the model ending with "doom_of_ithogoaki". It should show up, animated, to the right. In the bottom right corner of the screen, there should be a line named "Asset relative path". That's where you find your model's path. Select it, copy it, and paste it in your code. There you go!

"BaseClass" is what the unit actually is. npc_dota_hero is, well, a hero. Among other choices are npc_dota_tower, a building which can attack. npc_dota_building, a building which can't attack, and many more. Our choice here is npc_dota_creature, a unit which isn't a hero. There are lots of different kinds of base classes.

The next lines are pretty straightforward, until the abilities. A non-hero unit can have hero abilities, but they will always be maxed out in levels. So, a 4-levels ability will always be level 4 on a non-hero unit. You can also give units normal abilities, which is what we did here. Be careful to give the unit the correct name of the ability.

"AttackCapabilities" 3 choices here.
  • DOTA_UNIT_CAP_MELEE_ATTACK
  • DOTA_UNIT_CAP_RANGED_ATTACK
  • DOTA_UNIT_CAP_NO_ATTACK
"AttackRate" can be as low as 0.01 for a very, very fast attack. The rest of the options are balance details, set whatever you want. Testing is the key here.

"ProjectileModel" this is like the model above. You find it in the asset browser, and it is very important to put the correct path of the particle, or else nothing will show up (which is annoying). See "Model" above for more information.

Hull size isn't very important, it's aesthetic, what matters is that the health bar can be offset compared to the unit's model size. Generally useless.

Give it the bounty you want, health you want, these are balance matters.

"TeamName" There are 4 teams in dota currently:
  • DOTA_TEAM_BADGUYS
  • DOTA_TEAM_GOODGUYS
  • DOTA_TEAM_NEUTRALS
  • DOTA_TEAM_NOTEAM
"CombatClass" refers to the attack and defense property of the unit. Heroes have the best attack and defense, while others have more reduction to their outgoing damage. Test it for whatever purpose you may have for your unit.

The deal at the end is the tricky part. The "States". Units will cast their spells, or not, depending on those states. This unit, for example, will always cast its most aggressive spell, due to its 100% aggression stance. You can toy with those settings and see what does what, but I'm not entirely sure still if those are based on % of HP or pure probabilities. Anyhow, higher "Support" value tends to cast defensive spells, while higher "Aggression" value means more offensive spells.
 
Last edited:
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top