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.
  • 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 The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top