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

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (clean up, added deadend tag)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Dead end|date=January 2024}}
{{Note | This page is automatically generated.  Any changes may be overwritten}}
{{Note | This page is automatically generated.  Any changes may be overwritten}}
[[Category:Dota2Function]]
[[Category:Global]]


== Function Description ==
== Function Description ==


''' table FindUnitsInLine(int ''teamNumber'', Vector ''vStartPos'', Vector ''vEndPos'', handle ''cacheUnit'', float ''width'', int ''teamFilter'', int ''typeFilter'', int ''flagFilter'') '''
''' 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)''
''Finds the units in a given line with the given flags. ( iTeamNumber, vStartPos, vEndPos, hCacheUnit, flWidth, iTeamFilter, iTypeFilter, iFlagFilter)''


;Example
;Example
Line 25: Line 22:
local flags = DOTA_UNIT_TARGET_FLAG_INVULNERABLE
local flags = DOTA_UNIT_TARGET_FLAG_INVULNERABLE


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


-- Make the found units move to (0, 0, 0)
-- Make the found units move to (0, 0, 0)
Line 75: Line 72:


''table'' - No Description Set
''table'' - No Description Set
[[Category:Dota2Function]]
[[Category:Global]]

Latest revision as of 09:56, 21 January 2024

Dead End - Icon.png
This article has no Wikipedia icon links to other VDC articles. Please help improve this article by adding links Wikipedia icon that are relevant to the context within the existing text.
January 2024
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

local 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 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