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

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (clean up, added deadend tag)
 
(5 intermediate revisions by 2 users 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:CEntities]]


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


''' handle FindByClassnameWithin(handle ''startFrom'', string ''className'', Vector ''origin'', float ''maxRadius'') '''
''' handle FindByClassnameWithin(handle ''startFrom'', string ''className'', Vector ''origin'', float ''maxRadius'') '''
Line 11: Line 10:


== 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 ==
[[Category:Dota2Function]]
To search through and print out all entities of tree class in a given radius
[[Category:CEntities]]
 
local x = Entities:FindByClassnameWithin(nil, "ent_dota_tree", vars.caster:GetOrigin(), 1000)
while x ~= nil do
x = Entities:FindByClassnameWithin(x, "ent_dota_tree", vars.caster:GetOrigin(), 1000)
print(x)
end

Latest revision as of 09:38, 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

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