Dota 2 Workshop Tools/Scripting/API/CEntities.FindByClassnameWithin: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Dota_Lebot push: Updated Page)
Line 9: Line 9:


''Find entities by class name within a radius. Pass ''nil'' to start an iteration, or reference to a previously found entity to continue a search''
''Find entities by class name within a radius. Pass ''nil'' to start an iteration, or reference to a previously found entity to continue a search''


== Parameters ==
== Parameters ==
{| class="standard-table" style="width: 100%;"
{| class="standard-table" style="width: 50%;"
! Type
! Type
! Name
! Name
! Description
! Description
! Example
|-
|-
| handle
| handle
| startFrom
| startFrom
| The last found unit, used to iterate through all units in area
| No Description Set
| x/nil
|-
|-
| string
| string
| className
| className
| The class of entity you are looking for
| No Description Set
| "ent_dota_tree"
|-
|-
| Vector
| Vector
| origin
| origin
| The center of the area to search around
| No Description Set
| keys.caster:GetAbsOrigin()
|-
|-
| float
| float
| maxRadius
| maxRadius
| The radius in dota distance that you want to search
| No Description Set
| 1000
|}
|}


== Returns ==
== Returns ==


''handle'' - The handle to the found unit
''handle'' - No Description Set
 
== Example ==
To search through and print out all entities of tree class in a given radius
 
  local x = nil
  repeat
      x = Entities:FindByClassnameWithin(x, "ent_dota_tree", vars.caster:GetOrigin(), 1000)
      print(x)
  until x == nil

Revision as of 02:14, 17 June 2015

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

Function Description

handle FindByClassnameWithin(handle startFrom, string className, Vector origin, float maxRadius)

Find entities by class name within a radius. Pass nil to start an iteration, or reference to a previously found entity to continue a search


Parameters

Type Name Description
handle startFrom No Description Set
string className No Description Set
Vector origin No Description Set
float maxRadius No Description Set

Returns

handle - No Description Set