Dota 2 Workshop Tools/Scripting/API/Global.FindUnitsInLine: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with "{{Note | This page is automatically generated. Any changes may be overwritten}} Category:Dota2Function Category:Global == Function Description == ''' table FindUni...")
 
No edit summary
Line 14: Line 14:
;Example
;Example
<source lang="lua">
<source lang="lua">
-- Find all Dire units
-- Find all enemy units
local hero = PlayerResource:GetPlayer(0):GetAssignedHero()
local hero = PlayerResource:GetPlayer(0):GetAssignedHero()


Line 44: Line 44:
|-
|-
| Vector
| Vector
| position
| vStartPos
| No Description Set
|-
| Vector
| vStartPos
| No Description Set
|-
| handle
| vEndPos
| No Description Set
| No Description Set
|-
|-
Line 52: Line 60:
|-
|-
| float
| float
| radius
| width
| No Description Set
| No Description Set
|-
|-
Line 65: Line 73:
| int
| int
| flagFilter
| flagFilter
| No Description Set
|-
| int
| order
| No Description Set
|-
| bool
| canGrowCache
| No Description Set
| No Description Set
|}
|}

Revision as of 22:56, 7 May 2016

Note.pngNote: This page is automatically generated. Any changes may be overwritten

Function Description

table FindUnitsInLine(int teamNumber, Vector vStartPos, Vector vEndPos, handle cacheUnit, float width, int teamFilter, int typeFilter, int flagFilter)

Finds the units in a given line with the given flags. ( iTeamNumber, vStartPos, vEndPos, hCacheUnit, flWidth, iTeamFilter, iTypeFilter, iFlagFilter)


Example
-- Find all enemy units
local hero = PlayerResource:GetPlayer(0):GetAssignedHero()

local vStartPos = hero:GetOrigin()
local vEndPos = vStartPos + hero:GetForwardVector() * 500

local width = 128
local teams = DOTA_UNIT_TARGET_TEAM_ENEMY
local types = DOTA_UNIT_TARGET_BASIC + DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BUILDING + DOTA_UNIT_TARGET_CREEP
local flags = DOTA_UNIT_TARGET_FLAG_INVULNERABLE

units = FindUnitsInLine(hero:GetTeam(), vStartPos, vEndPos, hero, width, teams, types, flags)

-- Make the found units move to (0, 0, 0)
for _,unit in pairs(units) do
   unit:MoveToPosition(Vector(0, 0, 0))
end

Parameters

Type Name Description
int teamNumber No Description Set
Vector vStartPos No Description Set
Vector vStartPos No Description Set
handle vEndPos No Description Set
handle cacheUnit No Description Set
float width No Description Set
int teamFilter No Description Set
int typeFilter No Description Set
int flagFilter No Description Set

Returns

table - No Description Set