nyuuzyou/wikis huggingface dataset:
Dota 2 Workshop Tools/Scripting/API/Global.UnitFilter

== Function Description ==
 int UnitFilter(handle handle_1, int int_2, int int_3, int int_4, int int_5) 
Check if a unit passes a set of filters. (hNPC, nTargetTeam, nTargetType, nTargetFlags, nTeam
;Example
function UnitFilter( handle_1, int_2, int_3, int_4, int_5 ) end
== Parameters ==
Type 	Name 	Description
handle	handle_1	No Description Set
int 	int_2 	No Description Set
int 	int_3 	No Description Set
int 	int_4 	No Description Set
int 	int_5 	No Description Set
== Returns ==
int - No Description Set
Category:Dota2Function
Category:Global
Dota 2 Workshop Tools/Scripting/API/Global.VectorToAngles

== Function Description ==
 QAngle VectorToAngles(Vector Vector_1) 
Get Qangles (with no roll) for a Vector.
== Parameters ==
Type 	Name 	Description
Vector	Vector_1	No Description Set
== Returns ==
QAngle - No Description Set
Category:Dota2Function
Category:Global
Dota 2 Workshop Tools/Scripting/API/Global.cvar setf

== Function Description ==
 bool cvar_setf(string string_1, float float_2) 
Sets the value of the given cvar, as a float.
== Parameters ==
Type 	Name 	Description
string	string_1	No Description Set
float 	float_2 	No Description Set
== Returns ==
bool - No Description Set
Category:Dota2Function
Category:Global
Dota 2 Workshop Tools/Scripting/API/Global.rr CommitAIResponse

== Function Description ==
 bool rr_CommitAIResponse(handle handle_1, handle handle_2) 
Commit the result of QueryBestResponse back to the given entity to play. Call with params (entity, airesponse)
== Parameters ==
Type 	Name 	Description
handle	handle_1	No Description Set
handle	handle_2	No Description Set
== Returns ==
bool - No Description Set
Category:Dota2Function
Category:Global
Dota 2 Workshop Tools/Scripting/API/Global.rr QueryBestResponse

== Function Description ==
 bool rr_QueryBestResponse(handle handle_1, handle handle_2, handle handle_3) 
Params: ( hEnt, hQuery, hResult ) // Static : tests 'query' against entity's response system and returns the best response found (or nil if none found).
== Parameters ==
Type 	Name 	Description
handle	handle_1	No Description Set
handle	handle_2	No Description Set
handle	handle_3	No Description Set
== Returns ==
bool - No Description Set
Category:Dota2Function
Category:Global
Dota 2 Workshop Tools/Scripting/API/GridNav.CanFindPath

== Function Description ==
 bool CanFindPath(Vector Vector_1, Vector Vector_2) 
Determine if it is possible to reach the specified end point from the specified start point. bool (vStart, vEnd)
;Example
function GridNav:CanFindPath( Vector_1, Vector_2 ) end
== Parameters ==
Type 	Name 	Description
Vector	Vector_1	No Description Set
Vector	Vector_2	No Description Set
== Returns ==
bool - No Description Set
Category:Dota2Function
Category:GridNav
Dota 2 Workshop Tools/Scripting/API/GridNav.DestroyTreesAroundPoint

== Function Description ==
 void DestroyTreesAroundPoint(Vector Vector_1, float float_2, bool bool_3) 
Destroy all trees in the area(vPosition, flRadius, bFullCollision
;Example
function GridNav:DestroyTreesAroundPoint( Vector_1, float_2, bool_3 ) end
== Parameters ==
Type 	Name 	Description
Vector	Vector_1	No Description Set
float 	float_2 	No Description Set
bool 	bool_3 	No Description Set
Category:Dota2Function
Category:GridNav
Dota 2 Workshop Tools/Scripting/API/GridNav.FindPathLength

== Function Description ==
 float FindPathLength(Vector Vector_1, Vector Vector_2) 
Find a path between the two points an return the length of the path. If there is not a path between the points the returned value will be -1. float (vStart, vEnd )
;Example
function GridNav:FindPathLength( Vector_1, Vector_2 ) end
== Parameters ==
Type 	Name 	Description
Vector	Vector_1	No Description Set
Vector	Vector_2	No Description Set
== Returns ==
float - No Description Set
Category:Dota2Function
Category:GridNav
Dota 2 Workshop Tools/Scripting/API/GridNav.GetAllTreesAroundPoint

== Function Description ==
 table GetAllTreesAroundPoint(Vector Vector_1, float float_2, bool bool_3) 
Returns a table full of tree HSCRIPTS (vPosition, flRadius, bFullCollision).
;Example
function GridNav:GetAllTreesAroundPoint( Vector_1, float_2, bool_3 ) end
== Parameters ==
Type 	Name 	Description
Vector	Vector_1	No Description Set
float 	float_2 	No Description Set
bool 	bool_3 	No Description Set
== Returns ==
table - No Description Set
Category:Dota2Function
Category:GridNav
Dota 2 Workshop Tools/Scripting/API/GridNav.GridPosToWorldCenterX

== Function Description ==
 float GridPosToWorldCenterX(int int_1) 
Get the X position of the center of a given X index
== Parameters ==
Type	Name 	Description
int 	int_1	No Description Set
== Returns ==
float - No Description Set
Category:Dota2Function
Category:GridNav
Dota 2 Workshop Tools/Scripting/API/GridNav.GridPosToWorldCenterY

== Function Description ==
 float GridPosToWorldCenterY(int int_1) 
Get the Y position of the center of a given Y index
== Parameters ==
Type	Name 	Description
int 	int_1	No Description Set
== Returns ==
float - No Description Set
Category:Dota2Function
Category:GridNav
Dota 2 Workshop Tools/Scripting/API/GridNav.IsNearbyTree

== Function Description ==
 bool IsNearbyTree(Vector position, float radius, bool bool_3) 
 
== Parameters ==
Type 	Name 	Description
Vector	position	No Description Set
float 	radius 	No Description Set
bool 	bool_3 	No Description Set
== Returns ==
bool - No Description Set
Category:Dota2Function
Category:GridNav
Dota 2 Workshop Tools/Scripting/API/GridNav.WorldToGridPosX

== Function Description ==
 int WorldToGridPosX(float float_1) 
Get the X index of a given world X position
== Parameters ==
Type 	Name 	Description
float	float_1	No Description Set
== Returns ==
int - No Description Set
Category:Dota2Function
Category:GridNav
Dota 2 Workshop Tools/Scripting/API/GridNav.WorldToGridPosY

== Function Description ==
 int WorldToGridPosY(float float_1) 
Get the Y index of a given world Y position
== Parameters ==
Type 	Name 	Description
float	float_1	No Description Set
== Returns ==
int - No Description Set
Category:Dota2Function
Category:GridNav
Dota 2 Workshop Tools/Scripting/API/ProjectileManager.CreateLinearProjectile

== Function Description ==
 int CreateLinearProjectile(table infoTable) 
Creates a linear projectile and returns the projectile ID
Table Inputs: Ability, Source, vSpawnOrigin, vVelocity, vAcceleration, fDistance, fStartRadius, fEndRadius, bHasFrontalCone, iUnitTargetTeam, iUnitTargetType, iUnitTargetFlags, bProvidesVision, iVisionTeamNumber, iVisionRadius, bDrawsOnMinimap, bVisibleToEnemies, bIgnoreSource,fExpireTime, fMaxSpeed''
;Example
--Creates a projectile that will travel 2000 units
function fire_arrow(args)
	local caster = args.caster
	--A Liner Projectile must have a table with projectile info
	local info = 
	{
		Ability = args.ability,
 	EffectName = args.EffectName,
 	vSpawnOrigin = caster:GetAbsOrigin(),
 	fDistance = 2000,
 	fStartRadius = 64,
 	fEndRadius = 64,
 	Source = caster,
 	bHasFrontalCone = false,
 	bReplaceExisting = false,
 	iUnitTargetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY,
 	iUnitTargetFlags = DOTA_UNIT_TARGET_FLAG_NONE,
 	iUnitTargetType = DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
 	fExpireTime = GameRules:GetGameTime() + 10.0,
		bDeleteOnHit = true,
		vVelocity = caster:GetForwardVector() * 1800,
		bProvidesVision = true,
		iVisionRadius = 1000,
		iVisionTeamNumber = caster:GetTeamNumber()
	}
	projectile = ProjectileManager:CreateLinearProjectile(info)
end
== Parameters ==
Type 	Name 	Description
table	infoTable	No Description Set
== Returns ==
int - projectile id
Category:Dota2Function
Category:ProjectileManager
Dota 2 Workshop Tools/Scripting/API/ProjectileManager.CreateTrackingProjectile

== Function Description ==
 void CreateTrackingProjectile(handle handle_1) 
Creates a tracking projectile
Table Inputs: Ability, Source, Target, EffectName, iMoveSpeed, vSourceLoc, iSourceAttachment, bProvidesVision, iVisionTeamNumber, iVisionRadius, bDrawsOnMinimap, bDodgeable, bIsAttack, bVisibleToEnemies, bReplaceExisting, flExpireTime''
;Example
--Create a tracking projectile from player 1 that follows player 2
local caster = PlayerResource:GetPlayer(0):GetAssignedHero()
local target = PlayerResource:GetPlayer(1):GetAssignedHero()
local info = 
{
	Target = target,
	Source = caster,
	Ability = caster:GetAbilityByIndex(0),	
	EffectName = "some_particle_effect",
 iMoveSpeed = 400,
	vSourceLoc= caster:GetAbsOrigin(), -- Optional (HOW)
	bDrawsOnMinimap = false, -- Optional
 bDodgeable = true, -- Optional
 bIsAttack = false, -- Optional
 bVisibleToEnemies = true, -- Optional
 bReplaceExisting = false, -- Optional
 flExpireTime = GameRules:GetGameTime() + 10, -- Optional but recommended
	bProvidesVision = true, -- Optional
	iVisionRadius = 400, -- Optional
	iVisionTeamNumber = caster:GetTeamNumber() -- Optional
}
projectile = ProjectileManager:CreateTrackingProjectile(info)
== Parameters ==
Type 	Name 	Description
handle	handle_1	No Description Set
Category:Dota2Function
Category:ProjectileManager
Dota 2 Workshop Tools/Scripting/API/ProjectileManager.GetLinearProjectileVelocity

== Function Description ==
 Vector GetLinearProjectileVelocity(int int_1) 
Returns a vector representing the current velocity of the projectile.
;Example
function ProjectileManager:GetLinearProjectileVelocity( int_1 ) end
== Parameters ==
Type	Name 	Description
int 	int_1	No Description Set
== Returns ==
Vector - No Description Set
Category:Dota2Function
Category:ProjectileManager
Dota 2 Workshop Tools/Scripting/API/Vector.Cross

== Function Description ==
 Vector Cross(Vector a, Vector b) 
Cross product of two vectors
;Example
a = Vector(1, 0, 0)
b = Vector(0, 1, 0)
c = a:Cross(b)
== Parameters ==
Type 	Name	Description
Vector	a 	No Description Set
Vector	b 	No Description Set
== Returns ==
Vector - Cross product of A and B
Category:Dota2Function
Category:Vector
Dota 2 Workshop Tools/Scripting/API/Vector.Dot

== Function Description ==
 float Dot(Vector a, Vector b) 
Dot product of two vectors
;Example
a = Vector(1, 0, 0)
b = Vector(0, 1, 0)
c = a:Dot(b)
== Parameters ==
Type 	Name	Description
Vector	a 	No Description Set
Vector	b 	No Description Set
== Returns ==
float - Dot product of A and B
Category:Dota2Function
Category:Vector
Dota 2 Workshop Tools/Scripting/API/Vector. add

== Function Description ==
 Vector __add(Vector a, Vector b) 
Overloaded +. Adds vectors together
;Example
local vec1 = Vector(1,2,3)
local vec2 = Vector(3,2,1)
print(vec1 + vec2) --prints '4, 4, 4'
== Parameters ==
Type 	Name	Description
Vector	a 	No Description Set
Vector	b 	No Description Set
== Returns ==
Vector - The Vectors added together
Category:Dota2Function
Category:Vector
Dota 2 Workshop Tools/Scripting/API/Vector. div

Category:Dota2Function
Category:Vector
== Function Description ==
 Vector __div(Vector a, Vector b) 
Overloaded /. Divides vectors
;Example
--some code here
== Parameters ==
Type 	Name	Description
Vector	a 	No Description Set
Vector	b 	No Description Set
== Returns ==
Vector - The Vectors divided
Dota 2 Workshop Tools/Scripting/API/Vector. eq

== Function Description ==
 bool __eq(Vector a, Vector b) 
Overloaded ==. Tests for Equality
;Example
a = Vector(1, 2, 3)
b = Vector(1, 2, 3)
eq = a == b
== Parameters ==
Type 	Name	Description
Vector	a 	No Description Set
Vector	b 	No Description Set
== Returns ==
bool - True if a == b
Category:Dota2Function
Category:Vector
Dota 2 Workshop Tools/Scripting/API/Vector. mul

== Function Description ==
 Vector __mul(Vector a, Vector b) 
Overloaded * returns the vectors multiplied together
;Example
a = Vec(1, 0, 0)
 b = Vec(0, 1, 0)
c=a * b
== Parameters ==
Type 	Name	Description
Vector	a 	No Description Set
Vector	b 	No Description Set
== Returns ==
Vector - Vectors multiplied together
Category:Dota2Function
Category:Vector
Dota 2 Workshop Tools/Scripting/API/Vector. sub

== Function Description ==
 Vector __sub(Vector a, Vector b) 
Overloaded -. Subtracts vectors
;Example
--some code here
== Parameters ==
Type 	Name	Description
Vector	a 	No Description Set
Vector	b 	No Description Set
== Returns ==
Vector - The Vectors subtracted
Category:Dota2Function
Category:Vector
Dota 2 Workshop Tools/Scripting/API/Vector.cross

== Function Description ==
 Vector cross(Vector a, Vector b) 
Cross product of two vectors
;Example
a = Vec(1, 0, 0)
 b = Vec(0, 1, 0)
c=a:cross(b)
== Parameters ==
Type 	Name	Description
Vector	a 	No Description Set
Vector	b 	No Description Set
== Returns ==
Vector - Cross product of A and B
Category:Dota2Function
Category:Vector
Dota 2 Workshop Tools/Scripting/API/Vector.dot

== Function Description ==
 float dot(Vector a, Vector b) 
Dot product of two vectors
;Example
a = Vec(1, 0, 0)
 b = Vec(0, 1, 0)
c=a:dot(b)
== Parameters ==
Type 	Name	Description
Vector	a 	No Description Set
Vector	b 	No Description Set
== Returns ==
float - Dot product of A and B
Category:Dota2Function
Category:Vector
Dota 2 Workshop Tools/Scripting/Abilities Data Driven/Modifier Events

A list of all the modifier events in the game. Not all of the events on this list are hooked up to the data-driven ability system at this time. Items listed below cannot be used directly and should be used as reference only.
*MODIFIER_EVENT_ON_ABILITY_END_CHANNEL
*MODIFIER_EVENT_ON_ABILITY_EXECUTED
*MODIFIER_EVENT_ON_ABILITY_START
*MODIFIER_EVENT_ON_ATTACK
*MODIFIER_EVENT_ON_ATTACK_ALLIED
*MODIFIER_EVENT_ON_ATTACKED
*MODIFIER_EVENT_ON_ATTACK_FAIL
*MODIFIER_EVENT_ON_ATTACK_LANDED
*MODIFIER_EVENT_ON_ATTACK_START
*MODIFIER_EVENT_ON_BREAK_INVISIBILITY
*MODIFIER_EVENT_ON_DEATH
*MODIFIER_EVENT_ON_HEAL_RECEIVED
*MODIFIER_EVENT_ON_HEALTH_GAINED
*MODIFIER_EVENT_ON_HERO_KILLED
*MODIFIER_EVENT_ON_MANA_GAINED
*MODIFIER_EVENT_ON_ORB_EFFECT
*MODIFIER_EVENT_ON_ORDER
*MODIFIER_EVENT_ON_PROCESS_UPGRADE
*MODIFIER_EVENT_ON_PROJECTILE_DODGE
*MODIFIER_EVENT_ON_REFRESH
*MODIFIER_EVENT_ON_RESPAWN
*MODIFIER_EVENT_ON_SPENT_MANA
*MODIFIER_EVENT_ON_STATE_CHANGED
*MODIFIER_EVENT_ON_TAKEDAMAGE
*MODIFIER_EVENT_ON_TAKEDAMAGE_REAPERSCYTHE
*MODIFIER_EVENT_ON_TELEPORTED
*MODIFIER_EVENT_ON_TELEPORTING
*MODIFIER_EVENT_ON_UNIT_MOVED
Category:Dota 2 Workshop Tools
Dota 2 Workshop Tools/Scripting/Abilities Scripted

It is possible to call Lua script functions when abilities are used to create even more interesting unique abilities.
"OnSpellStart"
{
	"RunScript"
	{
		"ScriptFile"		"custom_scripted_abilities.lua"
		"Function"		"Punch"
		"Target"		"POINT"
	}
}
* ScriptFile - Specifies the Lua file where the function resides
* Function - Function name to call
Category:Dota 2 Workshop Tools
Dota 2 Workshop Tools/Scripting/Applying Data Driven Modifiers from script

It's possible to freely apply custom data-driven modifiers from VScript using the following function.
=== CDOTA_Item_DataDriven ===
'''
Function 	Signature 	Description
ApplyDataDrivenModifier	void ApplyDataDrivenModifier(handle source, handle target, string modifier_name, handle modifierArgs)	
Hopefully you've noticed this function belongs to objects of the Item type. It's used along with a data-driven item definition containing your data-driven modifiers.
This item decleration should go into scripts/npc/npc_items_custom.txt
	"item_modifier_master"
	{
		"ID"							"1010"
		// General
		//-------------------------------------------------------------------------------------------------------------
		"AbilityBehavior"				"DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_IMMEDIATE"
		"BaseClass"						"item_datadriven"
		// Stats
		//-------------------------------------------------------------------------------------------------------------
		"AbilityCastRange"				"100"
		"AbilityCastPoint"				"0.0"
		
		// Item Info
		//-------------------------------------------------------------------------------------------------------------
		"Modifiers"
		{
			"modifier_custom"
			{
				"TextureName" "item_greater_salve"
				"EffectName" "particles/items_fx/healing_flask.vpcf"
				"EffectAttachType" "follow_origin"
				"Properties"
				{
					"MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT" "100"
				}
			}
		}
}
And the script:
local ModMaster = CreateItem("item_modifier_master", nil, nil) 
ModMaster:ApplyDataDrivenModifier(unit, unit, "modifier_custom", {duration = 3})
Category: Dota 2 Workshop Tools
Dota 2 Workshop Tools/Scripting/BoundsHullName Size Reference

* DOTA_HULL_SIZE_BARRACKS - 144x144
* DOTA_HULL_SIZE_BUILDING - 81.281357x81.281357
* DOTA_HULL_SIZE_FILLER - 96x96
* DOTA_HULL_SIZE_HERO - 24x24
* DOTA_HULL_SIZE_HUGE - 80x80
* DOTA_HULL_SIZE_REGULAR - 16x16
* DOTA_HULL_SIZE_SIEGE - 16x16
* DOTA_HULL_SIZE_SMALL - 8x8
* DOTA_HULL_SIZE_TOWER - 144x144
Found via Entity:GetBoundingMaxs()
Category: Dota 2 Workshop Tools
Dota 2 Workshop Tools/Scripting/Console Commands

* dota_script_function_help - Displays available function calls to be made into Dota 2.
* script_reload - Reloads scripts at runtime.
* dota_dump_units - Print a list of all game units.
* dota_dump_game_items - Print a list of all game items with their item ids in CSV format.
* dump_modifier_list - Dumps all modifiers that exist in the game.
* dota_gridnav_show - Show server-side gridnav overlay in-game.
Category:Dota 2 Workshop Tools
Category:English
Dota 2 Workshop Tools/Scripting/Data Driven Motion Controller Example

Example Video
Now that I have your attention, let's talk. The data-driven ability system is seriously cool and there's a lot of neat stuff we can make with it. There's also a couple of data-driven effects that weren't listed in any of the examples or documentation. One of these is "ApplyMotionController".
So what does ApplyMotionController do? I couldn't find any references to it anywhere, so I decided to find out for myself. First, let's start with the format. The format looks a little something like this:
"ApplyMotionController"
 {
 "TARGET" "TARGET"
 "ScriptFile"	 "scripts/vscripts/your_script_here.lua"
 "HorizontalControlFunction"	"TestGravityFunc"
 "VerticalControlFunction" "TestGravityFunc"			
 }
There could be other parameters too, but this appears to be enough to make it work. After some testing, I found that ApplyMotionController repeatedly calls both the horizontal and vertical control functions several times per second. Return values seemed to have no effect on the behavior. As for the function itself:
function TestGravityFunc(args)
 local targetPos = args.target:GetAbsOrigin()
 local casterPos = args.caster:GetAbsOrigin()
 local direction = targetPos - casterPos
 local vec = direction:Normalized() * 3.0
	
 args.caster:SetAbsOrigin(casterPos + vec)
 end
It's a pretty simple function. It gets the direction of the caster to the target, and moves the caster 3 units in that direction. Since the function is being called so often, the result is a pseudo-gravitational pull towards the target.
However, I believe there is a lot more to the effect than what I've done so far. For starters, I can't find any difference between the HorizontalControlFunction parameter and the VerticalControlFunction parameter. I imagine there should be some way to have these functions return some sort of differing movement command to the target, but so far I haven't figured that out yet. There's also a CDOTA_BaseNPC:InterruptMotionControllers(bool) function which I've tried out, although it doesn't appear to do anything.
Dota 2 Workshop Tools/Scripting/Debugging Lua scripts

=== Overview === 
The Lua debugger uses Eclipse LDT as the front end.
The debugging setup consists of the following steps
* Install Eclipse LDT
* Set up a new project
* Set up a new debug configuration
* Open the Debug perspective 
* Connect LDT to the game 
=== Installing Eclipse LDT === 
* Download Eclipse LDT from this page: https://eclipse.org/ldt/. 
* Unzip into a folder of your choice
* Run LuaDevelopmentTools.exe. Select a workspace folder, which is where LDT stores project information.
=== Setting up a new LDT project ===
* Click File->New->Lua Project, to bring up the New Lua project dialog
* Select a Project name
* In Contents, select "Create project at existing location...," and set the Directory to the location of the game folder
* Click Next. This may take some time, as LDT scans the contents of the Directory. When the scan is over, ignore the warning that says, "Your project has no source folder defined," and click Finish.
* At this point, it's possible to browse the scripts folder in the Script Explorer view, open Lua files, and set breakpoints by double-clicking in the margin.
=== Setting up a new LDT debug configuration for the project ===
* Click Run->Debug Configurations, to bring up the Debug Configurations dialog
* Select "Lua Attach to Application"
* Click the "New launch configuration" button
* Give the new configuration a name
* Set the "IDE key" to "server", or "client", to attach to the server or client script VM, respectively
* Set the Timeout(s) to a large value
* Hit "Apply". Close the Debug Configurations dialog.
=== Opening the Debug Perspective in LDT ===
Most debugging functionality is actually available via another window on LDT: the Debug perspective. Bring this up by clicking Window->Perspective->Open Perspective->Debug.
=== Connecting LDT to the game === 
 
* Start the game and wait till the frame loop starts. The in-game debugging server only gets to run during the frame loop, and LDT can time-out waiting for a response if this takes too long.
* Click the drop-down arrow next to the bug icon and select Debug Configurations.
* In the Debug Configurations dialog, select the configuration you just created, and hit Debug. Recently used configurations appear in the bug icon drop-down, for quick access.
* In VConsole2, type "script_attach_debugger" to debug the server VM, or "cl_script_attach_debugger" to debug the client VM. Note that for this to work, the Debug Configuration selected must have the IDE key set to "server" and "client" respectively.
=== Using the LDT debugging UI ===
LDT user guide - Debugging a Lua program
Category: Dota 2 Workshop Tools
Dota 2 Workshop Tools/Scripting/Dedicated VConsole Log Viewer

Some users find it useful to isolate all Vscript messages in VConsole to its own dedicated tab. This makes debugging your work simpler and reduces the chance of you missing an error or other important information. 
To do this, right click on any VScript channel header in VConsole, and select “Open In New Log Viewer” . This will open a new tab in VConsole that only contains messages sent to the VScript channel.
Category:Dota 2 Workshop Tools
Dota 2 Workshop Tools/Scripting/Detecting If Player Clicked Inside An Area

* Step 1: In Hammer, create a brush with the brush tool (+). Make sure you have the "toolstrigger.vmat" material selected. It should cover the area you want to be tested.
* Step 2: Select the brush you just and go to Tools > Tie To Entity (+). This will create a trigger entity that is tied to your box.
* Step 3: Select the trigger and change its class to "trigger_multiple". 
* Step 4: Give the trigger a targetname, for the sake of this example, let's call it "trigger_no_ward".
Now in npc_items_custom.txt:
	"item_custom_ward"
	{
		"BaseClass"					"item_datadriven"
		"AbilityTextureName"				"item_ward_sentry"
		"AbilityBehavior"				"DOTA_ABILITY_BEHAVIOR_POINT"
		"OnSpellStart"
		{
			"RunScript"
			{
				"ScriptFile"			"scripts/vscripts/custom_ward.lua"
				"Function"		 "spawn"
			 "Target" "POINT"
			}	
		}
	}
	
And in custom_ward.lua:
function spawn(keys)
 local inTrigger = false
 local CHECKINGRADIUS = 10
 for _,thing in pairs(Entities:FindAllInSphere(GetGroundPosition(keys.target_points[1], nil), CHECKINGRADIUS) ) do
 if (thing:GetName() == "trigger_no_ward") then
 --In no_ward trigger. Set flag.
 inTrigger = true
 end
 end
 
 if (inTrigger == True)
 --Used onto specified area. Do stuff...
 end
end
Category: Dota 2 Workshop Tools