Dota 2 Workshop Tools/Scripting/API/Global.FindUnitsInLine: Difference between revisions
< Dota 2 Workshop Tools | Scripting | API
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...") |
Thunder4ik (talk | contribs) m (clean up, added deadend tag) |
||
(3 intermediate revisions 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}} | ||
== 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 | ||
<source lang="lua"> | <source lang="lua"> | ||
-- Find all | -- Find all enemy units | ||
local hero = PlayerResource:GetPlayer(0):GetAssignedHero() | local hero = PlayerResource:GetPlayer(0):GetAssignedHero() | ||
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 44: | Line 41: | ||
|- | |- | ||
| Vector | | Vector | ||
| | | vStartPos | ||
| No Description Set | |||
|- | |||
| Vector | |||
| vEndPos | |||
| No Description Set | | No Description Set | ||
|- | |- | ||
Line 52: | Line 53: | ||
|- | |- | ||
| float | | float | ||
| | | width | ||
| No Description Set | | No Description Set | ||
|- | |- | ||
Line 65: | Line 66: | ||
| int | | int | ||
| flagFilter | | flagFilter | ||
| No Description Set | | No Description Set | ||
|} | |} | ||
Line 79: | Line 72: | ||
''table'' - No Description Set | ''table'' - No Description Set | ||
[[Category:Dota2Function]] | |||
[[Category:Global]] |
Latest revision as of 09:56, 21 January 2024

This article has no
links to other VDC articles. Please help improve this article by adding links
that are relevant to the context within the existing text.
January 2024


January 2024

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