This document covers every keyvalue of the npc_units_custom file
- Boolean Values and Flags
- Selection Properties
- Health and Mana
- Armor and Attack Types
- Lua VScript AI
- Creature Block
Most unit names start with "npc_" but this isn't necessary. A basic unit definition looks like this:
The definition of the default dota units can be found in npc_units.txt
There are a lot of classes for units, the complete list can be found in here, but as we don't have much control over their properties, only a few are really useful for custom units in general:
The most useful baseclass, it doesn't have any critical hardcoded property so it's the go-to unit type for most units. It also allows the usage of the "Creature" block, which will is reviewed in the next section. It's linked to the
"DOTA_UNIT_TARGET_BASIC"target type in abilities.
There is however one simple property imposed to this unit type, which for the most part it's useful but it's good to keep in mind, and it's that abilities are automatically skilled up to the MaxLevel if possible (limited by the Level*2 of the creature, meaning a Level 1 creature will autolearn its abilities upto the 2nd rank). This can be of course modified through Lua
SetLevelon each ability.
"DOTA_UNIT_TARGET_BUILDING", this baseclass can prove useful in many situations.
It has the following properties imposed to it, which we have no control over them:
- Invulnerable by default. Very annoying, it can be removed through Lua with
- Visible through fog. This is troublesome, and forces any game that wants to have building strategies to use npc_dota_creature and define custom building damage, with some other downsides.
- No visual turning, even if internally the unit is actually changing its forward vector. Usually a good thing, the creature equivalent behavior for this is the stunned state.
Worth mentioning `npc_dota_tower` is a subclass of building, and is coded to trigger stuff like the announcers, team gold sharing and aggro AI. Use npc_dota_building with attack to make towers that aren't forced to use those mechanics.
- Invulnerable by default. Very annoying, it can be removed through Lua with
For dummy units. More on this later
For the rest of this guide, we'll be assuming a `"BaseClass" "npc_dota_creature"`
This level can be accessed and modified with Lua though various creature functions.
Self explanatory, get the models through the asset browser and set its size (it will use "1" by omission).
Creatures using models that are broken down for cosmetic equipment will be 'naked' unless we attach them wearables. More on this later.
This can be any name, its only useful purpose is to use with Lua
GetUnitLabel() which can work as an easy method of tagging units.
Associated Lua functions:
SetHasInventory(true) won't work on units that didn't have
"HasInventory" "1" previously defined.
Self explanatory, the default values are 0 for summoned (so the lua IsSummoned will always return false unless you set this), and 1 for dominated creaturesl
``` "ConsideredHero" "1" ```
"DOTA_UNIT_TARGET_FLAG_NOT_CREEP_HERO" datadriven flag. Gives the unit a hero styled health bar:
``` "IsAncient" "1" ``` Associated Lua function: `IsAncient()`
`"DOTA_UNIT_TARGET_FLAG_NOT_ANCIENTS"` datadriven flag.
``` "IsNeutralUnitType" "1" ```
Associated Lua function:
``` "CanBeDominated" "0" ```
Helm of the Dominator specific. No associated Lua function, but it's easy to make one to read from this value if you wish.
``` "AutoAttacksByDefault" "0" ```
Ignores Auto Attack Behavior setting, forces to not autoattack. Used on Visage Familiars.
``` "ShouldDoFlyHeightVisual" "0" ```
Seems broken, no noticeable difference.
``` "WakesNeutrals" "1" ```
Unit won't aggro units on the Neutral team within their acquisition range.
- SelectionGroup will make it so that all the units of this type are in a group which can be accessed through tab.
I pressed tab once and all these units got selected after defining them in the same control group
SelectOnSpawn forces the unit into the selection of the hero, even if the "Auto Select Summoned Units" setting is turned off. It's used on Visage Familiars.
IgnoreAddSummonedToSelection if set to 1, makes the "Auto Select Summoned Units" ignore this unit when it spawns. It's used on Brewmaster Primal Split units.
SoundSet with the correct GameSoundsFile associated takes care of sounds like attacks and walking footsteps. The SoundSet string should be the first part of each of the hero sounds, which can be easily seen through the Dota 2 Sound Editor. Example
IdleSoundLoop will be played constantly after the unit spawns. Some heroes don't have a loop sound defined, but as in the example above it's possible to use this as an Spawn sound for the unit if you add the string of a non-loopable sound.
The unit can hold up to 16 abilities at any time being.
"AbilityLayout" is used for the built-in Flash UI to change how many abilities it can display, and currently its limited to 4, 5 and 6 (anything else will malfunction)
Because of :valve: - reasons , unit stats aren't hover-able, but they are there.
List of Attack Capabilities:
Find hero/unit attack particles with the asset browser, filtering for the hero name + "attack vpcf"
If you have any "Melee to Ranged" mechanic, the unit definition should have a projectile speed, else it will default to 0, effectively making them never reach its target.
This is seen in every unit file, but worthless/unsupported. In the future, we could see it being used to easily define Air/Ground attacks, Magic Attacks, etc, which currently require scripted abilities to simulate those behaviors.
Attributes are ignored for anything that isn't a hero unit, but because anything used to define units can also be used for npc_heroes_custom, these are the keyvalues, all self explanatory:
If you want to make any complex rule for XP/Gold, for example, give less XP from this unit to heroes at a certain level, it's better to leave the values at 0 and grant it through lua.
This defines the unit collision with other units.
Bound Size Reference:
|Value||Radius in Hammer units|
SetHullRadius(float)can change this to any value in between or even above 144.
The visible selection ring when the unit is selected
The height from the ground at which the Health Bar should be placed. By default this value is set to "-1" to use the models default height. The bigger the Model and ModelScale, this should be adjusted to a higher number so it doesn't look weird.
List of Movement Capabilities
Plays alternate idle/run animation when near enemies, e.g. Abaddon model
Distance to keep when following. Healing Ward/Sigil have it set at 250.
- Negative Health/Mana Regen doesn't work.
- Setting StatusMana on 0 will make it not have a mana bar.
- There is currently no way of Setting MAX Mana in Lua! Unit mana pool modification has to be done with the Creature block and Levels.
-1 means default to full mana, which is the default. It can be changed to any integer value so the units don't spawn with a filled pool.
The Table of Physical Attacks vs Armor Types can be found here in this link to the dota wiki
Vision on any unit can't exceed 1800, any value above that will just default to 1800.
## Unit Relationship Class
This doesn't seem to make any difference, might be deprecated or just used for tagging stuff internally.
This will load a lua script file as soon as the unit is spawned. With a Spawn ( entityKeyValues ) function one can initiate a thinker to do any sort of logic, this is a very simple example for a unit that goes through a series of waypoints while casting spells anytime its possible: ai_tank_miniboss.lua.
When you add a creep to the map and set it to the neutral team, the default is to turn it to a neutral. If you wan't to use a custom behavior, turn it off:
The creature block allows for a variety of features to be applied from KV like basic AI, stat bonuses based on creature level, and wearables. All these settings can and should be put inside one creature block, but they will be separated by category in this guide
See this guide for more info.
I highly recommend using Lua for AI instead, but will leave some information here anyway.