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

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 25: Line 25:
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)

Revision as of 22:58, 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

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