Dota 2 Workshop Tools/Scripting/API/Global.FindUnitsInRadius

From Valve Developer Community
Jump to: navigation, search
Note: This page is automatically generated. Any changes may be overwritten

Function Description

table FindUnitsInRadius(int teamNumber, Vector position, handle cacheUnit, float radius, int teamFilter, int typeFilter, int flagFilter, int order, bool canGrowCache)

Finds the units in a given radius with the given flags. ( iTeamNumber, vPosition, hCacheUnit, flRadius, iTeamFilter, iTypeFilter, iFlagFilter, iOrder, bCanGrowCache )

-- Find all Dire units
direUnits = FindUnitsInRadius(DOTA_TEAM_BADGUYS,
                              Vector(0, 0, 0),
-- Make the found units move to (0, 0, 0)
for _,unit in pairs(direUnits) do
   unit:MoveToPosition(Vector(0, 0, 0))


Type Name Description
int teamNumber Your Unit's Team. Refer Here
Vector position Point in dota 2 map about which you want to center your search. Use unit:GetAbsOrigin() to center it about a unit.
handle cacheUnit No Description Set
float radius The search radius. (FIND_UNITS_EVERYWHERE means the radius will cover the whole map. Refer to more Here)
int teamFilter This will be with respect to team on the first parameter. Refer Here
int typeFilter Types of units you want to include/exclude in search. Refer Here
int flagFilter Include/Exclude units which if respectilely flagged. Refer Here
int order No Description Set
bool canGrowCache No Description Set


A table containing the found units. If no units are found, FindUnitsInRadius returns an empty table; it does not return nil.