d2moddin documentation - read the docsd2moddin documentation, release 1.0 2.1.6creating a minimap...
TRANSCRIPT
D2Moddin DocumentationRelease 1.0
Christian Stewart
August 10, 2014
Contents
1 SDK Setup 31.1 SDK Setup Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 Creating an Addon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Mapping 72.1 Mapping with Hammer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 Game Logic 113.1 LUA Scripting Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.2 Dota 2 Lua API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 Integration with D2Moddin 157
5 Chat with Us 159
i
ii
D2Moddin Documentation, Release 1.0
D2Moddin is a platform to easily play Dota 2 custom game modes. It is also a base for the Dota 2 modding community,with the D2Moddin forums and the developer documentation you are reading right now.
Contents 1
D2Moddin Documentation, Release 1.0
2 Contents
CHAPTER 1
SDK Setup
Dota 2 game modes are built using the addon framework used to build the official Frostivus and New Bloom events.Addons are essentially overlays on the game directory - any content in an addon will override the default content.Game code is written in lua and operates server-side only. Custom assets (models, sounds, and UI) can be added tothe client and used in maps.
As there is currently no officially released toolchain, including map and particle editors, the Alien Swarm SDK andpipeline is used to create maps and assets.
See the below documentation pages to get started:
1.1 SDK Setup Tutorial
This page is based on the Dota 2 wiki.
Install the Alien Swarm SDK. In Steam, go to the Library section, and under Tools, download the Alien Swarm SDK.You can also click this shortcut link.
1.1.1 Extract Dota’s Files
Dota 2’s content files are distributed in compressed VPK form. You can extract them using GCFScape to later modifythem in your game mode. You may need to use the x86 version, which works fine on 64 bit systems.
The primary Dota 2 package is the pak01_dir.vpk file under the base dota game directory. Open the pak inGCFScape, right click the root element, and extract the files to Alien Swarm\swarm\addons so they may beused in the Alien Swarm editors.
Rename the directory you have just created in the Alien Swarm addons to Dota2Extract.
1.1.2 Misc. Files
Copy the bin and platform directories into the Dota2Extract directory.
Finally, download dota2fgd (by RoyAwesome on GitHub) and UpVersion.exe (by ModDota) to the bin directory withinDota2Extract.
3
D2Moddin Documentation, Release 1.0
1.1.3 Alien Swarm Search Paths
Replace the contents of Alien Swarm\swarm\gameinfo.txt with:
"GameInfo"{
"game" "Alien Swarm""title" " " // asw - leave this blank as we have a texture logo"type" "multiplayer_only"GameData "swarm.fgd"InstancePath "tilegen/instances/"
SupportsDX8 0
"FileSystem"{
"SteamAppId" "630""ToolsAppId" "211"
"SearchPaths"{
"Game" "|gameinfo_path|.""Game" "swarm_base""Game" "platform""Game" "|gameinfo_path|addons\Dota2Extract"
}}
}
1.1.4 Configuring Hammer
Start the Alien Swarm SDK, select Hammer World Editor and let it open up. Now go to “Tools” -> “Options” and addthe “dota2.fgd” from Alien Swarm\Swarm\addons\Dota2Extract\bin\dota2.fgd.
Next, increase the render distance so that the entire map will be visible at any given time. Under “3D Views” increasethe Model Render Distance and Detail Render Distance.
1.1.5 Creating a Test Map
Under File, create a new map. Save it as test.vmf. Next, select File->Run Map and press “Expert” in the bottomleft corner:
Click “Edit” and create a new config for Dota 2. We will define the build process as a series of commands.
The BSP Command
Click “New”, then “Cmds” and “BSP Program”. Add -alldetail -game $gamedir $path\$file.
UpVersion
Upversion is a tool that will convert the BSP into a format suitable for Dota 2.
Click “new” then “cmds”. Select “Executable” and find “UpVersion.exe” in AlienSwarm\swarm\addons\Dota2Extract\bin. If it’s not there, return t the Misc Files step and download it.
4 Chapter 1. SDK Setup
D2Moddin Documentation, Release 1.0
Add the parameters $path\$file.bsp $path\$file.$ext $path\$file.pbm.
Copy Map
Finally, to use the map in Dota 2 we will copy the compiled .bsp to the Dota 2 maps directory.
Click “new” then “cmds”. Select “Executable” and specify: CgWindows\System32\xcopy.exe,the built in Windows copy tool. Add the parameters: $path\$file.bsp "C:\Program Files(x86)\Steam\SteamApps\common\dota 2 beta\dota\maps" /y. Make sure the path is the correctpath to your Dota 2 maps directory.‘
1.1.6 Next Steps
You now have the Alien Swarm SDK set up properly to start working on Dota 2 game modes. You can follow themapping tutorial in the next section.
1.2 Creating an Addon
“Addon” and “Game Mode” are used interchangeably throughout this documentation.
1.2.1 Addon Bootstrapper
The D2Moddin addon bootstrapper will ask you some simple questions about your game mode and build the files foryour mode based on your answers. In the future it will also be able to create additional files for you for NPCs, units,particles, maps, etc.
To use the bootstrapper, you will need Node.JS. Download and install it.
First, download the latest version of the bootstrapper. You can use git clone --recursivehttps://github.com/D2Modding/d2tool.git or just download from here.
If you downloaded from the link you need to also download barebones and put it into the barebones directory ind2tool. Otherwise you will see an error saying info.json is missing.
Use the cd command to move into the d2tool directory.
Install the dependencies with NPM, run npm install in the d2tool directory.
Next, run the bootstrapper with Node.JS. node d2tool.js. In the future there will be a compiled exe for this aswell.
Answer the questions:
The result will be the following directory structure (in this example, a mode called “teamfight”):
-- addoninfo.txt - Version & name information.-- info.json - D2Moddin metadata-- maps - Maps| -- teamfight.bsp - Compiled map| -- teamfight.gnv - Compiled gridnav-- materials - Any engine materials| -- overviews - Minimaps (named Overviews)| -- teamfight.vmt| -- teamfight.vtf-- particles - Custom particles
1.2. Creating an Addon 5
D2Moddin Documentation, Release 1.0
| -- frostivus_gameplay.pcf| -- frostivus_herofx.pcf| -- test_particle.pcf-- PhysicsReadme.txt - Readme of the physics system-- resource - Translations & flash resources| -- addon_english.txt| -- flash3| | -- images| | -- items| | | -- example_item.png| | -- spellicons| | -- holdout_battle_rage.png| | -- holdout_blade_fury.png| | -- holdout_culling_blade.png| | -- holdout_fiery_soul.png| | -- holdout_focusfire.png| | -- holdout_friendly_skewer.png| | -- holdout_glacier_arrows.png| | -- holdout_gods_strength.png| | -- holdout_guardian_angel.png| | -- holdout_multishot.png| | -- holdout_omnislash.png| | -- holdout_scourge_ward.png| | -- holdout_voodoo.png| | -- templar_assassin_refraction_holdout.png| -- overviews - Define any custom overviews| -- teamfight.txt-- scripts - Scripts and other game mode data.| -- custom_events.txt| -- game_sounds_custom.txt| -- maps| | -- barebones.txt| -- npc - KV files for heros, items, units| | -- herolist.txt| | -- npc_abilities_custom.txt| | -- npc_abilities_override.txt| | -- npc_heroes_custom.txt| | -- npc_items_custom.txt| | -- npc_units_custom.txt| -- shops - Shop data| | -- barebones_shops.txt| -- vscripts - Server-side scripts (can be excluded in the client)| | -- addon_game_mode.lua| | -- addon_init.lua| | -- physics.lua| | -- teamfight.lua| | -- util.lua| -- world_map_custom.txt-- sound - Custom sounds
-- mini_rosh_firebreath.wav
6 Chapter 1. SDK Setup
CHAPTER 2
Mapping
Mapping is done in the old Source Engine map editor, Hammer.
See the below documentation pages to get started:
2.1 Mapping with Hammer
Maps are created with Hammer for Dota 2, an old Source Engine map creation tool used for Portal 2, Half Life, andother valve games.
Make sure you’ve completed the getting started tutorial first.
2.1.1 General Mapping Notes
• Maps are a much larger scale in Dota 2 than they are in other Source games. Units are around 48 units wide,towers are 128x128x320 units tall.
• If an entity is outside the bounds of the map, it crashes the game with no error.
• AlienSwarm converts all brushwork into func_detail, so you need to seal the map with a func_brush namedstructure_seal. The brush should be textured nodraw.
• Required entities include: info_player_start_goodguys, info_player_start_badguys, ent_dota_game_events,env_global_light.
• Models require a shader that is not provided in Hammer. In your extracted gamedata, open every .vmt file andreplace “GlobalLitSimple” with “VertexLitGeneric”. A tool such as Notepad++ can do this quickly.
• The func_brush named “structure_seal” should be nodraw (no skybox required).
2.1.2 Overlay Limit
You cannot decompile and re-compile the dota.bsp map as it has too many overlays. The overlay limit was raised to8192 from 512 for Dota 2, but the compiler toolchain still works under the 512 limit.
2.1.3 Fog of War Calculation
Units can climb to virtually any height within the map, but there are only five Fog or War heights defined in the Dota2 engine. They are:
7
D2Moddin Documentation, Release 1.0
• 0-128: River
• 128-256: Midlane
• 256-384: Highground base
• 384-512: Ward spots
• 512-∞: Edge of the map.
The camera will stay in place above 512 units in the Z axis.
2.1.4 Building the NavGrid
Units in Dota 2 do not navigate based on the structure of the map, rather, they move on a 2D grid known as thenavmesh. Every square in the navgrid has two states: pathable, and not pathable. If a square is not pathable, the unitwill not walk there and cannot blink/force staff to that location. It is possible to cross unpathable areas with blinks orforce movements.
Install the GNVTool
The GNVtool (by Penguinwizzard) converts netpbm formats to the binary GridNav format. It can do two way conver-sion between PBM files, which are editable in photo editing software to manually touch up the grid.
• Download GNVTool
• List of NetPBM Software
• Paint.Net PBM Plugin
Netpbms are 1 bit bitmaps. The bitmap size must be the world size / 64. The bitmap must have dimensions divisibleby 8 or it will be sheared.
Usage: code::GNVtool.exe tognv source.pbm target.gnv offsetx offsety.
Offset x/Offset y are always negative and 1/2 the dimensions of the bitmap.
You can view your navmesh in game with code::dota_gridnav_show 1.
2.1.5 Creating a NETPBM
First, open up a Hammer map.
The first two arguments you need are the dimensions of the map. This will be a rectangle aligned with the Hammergrid.
In this image it is 4096x4096:
Next, you need the offset of the map from the origin. Get the top left point of the map (in this image, -2048, 2048).
Using these values, you can create the netpbm. Divide the dimensions by 64 to get the size of the pbm file you need tomake (here 64x64). Use the offset (with the y-axis-component negated, because gnv files are upside-down) to calculatethe last 2 arguments to GNVTool, and you should get a gnv file that works for your map!
8 Chapter 2. Mapping
D2Moddin Documentation, Release 1.0
2.1.6 Creating a Minimap
The VTFEdit tool is used to convert an image into a .vtf minimap file.
While Valve paints their minimaps manually, it is generally sufficient to take a top-down screenshot of the map.
Open VTFEdit, select Import, find your image, and save it as MAPNAME.vtf. Under tools, select “Create VMT”.In the Options tab, for shader, select UnlitGeneric and check the boxes ‘Translucent’ and ‘Vertex Alpha’. Save it asMAPNAME.vmt.
Put both of these files in a folder named materials/overviews in your addon directory.
Next, create a new textfile named MAPNAME.txt. This is a Key-Value file denoting where the bounds of the minimaplie. The structure is as follows:
MAPNAME{material "overviews/MAPNAME" //Note no file extension
//Coordinates to the upper left corner of your mappos_y 2560pos_x -2560scale 5.000 //Minimap scale.rotate 0 //Minimap rotation. This should always be 0.zoom 1.0000 //Minimap zoom. This should always be 1 unless your texture is larger than the playable bounds of your map.
}
Put this file in your code::addon/resource/overviews directory.
2.1. Mapping with Hammer 9
D2Moddin Documentation, Release 1.0
10 Chapter 2. Mapping
CHAPTER 3
Game Logic
Game logic is written in LUA.
See the below documentation pages to get started:
3.1 LUA Scripting Guide
This is a short documentation on the various parts of LUA scripting in Dota 2. You can refer to the API documentationfor specific functions/game events etc.
3.1.1 Addon Initialization
When the server starts up and loads your game mode, it will first execute addon_init.lua. In the bootstrappedaddon, addon_init.lua will require util, physics, and finally your game mode lua file at the end of the script.
Next, when the server is ready to create your game mode instance, it will execute addon_game_mode.lua, which,in the bootstrapper, will simply call InitGameMode() on your game mode defined in gamemode.lua.
3.1.2 Lua Scope
Any variables defined in the root of the script, without the local tag, will be considered global and accessibleanywhere in any lua file loaded into the Dota 2 Lua VM.
You will generally want to use the local tag before variables so you don’t pollute the global scope.
3.1.3 Game Mode Class
Game modes are Lua objects/tables, defined as such:
TeamFightGameMode = {}TeamFightGameMode.szEntityGameMode = "gamemode"TeamFightGameMode.szNativeClassName = "dota_base_game_mode"TeamFightGameMode.__index = TeamFightGameMode
This definition block occurs in gamemode.lua, which will be named according to your mod’s name.
Next, the functions that the mode requires are defined on the game mode table/object, for example:
11
D2Moddin Documentation, Release 1.0
function TeamFightGameMode:InitGameMode()...
end
3.1.4 Registering Hooks
Most of the logic in the lua game mode code revolves around hooking into the game’s standard events.
For example, to perform some logic when a player says something, register the hook in the game mode init:
ListenToGameEvent(’player_say’, Dynamic_Wrap(TeamFightGameMode, ’PlayerSay’), self)
Here, we ask the Lua engine to call TeamFightGameMode:PlayerSay(keys) when the player_say gameevent is fired.
Next, define your implementation:
function TeamFightGameMode:PlayerSay(keys)local ply = self.vUserIds[keys.userid]Log(keys.text)
end
In this case, keys is a table/object with relevant data to the say event, such as the text of the message.
You can view the full API in the API docs sections.
3.1.5 Timers
To put off execution of some code into some seconds in the future, you can register a timer with a unique ID generatedby DoUniqueString:
TeamFightGameMode:CreateTimer(DoUniqueString("dothislater"), {endTime = GameRules:GetGameTime() + 3,useGameTime = true,callback = function(teamfight, args)Log("Three... seconds... later...")
end})
Here, you pass in the ID of the timer (a unique string starting with dothislater, which can be any unique string)and an object with options. In this case, the callback will be called when the game time is greater than endTime,which is set to the current game time plus three seconds. Game time or server time can be used, where server timebased timers will tick even while the game is paused.
3.2 Dota 2 Lua API
{{Note | This page is automatically generated. Any changes may be overwritten}}
===’‘’Accessing the DOTA 2 Scripting API from Lua===
While Lua is [http://en.wikipedia.org/wiki/Dynamically_typed dynamically typed], the DOTA 2 engine is writtenprimarily in C++, which is [http://en.wikipedia.org/wiki/Type_system#Static_type-checking statically typed]. Thus,you’ll need to be conscious of your data types when calling the API. (If you try to pass the wrong type to an APIfunction, you’ll get an error message in Vconsole telling you what you passed and what it was expecting.)
12 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
3.2.1 Global
Global functions. These can be called without any class
• AngleDiff(float ang1, float ang2)
• AppendToLogFile(string a, string b)
• ApplyDamage(handle DamageTable)
• AxisAngleToQuaternion(Vector a, float b)
• CancelEntityIOEvents(ehandle a)
• CreateEffect(handle a)
• CreateHeroForPlayer(string a, handle b)
• CreateItem(string item_name, handle owner, handle owner)
• CreateItemOnPositionSync(Vector a, handle b)
• CreateTrigger(Vector a, Vector b, Vector c)
• CreateTriggerRadiusApproximate(Vector a, float b)
• CreateUnitByName(string a, Vector b, bool c, handle d, handle e, int f)
• CreateUnitByNameAsync(string a, Vector b, bool c, handle d, handle e, int f, handle g)
• cvar_getf(string a)
• cvar_setf(string a, float b)
• DebugBreak()
• DebugDrawBox(Vector a, Vector b, Vector c, int d, int e, int f, int g, float h)
• DebugDrawBoxDirection(Vector a, Vector b, Vector c, Vector d, Vector e, float f, float g)
• DebugDrawCircle(Vector a, Vector b, float c, float d, bool e, float f)
• DebugDrawClear()
• DebugDrawLine(Vector a, Vector b, int c, int d, int e, bool f, float g)
• DebugDrawLine_vCol(Vector a, Vector b, Vector c, bool d, float e)
• DebugDrawScreenTextLine(float a, float b, int c, string d, int e, int f, int g, int h, float i)
• DebugDrawSphere(Vector a, Vector b, float c, float d, bool e, float f)
• DebugDrawText(Vector a, string b, bool c, float d)
• DebugScreenTextPretty(float a, float b, int c, string d, int e, int f, int g, int h, float i, string j, int k, bool l)
• DoEntFire(string a, string b, string c, float d, handle e, handle f)
• DoEntFireByInstanceHandle(handle a, string b, string c, float d, handle e, handle f)
• DoIncludeScript(string a, handle b)
• DoScriptAssert(bool a, string b)
• DoUniqueString(string a)
• EmitGlobalSound(string a)
• EmitSoundOn(string a, handle b)
• EmitSoundOnClient(string a, handle b)
3.2. Dota 2 Lua API 13
D2Moddin Documentation, Release 1.0
• EntIndexToHScript(int a)
• ExecuteOrderFromTable(handle a)
• ExponentialDecay(float a, float b, float c)
• FileToString(string a)
• FindClearSpaceForUnit(handle a, Vector b, bool c)
• FindUnitsInRadius(int a, Vector b, handle c, float d, int e, int f, int g, int h, bool i)
• FireEntityIOInputNameOnly(ehandle a, string b)
• FireEntityIOInputString(ehandle a, string b, string c)
• FireEntityIOInputVec(ehandle a, string b, Vector c)
• FireGameEvent(string eventName, handle parameterTable)
• FireGameEventLocal(string a, handle b)
• FrameTime()
• GetFrameCount()
• GetFrostyBoostAmount(int a, int b)
• GetFrostyPointsForRound(int a, int b, int c)
• GetGoldFrostyBoostAmount(int a, int b)
• GetGoldFrostyPointsForRound(int a, int b, int c)
• GetGroundPosition(Vector a, handle b)
• GetListenServerHost()
• GetMapName()
• GetMaxOutputDelay(ehandle a, string b)
• GetPhysAngularVelocity(handle a)
• GetPhysVelocity(handle a)
• GetSystemDate()
• GetSystemTime()
• GetWorldMaxX()
• GetWorldMaxY()
• GetWorldMinX()
• GetWorldMinY()
• InitLogFile(string a, string b)
• IsDedicatedServer()
• IsMarkedForDeletion(handle a)
• IsValidEntity(handle a)
• ListenToGameEvent(string EventName, handle functionNameToCall, handle context)
• LoadKeyValues(string a)
• LoadKeyValuesFromString(string a)
14 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• MakeStringToken(string a)
• Msg(string a)
• PauseGame(bool a)
• PlayerInstanceFromIndex(int a)
• PrecacheEntityFromTable(string a, handle b, handle c)
• PrecacheEntityListFromTable(handle a, handle b)
• PrecacheItemByNameAsync(string a, handle b)
• PrecacheItemByNameSync(string a, handle b)
• PrecacheModel(string a, handle b)
• PrecacheResource(string a, string b, handle c)
• PrecacheUnitByNameAsync(string a, handle b)
• PrecacheUnitByNameSync(string a, handle b)
• PrintLinkedConsoleMessage(string a, string b)
• RandomFloat(float a, float b)
• RandomInt(int a, int b)
• RandomVector(float a)
• RegisterSpawnGroupFilterProxy(string a)
• ReloadMOTD()
• RemoveSpawnGroupFilterProxy(string a)
• RollPercentage(int a)
• RotateOrientation(QAngle a, QAngle b)
• RotatePosition(Vector a, QAngle b, Vector c)
• RotateQuaternionByAxisAngle(Quaternion a, Vector b, float c)
• RotationDelta(QAngle a, QAngle b)
• rr_AddDecisionRule(handle a)
• rr_CommitAIResponse(handle a, handle b)
• rr_GetResponseTargets()
• rr_QueryBestResponse(handle a, handle b, handle c)
• Say(handle entity, string message, bool teamOnly)
• ScreenShake(Vector a, float b, float c, float d, float e, int f, bool g)
• SendFrostivusTimeElapsedToGC()
• SendFrostyPointsMessageToGC(handle a)
• SendToConsole(string a)
• SendToServerConsole(string a)
• SetOpvarFloatAll(string a, string b, string c, float d)
• SetOpvarFloatPlayer(string a, string b, string c, float d, handle e)
3.2. Dota 2 Lua API 15
D2Moddin Documentation, Release 1.0
• SetQuestName(string a)
• SetQuestPhase(int a)
• SetRenderingEnabled(ehandle a, bool b)
• ShowGenericPopup(string title, string content, string unknown, string unknown, int containerType)
• ShowGenericPopupToPlayer(handle a, string b, string c, string d, string e, int f)
• ShowMessage(string a)
• SpawnEntityFromTableSynchronous(string a, handle b)
• SpawnEntityGroupFromTable(handle groupSpawnTables, bool bAsync, handle hCallback)
• SpawnEntityListFromTableAsynchronous(handle a, handle b)
• SpawnEntityListFromTableSynchronous(handle a)
• SplineQuaternions(Quaternion a, Quaternion b, float c)
• SplineVectors(Vector a, Vector b, float c)
• StartSoundEvent(string a, handle b)
• StopEffect(handle a, string b)
• StopListeningToAllGameEvents(handle a)
• StopListeningToGameEvent(int a)
• StopSoundEvent(string a, handle b)
• StopSoundOn(string soundName, handle playingEntity)
• StringToFile(string a, string b)
• Time()
• TraceCollideable(handle a)
• TraceHull(handle a)
• TraceLine(handle a)
• UnloadSpawnGroup(string a)
• UnloadSpawnGroupByHandle(int a)
• UpdateEventPoints(handle a)
• UTIL_Remove(handle a)
• UTIL_RemoveImmediate(handle a)
• VectorToAngles(Vector a)
• Warning(string a)
3.2.2 CBaseEntity
The base class for stuff
• ApplyAbsVelocityImpulse(Vector a)
• ApplyLocalAngularVelocityImpulse(Vector a)
• EmitSound(string soundName)
16 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• EmitSoundParams(string soundName, int pitch, float volume, float soundTime)
• EyeAngles()
• EyePosition()
• FirstMoveChild()
• GatherCriteria(handle a)
• GetAbsOrigin()
• GetAngles()
• GetAnglesAsVector()
• GetAngularVelocity()
• GetBaseVelocity()
• GetBoundingMaxs()
• GetBoundingMins()
• GetBounds()
• GetCenter()
• GetChildren()
• GetContext(string a)
• GetForwardVector()
• GetHealth()
• GetLocalAngularVelocity()
• GetLocalVelocity()
• GetMaxHealth()
• GetModelName()
• GetMoveParent()
• GetOrigin()
• GetOwner()
• GetOwnerEntity()
• GetRightVector()
• GetRootMoveParent()
• GetSoundDuration(string soundName, string actormodelname)
• GetTeam()
• GetUpVector()
• GetVelocity()
• IsAlive()
• IsPlayer()
• Kill()
• NextMovePeer()
3.2. Dota 2 Lua API 17
D2Moddin Documentation, Release 1.0
• OverrideFriction(float a, float b)
• PrecacheScriptSound(string a)
• SetAbsOrigin(Vector origin)
• SetAngles(float pitch, float yaw, float roll)
• SetAngularVelocity(float pitch, float yaw, float roll)
• SetContext(string a, string b, float c)
• SetContextNum(string a, float b, float c)
• SetContextThink(string a, handle b, float c)
• SetForwardVector(Vector forwardVec)
• SetFriction(float a)
• SetGravity(float a)
• SetHealth(int hp)
• SetMaxHealth(int maxHP)
• SetModel(string modelName)
• SetOrigin(Vector origin)
• SetOwner(handle owningEntity)
• SetParent(handle a, string b)
• SetRenderColor(int a, int b, int c)
• SetSize(Vector a, Vector b)
• SetTeam(int team)
• SetVelocity(Vector a)
• StopSound(string soundName)
• Trigger()
3.2.3 CEntities
No Description Set
• CreateByClassname(string className)
• FindAllByClassname(string a)
• FindAllByClassnameWithin(string a, Vector b, float c)
• FindAllByModel(string modelName)
• FindAllByName(string name)
• FindAllByNameWithin(string name, Vector origin, float maxRadius)
• FindAllByTarget(string targetName)
• FindAllInSphere(Vector origin, float maxRadius)
• FindByClassname(handle startFrom, string className)
• FindByClassnameNearest(string className, Vector origin, float maxRadius)
18 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• FindByClassnameWithin(handle startFrom, string className, Vector origin, float maxRadius)
• FindByModel(handle startFrom, string modelName)
• FindByModelWithin(handle startFrom, string modelName, Vector origin, float maxRadius)
• FindByName(handle lastEnt, string searchString)
• FindByNameNearest(string name, Vector origin, float maxRadius)
• FindByNameWithin(handle startFrom, string name, Vector origin, float maxRadius)
• FindByTarget(handle startFrom, string targetName)
• FindInSphere(handle startFrom, Vector origin, float maxRadius)
• First()
• Next(handle startFrom)
3.2.4 CEntityInstance
extends CBaseEntity No Description Set
• ConnectOutput(string a, string b)
• Destroy()
• DisconnectOutput(string a, string b)
• DisconnectRedirectedOutput(string a, string b, handle c)
• entindex()
• FireOutput(string a, handle b, handle c, table d, float e)
• GetClassname()
• GetDebugName()
• GetEntityHandle()
• GetEntityIndex()
• GetIntAttr(string a)
• GetName()
• GetOrCreatePrivateScriptScope()
• GetOrCreatePublicScriptScope()
• GetPrivateScriptScope()
• GetPublicScriptScope()
• RedirectOutput(string a, string b, handle c)
• RemoveSelf()
• SetIntAttr(string a, int b)
3.2. Dota 2 Lua API 19
D2Moddin Documentation, Release 1.0
3.2.5 CDOTABaseAbility
extends CBaseEntity No Description Set
• CastAbility()
• ContinueCasting()
• CreateVisibilityNode(Vector a, float b, float c)
• DecrementModifierRefCount()
• EndChannel(bool a)
• EndCooldown()
• GetAbilityDamage()
• GetAbilityDamageType()
• GetAbilityIndex()
• GetAbilityName()
• GetAbilityTargetFlags()
• GetAbilityTargetTeam()
• GetAbilityTargetType()
• GetAbilityType()
• GetAnimationIgnoresModelScale()
• GetAssociatedPrimaryAbilities()
• GetAssociatedSecondaryAbilities()
• GetAutoCastState()
• GetBackswingTime()
• GetBehavior()
• GetCaster()
• GetCastPoint()
• GetCastRange()
• GetChannelledManaCostPerSecond(int a)
• GetChannelStartTime()
• GetChannelTime()
• GetCloneSource()
• GetConceptRecipientType()
• GetCooldown(int a)
• GetCooldownTime()
• GetCooldownTimeRemaining()
• GetCursorPosition()
• GetCursorTarget()
• GetCursorTargetingNothing()
20 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• GetDuration()
• GetGoldCost(int a)
• GetGoldCostForUpgrade(int a)
• GetHeroLevelRequiredToUpgrade()
• GetIntrinsicModifierName()
• GetLevel()
• GetLevelSpecialValueFor(string a, int b)
• GetManaCost(int a)
• GetMaxLevel()
• GetModifierValue()
• GetModifierValueBonus()
• GetPlaybackRateOverride()
• GetSharedCooldownName()
• GetSpecialValueFor(string a)
• GetStolenActivityModifier()
• GetToggleState()
• HeroXPChange(float a)
• IncrementModifierRefCount()
• IsActivated()
• IsAttributeBonus()
• IsChanneling()
• IsCooldownReady()
• IsCosmetic()
• IsFullyCastable()
• IsHidden()
• IsHiddenWhenStolen()
• IsInAbilityPhase()
• IsItem()
• IsOwnersGoldEnough(int a)
• IsOwnersGoldEnoughForUpgrade()
• IsOwnersManaEnough()
• IsPassive()
• IsSharedWithTeammates()
• IsStealable()
• IsStolen()
• IsToggle()
3.2. Dota 2 Lua API 21
D2Moddin Documentation, Release 1.0
• IsTrained()
• MarkAbilityButtonDirty()
• NumModifiersUsingAbility()
• OnAbilityPhaseInterrupted()
• OnAbilityPhaseStart()
• OnAbilityPinged()
• OnChannelFinish(bool a)
• OnChannelThink(float a)
• OnHeroCalculateStatBonus()
• OnHeroLevelUp()
• OnInventoryContentsChanged()
• OnOwnerDied()
• OnOwnerSpawned()
• OnSpellStart()
• OnToggle()
• OnUpgrade()
• PayGoldCost()
• PayGoldCostForUpgrade()
• PayManaCost()
• PlaysDefaultAnimWhenStolen()
• ProcsMagicStick()
• RefCountsModifiers()
• RefundManaCost()
• ResetToggleOnRespawn()
• SetAbilityIndex(int a)
• SetActivated(bool a)
• SetChanneling(bool a)
• SetHidden(bool a)
• SetInAbilityPhase(bool a)
• SetLevel(int a)
• SetOverrideCastPoint(float a)
• SetRefCountsModifiers(bool a)
• SetStolen(bool a)
• ShouldUseResources()
• SpeakAbilityConcept(int a)
• SpeakTrigger()
22 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• StartCooldown(float a)
• ToggleAbility()
• ToggleAutoCast()
• UpgradeAbility()
• UseResources(bool a, bool b, bool c)
3.2.6 CDOTA_Ability_Animation_Attack
extends CDOTABaseAbility No Description Set
• SetPlaybackRate(float a)
3.2.7 CDOTA_Ability_Animation_TailSpin
extends CDOTABaseAbility No Description Set
• SetPlaybackRate(float a)
3.2.8 CDOTA_Ability_Nian_Leap
extends CDOTABaseAbility No Description Set
• SetPlaybackRate(float a)
3.2.9 CDOTA_Ability_Nian_Dive
extends CDOTABaseAbility No Description Set
• SetPlaybackRate(float a)
3.2.10 CDOTA_Ability_Nian_Roar
extends CDOTABaseAbility No Description Set
• GetCastCount()
3.2.11 CDOTA_Item
extends CDOTABaseAbility No Description Set
• GetContainer()
• GetCost()
• GetCurrentCharges()
• GetInitialCharges()
• GetPurchaser()
• GetPurchaseTime()
• GetShareability()
3.2. Dota 2 Lua API 23
D2Moddin Documentation, Release 1.0
• IsPermanent()
• LaunchLoot(bool a, float b, float c, Vector d)
• SetCurrentCharges(int a)
• SetPurchaser(handle a)
• SetPurchaseTime(float a)
• SetStacksWithOtherOwners(bool a)
• StacksWithOtherOwners()
• Think()
3.2.12 CDOTA_Item_Physical
extends CBaseAnimating No Description Set
• GetContainedItem()
• GetCreationTime()
• SetContainedItem(handle a)
3.2.13 CDOTA_Item_DataDriven
extends CDOTA_Item
• ApplyDataDrivenModifier(handle source, handle target, string modifier_name, handle modifierArgs)
3.2.14 CDOTA_Unit_Nian
extends CDOTA_BaseNPC_Creature No Description Set
• GetHorn()
• GetTail()
• IsHornAlive()
• IsTailAlive()
3.2.15 CBasePlayer
No Description Set
• IsNoclipping()
3.2.16 CDOTAPlayer
extends CBaseAnimating No Description Set
• GetAssignedHero()
• GetControlledRPGUnit()
• GetPlayerID()
24 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• MakeRandomHeroSelection()
• SetKillCamUnit(handle a)
• SetMusicStatus(int nMusicStatus, float flIntensity)
3.2.17 CDOTA_PlayerResource
extends CBaseEntity No Description Set
• AddAegisPickup(int a)
• AddClaimedFarm(int a, float b)
• AddGoldSpentOnSupport(int a, int b)
• AddRunePickup(int a)
• AreUnitsSharedWithPlayerID(int a, int b)
• ClearKillsMatrix(int a)
• ClearLastHitMultikill(int a)
• ClearLastHitStreak(int a)
• ClearRawPlayerDamageMatrix(int a)
• ClearStreak(int a)
• GetAegisPickups(int a)
• GetAssists(int a)
• GetBroadcasterChannel(int a)
• GetBroadcasterChannelSlot(int a)
• GetClaimedDenies(int a)
• GetClaimedFarm(int a)
• GetClaimedMisses(int a)
• GetConnectionState(int a)
• GetCreepDamageTaken(int a)
• GetCustomBuybackCooldown(int a)
• GetCustomBuybackCost(int a)
• GetDamageDoneToHero(int a, int b)
• GetDeaths(int a)
• GetDenies(int a)
• GetEventPointsForPlayerID(int a)
• GetEventPremiumPointsGranted(int a)
• GetEventRankGranted(int a)
• GetGold(int a)
• GetGoldBagsCollected(int a)
• GetGoldLostToDeath(int a)
3.2. Dota 2 Lua API 25
D2Moddin Documentation, Release 1.0
• GetGoldPerMin(int a)
• GetGoldSpentOnBuybacks(int a)
• GetGoldSpentOnConsumables(int a)
• GetGoldSpentOnItems(int a)
• GetGoldSpentOnSupport(int a)
• GetHealing(int a)
• GetHeroDamageTaken(int a)
• GetKills(int a)
• GetKillsDoneToHero(int a, int b)
• GetLastHitMultikill(int a)
• GetLastHits(int a)
• GetLastHitStreak(int a)
• GetLevel(int playerID)
• GetMisses(int a)
• GetNearbyCreepDeaths(int a)
• GetNthCourierForTeam(int a, int b)
• GetNthPlayerIDOnTeam(int a, int b)
• GetNumConsumablesPurchased(int a)
• GetNumCouriersForTeam(int a)
• GetNumItemsPurchased(int a)
• GetPlayer(int a)
• GetPlayerLoadedCompletely(int a)
• GetPlayerName(int a)
• GetPlayerReservedState(int a)
• GetRawPlayerDamage(int a)
• GetReliableGold(int a)
• GetRespawnSeconds(int a)
• GetRoshanKills(int a)
• GetRunePickups(int a)
• GetSelectedHeroEntity(int a)
• GetSelectedHeroID(int a)
• GetSelectedHeroName(int a)
• GetSteamAccountID(int a)
• GetStreak(int a)
• GetStuns(int a)
• GetTeam(int a)
26 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• GetTeamKills(int a)
• GetTimeOfLastConsumablePurchase(int a)
• GetTimeOfLastDeath(int a)
• GetTimeOfLastItemPurchase(int a)
• GetTotalEarnedGold(int a)
• GetTotalEarnedXP(int a)
• GetTotalGoldSpent(int a)
• GetTowerDamageTaken(int a)
• GetTowerKills(int a)
• GetUnitShareMaskForPlayer(int a, int b)
• GetUnreliableGold(int a)
• GetXPPerMin(int a)
• HasRandomed(int a)
• HasRepicked(int playerID)
• HasSelectedHero(int a)
• HaveAllPlayersJoined()
• HeroLevelUp(int a)
• IncrementAssists(int playerID)
• IncrementClaimedDenies(int a)
• IncrementClaimedMisses(int a)
• IncrementDeaths(int playerID)
• IncrementDenies(int a)
• IncrementGoldBagsCollected(int a)
• IncrementKills(int playerID, int kills)
• IncrementLastHitMultikill(int a)
• IncrementLastHits(int a)
• IncrementLastHitStreak(int a)
• IncrementMisses(int a)
• IncrementNearbyCreepDeaths(int a)
• IncrementStreak(int a)
• IncrementTotalEarnedXP(int a, int b)
• IsBroadcaster(int a)
• IsDisableHelpSetForPlayerID(int a, int b)
• IsFakeClient(int a)
• IsHeroSelected(string a)
• IsHeroSharedWithPlayerID(int a, int b)
3.2. Dota 2 Lua API 27
D2Moddin Documentation, Release 1.0
• IsValidPlayer(int playerID)
• IsValidPlayerID(int playerID)
• IsValidTeamPlayer(int playerID)
• IsValidTeamPlayerID(int playerID)
• ModifyGold(int playerID, int goldAmmt, bool reliable, int d)
• ReplaceHeroWith(int a, string b, int c, int d)
• ResetBuybackCostTime(int a)
• ResetTotalEarnedGold(int a)
• SetBuybackCooldownTime(int a, float b)
• SetBuybackGoldLimitTime(int a, float b)
• SetCameraTarget(int a, handle b)
• SetCustomBuybackCooldown(int a, float b)
• SetCustomBuybackCost(int a, int b)
• SetGold(int a, int b, bool c)
• SetHasRandomed(int playerID)
• SetHasRepicked(int playerID)
• SetLastBuybackTime(int a, int b)
• SetPlayerReservedState(int a, bool b)
• SetUnitShareMaskForPlayer(int a, int b, int c, bool d)
• SpendGold(int a, int b, int c)
• UpdateTeamSlot(int a, int b)
• WhoSelectedHero(string a)
3.2.18 CDOTA_BaseNPC
extends CBaseFlex
• AddAbility(string a)
• AddItem(handle a)
• AddNewModifier(handle caster, handle optionalSourceAbility, string modifierName, handle modifierData)
• AddNoDraw()
• AlertNearbyUnits(handle a, handle b)
• AngerNearbyUnits()
• AttackNoEarlierThan(float a)
• AttackReady()
• BoundingRadius2D()
• CastAbilityImmediately(handle a, int b)
• CastAbilityNoTarget(handle ability, int playerIndex)
28 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• CastAbilityOnPosition(Vector a, handle b, int c)
• CastAbilityOnTarget(handle target, handle ability, int playerIndex)
• CastAbilityToggle(handle a, int b)
• DisassembleItem(handle a)
• DropItemAtPosition(Vector a, handle b)
• DropItemAtPositionImmediate(handle a, Vector b)
• EjectItemFromStash(handle a)
• FindAbilityByName(string a)
• ForceKill(bool a)
• GetAbilityByIndex(int a)
• GetAbilityCount()
• GetAcquisitionRange()
• GetAdditionalBattleMusicWeight()
• GetAttackAnimationPoint()
• GetAttackDamage()
• GetAttackRange()
• GetAttackRangeBuffer()
• GetAttackSpeed()
• GetAttacksPerSecond()
• GetAttackTarget()
• GetAverageTrueAttackDamage()
• GetBaseAttackRange()
• GetBaseAttackTime()
• GetBaseDamageMax()
• GetBaseDamageMin()
• GetBaseDayTimeVisionRange()
• GetBaseHealthRegen()
• GetBaseMagicalResistanceValue()
• GetBaseMaxHealth()
• GetBaseMoveSpeed()
• GetBaseNightTimeVisionRange()
• GetCastPoint(bool a)
• GetCollisionPadding()
• GetConstantBasedManaRegen()
• GetCreationTime()
• GetCurrentActiveAbility()
3.2. Dota 2 Lua API 29
D2Moddin Documentation, Release 1.0
• GetCurrentVisionRange()
• GetCursorCastTarget()
• GetCursorPosition()
• GetCursorTargetingNothing()
• GetDayTimeVisionRange()
• GetDeathXP()
• GetForceAttackTarget()
• GetGoldBounty()
• GetHasteFactor()
• GetHealth()
• GetHealthDeficit()
• GetHealthPercent()
• GetHealthRegen()
• GetHullRadius()
• GetIdealSpeed()
• GetIncreasedAttackSpeed()
• GetInitialGoalEntity()
• GetItemInSlot(int a)
• GetLastIdleChangeTime()
• GetLevel()
• GetMagicalArmorValue()
• GetMainControllingPlayer()
• GetMana()
• GetManaPercent()
• GetManaRegen()
• GetMaxHealth()
• GetMaxMana()
• GetModelRadius()
• GetModifierCount()
• GetModifierNameByIndex(int a)
• GetMoveSpeedModifier(float a)
• GetMustReachEachGoalEntity()
• GetNightTimeVisionRange()
• GetOpposingTeamNumber()
• GetPaddedCollisionRadius()
• GetPercentageBasedManaRegen()
30 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• GetPhysicalArmorBaseValue()
• GetPhysicalArmorValue()
• GetPlayerOwner()
• GetPlayerOwnerID()
• GetProjectileSpeed()
• GetRangeToUnit(handle a)
• GetSecondsPerAttack()
• GetStatsBasedManaRegen()
• GetTeamNumber()
• GetTotalPurchasedUpgradeGoldCost()
• GetUnitLabel()
• GetUnitName()
• GiveMana(float a)
• HasAbility(string a)
• HasAttackCapability()
• HasFlyingVision()
• HasFlyMovementCapability()
• HasGroundMovementCapability()
• HasInventory()
• HasItemInInventory(string a)
• HasModifier(string a)
• HasMovementCapability()
• HasScepter()
• Heal(float a, handle b)
• Hold()
• Interrupt()
• InterruptChannel()
• InterruptMotionControllers(bool a)
• IsAlive()
• IsAncient()
• IsAttackImmune()
• IsAttacking()
• IsAttackingEntity(handle a)
• IsBlind()
• IsBlockDisabled()
• IsCommandRestricted()
3.2. Dota 2 Lua API 31
D2Moddin Documentation, Release 1.0
• IsControllableByAnyPlayer()
• IsCreature()
• IsDeniable()
• IsDisarmed()
• IsDominated()
• IsEvadeDisabled()
• IsFrozen()
• IsHardDisarmed()
• IsHero()
• IsHexed()
• IsIdle()
• IsIllusion()
• IsInvisible()
• IsInvulnerable()
• IsLowAttackPriority()
• IsMagicImmune()
• IsMechanical()
• IsMovementImpaired()
• IsMuted()
• IsNeutralUnitType()
• IsNightmared()
• IsOpposingTeam(int a)
• IsOutOfGame()
• IsOwnedByAnyPlayer()
• IsPhantom()
• IsPhantomBlocker()
• IsPhased()
• IsPositionInRange(Vector a, float b)
• IsRangedAttacker()
• IsRealHero()
• IsRooted()
• IsSilenced()
• IsSoftDisarmed()
• IsSpeciallyDeniable()
• IsStunned()
• IsSummoned()
32 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• IsTower()
• IsUnableToMiss()
• IsUnselectable()
• Kill(handle a, handle b)
• MakeIllusion()
• MakePhantomBlocker()
• MakeVisibleDueToAttack(int a)
• MakeVisibleToTeam(int a, float b)
• ModifyHealth(int a, handle b, bool c, int d)
• MoveToNPC(handle a)
• MoveToNPCToGiveItem(handle a, handle b)
• MoveToPosition(Vector a)
• MoveToPositionAggressive(Vector a)
• MoveToTargetToAttack(handle a)
• NoHealthBar()
• NoTeamMoveTo()
• NoTeamSelect()
• NotOnMinimap()
• NotOnMinimapForEnemies()
• NoUnitCollision()
• PassivesDisabled()
• PerformAttack(handle a, bool b, bool c, bool d, bool e)
• PickupDroppedItem(handle a)
• PickupRune(handle a)
• ProvidesVision()
• ReduceMana(float a)
• RemoveAbility(string a)
• RemoveItem(handle a)
• RemoveModifierByName(string a)
• RemoveModifierByNameAndCaster(string a, handle b)
• RemoveNoDraw()
• RespawnUnit()
• SellItem(handle a)
• SetAdditionalBattleMusicWeight(float a)
• SetAttackCapability(int a)
• SetAttacking(handle a)
3.2. Dota 2 Lua API 33
D2Moddin Documentation, Release 1.0
• SetBaseAttackTime(float a)
• SetBaseDamageMax(int a)
• SetBaseDamageMin(int a)
• SetBaseHealthRegen(float a)
• SetBaseMagicalResistanceValue(float a)
• SetBaseManaRegen(float a)
• SetBaseMaxHealth(float a)
• SetBaseMoveSpeed(int a)
• SetControllableByPlayer(int a, bool b)
• SetCursorCastTarget(handle a)
• SetCursorPosition(Vector a)
• SetCursorTargetingNothing(bool a)
• SetDayTimeVisionRange(int a)
• SetDeathXP(int a)
• SetForceAttackTarget(handle a)
• SetHasInventory(bool a)
• SetHullRadius(float a)
• SetIdleAcquire(bool a)
• SetInitialGoalEntity(handle a)
• SetMana(float a)
• SetMaximumGoldBounty(int a)
• SetMinimumGoldBounty(int a)
• SetMoveCapability(int a)
• SetMustReachEachGoalEntity(bool a)
• SetNeverMoveToClearSpace(bool a)
• SetNightTimeVisionRange(int a)
• SetOriginalModel(string originalModel)
• SetPhysicalArmorBaseValue(float a)
• SetRangedProjectileName(string a)
• SetStolenScepter(bool a)
• SetUnitName(string a)
• ShouldIdleAcquire()
• SpendMana(float a, handle b)
• Stop()
• SwapAbilities(string a, string b, bool c, bool d)
• TimeUntilNextAttack()
34 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• TriggerModifierDodge()
• TriggerSpellAbsorb(handle a)
• UnitCanRespawn()
3.2.19 CDOTA_BaseNPC_Hero
extends CDOTA_BaseNPC
• AddExperience(float amount, bool applyBotDifficultyScaling)
• Buyback()
• CalculateStatBonus()
• CanEarnGold()
• ClearLastHitMultikill()
• ClearLastHitStreak()
• ClearStreak()
• GetAbilityPoints()
• GetAgility()
• GetAgilityGain()
• GetAssists()
• GetAttacker(int a)
• GetBaseAgility()
• GetBaseDamageMax()
• GetBaseDamageMin()
• GetBaseIntellect()
• GetBaseStrength()
• GetBonusDamageFromPrimaryStat()
• GetBuybackCooldownTime()
• GetBuybackCost()
• GetBuybackGoldLimitTime()
• GetCurrentXP()
• GetDeathGoldCost()
• GetDeaths()
• GetDenies()
• GetGold()
• GetGoldBounty()
• GetHealthRegen()
• GetIncreasedAttackSpeed()
• GetIntellect()
3.2. Dota 2 Lua API 35
D2Moddin Documentation, Release 1.0
• GetIntellectGain()
• GetKills()
• GetLastHits()
• GetManaRegen()
• GetMostRecentDamageTime()
• GetMultipleKillCount()
• GetNumAttackers()
• GetPhysicalArmorValue()
• GetPlayerID()
• GetPrimaryAttribute()
• GetPrimaryStatValue()
• GetRespawnTime()
• GetStatsBasedManaRegen()
• GetStreak()
• GetStrength()
• GetStrengthGain()
• GetTimeUntilRespawn()
• HasAnyAvailableInventorySpace()
• HasFlyingVision()
• HasOwnerAbandoned()
• HasRoomForItem(string a, bool b, bool c)
• HeroLevelUp(bool a)
• IncrementAssists()
• IncrementDeaths()
• IncrementDenies()
• IncrementKills(int kills)
• IncrementLastHitMultikill()
• IncrementLastHits()
• IncrementLastHitStreak()
• IncrementNearbyCreepDeaths()
• IncrementStreak()
• IsBuybackDisabledByReapersScythe()
• IsReincarnating()
• KilledHero(handle a, handle b)
• ModifyAgility(float a)
• ModifyGold(int goldAmmt, bool reliable, int reason)
36 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• ModifyIntellect(float a)
• ModifyStrength(float a)
• PerformTaunt()
• RecordLastHit()
• RespawnHero(bool buyback, bool unknown1, bool unknown2)
• SetAbilityPoints(int a)
• SetBaseAgility(float a)
• SetBaseIntellect(float a)
• SetBaseStrength(float a)
• SetBuybackCooldownTime(float a)
• SetBuyBackDisabledByReapersScythe(bool a)
• SetBuybackGoldLimitTime(float a)
• SetCustomDeathXP(int a)
• SetGold(int a, bool b)
• SetPlayerID(int a)
• SetRespawnPosition(Vector a)
• SetTimeUntilRespawn(float a)
• ShouldDoFlyHeightVisual()
• SpendGold(int a, int b)
• UnitCanRespawn()
• UpgradeAbility(handle a)
• WillReincarnate()
3.2.20 CDOTA_BaseNPC_Creature
extends CDOTA_BaseNPC No Description Set
• AddItemDrop(handle a)
• CreatureLevelUp(int a)
• IsChampion()
• SetArmorGain(float a)
• SetAttackTimeGain(float a)
• SetBountyGain(int a)
• SetChampion(bool a)
• SetDamageGain(int a)
• SetDisableResistanceGain(float a)
• SetHPGain(int a)
• SetHPRegenGain(float a)
3.2. Dota 2 Lua API 37
D2Moddin Documentation, Release 1.0
• SetMagicResistanceGain(float a)
• SetManaGain(int a)
• SetManaRegenGain(float a)
• SetMoveSpeedGain(int a)
• SetXPGain(int a)
3.2.21 CDOTA_BaseNPC_Building
extends CDOTA_BaseNPC No Description Set
• GetInvulnCount()
• SetInvulnCount(int a)
3.2.22 CRPG_Unit
No Description Set
• ActionState()
• ClearMovementTarget()
• FindSensedEnemies()
• GetMaxSpeed()
• GetMaxStamina()
• GetMovementTargetEntity()
• GetSensingSphereRange()
• GetSightConeAngle()
• GetSightConeRange()
• GetStamina()
• GetTurnRate()
• GetUnitName()
• GrantItem(string a, bool b)
• IsBlocking()
• IsFacing(Vector a, float b)
• SetBlocking(bool a)
• SetMaxSpeed(float a)
• SetMovementTargetEntity(handle a, float b)
• SetMovementTargetPosition(Vector a, float b)
• SetSensingSphereRange(float a)
• SetSightConeAngle(float a)
• SetSightConeRange(float a)
• SetTurnRate(float a)
38 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
3.2.23 CDOTABaseGameMode
extends CBaseEntity No Description Set
• ClientLoadGridNav()
• SetAlwaysShowPlayerInventory(bool a)
• SetBotThinkingEnabled(bool a)
• SetBuybackEnabled(bool a)
• SetCameraDistanceOverride(float a)
• SetCustomBuybackCooldownEnabled(bool a)
• SetCustomBuybackCostEnabled(bool a)
• SetCustomHeroMaxLevel(int maxLevel)
• SetCustomXPRequiredToReachNextLevel(handle a)
• SetFogOfWarDisabled(bool a)
• SetGoldSoundDisabled(bool a)
• SetOverrideSelectionEntity(handle unit)
• SetRecommendedItemsDisabled(bool a)
• SetRemoveIllusionsOnDeath(bool a)
• SetTopBarTeamValue(int a, int b)
• SetTopBarTeamValuesOverride(bool a)
• SetTopBarTeamValuesVisible(bool a)
• SetTowerBackdoorProtectionEnabled(bool a)
• SetUseCustomHeroLevels(bool a)
3.2.24 CDotaQuest
extends CBaseEntity A quest, as seen in the Tutorial and Frostivus
• AddSubquest(handle a)
• CompleteQuest()
• GetSubquest(int a)
• GetSubquestByName(string a)
• RemoveSubquest(handle a)
• SetTextReplaceString(string a)
• SetTextReplaceValue(int a, int b)
3.2.25 CDotaSubquestBase
extends CDotaQuest No Description Set
• CompleteSubquest()
3.2. Dota 2 Lua API 39
D2Moddin Documentation, Release 1.0
• SetTextReplaceString(string a)
• SetTextReplaceValue(int a, int b)
3.2.26 CPhysicsComponent
No Description Set
• ExpensiveInstantRayCast(Vector a, Vector b, handle c)
3.2.27 CPointTemplate
No Description Set
• DeleteCreatedSpawnGroups()
• ForceSpawn()
• GetSpawnedEntities()
• SetSpawnCallback(handle a, handle b)
3.2.28 CBodyComponent
No Description Set
• AddImpulseAtPosition(Vector a, Vector b)
• AddVelocity(Vector a, Vector b)
• DetachFromParent()
• GetSequence()
• IsAttachedToParent()
• LookupSequence(string a)
• SequenceDuration(string a)
• SetAngularVelocity(Vector a)
• SetAnimation(string a)
• SetBodyGroup(string a)
• SetMaterialGroup(utlstringtoken a)
• SetVelocity(Vector velocity)
3.2.29 CBaseAnimating
extends CBaseEntity A class containing functions involved in animations
• GetAttachmentAngles(int a)
• GetAttachmentOrigin(int a)
• IsSequenceFinished()
• ScriptLookupAttachment(string a)
40 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• SetBodygroup(int a, int b)
• SetModelScale(float scale)
• SetPoseParameter(string a, float b)
3.2.30 CBaseCombatCharacter
No Description Set
• GetEquippedWeapons()
• GetWeaponCount()
3.2.31 ProjectileManager
The projectile manager, it manages projectiles.
• CreateLinearProjectile(handle a)
• CreateTrackingProjectile(handle a)
• DestroyLinearProjectile(int a)
• ProjectileDodge(handle a)
3.2.32 CBaseTrigger
No Description Set
• Disable()
• Enable()
• IsTouching(handle a)
3.2.33 CEnvEntityMaker
extends CBaseEntity No Description Set
• SpawnEntity()
• SpawnEntityAtEntityOrigin(handle a)
• SpawnEntityAtLocation(Vector a, Vector b)
• SpawnEntityAtNamedEntityOrigin(string a)
3.2.34 CDOTAVoteSystem
No Description Set
• StartVote(handle a)
3.2. Dota 2 Lua API 41
D2Moddin Documentation, Release 1.0
3.2.35 CMarkupVolumeTagged
No Description Set
• HasTag(string a)
3.2.36 CScriptPrecacheContext
No Description Set
• AddResource(string a)
• GetValue(string a)
3.2.37 CScriptKeyValues
No Description Set
• GetValue(string a)
3.2.38 CScriptParticleManager
No Description Set
• CreateParticle(string particleName, int particleAttach, handle owningEntity)
• CreateParticleForPlayer(string particleName, int particleAttach, handle owningEntity, handle owningPlayer)
• GetParticleReplacement(string a, handle b)
• ReleaseParticleIndex(int particleId)
• SetParticleAlwaysSimulate(int a)
• SetParticleControl(int particleId, int controlIndex, Vector controlData)
• SetParticleControlEnt(int a, int b, handle c, int d, string e, Vector f, bool g)
3.2.39 CScriptHeroList
No Description Set
• GetAllHeroes()
• GetHero(int heroId)
• GetHeroCount()
3.2.40 CNativeOutputs
No Description Set
• AddOutput(string a, string b)
• Init(int a)
42 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
3.2.41 CEnvProjectedTexture
extends CBaseEntity No Description Set
• SetFarRange(float a)
• SetLinearAttenuation(float a)
• SetNearRange(float a)
• SetQuadraticAttenuation(float a)
• SetVolumetrics(bool a, float b, float c, int d, float e)
3.2.42 CInfoData
No Description Set
• QueryColor(utlstringtoken a, Vector b)
• QueryFloat(utlstringtoken a, float b)
• QueryInt(utlstringtoken a, int b)
• QueryNumber(utlstringtoken a, float b)
• QueryString(utlstringtoken a, string b)
• QueryVector(utlstringtoken a, Vector b)
3.2.43 CPhysicsProp
No Description Set
• DisableMotion()
• EnableMotion()
3.2.44 CDOTAGamerules
• Defeated()
• DidMatchSignoutTimeOut()
• GetCustomGameDifficulty()
• GetDifficulty()
• GetDroppedItem(int dropIndex)
• GetGameModeEntity()
• GetGameTime()
• GetMatchSignoutComplete()
• GetNianFightStartTime()
• GetNianTotalDamageTaken()
• GetTimeOfDay()
• IsDaytime()
3.2. Dota 2 Lua API 43
D2Moddin Documentation, Release 1.0
• MakeTeamLose(int team)
• NumDroppedItems()
• Playtesting_UpdateAddOnKeyValues()
• ResetDefeated()
• ResetToHeroSelection()
• SendCustomMessage(string message, int teamID, int unknown(1?))
• SetCreepMinimapIconScale(float scale)
• SetCustomGameDifficulty(int a)
• SetFirstBloodActive(bool a)
• SetGameWinner(int team)
• SetGoldPerTick(int a)
• SetGoldTickTime(float a)
• SetHeroMinimapIconSize(int iconSize)
• SetHeroRespawnEnabled(bool canRespawn)
• SetHeroSelectionTime(float time)
• SetNianFightStartTime(float a)
• SetOverlayHealthBarUnit(handle unit, int style)
• SetPostGameTime(float time)
• SetPreGameTime(float time)
• SetRuneMinimapIconScale(float scale)
• SetRuneSpawnTime(float time)
• SetSafeToLeave(bool safeToLeave)
• SetSameHeroSelectionEnabled(bool enabled)
• SetTimeOfDay(float time)
• SetTreeRegrowTime(float time)
• SetUseBaseGoldBountyOnHeroes(bool a)
• SetUseCustomHeroXPValues(bool a)
• SetUseUniversalShopMode(bool enabled)
• State_Get()
3.2.45 CToneMapControllerComponent
No Description Set
• GetBloomScale()
• GetMaxExposure()
• GetMinExposure()
• SetBloomScale(float a)
44 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
• SetMaxExposure(float a)
• SetMinExposure(float a)
3.2.46 CDebugOverlayScriptHelper
No Description Set
• Axis(Vector a, Quaternion b, float c, bool d, float e)
• Box(Vector a, Vector b, int c, int d, int e, int f, bool g, float h)
• BoxAngles(Vector a, Vector b, Vector c, Quaternion d, int e, int f, int g, int h, bool i, float j)
• Capsule(Vector a, Quaternion b, float c, float d, int e, int f, int g, int h, bool i, float j)
• Circle(Vector a, Quaternion b, float c, int d, int e, int f, int g, bool h, float i)
• CircleScreenOriented(Vector a, float b, int c, int d, int e, int f, bool g, float h)
• Cone(Vector a, Vector b, float c, float d, int e, int f, int g, int h, bool i, float j)
• Cross(Vector a, float b, int c, int d, int e, int f, bool g, float h)
• Cross3D(Vector a, float b, int c, int d, int e, int f, bool g, float h)
• Cross3DOriented(Vector a, Quaternion b, float c, int d, int e, int f, int g, bool h, float i)
• DrawTickMarkedLine(Vector a, Vector b, float c, int d, int e, int f, int g, int h, bool i, float j)
• EntityAttachments(ehandle a, float b)
• EntityAxis(ehandle a, float b, bool c, float d)
• EntityBounds(ehandle a, int b, int c, int d, int e, bool f, float g)
• EntitySkeleton(ehandle a, float b)
• EntityText(ehandle a, int b, string c, int d, int e, int f, int g, float h)
• FilledRect2D(Vector2D a, Vector2D b, int c, int d, int e, int f, float g)
• HorzArrow(Vector a, Vector b, float c, int d, int e, int f, int g, bool h, float i)
• Line(Vector a, Vector b, int c, int d, int e, int f, bool g, float h)
• Line2D(Vector2D a, Vector2D b, int c, int d, int e, int f, float g)
• PopDebugOverlayScope()
• PushAndClearDebugOverlayScope(utlstringtoken a)
• PushDebugOverlayScope(utlstringtoken a)
• RemoveAllInScope(utlstringtoken a)
• SolidCone(Vector a, Vector b, float c, float d, int e, int f, int g, int h, bool i, float j)
• Sphere(Vector a, float b, int c, int d, int e, int f, bool g, float h)
• SweptBox(Vector a, Vector b, Vector c, Vector d, Quaternion e, int f, int g, int h, int i, float j)
• Text(Vector a, int b, string c, float d, int e, int f, int g, int h, float i)
• Texture(string a, Vector2D b, Vector2D c, int d, int e, int f, int g, Vector2D h, Vector2D i, float j)
• Triangle(Vector a, Vector b, Vector c, int d, int e, int f, int g, bool h, float i)
• UnitTestCycleOverlayRenderType()
3.2. Dota 2 Lua API 45
D2Moddin Documentation, Release 1.0
• VectorText3D(Vector a, Quaternion b, string c, int d, int e, int f, int g, bool h, float i)
• VertArrow(Vector a, Vector b, float c, int d, int e, int f, int g, bool h, float i)
• YawArrow(Vector a, float b, float c, float d, int e, int f, int g, int h, bool i, float j)
3.2.47 CBaseFlex
extends CBaseAnimating Animated characters who have vertex flex capability (Hi hex6)
• GetCurrentScene()
• GetSceneByIndex(int a)
3.2.48 CSceneEntity
extends CBaseEntity Choreographed scene which controls animation and/or dialog on one or more actors.
• AddBroadcastTeamTarget(int a)
• Cancel()
• EstimateLength()
• FindCamera()
• FindNamedEntity(string a)
• IsPaused()
• IsPlayingBack()
• LoadSceneFromString(string a, string b)
• RemoveBroadcastTeamTarget(int a)
• Start(handle a)
3.2.49 GridNav
A class that can communicate with the gridnav, useful for seeing if stuff should be able to move
• GridPosToWorldCenterX(int a)
• GridPosToWorldCenterY(int a)
• IsBlocked(Vector a)
• IsNearbyTree(Vector position, float radius, bool c)
• IsTraversable(Vector a)
• RegrowAllTrees()
• WorldToGridPosX(float a)
• WorldToGridPosY(float a)
46 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
3.2.50 Convars
No Description Set
• GetBool(string variableName)
• GetCommandClient()
• GetDOTACommandClient()
• GetFloat(string name)
• GetInt(string a)
• GetStr(string variableName)
• RegisterCommand(string variableName, handle function, string helpText, int flags)
• RegisterConvar(string name, string defaultValue, string helpText, int flags)
• SetBool(string variableName, bool value)
• SetFloat(string variableName, float value)
• SetInt(string a, int b)
• SetStr(string a, string b)
float Global.AngleDiff(float ang1, float ang2)—————
Returns the number of degrees difference between two yaw angles
:: local ang = AngleDiff(45, 80)
print(ang) +———–+————–+————–+ |Type | Name | Description |+===========+==============+==============+ | float | ang1 | No Description Set | | float | ang2 |No Description Set | +———–+————–+————–+ Returns: float - No Description Set
void Global.AppendToLogFile(string a, string b)—————
Appends a ‘’string” to a log file on the server
float Global.ApplyDamage(handle DamageTable)—————
Pass ‘’table” - Inputs: victim, attacker, damage, damage_type, damage_flags, abilityReturn damage done.
:: –Apply 500 pure damage from player 1’s hero to itself
playerHero = PlayerResource:GetPlayer(1):GetAssignedHero()
local damageTable = { victim = playerHero, attacker = playerHero, damage = 500, damage_type = DAM-AGE_TYPE_PURE,
}
playerHero:ApplyDamage(damageTable) +———–+————–+————–+ |Type | Name | Description |+===========+==============+==============+ | handle | DamageTable | a table containing Unit Vic-tim, Unit attacker, float damage, and DAMAGE_TYPE type | +———–+————–+————–+ Returns: float -damage done after reductions
3.2. Dota 2 Lua API 47
D2Moddin Documentation, Release 1.0
Quaternion Global.AxisAngleToQuaternion(Vector a, float b)—————
(‘’vector’‘,’‘float’‘) constructs a quaternion representing a rotation by angle around the specified ‘’vector” axis
Returns: Quaternion - No Description Set
void Global.CancelEntityIOEvents(ehandle a)—————
Create all I/O events for a particular entity
bool Global.CreateEffect(handle a)—————
Pass ‘’table” - Inputs: entity, effect
Returns: bool - No Description Set
handle Global.CreateHeroForPlayer(string a, handle b)—————
Creates a DOTA hero by its dota_npc_units.txt name and sets it as the given player’s controlled hero
Returns: handle - No Description Set
handle Global.CreateItem(string item_name, handle owner, handle owner)—————
Creates an item with classname <i>item_name</i> that <i>owner</i> can use.
Returns: handle - No Description Set
handle Global.CreateItemOnPositionSync(Vector a, handle b)—————
Create a physical item at a given location
Returns: handle - No Description Set
handle Global.CreateTrigger(Vector a, Vector b, Vector c)—————
CreateTrigger( vecMin, vecMax ) : Creates and returns an AABB trigger
Returns: handle - No Description Set
handle Global.CreateTriggerRadiusApproximate(Vector a, float b)—————
CreateTriggerRadiusApproximate( vecOrigin, flRadius ) : Creates and returns an AABB trigger thats bigger than theradius provided
Returns: handle - No Description Set
handle Global.CreateUnitByName(string a, Vector b, bool c, handle d, handle e, int f)—————
Creates a DOTA unit by its dota_npc_units.txt name ( szUnitName, vLocation, bFindClearSpace, hNPCOwner, hUni-tOwner, iTeamNumber )
Returns: handle - No Description Set
48 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int Global.CreateUnitByNameAsync(string a, Vector b, bool c, handle d, handle e, int f, handle g)—————
Creates a DOTA unit by its dota_npc_units.txt name ( szUnitName, vLocation, bFindClearSpace, hNPCOwner, hUni-tOwner, iTeamNumber, hCallback )
Returns: int - No Description Set
float Global.cvar_getf(string a)—————
Gets the value of the given cvar, as a ‘’float’‘.
Returns: float - No Description Set
bool Global.cvar_setf(string a, float b)—————
Sets the value of the given cvar, as a ‘’float’‘.
Returns: bool - No Description Set
void Global.DebugBreak()—————
Breaks in the debugger
void Global.DebugDrawBox(Vector a, Vector b, Vector c, int d, int e, int f, int g, float h)—————
Draw a debug overlay box (origin, mins, maxs, forward, r, g, b, a, duration )
void Global.DebugDrawBoxDirection(Vector a, Vector b, Vector c, Vector d, Vector e, float f, float g)—————
Draw a debug forward box (cent, min, max, forward, vRgb, a, duration)
void Global.DebugDrawCircle(Vector a, Vector b, float c, float d, bool e, float f)—————
Draw a debug circle (center, vRgb, a, rad, ztest, duration)
void Global.DebugDrawClear()—————
Try to clear all the debug overlay info
void Global.DebugDrawLine(Vector a, Vector b, int c, int d, int e, bool f, float g)—————
Draw a debug overlay line (origin, target, r, g, b, ztest, duration)
void Global.DebugDrawLine_vCol(Vector a, Vector b, Vector c, bool d, float e)—————
Draw a debug line using color vec (start, end, vRgb, a, ztest, duration)
void Global.DebugDrawScreenTextLine(float a, float b, int c, string d, int e, int f, int g, int h, float i)—————
Draw text with a line offset (x, y, lineOffset, text, r, g, b, a, duration)
3.2. Dota 2 Lua API 49
D2Moddin Documentation, Release 1.0
void Global.DebugDrawSphere(Vector a, Vector b, float c, float d, bool e, float f)—————
Draw a debug sphere (center, vRgb, a, rad, ztest, duration)
void Global.DebugDrawText(Vector a, string b, bool c, float d)—————
Draw text in 3d (origin, text, bViewCheck, duration)
void Global.DebugScreenTextPretty(float a, float b, int c, string d, int e, int f, int g, int h, float i, string j, int k, booll)—————
Draw pretty debug text (x, y, lineOffset, text, r, g, b, a, duration, font, size, bBold)
void Global.DoEntFire(string a, string b, string c, float d, handle e, handle f)—————
EntFire: Generate an entity i/o event ( szTarget, szAction, szValue, flDelay, hActivator, hCaller )
void Global.DoEntFireByInstanceHandle(handle a, string b, string c, float d, handle e, handle f)—————
EntFireByHandle:Generate and entity i/o event
bool Global.DoIncludeScript(string a, handle b)—————
Execute a script (internal)
Returns: bool - No Description Set
void Global.DoScriptAssert(bool a, string b)—————
ScriptAssert:Asserts the passed in value. Prints out a message and brings up the assert dialog.
string Global.DoUniqueString(string a)—————
UniqueString:Generate a string guaranteed to be unique across the life of the script VM, with an optional root string.Useful for adding data to table’s when not sure what keys are already in use in that table.
Returns: string - No Description Set
void Global.EmitGlobalSound(string a)—————
Play named sound for all players
void Global.EmitSoundOn(string a, handle b)—————
Play named sound on Entity
void Global.EmitSoundOnClient(string a, handle b)—————
Play named sound only on the client for the passed in player
50 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
handle Global.EntIndexToHScript(int a)—————
Turn an entity index integer to an HScript representing that entity’s script instance.
Returns: handle - No Description Set
void Global.ExecuteOrderFromTable(handle a)—————
Issue an order from a script table
::
local newOrder = {
UnitIndex = unitIndex, OrderType = order, TargetIndex = targetIndex, AbilityIndex = abilityIn-dex, Position = position, Queue = queue
}
ExecuteOrderFromTable(newOrder) +———–+————–+————–+ |Type | Name | Description |+===========+==============+==============+ | handle | | No Description Set | +———–+————–+————–+
float Global.ExponentialDecay(float a, float b, float c)—————
Smooth curve decreasing slower as it approaches zero
Returns: float - No Description Set
string Global.FileToString(string a)—————
Reads a ‘’string” from a file to send to script
Returns: string - No Description Set
void Global.FindClearSpaceForUnit(handle a, Vector b, bool c)—————
Place a unit somewhere not already occupied.
table Global.FindUnitsInRadius(int a, Vector b, handle c, float d, int e, int f, int g, int h, bool i)—————
Finds the units in a given radius with the given flags. ( iTeamNumber, vPosition, hCacheUnit, flRadius, iTeamFilter,iTypeFilter, iFlagFilter, iOrder, bCanGrowCache )
Returns: table - No Description Set
void Global.FireEntityIOInputNameOnly(ehandle a, string b)—————
Fire Entity’s Action Input w/no data
void Global.FireEntityIOInputString(ehandle a, string b, string c)—————
Fire Entity’s Action Input with passed String - you own the memory
3.2. Dota 2 Lua API 51
D2Moddin Documentation, Release 1.0
void Global.FireEntityIOInputVec(ehandle a, string b, Vector c)—————
Fire Entity’s Action Input with passed ‘’Vector” ( hEntity, szActionName, vector )
void Global.FireGameEvent(string eventName, handle parameterTable)—————
Fire a pre-defined event, which can be found either in custom_events.txt or in dota’s resource/*.res
void Global.FireGameEventLocal(string a, handle b)—————
Fire a game event without broadcasting to the client.
float Global.FrameTime()—————
Get the time spent on the server in the last frame
Returns: float - No Description Set
int Global.GetFrameCount()—————
Returns the engines current frame count
Returns: int - No Description Set
float Global.GetFrostyBoostAmount(int a, int b)—————
No Description Set
Returns: float - No Description Set
int Global.GetFrostyPointsForRound(int a, int b, int c)—————
No Description Set
Returns: int - No Description Set
float Global.GetGoldFrostyBoostAmount(int a, int b)—————
No Description Set
Returns: float - No Description Set
int Global.GetGoldFrostyPointsForRound(int a, int b, int c)—————
No Description Set
Returns: int - No Description Set
52 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
Vector Global.GetGroundPosition(Vector a, handle b)—————
Returns the supplied position moved to the ground. Second parameter is an NPC for measuring movement collisionhull offset.
Returns: Vector - No Description Set
handle Global.GetListenServerHost()—————
Get the local player on a listen server.
Returns: handle - No Description Set
string Global.GetMapName()—————
Get the name of the map.
Returns: string - No Description Set
float Global.GetMaxOutputDelay(ehandle a, string b)—————
Get the longest delay for all events attached to an output
Returns: float - No Description Set
Vector Global.GetPhysAngularVelocity(handle a)—————
Get Angular Velocity for VPHYS or normal object
Returns: Vector - No Description Set
Vector Global.GetPhysVelocity(handle a)—————
Get Velocity for VPHYS or normal object
Returns: Vector - No Description Set
string Global.GetSystemDate()—————
Get the current real world date
Returns: string - No Description Set
string Global.GetSystemTime()—————
Get the current real world time
Returns: string - No Description Set
float Global.GetWorldMaxX()—————
Gets the world’s maximum X position.
Returns: float - No Description Set
3.2. Dota 2 Lua API 53
D2Moddin Documentation, Release 1.0
float Global.GetWorldMaxY()—————
Gets the world’s maximum Y position.
Returns: float - No Description Set
float Global.GetWorldMinX()—————
Gets the world’s minimum X position.
Returns: float - No Description Set
float Global.GetWorldMinY()—————
Gets the world’s minimum Y position.
Returns: float - No Description Set
void Global.InitLogFile(string a, string b)—————
If the given file doesn’t exist, creates it with the given contents; does nothing if it exists
bool Global.IsDedicatedServer()—————
Returns true if this server is a dedicated server.
Returns: bool - No Description Set
bool Global.IsMarkedForDeletion(handle a)—————
Returns true if the entity is valid and marked for deletion.
Returns: bool - No Description Set
bool Global.IsValidEntity(handle a)—————
Checks to see if the given hScript is a valid entity
Returns: bool - No Description Set
int Global.ListenToGameEvent(string EventName, handle functionNameToCall, handle context)—————
Register as a listener for a game event from script.
{{tip|In addition to listening for [[Dota 2 Workshop Tools/Scripting/Built-In Engine Events|standard engine events]],you can also create your own events by placing them in /scripts/custom_events.txt.}}
:: ListenToGameEvent(‘entity_killed’, Dynamic_Wrap(MyCustomGameMode, ‘OnEntityKilled’), self)
Returns: int - a handle for the event/function pair
54 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
table Global.LoadKeyValues(string a)—————
Creates a ‘’table” from the specified keyvalues text file
Returns: table - No Description Set
table Global.LoadKeyValuesFromString(string a)—————
Creates a ‘’table” from the specified keyvalues ‘’string’‘
Returns: table - No Description Set
int Global.MakeStringToken(string a)—————
Checks to see if the given hScript is a valid entity
Returns: int - No Description Set
void Global.Msg(string a)—————
Print a message
void Global.PauseGame(bool a)—————
Pause or unpause the game.
handle Global.PlayerInstanceFromIndex(int a)—————
Get a script instance of a player by index.
Returns: handle - No Description Set
void Global.PrecacheEntityFromTable(string a, handle b, handle c)—————
Precache an entity from KeyValues in ‘’table’‘
void Global.PrecacheEntityListFromTable(handle a, handle b)—————
Precache a list of entity KeyValues table’s
void Global.PrecacheItemByNameAsync(string a, handle b)—————
Asynchronously precaches a DOTA item by its dota_npc_items.txt name, provides a callback when it’s finished.
void Global.PrecacheItemByNameSync(string a, handle b)—————
Precaches a DOTA item by its dota_npc_items.txt name
void Global.PrecacheModel(string a, handle b)—————
( modelName, context ) - Manually precache a single model
3.2. Dota 2 Lua API 55
D2Moddin Documentation, Release 1.0
void Global.PrecacheResource(string a, string b, handle c)—————
Manually precache a single resource
void Global.PrecacheUnitByNameAsync(string a, handle b)—————
Asynchronously precaches a DOTA unit by its dota_npc_units.txt name, provides a callback when it’s finished.
void Global.PrecacheUnitByNameSync(string a, handle b)—————
Precaches a DOTA unit by its dota_npc_units.txt name
void Global.PrintLinkedConsoleMessage(string a, string b)—————
Print a console message with a linked console command
float Global.RandomFloat(float a, float b)—————
Get a random ‘’float” within a range
Returns: float - No Description Set
int Global.RandomInt(int a, int b)—————
Get a random ‘’int” within a range
Returns: int - No Description Set
Vector Global.RandomVector(float a)—————
Get a random 2D ‘’vector’‘. Argument (‘’float’‘) is the minimum length of the returned vector.
Returns: Vector - No Description Set
void Global.RegisterSpawnGroupFilterProxy(string a)—————
Create a C proxy for a script-based spawn group filter
void Global.ReloadMOTD()—————
Reloads the MotD file
void Global.RemoveSpawnGroupFilterProxy(string a)—————
Remove the C proxy for a script-based spawn group filter
56 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
bool Global.RollPercentage(int a)—————
Rolls a number from 1 to 100 and returns true if the roll is less than or equal to the number specified
Returns: bool - No Description Set
QAngle Global.RotateOrientation(QAngle a, QAngle b)—————
Rotate a ‘’QAngle” by another ‘’QAngle’‘.
Returns: QAngle - No Description Set
Vector Global.RotatePosition(Vector a, QAngle b, Vector c)—————
Rotate a ‘’Vector” around a point.
Returns: Vector - No Description Set
Quaternion Global.RotateQuaternionByAxisAngle(Quaternion a, Vector b, float c)—————
Rotates a quaternion by the specified angle around the specified ‘’vector” axis
Returns: Quaternion - No Description Set
QAngle Global.RotationDelta(QAngle a, QAngle b)—————
Find the delta between two ‘’QAngle”s.
Returns: QAngle - No Description Set
bool Global.rr_AddDecisionRule(handle a)—————
Add a rule to the decision database.
Returns: bool - No Description Set
bool Global.rr_CommitAIResponse(handle a, handle b)—————
Commit the result of QueryBestResponse back to the given entity to play. Call with params (entity, airesponse)
Returns: bool - No Description Set
handle Global.rr_GetResponseTargets()—————
Retrieve a ‘’table” of all available expresser targets, in the form { name : ‘’handle’‘, name: ‘’handle” }.
Returns: handle - No Description Set
bool Global.rr_QueryBestResponse(handle a, handle b, handle c)—————
Params: ( hEnt, hQuery, hResult ) // Static : tests ‘query’ against entity’s response system and returns the best responsefound (or ‘’nil” if none found).
Returns: bool - No Description Set
3.2. Dota 2 Lua API 57
D2Moddin Documentation, Release 1.0
void Global.Say(handle entity, string message, bool teamOnly)—————
Have Entity say ‘’string’‘, and teamOnly or not
void Global.ScreenShake(Vector a, float b, float c, float d, float e, int f, bool g)—————
Start a screenshake with the following parameters. vecCenter, flAmplitude, flFrequency, flDuration, flRadius, eCom-mand( SHAKE_START = 0, SHAKE_STOP = 1 ), bAirShake
void Global.SendFrostivusTimeElapsedToGC()—————
No Description Set
void Global.SendFrostyPointsMessageToGC(handle a)—————
No Description Set
void Global.SendToConsole(string a)—————
Send a ‘’string” to the console as a client command
void Global.SendToServerConsole(string a)—————
Send a ‘’string” to the console as a server command
void Global.SetOpvarFloatAll(string a, string b, string c, float d)—————
Sets an opvar value for all players
void Global.SetOpvarFloatPlayer(string a, string b, string c, float d, handle e)—————
Sets an opvar value for a single player ( szStackName, szOperatorName, szOpvarName, flOpvarValue, hEnt )
void Global.SetQuestName(string a)—————
Set the current quest name.
void Global.SetQuestPhase(int a)—————
Set the current quest phase.
void Global.SetRenderingEnabled(ehandle a, bool b)—————
Set rendering on/off for an ‘’ehandle’‘
void Global.ShowGenericPopup(string title, string content, string unknown, string unknown, int containerType)—————
58 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void Global.ShowGenericPopupToPlayer(handle a, string b, string c, string d, string e, int f)—————
Show a generic popup dialog to a specific player.
void Global.ShowMessage(string a)—————
Print a hud message on all clients
handle Global.SpawnEntityFromTableSynchronous(string a, handle b)—————
Synchronously spawns a single entity from a ‘’table’‘
Returns: handle - No Description Set
bool Global.SpawnEntityGroupFromTable(handle groupSpawnTables, bool bAsync, handle hCallback)—————
Hierarchically spawn an entity group from a set of spawn tables.
:: –some code here
Returns: bool - No Description Set
int Global.SpawnEntityListFromTableAsynchronous(handle a, handle b)—————
Asynchronously spawn an entity group from a list of spawn table’s. A callback will be triggered when the spawningis complete
Returns: int - No Description Set
handle Global.SpawnEntityListFromTableSynchronous(handle a)—————
Synchronously spawn an entity group from a list of spawn table’s.
Returns: handle - No Description Set
Quaternion Global.SplineQuaternions(Quaternion a, Quaternion b, float c)—————
(quaternion,quaternion,’‘float’‘) very basic interpolation of v0 to v1 over t on [0,1]
Returns: Quaternion - No Description Set
Vector Global.SplineVectors(Vector a, Vector b, float c)—————
(‘’vector’‘,’‘vector’‘,’‘float’‘) very basic interpolation of v0 to v1 over t on [0,1]
Returns: Vector - No Description Set
void Global.StartSoundEvent(string a, handle b)—————
Start a sound event
3.2. Dota 2 Lua API 59
D2Moddin Documentation, Release 1.0
void Global.StopEffect(handle a, string b)—————
(hEntity, szEffectName)
void Global.StopListeningToAllGameEvents(handle a)—————
Stop listening to all game events within a specific context.
bool Global.StopListeningToGameEvent(int a)—————
Stop listening to a particular game event.
Returns: bool - No Description Set
void Global.StopSoundEvent(string a, handle b)—————
Stops a sound event
void Global.StopSoundOn(string soundName, handle playingEntity)—————
Stop named sound on Entity
bool Global.StringToFile(string a, string b)—————
Store a ‘’string” to a file for later reading
Returns: bool - No Description Set
float Global.Time()—————
Get the current server time
Returns: float - No Description Set
bool Global.TraceCollideable(handle a)—————
Pass ‘’table” - Inputs: start, end, ent, (optional mins, maxs) – outputs: pos, fraction, hit, startsolid, normal
Returns: bool - No Description Set
bool Global.TraceHull(handle a)—————
Pass ‘’table” - Inputs: start, end, min, max, mask, ignore – outputs: pos, fraction, hit, enthit, startsolid
Returns: bool - No Description Set
bool Global.TraceLine(handle a)—————
Pass ‘’table” - Inputs: startpos, endpos, mask, ignore – outputs: pos, fraction, hit, enthit, startsolid
Returns: bool - No Description Set
60 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void Global.UnloadSpawnGroup(string a)—————
Unload a spawn group by name
void Global.UnloadSpawnGroupByHandle(int a)—————
Unload a spawn group by ‘’handle’‘
void Global.UpdateEventPoints(handle a)—————
No Description Set
void Global.UTIL_Remove(handle a)—————
Removes the specified entity
void Global.UTIL_RemoveImmediate(handle a)—————
Immediately removes the specified entity
QAngle Global.VectorToAngles(Vector a)—————
Get Qangles (with no roll) for a ‘’Vector’‘.
Returns: QAngle - No Description Set
void Global.Warning(string a)—————
Print a warning
void CBaseEntity.ApplyAbsVelocityImpulse(Vector a)—————
Apply a Velocity Impulse
void CBaseEntity.ApplyLocalAngularVelocityImpulse(Vector a)—————
Apply an Ang Velocity Impulse
void CBaseEntity.EmitSound(string soundName)—————
void CBaseEntity.EmitSoundParams(string soundName, int pitch, float volume, float soundTime)—————
Plays/modifies a sound from this entity. changes sound if Pitch and/or Volume or SoundTime is > 0.
QAngle CBaseEntity.EyeAngles()—————
Get the qangles that this entity is looking at.
Returns: QAngle - No Description Set
3.2. Dota 2 Lua API 61
D2Moddin Documentation, Release 1.0
Vector CBaseEntity.EyePosition()—————
Get ‘’vector” to eye position - absolute coords
Returns: Vector - No Description Set
handle CBaseEntity.FirstMoveChild()—————
No Description Set
Returns: handle - No Description Set
void CBaseEntity.GatherCriteria(handle a)—————
Returns a ‘’table” containing the criteria that would be used for response queries on this entity. This is the same as the‘’table” that is passed to response rule script function callbacks.
Vector CBaseEntity.GetAbsOrigin()—————
No Description Set
Returns: Vector - No Description Set
QAngle CBaseEntity.GetAngles()—————
No Description Set
Returns: QAngle - No Description Set
Vector CBaseEntity.GetAnglesAsVector()—————
Get entity pitch, yaw, roll as a ‘’vector’‘
Returns: Vector - No Description Set
Vector CBaseEntity.GetAngularVelocity()—————
Get the local angular velocity - returns a ‘’vector” of pitch,yaw,roll
Returns: Vector - No Description Set
Vector CBaseEntity.GetBaseVelocity()—————
Get Base velocity
Returns: Vector - No Description Set
Vector CBaseEntity.GetBoundingMaxs()—————
Get a ‘’vector” containing max bounds, centered on object
Returns: Vector - No Description Set
62 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
Vector CBaseEntity.GetBoundingMins()—————
Get a ‘’vector” containing min bounds, centered on object
Returns: Vector - No Description Set
table CBaseEntity.GetBounds()—————
Get a ‘’table” containing the ‘Mins’ & ‘Maxs’ ‘’vector” bounds, centered on object
Returns: table - No Description Set
Vector CBaseEntity.GetCenter()—————
Get ‘’vector” to center of object - absolute coords
Returns: Vector - No Description Set
handle CBaseEntity.GetChildren()—————
Get the entities parented to this entity.
Returns: handle - No Description Set
table CBaseEntity.GetContext(string a)—————
GetContext( name ): looks up a context and returns it if available. May return ‘’string’‘, ‘’float’‘, or ‘’nil” (if thecontext isn’t found)
Returns: table - No Description Set
Vector CBaseEntity.GetForwardVector()—————
Get the forward ‘’vector” of the entity
Returns: Vector - No Description Set
int CBaseEntity.GetHealth()—————
No Description Set
Returns: int - No Description Set
QAngle CBaseEntity.GetLocalAngularVelocity()—————
Maybe local angvel
Returns: QAngle - No Description Set
Vector CBaseEntity.GetLocalVelocity()—————
Get Entity relative velocity
3.2. Dota 2 Lua API 63
D2Moddin Documentation, Release 1.0
Returns: Vector - No Description Set
int CBaseEntity.GetMaxHealth()—————
No Description Set
Returns: int - No Description Set
string CBaseEntity.GetModelName()—————
Returns the name of the model
Returns: string - No Description Set
handle CBaseEntity.GetMoveParent()—————
If in hierarchy, retrieves the entity’s parent
Returns: handle - No Description Set
Vector CBaseEntity.GetOrigin()—————
No Description Set
Returns: Vector - No Description Set
handle CBaseEntity.GetOwner()—————
Gets this entity’s owner
Returns: handle - No Description Set
handle CBaseEntity.GetOwnerEntity()—————
Get the owner entity, if there is one
Returns: handle - No Description Set
Vector CBaseEntity.GetRightVector()—————
Get the right ‘’vector” of the entity
Returns: Vector - No Description Set
handle CBaseEntity.GetRootMoveParent()—————
If in hierarchy, walks up the hierarchy to find the root parent
Returns: handle - No Description Set
64 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
float CBaseEntity.GetSoundDuration(string soundName, string actormodelname)—————
Returns ‘’float” duration of the sound. Takes soundname and optional actormodelname.
Returns: float - No Description Set
int CBaseEntity.GetTeam()—————
No Description Set
Returns: int - No Description Set
Vector CBaseEntity.GetUpVector()—————
Get the up ‘’vector” of the entity
Returns: Vector - No Description Set
Vector CBaseEntity.GetVelocity()—————
No Description Set
Returns: Vector - No Description Set
bool CBaseEntity.IsAlive()—————
No Description Set.
Returns: bool - No Description Set
bool CBaseEntity.IsPlayer()—————
Is this a player entity?
Returns: bool - No Description Set
void CBaseEntity.Kill()—————
No Description Set
handle CBaseEntity.NextMovePeer()—————
No Description Set
Returns: handle - No Description Set
void CBaseEntity.OverrideFriction(float a, float b)—————
Takes duration, value for a temporary override
void CBaseEntity.PrecacheScriptSound(string a)—————
Precache a sound for later playing.
3.2. Dota 2 Lua API 65
D2Moddin Documentation, Release 1.0
void CBaseEntity.SetAbsOrigin(Vector origin)—————
SetAbsOrigin
void CBaseEntity.SetAngles(float pitch, float yaw, float roll)—————
Set entity pitch, yaw, roll
void CBaseEntity.SetAngularVelocity(float pitch, float yaw, float roll)—————
Set the local angular velocity - takes ‘’float” pitch,yaw,roll velocities
void CBaseEntity.SetContext(string a, string b, float c)—————
SetContext( name , value, duration ): store any key/value pair in this entity’s dialog contexts. Value must be a ‘’string’‘.Will last for duration (set 0 to mean ‘forever’).
void CBaseEntity.SetContextNum(string a, float b, float c)—————
SetContext( name , value, duration ): store any key/value pair in this entity’s dialog contexts. Value must be a number(‘’int” or ‘’float’‘). Will last for duration (set 0 to mean ‘forever’).
void CBaseEntity.SetContextThink(string a, handle b, float c)—————
Set a think function on this entity.
void CBaseEntity.SetForwardVector(Vector forwardVec)—————
Set the orientation of the entity to have this forward ‘’forwardVec’‘
void CBaseEntity.SetFriction(float a)—————
Set PLAYER friction, ignored for objects
void CBaseEntity.SetGravity(float a)—————
Set PLAYER gravity, ignored for objects
void CBaseEntity.SetHealth(int hp)—————
No Description Set
void CBaseEntity.SetMaxHealth(int maxHP)—————
No Description Set
66 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CBaseEntity.SetModel(string modelName)—————
No Description Set
void CBaseEntity.SetOrigin(Vector origin)—————
No Description Set
void CBaseEntity.SetOwner(handle owningEntity)—————
Sets this entity’s owner
void CBaseEntity.SetParent(handle a, string b)—————
Set the parent for this entity.
void CBaseEntity.SetRenderColor(int a, int b, int c)—————
SetRenderColor( r, g, b ): Sets the render color of the entity.
void CBaseEntity.SetSize(Vector a, Vector b)—————
No Description Set
void CBaseEntity.SetTeam(int team)—————
No Description Set
void CBaseEntity.SetVelocity(Vector a)—————
No Description Set
void CBaseEntity.StopSound(string soundName)—————
Stops a named sound playing from this entity.
void CBaseEntity.Trigger()—————
Fires off this entity’s OnTrigger responses
handle CEntities.CreateByClassname(string className)—————
Creates an entity by classname
Returns: handle - No Description Set
3.2. Dota 2 Lua API 67
D2Moddin Documentation, Release 1.0
table CEntities.FindAllByClassname(string a)—————
Finds all entities by class name. Returns an array containing all the found entities.
Returns: table - No Description Set
table CEntities.FindAllByClassnameWithin(string a, Vector b, float c)—————
Find entities by class name within a radius.
Returns: table - No Description Set
table CEntities.FindAllByModel(string modelName)—————
Find entities by model name.
Returns: table - No Description Set
table CEntities.FindAllByName(string name)—————
Find all entities by name. Returns an array containing all the found entities in it.
Returns: table - No Description Set
table CEntities.FindAllByNameWithin(string name, Vector origin, float maxRadius)—————
Find entities by name within a radius.
Returns: table - No Description Set
table CEntities.FindAllByTarget(string targetName)—————
Find entities by targetname.
Returns: table - No Description Set
table CEntities.FindAllInSphere(Vector origin, float maxRadius)—————
Find entities within a radius.
Returns: table - No Description Set
handle CEntities.FindByClassname(handle startFrom, string className)—————
Find entities by class name. Pass ‘’nil” to start an iteration, or reference to a previously found entity to continue asearch
Returns: handle - No Description Set
handle CEntities.FindByClassnameNearest(string className, Vector origin, float maxRadius)—————
Find entities by class name nearest to a point.
Returns: handle - No Description Set
68 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
handle CEntities.FindByClassnameWithin(handle startFrom, string className, Vector origin, float maxRadius)—————
Find entities by class name within a radius. Pass ‘’nil” to start an iteration, or reference to a previously found entity tocontinue a search
Returns: handle - No Description Set
handle CEntities.FindByModel(handle startFrom, string modelName)—————
Find entities by model name. Pass ‘’nil” to start an iteration, or reference to a previously found entity to continue asearch
Returns: handle - No Description Set
handle CEntities.FindByModelWithin(handle startFrom, string modelName, Vector origin, float maxRadius)—————
Find entities by model name within a radius. Pass ‘’nil” to start an iteration, or reference to a previously found entityto continue a search
Returns: handle - No Description Set
handle CEntities.FindByName(handle lastEnt, string searchString)—————
Find entities by name. Pass ‘’nil” to start an iteration, or reference to a previously found entity to continue a search
Returns: handle - No Description Set
handle CEntities.FindByNameNearest(string name, Vector origin, float maxRadius)—————
Find entities by name nearest to a point.
Returns: handle - No Description Set
handle CEntities.FindByNameWithin(handle startFrom, string name, Vector origin, float maxRadius)—————
Find entities by name within a radius. Pass ‘’nil” to start an iteration, or reference to a previously found entity tocontinue a search
Returns: handle - No Description Set
handle CEntities.FindByTarget(handle startFrom, string targetName)—————
Find entities by targetname. Pass ‘’nil” to start an iteration, or reference to a previously found entity to continue asearch
Returns: handle - No Description Set
handle CEntities.FindInSphere(handle startFrom, Vector origin, float maxRadius)—————
Find entities within a radius. Pass ‘’nil” to start an iteration, or reference to a previously found entity to continue asearch
3.2. Dota 2 Lua API 69
D2Moddin Documentation, Release 1.0
Returns: handle - No Description Set
handle CEntities.First()—————
Begin an iteration over the list of entities
Returns: handle - No Description Set
handle CEntities.Next(handle startFrom)—————
Continue an iteration over the list of entities, providing reference to a previously found entity
Returns: handle - No Description Set
void CEntityInstance.ConnectOutput(string a, string b)—————
Adds an I/O connection that will call the named function on this entity when the specified output fires.
void CEntityInstance.Destroy()—————
No Description Set
void CEntityInstance.DisconnectOutput(string a, string b)—————
Removes a connected script function from an I/O event on this entity.
void CEntityInstance.DisconnectRedirectedOutput(string a, string b, handle c)—————
Removes a connected script function from an I/O event on the passed entity.
int CEntityInstance.entindex()—————
No Description Set
Returns: int - No Description Set
void CEntityInstance.FireOutput(string a, handle b, handle c, table d, float e)—————
Fire an entity output
string CEntityInstance.GetClassname()—————
No Description Set
Returns: string - No Description Set
string CEntityInstance.GetDebugName()—————
Get the entity name w/help if not defined (i.e. classname/etc)
Returns: string - No Description Set
70 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
ehandle CEntityInstance.GetEntityHandle()—————
Get the entity as an EHANDLE
Returns: ehandle - No Description Set
int CEntityInstance.GetEntityIndex()—————
No Description Set
Returns: int - No Description Set
int CEntityInstance.GetIntAttr(string a)—————
Get Integer Attribute
Returns: int - No Description Set
string CEntityInstance.GetName()—————
No Description Set
Returns: string - No Description Set
handle CEntityInstance.GetOrCreatePrivateScriptScope()—————
Retrieve, creating if necessary, the private per-instance script-side data associated with an entity
Returns: handle - No Description Set
handle CEntityInstance.GetOrCreatePublicScriptScope()—————
Retrieve, creating if necessary, the public script-side data associated with an entity
Returns: handle - No Description Set
handle CEntityInstance.GetPrivateScriptScope()—————
Retrieve the private per-instance script-side data associated with an entity
Returns: handle - No Description Set
handle CEntityInstance.GetPublicScriptScope()—————
Retrieve the public script-side data associated with an entity
Returns: handle - No Description Set
void CEntityInstance.RedirectOutput(string a, string b, handle c)—————
Adds an I/O connection that will call the named function on the passed entity when the specified output fires.
3.2. Dota 2 Lua API 71
D2Moddin Documentation, Release 1.0
void CEntityInstance.RemoveSelf()—————
Delete this entity
void CEntityInstance.SetIntAttr(string a, int b)—————
Set Integer Attribute
void CDOTABaseAbility.CastAbility()—————
No Description Set
bool CDOTABaseAbility.ContinueCasting()—————
No Description Set
Returns: bool - No Description Set
void CDOTABaseAbility.CreateVisibilityNode(Vector a, float b, float c)—————
No Description Set
void CDOTABaseAbility.DecrementModifierRefCount()—————
No Description Set
void CDOTABaseAbility.EndChannel(bool a)—————
Param: ‘’bool” bInterrupted
void CDOTABaseAbility.EndCooldown()—————
Clear the cooldown remaining on this ability.
int CDOTABaseAbility.GetAbilityDamage()—————
No Description Set
Returns: int - No Description Set
int CDOTABaseAbility.GetAbilityDamageType()—————
No Description Set
Returns: int - No Description Set
int CDOTABaseAbility.GetAbilityIndex()—————
No Description Set
Returns: int - No Description Set
72 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
string CDOTABaseAbility.GetAbilityName()—————
No Description Set
Returns: string - No Description Set
int CDOTABaseAbility.GetAbilityTargetFlags()—————
No Description Set
Returns: int - No Description Set
int CDOTABaseAbility.GetAbilityTargetTeam()—————
No Description Set
Returns: int - No Description Set
int CDOTABaseAbility.GetAbilityTargetType()—————
No Description Set
Returns: int - No Description Set
int CDOTABaseAbility.GetAbilityType()—————
No Description Set
Returns: int - No Description Set
bool CDOTABaseAbility.GetAnimationIgnoresModelScale()—————
No Description Set
Returns: bool - No Description Set
string CDOTABaseAbility.GetAssociatedPrimaryAbilities()—————
No Description Set
Returns: string - No Description Set
string CDOTABaseAbility.GetAssociatedSecondaryAbilities()—————
No Description Set
Returns: string - No Description Set
bool CDOTABaseAbility.GetAutoCastState()—————
No Description Set
Returns: bool - No Description Set
3.2. Dota 2 Lua API 73
D2Moddin Documentation, Release 1.0
float CDOTABaseAbility.GetBackswingTime()—————
No Description Set
Returns: float - No Description Set
int CDOTABaseAbility.GetBehavior()—————
No Description Set
Returns: int - No Description Set
handle CDOTABaseAbility.GetCaster()—————
No Description Set
Returns: handle - No Description Set
float CDOTABaseAbility.GetCastPoint()—————
No Description Set
Returns: float - No Description Set
int CDOTABaseAbility.GetCastRange()—————
No Description Set
Returns: int - No Description Set
int CDOTABaseAbility.GetChannelledManaCostPerSecond(int a)—————
No Description Set
Returns: int - No Description Set
float CDOTABaseAbility.GetChannelStartTime()—————
No Description Set
Returns: float - No Description Set
float CDOTABaseAbility.GetChannelTime()—————
No Description Set
Returns: float - No Description Set
handle CDOTABaseAbility.GetCloneSource()—————
No Description Set
Returns: handle - No Description Set
74 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int CDOTABaseAbility.GetConceptRecipientType()—————
No Description Set
Returns: int - No Description Set
float CDOTABaseAbility.GetCooldown(int a)—————
Get the cooldown duration for this ability at a given level, not the amount of cooldown actually left.
Returns: float - No Description Set
float CDOTABaseAbility.GetCooldownTime()—————
No Description Set
Returns: float - No Description Set
float CDOTABaseAbility.GetCooldownTimeRemaining()—————
No Description Set
Returns: float - No Description Set
Vector CDOTABaseAbility.GetCursorPosition()—————
No Description Set
Returns: Vector - No Description Set
handle CDOTABaseAbility.GetCursorTarget()—————
No Description Set
Returns: handle - No Description Set
bool CDOTABaseAbility.GetCursorTargetingNothing()—————
No Description Set
Returns: bool - No Description Set
float CDOTABaseAbility.GetDuration()—————
No Description Set
Returns: float - No Description Set
int CDOTABaseAbility.GetGoldCost(int a)—————
No Description Set
Returns: int - No Description Set
3.2. Dota 2 Lua API 75
D2Moddin Documentation, Release 1.0
int CDOTABaseAbility.GetGoldCostForUpgrade(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTABaseAbility.GetHeroLevelRequiredToUpgrade()—————
No Description Set
Returns: int - No Description Set
string CDOTABaseAbility.GetIntrinsicModifierName()—————
No Description Set
Returns: string - No Description Set
int CDOTABaseAbility.GetLevel()—————
Get the current level of the ability
Returns: int - No Description Set
table CDOTABaseAbility.GetLevelSpecialValueFor(string a, int b)—————
No Description Set
Returns: table - No Description Set
int CDOTABaseAbility.GetManaCost(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTABaseAbility.GetMaxLevel()—————
No Description Set
Returns: int - No Description Set
float CDOTABaseAbility.GetModifierValue()—————
No Description Set
Returns: float - No Description Set
float CDOTABaseAbility.GetModifierValueBonus()—————
No Description Set
Returns: float - No Description Set
76 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
float CDOTABaseAbility.GetPlaybackRateOverride()—————
No Description Set
Returns: float - No Description Set
string CDOTABaseAbility.GetSharedCooldownName()—————
No Description Set
Returns: string - No Description Set
table CDOTABaseAbility.GetSpecialValueFor(string a)—————
No Description Set
Returns: table - No Description Set
string CDOTABaseAbility.GetStolenActivityModifier()—————
No Description Set
Returns: string - No Description Set
bool CDOTABaseAbility.GetToggleState()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.HeroXPChange(float a)—————
No Description Set
Returns: bool - No Description Set
void CDOTABaseAbility.IncrementModifierRefCount()—————
No Description Set
bool CDOTABaseAbility.IsActivated()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsAttributeBonus()—————
No Description Set
Returns: bool - No Description Set
3.2. Dota 2 Lua API 77
D2Moddin Documentation, Release 1.0
bool CDOTABaseAbility.IsChanneling()—————
Returns whether the ability is currently channeling.
Returns: bool - No Description Set
bool CDOTABaseAbility.IsCooldownReady()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsCosmetic()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsFullyCastable()—————
Returns whether the ability can be cast.
Returns: bool - No Description Set
bool CDOTABaseAbility.IsHidden()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsHiddenWhenStolen()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsInAbilityPhase()—————
Returns whether the ability is currently casting.
Returns: bool - No Description Set
bool CDOTABaseAbility.IsItem()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsOwnersGoldEnough(int a)—————
No Description Set
Returns: bool - No Description Set
78 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
bool CDOTABaseAbility.IsOwnersGoldEnoughForUpgrade()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsOwnersManaEnough()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsPassive()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsSharedWithTeammates()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsStealable()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsStolen()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsToggle()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.IsTrained()—————
No Description Set
Returns: bool - No Description Set
void CDOTABaseAbility.MarkAbilityButtonDirty()—————
Mark the ability button for this ability as needing a refresh
3.2. Dota 2 Lua API 79
D2Moddin Documentation, Release 1.0
int CDOTABaseAbility.NumModifiersUsingAbility()—————
No Description Set
Returns: int - No Description Set
void CDOTABaseAbility.OnAbilityPhaseInterrupted()—————
No Description Set
bool CDOTABaseAbility.OnAbilityPhaseStart()—————
No Description Set
Returns: bool - No Description Set
void CDOTABaseAbility.OnAbilityPinged()—————
No Description Set
void CDOTABaseAbility.OnChannelFinish(bool a)—————
No Description Set
void CDOTABaseAbility.OnChannelThink(float a)—————
No Description Set
void CDOTABaseAbility.OnHeroCalculateStatBonus()—————
No Description Set
void CDOTABaseAbility.OnHeroLevelUp()—————
No Description Set
void CDOTABaseAbility.OnInventoryContentsChanged()—————
No Description Set
void CDOTABaseAbility.OnOwnerDied()—————
No Description Set
void CDOTABaseAbility.OnOwnerSpawned()—————
No Description Set
80 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTABaseAbility.OnSpellStart()—————
No Description Set
void CDOTABaseAbility.OnToggle()—————
No Description Set
void CDOTABaseAbility.OnUpgrade()—————
No Description Set
void CDOTABaseAbility.PayGoldCost()—————
No Description Set
void CDOTABaseAbility.PayGoldCostForUpgrade()—————
No Description Set
void CDOTABaseAbility.PayManaCost()—————
No Description Set
bool CDOTABaseAbility.PlaysDefaultAnimWhenStolen()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.ProcsMagicStick()—————
No Description Set
Returns: bool - No Description Set
bool CDOTABaseAbility.RefCountsModifiers()—————
No Description Set
Returns: bool - No Description Set
void CDOTABaseAbility.RefundManaCost()—————
No Description Set
bool CDOTABaseAbility.ResetToggleOnRespawn()—————
No Description Set
Returns: bool - No Description Set
3.2. Dota 2 Lua API 81
D2Moddin Documentation, Release 1.0
void CDOTABaseAbility.SetAbilityIndex(int a)—————
No Description Set
void CDOTABaseAbility.SetActivated(bool a)—————
No Description Set
void CDOTABaseAbility.SetChanneling(bool a)—————
No Description Set
void CDOTABaseAbility.SetHidden(bool a)—————
No Description Set
void CDOTABaseAbility.SetInAbilityPhase(bool a)—————
No Description Set
void CDOTABaseAbility.SetLevel(int a)—————
Sets the level of this ability.
void CDOTABaseAbility.SetOverrideCastPoint(float a)—————
No Description Set
void CDOTABaseAbility.SetRefCountsModifiers(bool a)—————
No Description Set
void CDOTABaseAbility.SetStolen(bool a)—————
No Description Set
bool CDOTABaseAbility.ShouldUseResources()—————
No Description Set
Returns: bool - No Description Set
void CDOTABaseAbility.SpeakAbilityConcept(int a)—————
No Description Set
82 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
bool CDOTABaseAbility.SpeakTrigger()—————
No Description Set
Returns: bool - No Description Set
void CDOTABaseAbility.StartCooldown(float a)—————
param: flCooldown
void CDOTABaseAbility.ToggleAbility()—————
No Description Set
void CDOTABaseAbility.ToggleAutoCast()—————
No Description Set
void CDOTABaseAbility.UpgradeAbility()—————
No Description Set
void CDOTABaseAbility.UseResources(bool a, bool b, bool c)—————
No Description Set
void CDOTA_Ability_Animation_Attack.SetPlaybackRate(float a)—————
Override playbackrate
void CDOTA_Ability_Animation_TailSpin.SetPlaybackRate(float a)—————
Override playbackrate
void CDOTA_Ability_Nian_Leap.SetPlaybackRate(float a)—————
Override playbackrate
void CDOTA_Ability_Nian_Dive.SetPlaybackRate(float a)—————
Override playbackrate
int CDOTA_Ability_Nian_Roar.GetCastCount()—————
Number of times Nian has used the roar
Returns: int - No Description Set
3.2. Dota 2 Lua API 83
D2Moddin Documentation, Release 1.0
handle CDOTA_Item.GetContainer()—————
Get the container for this item.
Returns: handle - No Description Set
int CDOTA_Item.GetCost()—————
No Description Set
Returns: int - No Description Set
int CDOTA_Item.GetCurrentCharges()—————
Get the number of charges this item currently has.
Returns: int - No Description Set
int CDOTA_Item.GetInitialCharges()—————
Get the initial number of charges this item has.
Returns: int - No Description Set
handle CDOTA_Item.GetPurchaser()—————
Get the purchaser for this item.
Returns: handle - No Description Set
float CDOTA_Item.GetPurchaseTime()—————
Get the purchase time of this item
Returns: float - No Description Set
int CDOTA_Item.GetShareability()—————
No Description Set
Returns: int - No Description Set
bool CDOTA_Item.IsPermanent()—————
Is this a permanent item?
Returns: bool - No Description Set
void CDOTA_Item.LaunchLoot(bool a, float b, float c, Vector d)—————
No Description Set
84 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTA_Item.SetCurrentCharges(int a)—————
Set the number of charges on this item
void CDOTA_Item.SetPurchaser(handle a)—————
Set the purchaser of record for this item.
void CDOTA_Item.SetPurchaseTime(float a)—————
Set the purchase time of this item
void CDOTA_Item.SetStacksWithOtherOwners(bool a)—————
No Description Set
bool CDOTA_Item.StacksWithOtherOwners()—————
No Description Set
Returns: bool - No Description Set
void CDOTA_Item.Think()—————
Think this item
handle CDOTA_Item_Physical.GetContainedItem()—————
Returned the contained item.
Returns: handle - No Description Set
float CDOTA_Item_Physical.GetCreationTime()—————
Returns the game time when this item was created in the world
Returns: float - No Description Set
void CDOTA_Item_Physical.SetContainedItem(handle a)—————
Set the contained item.
void CDOTA_Item_DataDriven.ApplyDataDrivenModifier(handle source, handle target, string modifier_name, han-dle modifierArgs)—————
handle CDOTA_Unit_Nian.GetHorn()—————
Is the Nian horn?
Returns: handle - No Description Set
3.2. Dota 2 Lua API 85
D2Moddin Documentation, Release 1.0
handle CDOTA_Unit_Nian.GetTail()—————
Is the Nian’s tail broken?
Returns: handle - No Description Set
bool CDOTA_Unit_Nian.IsHornAlive()—————
Is the Nian’s horn broken?
Returns: bool - No Description Set
bool CDOTA_Unit_Nian.IsTailAlive()—————
Is the Nian’s tail broken?
Returns: bool - No Description Set
bool CBasePlayer.IsNoclipping()—————
Returns true if the player is in noclip mode.
Returns: bool - No Description Set
handle CDOTAPlayer.GetAssignedHero()—————
Get the player’s hero.
Returns: handle - No Description Set
handle CDOTAPlayer.GetControlledRPGUnit()—————
Get the RPG unit this player controls.
Returns: handle - No Description Set
int CDOTAPlayer.GetPlayerID()—————
Get the player’s official PlayerID; notably is -1 when the player isn’t yet on a team.
Returns: int - No Description Set
void CDOTAPlayer.MakeRandomHeroSelection()—————
Randoms this player’s hero.
void CDOTAPlayer.SetKillCamUnit(handle a)—————
Set the kill cam unit for this hero.
86 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTAPlayer.SetMusicStatus(int nMusicStatus, float flIntensity)—————
Set the music status for this player, note this will only really apply if dota_music_battle_enable is off.
void CDOTA_PlayerResource.AddAegisPickup(int a)—————
No Description Set
void CDOTA_PlayerResource.AddClaimedFarm(int a, float b)—————
No Description Set
void CDOTA_PlayerResource.AddGoldSpentOnSupport(int a, int b)—————
No Description Set
void CDOTA_PlayerResource.AddRunePickup(int a)—————
No Description Set
bool CDOTA_PlayerResource.AreUnitsSharedWithPlayerID(int a, int b)—————
No Description Set
Returns: bool - No Description Set
void CDOTA_PlayerResource.ClearKillsMatrix(int a)—————
No Description Set
void CDOTA_PlayerResource.ClearLastHitMultikill(int a)—————
No Description Set
void CDOTA_PlayerResource.ClearLastHitStreak(int a)—————
No Description Set
void CDOTA_PlayerResource.ClearRawPlayerDamageMatrix(int a)—————
No Description Set
void CDOTA_PlayerResource.ClearStreak(int a)—————
No Description Set
3.2. Dota 2 Lua API 87
D2Moddin Documentation, Release 1.0
int CDOTA_PlayerResource.GetAegisPickups(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetAssists(int a)—————
No Description Set
Returns: int - No Description Set
<> CDOTA_PlayerResource.GetBroadcasterChannel(int a)—————
No Description Set
Returns: <> - No Description Set
<> CDOTA_PlayerResource.GetBroadcasterChannelSlot(int a)—————
No Description Set
Returns: <> - No Description Set
int CDOTA_PlayerResource.GetClaimedDenies(int a)—————
No Description Set
Returns: int - No Description Set
float CDOTA_PlayerResource.GetClaimedFarm(int a)—————
No Description Set
Returns: float - No Description Set
int CDOTA_PlayerResource.GetClaimedMisses(int a)—————
No Description Set
Returns: int - No Description Set
<> CDOTA_PlayerResource.GetConnectionState(int a)—————
No Description Set
Returns: <> - No Description Set
int CDOTA_PlayerResource.GetCreepDamageTaken(int a)—————
No Description Set
Returns: int - No Description Set
88 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
float CDOTA_PlayerResource.GetCustomBuybackCooldown(int a)—————
No Description Set
Returns: float - No Description Set
int CDOTA_PlayerResource.GetCustomBuybackCost(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetDamageDoneToHero(int a, int b)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetDeaths(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetDenies(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetEventPointsForPlayerID(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetEventPremiumPointsGranted(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetEventRankGranted(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetGold(int a)—————
No Description Set
Returns: int - No Description Set
3.2. Dota 2 Lua API 89
D2Moddin Documentation, Release 1.0
int CDOTA_PlayerResource.GetGoldBagsCollected(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetGoldLostToDeath(int a)—————
No Description Set
Returns: int - No Description Set
float CDOTA_PlayerResource.GetGoldPerMin(int a)—————
No Description Set
Returns: float - No Description Set
int CDOTA_PlayerResource.GetGoldSpentOnBuybacks(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetGoldSpentOnConsumables(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetGoldSpentOnItems(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetGoldSpentOnSupport(int a)—————
No Description Set
Returns: int - No Description Set
float CDOTA_PlayerResource.GetHealing(int a)—————
No Description Set
Returns: float - No Description Set
int CDOTA_PlayerResource.GetHeroDamageTaken(int a)—————
No Description Set
Returns: int - No Description Set
90 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int CDOTA_PlayerResource.GetKills(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetKillsDoneToHero(int a, int b)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetLastHitMultikill(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetLastHits(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetLastHitStreak(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetLevel(int playerID)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetMisses(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetNearbyCreepDeaths(int a)—————
No Description Set
Returns: int - No Description Set
handle CDOTA_PlayerResource.GetNthCourierForTeam(int a, int b)—————
No Description Set
Returns: handle - No Description Set
3.2. Dota 2 Lua API 91
D2Moddin Documentation, Release 1.0
int CDOTA_PlayerResource.GetNthPlayerIDOnTeam(int a, int b)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetNumConsumablesPurchased(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetNumCouriersForTeam(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetNumItemsPurchased(int a)—————
No Description Set
Returns: int - No Description Set
handle CDOTA_PlayerResource.GetPlayer(int a)—————
No Description Set
Returns: handle - No Description Set
bool CDOTA_PlayerResource.GetPlayerLoadedCompletely(int a)—————
No Description Set
Returns: bool - No Description Set
string CDOTA_PlayerResource.GetPlayerName(int a)—————
No Description Set
Returns: string - No Description Set
bool CDOTA_PlayerResource.GetPlayerReservedState(int a)—————
No Description Set
Returns: bool - No Description Set
int CDOTA_PlayerResource.GetRawPlayerDamage(int a)—————
No Description Set
Returns: int - No Description Set
92 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int CDOTA_PlayerResource.GetReliableGold(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetRespawnSeconds(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetRoshanKills(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetRunePickups(int a)—————
No Description Set
Returns: int - No Description Set
handle CDOTA_PlayerResource.GetSelectedHeroEntity(int a)—————
No Description Set
Returns: handle - No Description Set
int CDOTA_PlayerResource.GetSelectedHeroID(int a)—————
No Description Set
Returns: int - No Description Set
string CDOTA_PlayerResource.GetSelectedHeroName(int a)—————
No Description Set
Returns: string - No Description Set
<> CDOTA_PlayerResource.GetSteamAccountID(int a)—————
No Description Set
Returns: <> - No Description Set
int CDOTA_PlayerResource.GetStreak(int a)—————
No Description Set
Returns: int - No Description Set
3.2. Dota 2 Lua API 93
D2Moddin Documentation, Release 1.0
float CDOTA_PlayerResource.GetStuns(int a)—————
No Description Set
Returns: float - No Description Set
int CDOTA_PlayerResource.GetTeam(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetTeamKills(int a)—————
No Description Set
Returns: int - No Description Set
float CDOTA_PlayerResource.GetTimeOfLastConsumablePurchase(int a)—————
No Description Set
Returns: float - No Description Set
float CDOTA_PlayerResource.GetTimeOfLastDeath(int a)—————
No Description Set
Returns: float - No Description Set
float CDOTA_PlayerResource.GetTimeOfLastItemPurchase(int a)—————
No Description Set
Returns: float - No Description Set
int CDOTA_PlayerResource.GetTotalEarnedGold(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetTotalEarnedXP(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetTotalGoldSpent(int a)—————
No Description Set
Returns: int - No Description Set
94 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int CDOTA_PlayerResource.GetTowerDamageTaken(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetTowerKills(int a)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetUnitShareMaskForPlayer(int a, int b)—————
No Description Set
Returns: int - No Description Set
int CDOTA_PlayerResource.GetUnreliableGold(int a)—————
No Description Set
Returns: int - No Description Set
float CDOTA_PlayerResource.GetXPPerMin(int a)—————
No Description Set
Returns: float - No Description Set
bool CDOTA_PlayerResource.HasRandomed(int a)—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_PlayerResource.HasRepicked(int playerID)—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_PlayerResource.HasSelectedHero(int a)—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_PlayerResource.HaveAllPlayersJoined()—————
No Description Set
Returns: bool - No Description Set
3.2. Dota 2 Lua API 95
D2Moddin Documentation, Release 1.0
void CDOTA_PlayerResource.HeroLevelUp(int a)—————
No Description Set
void CDOTA_PlayerResource.IncrementAssists(int playerID)—————
No Description Set
void CDOTA_PlayerResource.IncrementClaimedDenies(int a)—————
No Description Set
void CDOTA_PlayerResource.IncrementClaimedMisses(int a)—————
No Description Set
void CDOTA_PlayerResource.IncrementDeaths(int playerID)—————
No Description Set
void CDOTA_PlayerResource.IncrementDenies(int a)—————
No Description Set
void CDOTA_PlayerResource.IncrementGoldBagsCollected(int a)—————
No Description Set
void CDOTA_PlayerResource.IncrementKills(int playerID, int kills)—————
No Description Set
void CDOTA_PlayerResource.IncrementLastHitMultikill(int a)—————
No Description Set
void CDOTA_PlayerResource.IncrementLastHits(int a)—————
No Description Set
void CDOTA_PlayerResource.IncrementLastHitStreak(int a)—————
No Description Set
void CDOTA_PlayerResource.IncrementMisses(int a)—————
No Description Set
96 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTA_PlayerResource.IncrementNearbyCreepDeaths(int a)—————
No Description Set
void CDOTA_PlayerResource.IncrementStreak(int a)—————
No Description Set
void CDOTA_PlayerResource.IncrementTotalEarnedXP(int a, int b)—————
No Description Set
bool CDOTA_PlayerResource.IsBroadcaster(int a)—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_PlayerResource.IsDisableHelpSetForPlayerID(int a, int b)—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_PlayerResource.IsFakeClient(int a)—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_PlayerResource.IsHeroSelected(string a)—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_PlayerResource.IsHeroSharedWithPlayerID(int a, int b)—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_PlayerResource.IsValidPlayer(int playerID)—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_PlayerResource.IsValidPlayerID(int playerID)—————
No Description Set
Returns: bool - No Description Set
3.2. Dota 2 Lua API 97
D2Moddin Documentation, Release 1.0
bool CDOTA_PlayerResource.IsValidTeamPlayer(int playerID)—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_PlayerResource.IsValidTeamPlayerID(int playerID)—————
No Description Set
Returns: bool - No Description Set
int CDOTA_PlayerResource.ModifyGold(int playerID, int goldAmmt, bool reliable, int d)—————
No Description Set
Returns: int - No Description Set
handle CDOTA_PlayerResource.ReplaceHeroWith(int a, string b, int c, int d)—————
(playerID, heroClassName, gold, XP) - replaces the player’s hero with a new one of the specified class, gold and XP
Returns: handle - No Description Set
void CDOTA_PlayerResource.ResetBuybackCostTime(int a)—————
No Description Set
void CDOTA_PlayerResource.ResetTotalEarnedGold(int a)—————
No Description Set
void CDOTA_PlayerResource.SetBuybackCooldownTime(int a, float b)—————
No Description Set
void CDOTA_PlayerResource.SetBuybackGoldLimitTime(int a, float b)—————
No Description Set
void CDOTA_PlayerResource.SetCameraTarget(int a, handle b)—————
(playerID, entity) - force the given player’s camera to follow the given entity
void CDOTA_PlayerResource.SetCustomBuybackCooldown(int a, float b)—————
Set the buyback cooldown for this player.
98 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTA_PlayerResource.SetCustomBuybackCost(int a, int b)—————
Set the buyback cost for this player.
void CDOTA_PlayerResource.SetGold(int a, int b, bool c)—————
No Description Set
void CDOTA_PlayerResource.SetHasRandomed(int playerID)—————
No Description Set
void CDOTA_PlayerResource.SetHasRepicked(int playerID)—————
No Description Set
void CDOTA_PlayerResource.SetLastBuybackTime(int a, int b)—————
No Description Set
void CDOTA_PlayerResource.SetPlayerReservedState(int a, bool b)—————
No Description Set
void CDOTA_PlayerResource.SetUnitShareMaskForPlayer(int a, int b, int c, bool d)—————
No Description Set
void CDOTA_PlayerResource.SpendGold(int a, int b, int c)—————
No Description Set
void CDOTA_PlayerResource.UpdateTeamSlot(int a, int b)—————
No Description Set
int CDOTA_PlayerResource.WhoSelectedHero(string a)—————
No Description Set
Returns: int - No Description Set
void CDOTA_BaseNPC.AddAbility(string a)—————
Add an ability to this unit by name.
void CDOTA_BaseNPC.AddItem(handle a)—————
Add an item to this unit’s inventory.
3.2. Dota 2 Lua API 99
D2Moddin Documentation, Release 1.0
void CDOTA_BaseNPC.AddNewModifier(handle caster, handle optionalSourceAbility, string modifierName, handlemodifierData)—————
void CDOTA_BaseNPC.AddNoDraw()—————
Adds the no draw flag.
void CDOTA_BaseNPC.AlertNearbyUnits(handle a, handle b)—————
No Description Set
void CDOTA_BaseNPC.AngerNearbyUnits()—————
No Description Set
void CDOTA_BaseNPC.AttackNoEarlierThan(float a)—————
No Description Set
bool CDOTA_BaseNPC.AttackReady()—————
No Description Set
Returns: bool - No Description Set
float CDOTA_BaseNPC.BoundingRadius2D()—————
No Description Set
Returns: float - No Description Set
void CDOTA_BaseNPC.CastAbilityImmediately(handle a, int b)—————
Cast an ability immediately.
void CDOTA_BaseNPC.CastAbilityNoTarget(handle ability, int playerIndex)—————
Cast an ability with no target. ( hAbility, iPlayerIndex )
void CDOTA_BaseNPC.CastAbilityOnPosition(Vector a, handle b, int c)—————
Cast an ability on a position.
void CDOTA_BaseNPC.CastAbilityOnTarget(handle target, handle ability, int playerIndex)—————
Cast an ability on a target entity.
100 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTA_BaseNPC.CastAbilityToggle(handle a, int b)—————
Toggle an ability. ( hAbility, iPlayerIndex )
void CDOTA_BaseNPC.DisassembleItem(handle a)—————
Disassemble the passed item in this unit’s inventory.
void CDOTA_BaseNPC.DropItemAtPosition(Vector a, handle b)—————
Drop an item at a given point.
void CDOTA_BaseNPC.DropItemAtPositionImmediate(handle a, Vector b)—————
Immediately drop a carried item at a given position.
void CDOTA_BaseNPC.EjectItemFromStash(handle a)—————
Drops the selected item out of this unit’s stash.
handle CDOTA_BaseNPC.FindAbilityByName(string a)—————
Retrieve an ability by name from the unit.
Returns: handle - No Description Set
void CDOTA_BaseNPC.ForceKill(bool a)—————
Kill this unit immediately.
handle CDOTA_BaseNPC.GetAbilityByIndex(int a)—————
Retrieve an ability by index from the unit.
Returns: handle - No Description Set
int CDOTA_BaseNPC.GetAbilityCount()—————
No Description Set
Returns: int - No Description Set
float CDOTA_BaseNPC.GetAcquisitionRange()—————
Gets the range at which this unit will auto-acquire.
Returns: float - No Description Set
3.2. Dota 2 Lua API 101
D2Moddin Documentation, Release 1.0
float CDOTA_BaseNPC.GetAdditionalBattleMusicWeight()—————
Combat involving this creature will have this weight added to the music calcuations
Returns: float - No Description Set
float CDOTA_BaseNPC.GetAttackAnimationPoint()—————
No Description Set
Returns: float - No Description Set
int CDOTA_BaseNPC.GetAttackDamage()—————
Returns a random integer between the minimum and maximum base damage of the unit.
Returns: int - No Description Set
float CDOTA_BaseNPC.GetAttackRange()—————
Gets this unit’s attack range after all modifiers.
Returns: float - No Description Set
float CDOTA_BaseNPC.GetAttackRangeBuffer()—————
Gets the attack range buffer.
Returns: float - No Description Set
float CDOTA_BaseNPC.GetAttackSpeed()—————
No Description Set
Returns: float - No Description Set
float CDOTA_BaseNPC.GetAttacksPerSecond()—————
No Description Set
Returns: float - No Description Set
handle CDOTA_BaseNPC.GetAttackTarget()—————
No Description Set
Returns: handle - No Description Set
int CDOTA_BaseNPC.GetAverageTrueAttackDamage()—————
Returns the average value of the minimum and maximum damage values.
Returns: int - No Description Set
102 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int CDOTA_BaseNPC.GetBaseAttackRange()—————
Gets this unit’s attack range before modifiers.
Returns: int - No Description Set
float CDOTA_BaseNPC.GetBaseAttackTime()—————
No Description Set
Returns: float - No Description Set
int CDOTA_BaseNPC.GetBaseDamageMax()—————
Gets the minimum base damage.
Returns: int - No Description Set
int CDOTA_BaseNPC.GetBaseDamageMin()—————
Gets the minimum base damage.
Returns: int - No Description Set
int CDOTA_BaseNPC.GetBaseDayTimeVisionRange()—————
Returns the vision range before modifiers.
Returns: int - No Description Set
float CDOTA_BaseNPC.GetBaseHealthRegen()—————
No Description Set
Returns: float - No Description Set
float CDOTA_BaseNPC.GetBaseMagicalResistanceValue()—————
Returns base magical armor value.
Returns: float - No Description Set
float CDOTA_BaseNPC.GetBaseMaxHealth()—————
Gets the base max health value.
Returns: float - No Description Set
float CDOTA_BaseNPC.GetBaseMoveSpeed()—————
No Description Set
Returns: float - No Description Set
3.2. Dota 2 Lua API 103
D2Moddin Documentation, Release 1.0
int CDOTA_BaseNPC.GetBaseNightTimeVisionRange()—————
Returns the vision range before modifiers.
Returns: int - No Description Set
float CDOTA_BaseNPC.GetCastPoint(bool a)—————
Parameter: bAttack
Returns: float - No Description Set
float CDOTA_BaseNPC.GetCollisionPadding()—————
Returns the size of the collision padding around the hull.
Returns: float - No Description Set
float CDOTA_BaseNPC.GetConstantBasedManaRegen()—————
This Mana regen is derived from constant bonuses like Basilius.
Returns: float - No Description Set
float CDOTA_BaseNPC.GetCreationTime()—————
No Description Set
Returns: float - No Description Set
handle CDOTA_BaseNPC.GetCurrentActiveAbility()—————
Get the ability this unit is currently casting.
Returns: handle - No Description Set
int CDOTA_BaseNPC.GetCurrentVisionRange()—————
Gets the current vision range.
Returns: int - No Description Set
handle CDOTA_BaseNPC.GetCursorCastTarget()—————
No Description Set
Returns: handle - No Description Set
Vector CDOTA_BaseNPC.GetCursorPosition()—————
No Description Set
Returns: Vector - No Description Set
104 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
bool CDOTA_BaseNPC.GetCursorTargetingNothing()—————
No Description Set
Returns: bool - No Description Set
int CDOTA_BaseNPC.GetDayTimeVisionRange()—————
Returns the vision range after modifiers.
Returns: int - No Description Set
int CDOTA_BaseNPC.GetDeathXP()—————
Get the XP bounty on this unit
Returns: int - No Description Set
handle CDOTA_BaseNPC.GetForceAttackTarget()—————
No Description Set
Returns: handle - No Description Set
int CDOTA_BaseNPC.GetGoldBounty()—————
Get the gold bounty on this unit
Returns: int - No Description Set
float CDOTA_BaseNPC.GetHasteFactor()—————
No Description Set
Returns: float - No Description Set
int CDOTA_BaseNPC.GetHealth()—————
Get the health of this unit.
Returns: int - No Description Set
int CDOTA_BaseNPC.GetHealthDeficit()—————
Returns integer amount of health missing from max.
Returns: int - No Description Set
int CDOTA_BaseNPC.GetHealthPercent()—————
Get the current health percent of the unit.
Returns: int - No Description Set
3.2. Dota 2 Lua API 105
D2Moddin Documentation, Release 1.0
float CDOTA_BaseNPC.GetHealthRegen()—————
No Description Set
Returns: float - No Description Set
float CDOTA_BaseNPC.GetHullRadius()—————
Get the collision hull radius of this NPC
Returns: float - No Description Set
float CDOTA_BaseNPC.GetIdealSpeed()—————
Returns speed after all modifiers.
Returns: float - No Description Set
float CDOTA_BaseNPC.GetIncreasedAttackSpeed()—————
No Description Set
Returns: float - No Description Set
handle CDOTA_BaseNPC.GetInitialGoalEntity()—————
Returns the initial waypoint goal for this NPC
Returns: handle - No Description Set
handle CDOTA_BaseNPC.GetItemInSlot(int a)—————
Returns nth item in inventory slot (index is zero based)
Returns: handle - No Description Set
float CDOTA_BaseNPC.GetLastIdleChangeTime()—————
Get the last game time that this unit switched to/from idle state.
Returns: float - No Description Set
int CDOTA_BaseNPC.GetLevel()—————
Returns the level of this unit.
Returns: int - No Description Set
float CDOTA_BaseNPC.GetMagicalArmorValue()—————
Returns current magical armor value.
Returns: float - No Description Set
106 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int CDOTA_BaseNPC.GetMainControllingPlayer()—————
Returns the player ID of the controlling player.
Returns: int - No Description Set
float CDOTA_BaseNPC.GetMana()—————
Get the mana on this unit.
Returns: float - No Description Set
int CDOTA_BaseNPC.GetManaPercent()—————
Get the percent of mana remaining.
Returns: int - No Description Set
float CDOTA_BaseNPC.GetManaRegen()—————
No Description Set
Returns: float - No Description Set
int CDOTA_BaseNPC.GetMaxHealth()—————
Get the maximum health of this unit.
Returns: int - No Description Set
float CDOTA_BaseNPC.GetMaxMana()—————
Get the maximum mana of this unit.
Returns: float - No Description Set
float CDOTA_BaseNPC.GetModelRadius()—————
No Description Set
Returns: float - No Description Set
int CDOTA_BaseNPC.GetModifierCount()—————
How many modifiers does this unit have?
Returns: int - No Description Set
string CDOTA_BaseNPC.GetModifierNameByIndex(int a)—————
Get a modifier name by index.
Returns: string - No Description Set
3.2. Dota 2 Lua API 107
D2Moddin Documentation, Release 1.0
float CDOTA_BaseNPC.GetMoveSpeedModifier(float a)—————
No Description Set
Returns: float - No Description Set
bool CDOTA_BaseNPC.GetMustReachEachGoalEntity()—————
Get whether this NPC is required to reach each goal entity, rather than being allowed to ‘unkink’ their path
Returns: bool - No Description Set
int CDOTA_BaseNPC.GetNightTimeVisionRange()—————
Returns the vision range after modifiers.
Returns: int - No Description Set
int CDOTA_BaseNPC.GetOpposingTeamNumber()—————
No Description Set
Returns: int - No Description Set
float CDOTA_BaseNPC.GetPaddedCollisionRadius()—————
Get the collision hull radius (including padding) of this NPC
Returns: float - No Description Set
float CDOTA_BaseNPC.GetPercentageBasedManaRegen()—————
This Mana regen is derived from % bonuses (from items like Void Stone).
Returns: float - No Description Set
float CDOTA_BaseNPC.GetPhysicalArmorBaseValue()—————
Returns base physical armor value.
Returns: float - No Description Set
float CDOTA_BaseNPC.GetPhysicalArmorValue()—————
Returns current physical armor value.
Returns: float - No Description Set
handle CDOTA_BaseNPC.GetPlayerOwner()—————
Returns the player that owns this unit
Returns: handle - No Description Set
108 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int CDOTA_BaseNPC.GetPlayerOwnerID()—————
Get the owner player ID for this unit.
Returns: int - No Description Set
int CDOTA_BaseNPC.GetProjectileSpeed()—————
No Description Set
Returns: int - No Description Set
float CDOTA_BaseNPC.GetRangeToUnit(handle a)—————
No Description Set
Returns: float - No Description Set
float CDOTA_BaseNPC.GetSecondsPerAttack()—————
No Description Set
Returns: float - No Description Set
float CDOTA_BaseNPC.GetStatsBasedManaRegen()—————
Returns mana regen rate per intelligence.
Returns: float - No Description Set
int CDOTA_BaseNPC.GetTeamNumber()—————
Get the team number of this unit.
Returns: int - No Description Set
int CDOTA_BaseNPC.GetTotalPurchasedUpgradeGoldCost()—————
Get how much gold has been spent on ability upgrades.
Returns: int - No Description Set
string CDOTA_BaseNPC.GetUnitLabel()—————
No Description Set
Returns: string - No Description Set
string CDOTA_BaseNPC.GetUnitName()—————
No Description Set
Returns: string - No Description Set
3.2. Dota 2 Lua API 109
D2Moddin Documentation, Release 1.0
void CDOTA_BaseNPC.GiveMana(float a)—————
Give mana to this unit, this can be used for mana gained by abilities or item usage.
bool CDOTA_BaseNPC.HasAbility(string a)—————
See whether this unit has an ability by name.
Returns: bool - No Description Set
bool CDOTA_BaseNPC.HasAttackCapability()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.HasFlyingVision()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.HasFlyMovementCapability()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.HasGroundMovementCapability()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.HasInventory()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.HasItemInInventory(string a)—————
See whether this unit has an item by name.
Returns: bool - No Description Set
bool CDOTA_BaseNPC.HasModifier(string a)—————
Sees if this unit has a given modifier
Returns: bool - No Description Set
110 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
bool CDOTA_BaseNPC.HasMovementCapability()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.HasScepter()—————
No Description Set
Returns: bool - No Description Set
void CDOTA_BaseNPC.Heal(float a, handle b)—————
Heal this unit.
void CDOTA_BaseNPC.Hold()—————
Hold position.
void CDOTA_BaseNPC.Interrupt()—————
No Description Set
void CDOTA_BaseNPC.InterruptChannel()—————
No Description Set
void CDOTA_BaseNPC.InterruptMotionControllers(bool a)—————
Parameter boolean determines finding clear space.
bool CDOTA_BaseNPC.IsAlive()—————
Is this unit alive?
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsAncient()—————
Is this creature an Ancient?
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsAttackImmune()—————
No Description Set
Returns: bool - No Description Set
3.2. Dota 2 Lua API 111
D2Moddin Documentation, Release 1.0
bool CDOTA_BaseNPC.IsAttacking()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsAttackingEntity(handle a)—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsBlind()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsBlockDisabled()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsCommandRestricted()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsControllableByAnyPlayer()—————
Is this unit controlled by any non-bot player?
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsCreature()—————
Is this a Creature type NPC
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsDeniable()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsDisarmed()—————
No Description Set
Returns: bool - No Description Set
112 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
bool CDOTA_BaseNPC.IsDominated()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsEvadeDisabled()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsFrozen()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsHardDisarmed()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsHero()—————
Is this a hero or hero illusion?
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsHexed()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsIdle()—————
Is this creature currently idle?
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsIllusion()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsInvisible()—————
No Description Set
Returns: bool - No Description Set
3.2. Dota 2 Lua API 113
D2Moddin Documentation, Release 1.0
bool CDOTA_BaseNPC.IsInvulnerable()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsLowAttackPriority()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsMagicImmune()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsMechanical()—————
Is the unit mechanical?
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsMovementImpaired()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsMuted()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsNeutralUnitType()—————
Is this a neutral?
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsNightmared()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsOpposingTeam(int a)—————
No Description Set
Returns: bool - No Description Set
114 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
bool CDOTA_BaseNPC.IsOutOfGame()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsOwnedByAnyPlayer()—————
Is this unit owned by any non-bot player?
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsPhantom()—————
Is this a phantom unit?
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsPhantomBlocker()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsPhased()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsPositionInRange(Vector a, float b)—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsRangedAttacker()—————
Is this unit a ranged attacker?
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsRealHero()—————
Returns true if the hero is a true Hero, not a creep or an Illusion of a hero
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsRooted()—————
No Description Set
Returns: bool - No Description Set
3.2. Dota 2 Lua API 115
D2Moddin Documentation, Release 1.0
bool CDOTA_BaseNPC.IsSilenced()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsSoftDisarmed()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsSpeciallyDeniable()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsStunned()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsSummoned()—————
Is this unit summoned?
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsTower()—————
Is this a tower?
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsUnableToMiss()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.IsUnselectable()—————
No Description Set
Returns: bool - No Description Set
void CDOTA_BaseNPC.Kill(handle a, handle b)—————
Kills this NPC, with the params Ability and Attacker
116 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTA_BaseNPC.MakeIllusion()—————
No Description Set
void CDOTA_BaseNPC.MakePhantomBlocker()—————
No Description Set
void CDOTA_BaseNPC.MakeVisibleDueToAttack(int a)—————
No Description Set
void CDOTA_BaseNPC.MakeVisibleToTeam(int a, float b)—————
No Description Set
void CDOTA_BaseNPC.ModifyHealth(int a, handle b, bool c, int d)—————
Sets the health to a specific value, with optional flags or inflictors.
void CDOTA_BaseNPC.MoveToNPC(handle a)—————
Move to follow a unit.
void CDOTA_BaseNPC.MoveToNPCToGiveItem(handle a, handle b)—————
Give an item to another unit.
void CDOTA_BaseNPC.MoveToPosition(Vector a)—————
Issue a Move-To command
void CDOTA_BaseNPC.MoveToPositionAggressive(Vector a)—————
Issue an Attack-Move-To command
void CDOTA_BaseNPC.MoveToTargetToAttack(handle a)—————
Move to a target to attack.
bool CDOTA_BaseNPC.NoHealthBar()—————
No Description Set
Returns: bool - No Description Set
3.2. Dota 2 Lua API 117
D2Moddin Documentation, Release 1.0
bool CDOTA_BaseNPC.NoTeamMoveTo()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.NoTeamSelect()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.NotOnMinimap()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.NotOnMinimapForEnemies()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.NoUnitCollision()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.PassivesDisabled()—————
No Description Set
Returns: bool - No Description Set
void CDOTA_BaseNPC.PerformAttack(handle a, bool b, bool c, bool d, bool e)—————
Performs an attack on a target. Params: Target, bUseCastAttackOrb, bProcessProcs, bSkipCooldown, bIgnoreInvis
void CDOTA_BaseNPC.PickupDroppedItem(handle a)—————
Pick up a dropped item.
void CDOTA_BaseNPC.PickupRune(handle a)—————
Pick up a rune.
bool CDOTA_BaseNPC.ProvidesVision()—————
No Description Set
Returns: bool - No Description Set
118 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTA_BaseNPC.ReduceMana(float a)—————
Remove mana from this unit, this can be used for involuntary mana loss, not for mana that is spent.
void CDOTA_BaseNPC.RemoveAbility(string a)—————
Remove an ability from this unit by name.
void CDOTA_BaseNPC.RemoveItem(handle a)—————
Removes the passed item from this unit’s inventory.
void CDOTA_BaseNPC.RemoveModifierByName(string a)—————
Removes a modifier
void CDOTA_BaseNPC.RemoveModifierByNameAndCaster(string a, handle b)—————
Removes a modifier that was cast by the given caster
void CDOTA_BaseNPC.RemoveNoDraw()—————
Remove the no draw flag.
void CDOTA_BaseNPC.RespawnUnit()—————
Respawns the target unit if it can be respawned.
void CDOTA_BaseNPC.SellItem(handle a)—————
Sells the passed item in this unit’s inventory.
void CDOTA_BaseNPC.SetAdditionalBattleMusicWeight(float a)—————
Combat involving this creature will have this weight added to the music calcuations
void CDOTA_BaseNPC.SetAttackCapability(int a)—————
No Description Set
void CDOTA_BaseNPC.SetAttacking(handle a)—————
No Description Set
void CDOTA_BaseNPC.SetBaseAttackTime(float a)—————
No Description Set
3.2. Dota 2 Lua API 119
D2Moddin Documentation, Release 1.0
void CDOTA_BaseNPC.SetBaseDamageMax(int a)—————
Sets the minimum base damage.
void CDOTA_BaseNPC.SetBaseDamageMin(int a)—————
Sets the minimum base damage.
void CDOTA_BaseNPC.SetBaseHealthRegen(float a)—————
No Description Set
void CDOTA_BaseNPC.SetBaseMagicalResistanceValue(float a)—————
Sets base magical armor value.
void CDOTA_BaseNPC.SetBaseManaRegen(float a)—————
No Description Set
void CDOTA_BaseNPC.SetBaseMaxHealth(float a)—————
Set a new base max health value.
void CDOTA_BaseNPC.SetBaseMoveSpeed(int a)—————
No Description Set
void CDOTA_BaseNPC.SetControllableByPlayer(int a, bool b)—————
Set this unit controllable by the player with the passed ID.
void CDOTA_BaseNPC.SetCursorCastTarget(handle a)—————
No Description Set
void CDOTA_BaseNPC.SetCursorPosition(Vector a)—————
No Description Set
void CDOTA_BaseNPC.SetCursorTargetingNothing(bool a)—————
No Description Set
void CDOTA_BaseNPC.SetDayTimeVisionRange(int a)—————
Set the base vision range.
120 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTA_BaseNPC.SetDeathXP(int a)—————
Set the XP bounty on this unit
void CDOTA_BaseNPC.SetForceAttackTarget(handle a)—————
No Description Set
void CDOTA_BaseNPC.SetHasInventory(bool a)—————
No Description Set
void CDOTA_BaseNPC.SetHullRadius(float a)—————
Set the collision hull radius of this NPC
void CDOTA_BaseNPC.SetIdleAcquire(bool a)—————
No Description Set
void CDOTA_BaseNPC.SetInitialGoalEntity(handle a)—————
Sets the initial waypoint goal for this NPC
void CDOTA_BaseNPC.SetMana(float a)—————
Set the mana on this unit.
void CDOTA_BaseNPC.SetMaximumGoldBounty(int a)—————
Set the maximum gold bounty for this unit.
void CDOTA_BaseNPC.SetMinimumGoldBounty(int a)—————
Set the minimum gold bounty for this unit.
void CDOTA_BaseNPC.SetMoveCapability(int a)—————
No Description Set
void CDOTA_BaseNPC.SetMustReachEachGoalEntity(bool a)—————
Set whether this NPC is required to reach each goal entity, rather than being allowed to ‘unkink’ their path
void CDOTA_BaseNPC.SetNeverMoveToClearSpace(bool a)—————
If set to true, we will never attempt to move this unit to clear space, even when it unphases.
3.2. Dota 2 Lua API 121
D2Moddin Documentation, Release 1.0
void CDOTA_BaseNPC.SetNightTimeVisionRange(int a)—————
Set the base vision range.
void CDOTA_BaseNPC.SetOriginalModel(string originalModel)—————
Sets the original model of this entity, which it will tend to fall back to anytime its state changes
void CDOTA_BaseNPC.SetPhysicalArmorBaseValue(float a)—————
Sets base physical armor value.
void CDOTA_BaseNPC.SetRangedProjectileName(string a)—————
No Description Set
void CDOTA_BaseNPC.SetStolenScepter(bool a)—————
No Description Set
void CDOTA_BaseNPC.SetUnitName(string a)—————
No Description Set
bool CDOTA_BaseNPC.ShouldIdleAcquire()—————
No Description Set
Returns: bool - No Description Set
void CDOTA_BaseNPC.SpendMana(float a, handle b)—————
Spend mana from this unit, this can be used for spending mana from abilities or item usage.
void CDOTA_BaseNPC.Stop()—————
Stop the current order.
void CDOTA_BaseNPC.SwapAbilities(string a, string b, bool c, bool d)—————
Swaps the slots of the two passed abilities and sets them enabled/disabled: const char* AbilityName1, const char*AbilityName2, ‘’bool” bEnable1, ‘’bool” bEnable2. The boolean controls which ability is active. The ability order isnever swapped when swapping abilities, only the boolean statements are flipped.
float CDOTA_BaseNPC.TimeUntilNextAttack()—————
No Description Set
Returns: float - No Description Set
122 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
bool CDOTA_BaseNPC.TriggerModifierDodge()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC.TriggerSpellAbsorb(handle a)—————
Query whether the passed ability will trigger spell absorb on this unit.
Returns: bool - No Description Set
bool CDOTA_BaseNPC.UnitCanRespawn()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC_Hero.AddExperience(float amount, bool applyBotDifficultyScaling)—————
Adds experience to this unit.
:: –Upgrade any spawned hero to Level 6
function MyGameMode:OnNPCSpawned( keys ) local spawnedUnit = EntIndexToHScript( keys.entindex ) ifspawnedUnit:IsHero() then
local level = spawnedUnit:GetLevel()
while level < 6 do spawnedUnit:AddExperience (2000,false) level = spawnedUnit:GetLevel()
end
end
end
Returns: bool - No Description Set
void CDOTA_BaseNPC_Hero.Buyback()—————
Spend the gold and buyback with this hero.
void CDOTA_BaseNPC_Hero.CalculateStatBonus()—————
Recalculate all stats after the hero gains stats.
bool CDOTA_BaseNPC_Hero.CanEarnGold()—————
Returns boolean value result of buyback gold limit time less than game time.
Returns: bool - No Description Set
3.2. Dota 2 Lua API 123
D2Moddin Documentation, Release 1.0
void CDOTA_BaseNPC_Hero.ClearLastHitMultikill()—————
Value is stored in PlayerResource.
void CDOTA_BaseNPC_Hero.ClearLastHitStreak()—————
Value is stored in PlayerResource.
void CDOTA_BaseNPC_Hero.ClearStreak()—————
Value is stored in PlayerResource.
int CDOTA_BaseNPC_Hero.GetAbilityPoints()—————
Gets the current unspent ability point’s.
Returns: int - No Description Set
float CDOTA_BaseNPC_Hero.GetAgility()—————
No Description Set
Returns: float - No Description Set
float CDOTA_BaseNPC_Hero.GetAgilityGain()—————
No Description Set
Returns: float - No Description Set
int CDOTA_BaseNPC_Hero.GetAssists()—————
Value is stored in PlayerResource.
Returns: int - No Description Set
int CDOTA_BaseNPC_Hero.GetAttacker(int a)—————
No Description Set
Returns: int - No Description Set
float CDOTA_BaseNPC_Hero.GetBaseAgility()—————
No Description Set
Returns: float - No Description Set
int CDOTA_BaseNPC_Hero.GetBaseDamageMax()—————
Hero damage is also affected by attributes.
Returns: int - No Description Set
124 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int CDOTA_BaseNPC_Hero.GetBaseDamageMin()—————
Hero damage is also affected by attributes.
Returns: int - No Description Set
float CDOTA_BaseNPC_Hero.GetBaseIntellect()—————
No Description Set
Returns: float - No Description Set
float CDOTA_BaseNPC_Hero.GetBaseStrength()—————
No Description Set
Returns: float - No Description Set
int CDOTA_BaseNPC_Hero.GetBonusDamageFromPrimaryStat()—————
No Description Set
Returns: int - No Description Set
float CDOTA_BaseNPC_Hero.GetBuybackCooldownTime()—————
Return ‘’float” value for the amount of time left on cooldown for this hero’s buyback.
Returns: float - No Description Set
int CDOTA_BaseNPC_Hero.GetBuybackCost()—————
Return integer value for the gold cost of a buyback.
Returns: int - No Description Set
float CDOTA_BaseNPC_Hero.GetBuybackGoldLimitTime()—————
Returns the amount of time gold gain is limited after buying back.
Returns: float - No Description Set
int CDOTA_BaseNPC_Hero.GetCurrentXP()—————
Returns the amount of XP
Returns: int - No Description Set
int CDOTA_BaseNPC_Hero.GetDeathGoldCost()—————
No Description Set
Returns: int - No Description Set
3.2. Dota 2 Lua API 125
D2Moddin Documentation, Release 1.0
int CDOTA_BaseNPC_Hero.GetDeaths()—————
Value is stored in PlayerResource.
Returns: int - No Description Set
int CDOTA_BaseNPC_Hero.GetDenies()—————
Value is stored in PlayerResource.
Returns: int - No Description Set
int CDOTA_BaseNPC_Hero.GetGold()—————
Returns gold amount for the player owning this hero
Returns: int - No Description Set
int CDOTA_BaseNPC_Hero.GetGoldBounty()—————
No Description Set
Returns: int - No Description Set
float CDOTA_BaseNPC_Hero.GetHealthRegen()—————
Hero health regen is affected by attributes.
Returns: float - No Description Set
float CDOTA_BaseNPC_Hero.GetIncreasedAttackSpeed()—————
Hero attack speed is also affected by agility.
Returns: float - No Description Set
float CDOTA_BaseNPC_Hero.GetIntellect()—————
No Description Set
Returns: float - No Description Set
float CDOTA_BaseNPC_Hero.GetIntellectGain()—————
No Description Set
Returns: float - No Description Set
int CDOTA_BaseNPC_Hero.GetKills()—————
Value is stored in PlayerResource.
Returns: int - No Description Set
126 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int CDOTA_BaseNPC_Hero.GetLastHits()—————
Value is stored in PlayerResource.
Returns: int - No Description Set
float CDOTA_BaseNPC_Hero.GetManaRegen()—————
Hero mana regen is affected by attributes.
Returns: float - No Description Set
float CDOTA_BaseNPC_Hero.GetMostRecentDamageTime()—————
No Description Set
Returns: float - No Description Set
int CDOTA_BaseNPC_Hero.GetMultipleKillCount()—————
No Description Set
Returns: int - No Description Set
int CDOTA_BaseNPC_Hero.GetNumAttackers()—————
No Description Set
Returns: int - No Description Set
float CDOTA_BaseNPC_Hero.GetPhysicalArmorValue()—————
Hero armor is affected by attributes.
Returns: float - No Description Set
int CDOTA_BaseNPC_Hero.GetPlayerID()—————
Returns player ID of the player owning this hero
Returns: int - No Description Set
int CDOTA_BaseNPC_Hero.GetPrimaryAttribute()—————
0 = strength, 1 = agility, 2 = intelligence.
Returns: int - No Description Set
float CDOTA_BaseNPC_Hero.GetPrimaryStatValue()—————
No Description Set
Returns: float - No Description Set
3.2. Dota 2 Lua API 127
D2Moddin Documentation, Release 1.0
float CDOTA_BaseNPC_Hero.GetRespawnTime()—————
No Description Set
Returns: float - No Description Set
float CDOTA_BaseNPC_Hero.GetStatsBasedManaRegen()—————
Returns only the regen based on Intelligence.
Returns: float - No Description Set
int CDOTA_BaseNPC_Hero.GetStreak()—————
Value is stored in PlayerResource.
Returns: int - No Description Set
float CDOTA_BaseNPC_Hero.GetStrength()—————
No Description Set
Returns: float - No Description Set
float CDOTA_BaseNPC_Hero.GetStrengthGain()—————
No Description Set
Returns: float - No Description Set
float CDOTA_BaseNPC_Hero.GetTimeUntilRespawn()—————
No Description Set
Returns: float - No Description Set
bool CDOTA_BaseNPC_Hero.HasAnyAvailableInventorySpace()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC_Hero.HasFlyingVision()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC_Hero.HasOwnerAbandoned()—————
No Description Set
Returns: bool - No Description Set
128 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int CDOTA_BaseNPC_Hero.HasRoomForItem(string a, bool b, bool c)—————
Args: const char* pItemName, ‘’bool” bIncludeStashCombines, ‘’bool” bAllowSelling
Returns: int - No Description Set
void CDOTA_BaseNPC_Hero.HeroLevelUp(bool a)—————
Levels up the hero, true or false to play effects.
void CDOTA_BaseNPC_Hero.IncrementAssists()—————
Value is stored in PlayerResource.
void CDOTA_BaseNPC_Hero.IncrementDeaths()—————
Value is stored in PlayerResource.
void CDOTA_BaseNPC_Hero.IncrementDenies()—————
Value is stored in PlayerResource.
void CDOTA_BaseNPC_Hero.IncrementKills(int kills)—————
Passed ID is for the victim, killer ID is ID of the current hero. Value is stored in PlayerResource.
void CDOTA_BaseNPC_Hero.IncrementLastHitMultikill()—————
Value is stored in PlayerResource.
void CDOTA_BaseNPC_Hero.IncrementLastHits()—————
Value is stored in PlayerResource.
void CDOTA_BaseNPC_Hero.IncrementLastHitStreak()—————
Value is stored in PlayerResource.
void CDOTA_BaseNPC_Hero.IncrementNearbyCreepDeaths()—————
Value is stored in PlayerResource.
void CDOTA_BaseNPC_Hero.IncrementStreak()—————
Value is stored in PlayerResource.
3.2. Dota 2 Lua API 129
D2Moddin Documentation, Release 1.0
bool CDOTA_BaseNPC_Hero.IsBuybackDisabledByReapersScythe()—————
No Description Set
Returns: bool - No Description Set
bool CDOTA_BaseNPC_Hero.IsReincarnating()—————
No Description Set
Returns: bool - No Description Set
void CDOTA_BaseNPC_Hero.KilledHero(handle a, handle b)—————
Args: Hero, Inflictor
void CDOTA_BaseNPC_Hero.ModifyAgility(float a)—————
Adds passed value to base attribute value, then calls CalculateStatBonus.
int CDOTA_BaseNPC_Hero.ModifyGold(int goldAmmt, bool reliable, int reason)—————
Gives this hero some gold. Args: ‘’int” nGoldChange, ‘’bool” bReliable, ‘’int” reason
Returns: int - No Description Set
void CDOTA_BaseNPC_Hero.ModifyIntellect(float a)—————
Adds passed value to base attribute value, then calls CalculateStatBonus.
void CDOTA_BaseNPC_Hero.ModifyStrength(float a)—————
Adds passed value to base attribute value, then calls CalculateStatBonus.
void CDOTA_BaseNPC_Hero.PerformTaunt()—————
No Description Set
void CDOTA_BaseNPC_Hero.RecordLastHit()—————
No Description Set
void CDOTA_BaseNPC_Hero.RespawnHero(bool buyback, bool unknown1, bool unknown2)—————
void CDOTA_BaseNPC_Hero.SetAbilityPoints(int a)—————
Sets the current unspent ability point’s.
130 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTA_BaseNPC_Hero.SetBaseAgility(float a)—————
No Description Set
void CDOTA_BaseNPC_Hero.SetBaseIntellect(float a)—————
No Description Set
void CDOTA_BaseNPC_Hero.SetBaseStrength(float a)—————
No Description Set
void CDOTA_BaseNPC_Hero.SetBuybackCooldownTime(float a)—————
Sets the buyback cooldown time.
void CDOTA_BaseNPC_Hero.SetBuyBackDisabledByReapersScythe(bool a)—————
No Description Set
void CDOTA_BaseNPC_Hero.SetBuybackGoldLimitTime(float a)—————
Set the amount of time gold gain is limited after buying back.
void CDOTA_BaseNPC_Hero.SetCustomDeathXP(int a)—————
Sets a custom experience value for this hero. {{tip|GameRules boolean must be set for this to work!}}
void CDOTA_BaseNPC_Hero.SetGold(int a, bool b)—————
Sets the gold amount for the player owning this hero
void CDOTA_BaseNPC_Hero.SetPlayerID(int a)—————
No Description Set
void CDOTA_BaseNPC_Hero.SetRespawnPosition(Vector a)—————
No Description Set
void CDOTA_BaseNPC_Hero.SetTimeUntilRespawn(float a)—————
No Description Set
bool CDOTA_BaseNPC_Hero.ShouldDoFlyHeightVisual()—————
No Description Set
Returns: bool - No Description Set
3.2. Dota 2 Lua API 131
D2Moddin Documentation, Release 1.0
void CDOTA_BaseNPC_Hero.SpendGold(int a, int b)—————
Args: ‘’int” nGold, ‘’int” nReason
bool CDOTA_BaseNPC_Hero.UnitCanRespawn()—————
No Description Set
Returns: bool - No Description Set
void CDOTA_BaseNPC_Hero.UpgradeAbility(handle a)—————
This upgrades the passed ability if it exists and the hero has enough ability point’s.
bool CDOTA_BaseNPC_Hero.WillReincarnate()—————
No Description Set
Returns: bool - No Description Set
void CDOTA_BaseNPC_Creature.AddItemDrop(handle a)—————
Add the specified item drop to this creature
void CDOTA_BaseNPC_Creature.CreatureLevelUp(int a)—————
Level the creature up by the specified number of levels
bool CDOTA_BaseNPC_Creature.IsChampion()—————
Is this unit a champion?
Returns: bool - No Description Set
void CDOTA_BaseNPC_Creature.SetArmorGain(float a)—————
Set the armor gained per level on this creature.
void CDOTA_BaseNPC_Creature.SetAttackTimeGain(float a)—————
Set the attack time gained per level on this creature.
void CDOTA_BaseNPC_Creature.SetBountyGain(int a)—————
Set the bounty gold gained per level on this creature.
void CDOTA_BaseNPC_Creature.SetChampion(bool a)—————
Flag this unit as a champion creature.
132 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTA_BaseNPC_Creature.SetDamageGain(int a)—————
Set the damage gained per level on this creature.
void CDOTA_BaseNPC_Creature.SetDisableResistanceGain(float a)—————
Set the disable resistance gained per level on this creature.
void CDOTA_BaseNPC_Creature.SetHPGain(int a)—————
Set the hit point’s gained per level on this creature.
void CDOTA_BaseNPC_Creature.SetHPRegenGain(float a)—————
Set the hit point’s regen gained per level on this creature.
void CDOTA_BaseNPC_Creature.SetMagicResistanceGain(float a)—————
Set the magic resistance gained per level on this creature.
void CDOTA_BaseNPC_Creature.SetManaGain(int a)—————
Set the mana point’s gained per level on this creature.
void CDOTA_BaseNPC_Creature.SetManaRegenGain(float a)—————
Set the mana point’s regen gained per level on this creature.
void CDOTA_BaseNPC_Creature.SetMoveSpeedGain(int a)—————
Set the move speed gained per level on this creature.
void CDOTA_BaseNPC_Creature.SetXPGain(int a)—————
Set the xp reward gained per level on this creature.
int CDOTA_BaseNPC_Building.GetInvulnCount()—————
Get the invulnerability count for a building.
Returns: int - No Description Set
void CDOTA_BaseNPC_Building.SetInvulnCount(int a)—————
Set the invulnerability counter of this building.
3.2. Dota 2 Lua API 133
D2Moddin Documentation, Release 1.0
handle CRPG_Unit.ActionState()—————
return the ActionState object for this unit.
Returns: handle - No Description Set
void CRPG_Unit.ClearMovementTarget()—————
Clear any movement target entity/position.
table CRPG_Unit.FindSensedEnemies()—————
returns list of all enemy units within this unit’s sight cone or sensing sphere
Returns: table - No Description Set
float CRPG_Unit.GetMaxSpeed()—————
returns unit’s max speed
Returns: float - No Description Set
float CRPG_Unit.GetMaxStamina()—————
returns maximum stamina amount.
Returns: float - No Description Set
handle CRPG_Unit.GetMovementTargetEntity()—————
Returs the movement target entity, if set.
Returns: handle - No Description Set
float CRPG_Unit.GetSensingSphereRange()—————
returns range of unit’s 360 degree sensing sphere
Returns: float - No Description Set
float CRPG_Unit.GetSightConeAngle()—————
returns angle in which the unit can see things up to sight range
Returns: float - No Description Set
float CRPG_Unit.GetSightConeRange()—————
returns range of unit’s sight cone
Returns: float - No Description Set
134 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
float CRPG_Unit.GetStamina()—————
returns current stamina amount.
Returns: float - No Description Set
float CRPG_Unit.GetTurnRate()—————
returns unit’s turn rate in degrees per second
Returns: float - No Description Set
string CRPG_Unit.GetUnitName()—————
get the unit name for this unit.
Returns: string - No Description Set
void CRPG_Unit.GrantItem(string a, bool b)—————
( sItemName ) - grant an item to the unit by name.
bool CRPG_Unit.IsBlocking()—————
is this unit blocking?
Returns: bool - No Description Set
bool CRPG_Unit.IsFacing(Vector a, float b)—————
( vecTargetPosition, flAngleTolerance ) - returns true if the unit is within flAngleTolerance degrees of the targetposition
Returns: bool - No Description Set
void CRPG_Unit.SetBlocking(bool a)—————
( bShouldBlock ) - Set the blocking state of this unit.
void CRPG_Unit.SetMaxSpeed(float a)—————
( flMaxSpeed ) - sets unit’s max speed
void CRPG_Unit.SetMovementTargetEntity(handle a, float b)—————
( hTargetEntity, flTargetRange ) - Try to move this unit to the given range from the target entity.
void CRPG_Unit.SetMovementTargetPosition(Vector a, float b)—————
( vecTargetPosition, flTargetRange ) - Try to move this unit to the given range from the target point.
3.2. Dota 2 Lua API 135
D2Moddin Documentation, Release 1.0
void CRPG_Unit.SetSensingSphereRange(float a)—————
( flSightRange ) - set range of unit’s 360 degree sensing sphere
void CRPG_Unit.SetSightConeAngle(float a)—————
( flAngleDegrees ) - sets angle in which the unit can see things up to sight range
void CRPG_Unit.SetSightConeRange(float a)—————
( fRange ) - set range of unit’s sight cone
void CRPG_Unit.SetTurnRate(float a)—————
( flTurnRate ) - sets unit’s turn rate in degrees per second
void CDOTABaseGameMode.ClientLoadGridNav()—————
Tell clients that they need to load gridnav information. Used for things like allowing clients to identify valid locationsto place buildings.
void CDOTABaseGameMode.SetAlwaysShowPlayerInventory(bool a)—————
Show the player hero’s inventory in the HUD, regardless of what unit is selected.
void CDOTABaseGameMode.SetBotThinkingEnabled(bool a)—————
Enables/Disables bot thinking. Requires a very Dota PvP-like map with 3 lanes, a shop, etc.
void CDOTABaseGameMode.SetBuybackEnabled(bool a)—————
Enables or disables buyback completely
void CDOTABaseGameMode.SetCameraDistanceOverride(float a)—————
Set a different camera distance; dota default is 1134.
void CDOTABaseGameMode.SetCustomBuybackCooldownEnabled(bool a)—————
Turns on capability to define custom buyback cooldowns.
void CDOTABaseGameMode.SetCustomBuybackCostEnabled(bool a)—————
Turns on capability to define custom buyback costs.
void CDOTABaseGameMode.SetCustomHeroMaxLevel(int maxLevel)—————
Allows definition of the max level heroes can achieve (default is 25).
136 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTABaseGameMode.SetCustomXPRequiredToReachNextLevel(handle a)—————
Allows definition of a ‘’table” of hero XP values.
void CDOTABaseGameMode.SetFogOfWarDisabled(bool a)—————
Turn the fog of war on or off.
void CDOTABaseGameMode.SetGoldSoundDisabled(bool a)—————
Turn the sound when gold is acquired off/on. Takes a ‘’bool’‘.
void CDOTABaseGameMode.SetOverrideSelectionEntity(handle unit)—————
Set an override for the default selection entity, instead of each player’s hero.
void CDOTABaseGameMode.SetRecommendedItemsDisabled(bool a)—————
Turn the panel for showing recommended items at the shop off/on. Takes a ‘’bool’‘.
void CDOTABaseGameMode.SetRemoveIllusionsOnDeath(bool a)—————
Make it so illusions are immediately removed upon death, rather than sticking around for a few seconds.
void CDOTABaseGameMode.SetTopBarTeamValue(int a, int b)—————
Set the team values on the top game bar.
void CDOTABaseGameMode.SetTopBarTeamValuesOverride(bool a)—————
Override the values of the team values on the top game bar.
void CDOTABaseGameMode.SetTopBarTeamValuesVisible(bool a)—————
Turning on/off the team values on the top game bar.
void CDOTABaseGameMode.SetTowerBackdoorProtectionEnabled(bool a)—————
Enables/Disables tower backdoor protection
void CDOTABaseGameMode.SetUseCustomHeroLevels(bool a)—————
Turn on custom-defined XP values for hero level ups. The ‘’table” should be defined before switching this on.
void CDotaQuest.AddSubquest(handle a)—————
Add a subquest to this quest
3.2. Dota 2 Lua API 137
D2Moddin Documentation, Release 1.0
void CDotaQuest.CompleteQuest()—————
Mark this quest complete
handle CDotaQuest.GetSubquest(int a)—————
Finds a subquest from this quest by index
Returns: handle - No Description Set
handle CDotaQuest.GetSubquestByName(string a)—————
Finds a subquest from this quest by name
Returns: handle - No Description Set
void CDotaQuest.RemoveSubquest(handle a)—————
Remove a subquest from this quest
void CDotaQuest.SetTextReplaceString(string a)—————
Set the text replace ‘’string” for this quest
void CDotaQuest.SetTextReplaceValue(int a, int b)—————
Set a quest value
void CDotaSubquestBase.CompleteSubquest()—————
Mark this subquest complete
void CDotaSubquestBase.SetTextReplaceString(string a)—————
Set the text replace ‘’string” for this subquest
void CDotaSubquestBase.SetTextReplaceValue(int a, int b)—————
Set a subquest value
bool CPhysicsComponent.ExpensiveInstantRayCast(Vector a, Vector b, handle c)—————
Do an instant (i.e. blocking) Ray Cast. Will do a handle/queue version later. Don’t plan to use this for real!
Returns: bool - No Description Set
138 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CPointTemplate.DeleteCreatedSpawnGroups()—————
DeleteCreatedSpawnGroups() : Deletes any spawn groups that this point_template has spawned. Note: Thepoint_template will not be deleted by this.
void CPointTemplate.ForceSpawn()—————
ForceSpawn() : Spawns all of the entities the point_template is pointing at.
handle CPointTemplate.GetSpawnedEntities()—————
GetSpawnedEntities() : Get the list of the most recent spawned entities
Returns: handle - No Description Set
void CPointTemplate.SetSpawnCallback(handle a, handle b)—————
SetSpawnCallback( hCallbackFunc, hCallbackScope, hCallbackData ) : Set a callback for when the template spawnsentities. The spawned entities will be passed in as an array.
void CBodyComponent.AddImpulseAtPosition(Vector a, Vector b)—————
Apply an impulse at a worldspace position to the physics
void CBodyComponent.AddVelocity(Vector a, Vector b)—————
Add linear and angular velocity to the physics object
void CBodyComponent.DetachFromParent()—————
Detach from its parent
<> CBodyComponent.GetSequence()—————
Returns the active sequence
Returns: <> - No Description Set
bool CBodyComponent.IsAttachedToParent()—————
Is attached to parent
Returns: bool - No Description Set
<> CBodyComponent.LookupSequence(string a)—————
Returns a sequence id given a name
Returns: <> - No Description Set
3.2. Dota 2 Lua API 139
D2Moddin Documentation, Release 1.0
float CBodyComponent.SequenceDuration(string a)—————
Returns the duration in seconds of the specified sequence
Returns: float - No Description Set
void CBodyComponent.SetAngularVelocity(Vector a)—————
No Description Set
void CBodyComponent.SetAnimation(string a)—————
Pass ‘’string” for the animation to play on this model
void CBodyComponent.SetBodyGroup(string a)—————
No Description Set
void CBodyComponent.SetMaterialGroup(utlstringtoken a)—————
No Description Set
Type Name Descriptionutlstringtoken | | No Description Set
void CBodyComponent.SetVelocity(Vector velocity)—————
No Description Set
Type Name DescriptionVector | velocity | No Description Set
Vector CBaseAnimating.GetAttachmentAngles(int a)—————
Get the attachement id’s angles as a p,y,r ‘’vector’‘
Returns: Vector - No Description Set
Vector CBaseAnimating.GetAttachmentOrigin(int a)—————
Get the attachement id’s origin ‘’vector’‘
Returns: Vector - No Description Set
bool CBaseAnimating.IsSequenceFinished()—————
Ask whether the main sequence is done playing
Returns: bool - No Description Set
int CBaseAnimating.ScriptLookupAttachment(string a)—————
Get the named attachment id
140 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
Returns: int - No Description Set
void CBaseAnimating.SetBodygroup(int a, int b)—————
Sets a bodygroup
void CBaseAnimating.SetModelScale(float scale)—————
Sets the model’s scale to <i>scale</i>, <br/>so if a unit had its model scale at 1, and you use<i>SetModelScale(<b>10.0</b>)</i>, it would set the scale to <b>10.0</b>.
float CBaseAnimating.SetPoseParameter(string a, float b)—————
Set the specified pose parameter to the specified value
Returns: float - No Description Set
table CBaseCombatCharacter.GetEquippedWeapons()—————
GetEquippedWeapons() : Returns an array of all the equipped weapons
Returns: table - No Description Set
int CBaseCombatCharacter.GetWeaponCount()—————
GetWeaponCount() : Gets the number of weapons currently equipped
Returns: int - No Description Set
int ProjectileManager.CreateLinearProjectile(handle a)—————
Creates a linear projectile and returns the projectile ID
Returns: int - No Description Set
void ProjectileManager.CreateTrackingProjectile(handle a)—————
Creates a tracking projectile
void ProjectileManager.DestroyLinearProjectile(int a)—————
Destroys the linear projectile matching the argument ID
void ProjectileManager.ProjectileDodge(handle a)—————
Makes the specified unit dodge projectiles
void CBaseTrigger.Disable()—————
Disable the trigger
3.2. Dota 2 Lua API 141
D2Moddin Documentation, Release 1.0
void CBaseTrigger.Enable()—————
Enable the trigger
bool CBaseTrigger.IsTouching(handle a)—————
Checks whether the passed entity is touching the trigger.
Returns: bool - No Description Set
void CEnvEntityMaker.SpawnEntity()—————
Create an entity at the location of the maker
void CEnvEntityMaker.SpawnEntityAtEntityOrigin(handle a)—————
Create an entity at the location of a specified entity instance
void CEnvEntityMaker.SpawnEntityAtLocation(Vector a, Vector b)—————
Create an entity at a specified location and orientaton, orientation is Euler angle in degrees (pitch, yaw, roll)
void CEnvEntityMaker.SpawnEntityAtNamedEntityOrigin(string a)—————
Create an entity at the location of a named entity
void CDOTAVoteSystem.StartVote(handle a)—————
Starts a vote, based upon a ‘’table” of parameters
bool CMarkupVolumeTagged.HasTag(string a)—————
Does this volume have the given tag.
Returns: bool - No Description Set
void CScriptPrecacheContext.AddResource(string a)—————
Precaches a specific resource
table CScriptPrecacheContext.GetValue(string a)—————
Reads a spawn key
Returns: table - No Description Set
142 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
table CScriptKeyValues.GetValue(string a)—————
Reads a spawn key
Returns: table - No Description Set
int CScriptParticleManager.CreateParticle(string particleName, int particleAttach, handle owningEntity)—————
Creates a new particle effect
Returns: int - No Description Set
int CScriptParticleManager.CreateParticleForPlayer(string particleName, int particleAttach, handle owningEntity,handle owningPlayer)—————
Creates a new particle effect that only plays for the specified player
Returns: int - Particle ID
string CScriptParticleManager.GetParticleReplacement(string a, handle b)—————
No Description Set
Returns: string - No Description Set
void CScriptParticleManager.ReleaseParticleIndex(int particleId)—————
Frees the specified particle index
void CScriptParticleManager.SetParticleAlwaysSimulate(int a)—————
No Description Set
void CScriptParticleManager.SetParticleControl(int particleId, int controlIndex, Vector controlData)—————
Set the control point data for a control on a particle effect
void CScriptParticleManager.SetParticleControlEnt(int a, int b, handle c, int d, string e, Vector f, bool g)—————
No Description Set
table CScriptHeroList.GetAllHeroes()—————
Returns all the heroes in the world
Returns: table - No Description Set
handle CScriptHeroList.GetHero(int heroId)—————
Get the Nth hero in the Hero List
Type Name Descriptionint | heroId | A value between 0 and 9
3.2. Dota 2 Lua API 143
D2Moddin Documentation, Release 1.0
Returns: handle - No Description Set
int CScriptHeroList.GetHeroCount()—————
Returns the number of heroes in the world
Returns: int - No Description Set
void CNativeOutputs.AddOutput(string a, string b)—————
Add an output
void CNativeOutputs.Init(int a)—————
Initialize with number of outputs
void CEnvProjectedTexture.SetFarRange(float a)—————
Set light maximum range
void CEnvProjectedTexture.SetLinearAttenuation(float a)—————
Set light linear attenuation value
void CEnvProjectedTexture.SetNearRange(float a)—————
Set light minimum range
void CEnvProjectedTexture.SetQuadraticAttenuation(float a)—————
Set light quadratic attenuation value
void CEnvProjectedTexture.SetVolumetrics(bool a, float b, float c, int d, float e)—————
Turn on/off light volumetrics: ‘’bool” bOn, ‘’float” flIntensity, ‘’float” flNoise, ‘’int” nPlanes, ‘’float” flPlaneOffset
Vector CInfoData.QueryColor(utlstringtoken a, Vector b)—————
Query color data for this key
Returns: Vector - No Description Set
float CInfoData.QueryFloat(utlstringtoken a, float b)—————
Query ‘’float” data for this key
Returns: float - No Description Set
144 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int CInfoData.QueryInt(utlstringtoken a, int b)—————
Query ‘’int” data for this key
Returns: int - No Description Set
float CInfoData.QueryNumber(utlstringtoken a, float b)—————
Query number data for this key
Returns: float - No Description Set
string CInfoData.QueryString(utlstringtoken a, string b)—————
Query ‘’string” data for this key
Returns: string - No Description Set
Vector CInfoData.QueryVector(utlstringtoken a, Vector b)—————
Query ‘’vector” data for this key
Returns: Vector - No Description Set
void CPhysicsProp.DisableMotion()—————
Enable motion for the prop
void CPhysicsProp.EnableMotion()—————
Enable motion for the prop
void CDOTAGamerules.Defeated()—————
Kills the ancient, etc.
bool CDOTAGamerules.DidMatchSignoutTimeOut()—————
true when we have waited some time after end of the game and not received signout
Returns: bool - No Description Set
int CDOTAGamerules.GetCustomGameDifficulty()—————
Returns the difficulty level of the custom game mode
Returns: int - No Description Set
int CDOTAGamerules.GetDifficulty()—————
Returns difficulty level of the custom game mode
Returns: int - No Description Set
3.2. Dota 2 Lua API 145
D2Moddin Documentation, Release 1.0
handle CDOTAGamerules.GetDroppedItem(int dropIndex)—————
Gets the Xth dropped item
Returns: handle - No Description Set
handle CDOTAGamerules.GetGameModeEntity()—————
Get the game mode entity
Returns: handle - No Description Set
float CDOTAGamerules.GetGameTime()—————
Returns the number of seconds elapsed since map start. This time doesn’t count up when the game is paused
Returns: float - No Description Set
bool CDOTAGamerules.GetMatchSignoutComplete()—————
Have we received the post match signout message that includes reward information
Returns: bool - No Description Set
float CDOTAGamerules.GetNianFightStartTime()—————
Gets the start time for the Nian fight
Returns: float - No Description Set
int CDOTAGamerules.GetNianTotalDamageTaken()—————
For New Bloom, get total damage taken by the Nian / Year Beast
Returns: int - No Description Set
float CDOTAGamerules.GetTimeOfDay()—————
Get the time of day
Returns: float - No Description Set
bool CDOTAGamerules.IsDaytime()—————
Is it day time.
Returns: bool - No Description Set
void CDOTAGamerules.MakeTeamLose(int team)—————
Makes ths specified team lose
146 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
int CDOTAGamerules.NumDroppedItems()—————
Returns the number of items currently dropped on the ground
Returns: int - No Description Set
void CDOTAGamerules.Playtesting_UpdateAddOnKeyValues()—————
Updates custom hero, unit and ability KeyValues in memory with the latest values from disk
void CDOTAGamerules.ResetDefeated()—————
Restart after killing the ancient, etc.
void CDOTAGamerules.ResetToHeroSelection()—————
Restart the game at hero selection
void CDOTAGamerules.SendCustomMessage(string message, int teamID, int unknown(1?))—————
Displays a line of text in the left textbox (where usually deaths/denies/buysbacks are announced). This function takesrestricted HTML as input! (<br>,<u>,<font>)
void CDOTAGamerules.SetCreepMinimapIconScale(float scale)—————
Scale the creep icons on the minimap.
void CDOTAGamerules.SetCustomGameDifficulty(int a)—————
Set the difficulty level of the custom game mode
void CDOTAGamerules.SetFirstBloodActive(bool a)—————
Sets whether First Blood has been triggered.
void CDOTAGamerules.SetGameWinner(int team)—————
Makes ths specified team win
void CDOTAGamerules.SetGoldPerTick(int a)—————
Set the auto gold increase per timed interval.
void CDOTAGamerules.SetGoldTickTime(float a)—————
Set the time ‘’int’‘erval between auto gold increases.
3.2. Dota 2 Lua API 147
D2Moddin Documentation, Release 1.0
void CDOTAGamerules.SetHeroMinimapIconSize(int iconSize)—————
(nMinimapHeroIconSize) - Set the hero minimap icon size.
void CDOTAGamerules.SetHeroRespawnEnabled(bool canRespawn)—————
Control if the normal DOTA hero respawn rules apply.
Type Name Descriptionbool | canRespawn | No Description Set
void CDOTAGamerules.SetHeroSelectionTime(float time)—————
Sets the amount of time players have to pick their hero.
void CDOTAGamerules.SetNianFightStartTime(float a)—————
Sets the start time for the Nian fight
void CDOTAGamerules.SetOverlayHealthBarUnit(handle unit, int style)—————
Show this unit’s health on the overlay health bar
void CDOTAGamerules.SetPostGameTime(float time)—————
Sets the amount of time players have between the game ending and the server disconnecting them.
void CDOTAGamerules.SetPreGameTime(float time)—————
Sets the amount of time players have between picking their hero and game start.
void CDOTAGamerules.SetRuneMinimapIconScale(float scale)—————
Scale the rune icons on the minimap.
void CDOTAGamerules.SetRuneSpawnTime(float time)—————
Sets the amount of time between rune spawns.
void CDOTAGamerules.SetSafeToLeave(bool safeToLeave)—————
Mark this game as safe to leave.
void CDOTAGamerules.SetSameHeroSelectionEnabled(bool enabled)—————
When true, players can repeatedly pick the same hero.
void CDOTAGamerules.SetTimeOfDay(float time)—————
Set the time of day.
148 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDOTAGamerules.SetTreeRegrowTime(float time)—————
Sets the tree regrow time in seconds.
void CDOTAGamerules.SetUseBaseGoldBountyOnHeroes(bool a)—————
Heroes will use the basic NPC functionality for determining their bounty, rather than DOTA specific formulas.
void CDOTAGamerules.SetUseCustomHeroXPValues(bool a)—————
Allows heroes in the map to give a specific amount of XP (this value must be set).
void CDOTAGamerules.SetUseUniversalShopMode(bool enabled)—————
When true, all items are available at as long as any shop is in range, including Secret Shop items
<> CDOTAGamerules.State_Get()—————
Get the current Gamerules state
Returns: <> - No Description Set
float CToneMapControllerComponent.GetBloomScale()—————
Gets bloomscale for this tonemap controller
Returns: float - No Description Set
float CToneMapControllerComponent.GetMaxExposure()—————
Gets max exposure for this tonemap controller
Returns: float - No Description Set
float CToneMapControllerComponent.GetMinExposure()—————
Gets min exposure for this tonemap controller
Returns: float - No Description Set
void CToneMapControllerComponent.SetBloomScale(float a)—————
Sets bloom scale for this tonemap controller
void CToneMapControllerComponent.SetMaxExposure(float a)—————
Sets max exposure for this tonemap controller
3.2. Dota 2 Lua API 149
D2Moddin Documentation, Release 1.0
void CToneMapControllerComponent.SetMinExposure(float a)—————
Sets min exposure for this tonemap controller
void CDebugOverlayScriptHelper.Axis(Vector a, Quaternion b, float c, bool d, float e)—————
Draws an axis. Specify origin + orientation in world space.
void CDebugOverlayScriptHelper.Box(Vector a, Vector b, int c, int d, int e, int f, bool g, float h)—————
Draws a world-space axis-aligned box. Specify bounds in world space.
void CDebugOverlayScriptHelper.BoxAngles(Vector a, Vector b, Vector c, Quaternion d, int e, int f, int g, int h, booli, float j)—————
Draws an oriented box at the origin. Specify bounds in local space.
void CDebugOverlayScriptHelper.Capsule(Vector a, Quaternion b, float c, float d, int e, int f, int g, int h, bool i, floatj)—————
Draws a capsule. Specify base in world space.
void CDebugOverlayScriptHelper.Circle(Vector a, Quaternion b, float c, int d, int e, int f, int g, bool h, float i)—————
Draws a circle. Specify center in world space.
void CDebugOverlayScriptHelper.CircleScreenOriented(Vector a, float b, int c, int d, int e, int f, bool g, float h)—————
Draws a circle oriented to the screen. Specify center in world space.
void CDebugOverlayScriptHelper.Cone(Vector a, Vector b, float c, float d, int e, int f, int g, int h, bool i, float j)—————
Draws a wireframe cone. Specify endpoint and direction in world space.
void CDebugOverlayScriptHelper.Cross(Vector a, float b, int c, int d, int e, int f, bool g, float h)—————
Draws a screen-aligned cross. Specify origin in world space.
void CDebugOverlayScriptHelper.Cross3D(Vector a, float b, int c, int d, int e, int f, bool g, float h)—————
Draws a world-aligned cross. Specify origin in world space.
void CDebugOverlayScriptHelper.Cross3DOriented(Vector a, Quaternion b, float c, int d, int e, int f, int g, bool h, floati)—————
Draws an oriented cross. Specify origin in world space.
150 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDebugOverlayScriptHelper.DrawTickMarkedLine(Vector a, Vector b, float c, int d, int e, int f, int g, int h, booli, float j)—————
Draws a dashed line. Specify endpoint’s in world space.
void CDebugOverlayScriptHelper.EntityAttachments(ehandle a, float b)—————
Draws the attachments of the entity
void CDebugOverlayScriptHelper.EntityAxis(ehandle a, float b, bool c, float d)—————
Draws the axis of the entity origin
void CDebugOverlayScriptHelper.EntityBounds(ehandle a, int b, int c, int d, int e, bool f, float g)—————
Draws bounds of an entity
void CDebugOverlayScriptHelper.EntitySkeleton(ehandle a, float b)—————
Draws the skeleton of the entity
void CDebugOverlayScriptHelper.EntityText(ehandle a, int b, string c, int d, int e, int f, int g, float h)—————
Draws text on an entity
void CDebugOverlayScriptHelper.FilledRect2D(Vector2D a, Vector2D b, int c, int d, int e, int f, float g)—————
Draws a screen-space filled 2D rectangle. Coordinates are in pixels.
void CDebugOverlayScriptHelper.HorzArrow(Vector a, Vector b, float c, int d, int e, int f, int g, bool h, float i)—————
Draws a horizontal arrow. Specify endpoint’s in world space.
void CDebugOverlayScriptHelper.Line(Vector a, Vector b, int c, int d, int e, int f, bool g, float h)—————
Draws a line between two point’s
void CDebugOverlayScriptHelper.Line2D(Vector2D a, Vector2D b, int c, int d, int e, int f, float g)—————
Draws a line between two point’s in screenspace
void CDebugOverlayScriptHelper.PopDebugOverlayScope()—————
Pops the identifier used to group overlays. Overlays marked with this identifier can be deleted in a big batch.
3.2. Dota 2 Lua API 151
D2Moddin Documentation, Release 1.0
void CDebugOverlayScriptHelper.PushAndClearDebugOverlayScope(utlstringtoken a)—————
Pushes an identifier used to group overlays. Deletes all existing overlays using this overlay id.
Type Name Descriptionutlstringtoken | | No Description Set
void CDebugOverlayScriptHelper.PushDebugOverlayScope(utlstringtoken a)—————
Pushes an identifier used to group overlays. Overlays marked with this identifier can be deleted in a big batch.
Type Name Descriptionutlstringtoken | | No Description Set
void CDebugOverlayScriptHelper.RemoveAllInScope(utlstringtoken a)—————
Removes all overlays marked with a specific identifier, regardless of their lifetime.
Type Name Descriptionutlstringtoken | | No Description Set
void CDebugOverlayScriptHelper.SolidCone(Vector a, Vector b, float c, float d, int e, int f, int g, int h, bool i, floatj)—————
Draws a solid cone. Specify endpoint and direction in world space.
void CDebugOverlayScriptHelper.Sphere(Vector a, float b, int c, int d, int e, int f, bool g, float h)—————
Draws a wireframe sphere. Specify center in world space.
void CDebugOverlayScriptHelper.SweptBox(Vector a, Vector b, Vector c, Vector d, Quaternion e, int f, int g, int h, inti, float j)—————
Draws a swept box. Specify endpoint’s in world space and the bounds in local space.
void CDebugOverlayScriptHelper.Text(Vector a, int b, string c, float d, int e, int f, int g, int h, float i)—————
Draws 2D text. Specify origin in world space.
void CDebugOverlayScriptHelper.Texture(string a, Vector2D b, Vector2D c, int d, int e, int f, int g, Vector2D h,Vector2D i, float j)—————
Draws a screen-space texture. Coordinates are in pixels.
void CDebugOverlayScriptHelper.Triangle(Vector a, Vector b, Vector c, int d, int e, int f, int g, bool h, float i)—————
Draws a filled triangle. Specify vertices in world space.
void CDebugOverlayScriptHelper.UnitTestCycleOverlayRenderType()—————
Toggles the overlay render type, for unit tests
152 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
void CDebugOverlayScriptHelper.VectorText3D(Vector a, Quaternion b, string c, int d, int e, int f, int g, bool h, floati)—————
Draws 3D text. Specify origin + orientation in world space.
void CDebugOverlayScriptHelper.VertArrow(Vector a, Vector b, float c, int d, int e, int f, int g, bool h, float i)—————
Draws a vertical arrow. Specify endpoint’s in world space.
void CDebugOverlayScriptHelper.YawArrow(Vector a, float b, float c, float d, int e, int f, int g, int h, bool i, floatj)—————
Draws a arrow associated with a specific yaw. Specify endpoint’s in world space.
handle CBaseFlex.GetCurrentScene()—————
Returns the instance of the oldest active scene entity ‘’‘(if any).
Returns: handle - No Description Set
handle CBaseFlex.GetSceneByIndex(int a)—————
Returns the instance of the scene entity at the specified index.
Returns: handle - No Description Set
void CSceneEntity.AddBroadcastTeamTarget(int a)—————
Adds a team (by index) to the broadcast list
void CSceneEntity.Cancel()—————
Cancel scene playback
float CSceneEntity.EstimateLength()—————
Returns length of this scene in seconds.
Returns: float - No Description Set
handle CSceneEntity.FindCamera()—————
Get the camera
Returns: handle - No Description Set
3.2. Dota 2 Lua API 153
D2Moddin Documentation, Release 1.0
handle CSceneEntity.FindNamedEntity(string a)—————
given an entity reference, such as !target, get actual entity from scene object
Returns: handle - No Description Set
bool CSceneEntity.IsPaused()—————
If this scene is currently paused.
Returns: bool - No Description Set
bool CSceneEntity.IsPlayingBack()—————
If this scene is currently playing.
Returns: bool - No Description Set
bool CSceneEntity.LoadSceneFromString(string a, string b)—————
given a dummy scene name and a vcd ‘’string’‘, load the scene
Returns: bool - No Description Set
void CSceneEntity.RemoveBroadcastTeamTarget(int a)—————
Removes a team (by index) from the broadcast list
void CSceneEntity.Start(handle a)—————
Start scene playback, takes activatorEntity as param
float GridNav.GridPosToWorldCenterX(int a)—————
Get the X position of the center of a given X index
Returns: float - No Description Set
float GridNav.GridPosToWorldCenterY(int a)—————
Get the Y position of the center of a given Y index
Returns: float - No Description Set
bool GridNav.IsBlocked(Vector a)—————
Checks whether the given position is blocked
Returns: bool - No Description Set
bool GridNav.IsNearbyTree(Vector position, float radius, bool c)—————
Returns: bool - No Description Set
154 Chapter 3. Game Logic
D2Moddin Documentation, Release 1.0
bool GridNav.IsTraversable(Vector a)—————
Checks whether the given position is traversable
Returns: bool - No Description Set
void GridNav.RegrowAllTrees()—————
int GridNav.WorldToGridPosX(float a)—————
Get the X index of a given world X position
Returns: int - No Description Set
int GridNav.WorldToGridPosY(float a)—————
Get the Y index of a given world Y position
Returns: int - No Description Set
table Convars.GetBool(string variableName)—————
GetBool(name) : returns the convar as a boolean flag.
Returns: table - No Description Set
handle Convars.GetCommandClient()—————
GetCommandClient() : returns the player who issued this console command.
Returns: handle - No Description Set
handle Convars.GetDOTACommandClient()—————
GetDOTACommandClient() : returns the DOTA player who issued this console command.
Returns: handle - No Description Set
table Convars.GetFloat(string name)—————
GetFloat(name) : returns the convar as a ‘’float’‘. May return ‘’nil” if no such convar.
Returns: table - No Description Set
table Convars.GetInt(string a)—————
GetInt(name) : returns the convar as an ‘’int’‘. May return ‘’nil” if no such convar.
Returns: table - No Description Set
3.2. Dota 2 Lua API 155
D2Moddin Documentation, Release 1.0
table Convars.GetStr(string variableName)—————
GetStr(name) : returns the convar as a ‘’string’‘. May return ‘’nil” if no such convar.
Returns: table - No Description Set
void Convars.RegisterCommand(string variableName, handle function, string helpText, int flags)—————
RegisterCommand(name, fn, helpString, flags) : register a console command.
void Convars.RegisterConvar(string name, string defaultValue, string helpText, int flags)—————
RegisterConvar(name, defaultValue, helpString, flags): register a new console variable.
void Convars.SetBool(string variableName, bool value)—————
SetBool(name, val) : sets the value of the convar to the ‘’bool’‘.
void Convars.SetFloat(string variableName, float value)—————
SetFloat(name, val) : sets the value of the convar to the ‘’float’‘.
void Convars.SetInt(string a, int b)—————
SetInt(name, val) : sets the value of the convar to the ‘’int’‘.
void Convars.SetStr(string a, string b)—————
SetStr(name, val) : sets the value of the convar to the ‘’string’‘.
156 Chapter 3. Game Logic
CHAPTER 4
Integration with D2Moddin
Integrating your addon with D2Moddin is a relatively painless process. D2Moddin’s server network supports granularversioning using simple version numbers, and normal Dota 2 addons.
See the below documentation pages to get started:
157
D2Moddin Documentation, Release 1.0
158 Chapter 4. Integration with D2Moddin
CHAPTER 5
Chat with Us
If you have any questions during development you can chat on the forums or in the irc channel #dota2mods onGameSurge.
159