entities: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (variable naming ine xamples)
 
(53 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma2oa |= Game name
|game1= arma2oa
|version1= 1.60


|1.60|= Game version
|game2= tkoh
____________________________________________________________________________________________
|version2= 1.00


| Returns a list of all alive and dead entities of the given type or deriving from the given type. Units in vehicles are ignored. When empty string "" is passed for the type, all entity types are returned.
|game3= arma3
<br><br>Alternative syntax introduced in Arma 3 v1.65.138685 allows to filter entities by type and alive status as well as to return entities currently in vehicles.<br><br>'''Optimisation tip''': Keep number of types in both ''includeTypes'' and ''excludeTypes'' arrays to a minimum by possibly using parent/base classes. If you have to use several types, arrange them in order so that the more common types go at the beginning of the array. |= Description
|version3= 0.50
____________________________________________________________________________________________


| '''entities''' type |= Syntax
|gr1= Object Detection


|p1= type: [[String]]  |= PARAMETER1
|descr= Returns a list of all alive and dead entities of the given type or deriving from the given type. Units in vehicles are ignored with the primary syntax.
{{Feature|informative|'''Optimisation tip''': Keep number of types in both ''includeTypes'' and ''excludeTypes'' arrays to a minimum by possibly using parent/base classes.<br>If you have to use several types, arrange them in order so that the more common types go at the beginning of the array.}}


| [[Array]] |= RETURNVALUE
|s1= [[entities]] type


| s2= '''entities''' [typesInclude, typesExclude, includeCrews, excludeDead]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;''since Arma 3 v1.65.138685'' |= Syntax
|p1= type: [[String]] - if an empty string {{hl|""}} is provided, all entities are returned
|p21= [typesInclude, typesExclude, includeCrews, excludeDead]: [[Array]] |= PARAMETER21
|p22= typesInclude: [[Array]] - in format [type1, type2, ...typeN], where type is a [[String]]. Empty array [] means include every entity. Method used for filtering - [[isKindOf]]|= PARAMETER22
|p23=  typesExclude: [[Array]] - in format [type1, type2, ...typeN], where type is a [[String]]. Empty array [] means exclude no entity. Method used for filtering - [[isKindOf]]|= PARAMETER23
|p24= includeCrews (Optional): [[Boolean]] - include crews currently in vehicles. Default: [[false]] |= PARAMETER24
|p25= excludeDead (Optional): [[Boolean]] - exclude dead entities. Default: [[false]] |= PARAMETER25


| r2= [[Array]] |= RETURNVALUE
|r1= [[Array]]


|x1= <code>_allcars = [[entities]] "Car";</code>|= EXAMPLE1
|s2= [[entities]] [typesInclude, typesExclude, includeCrews, excludeDead]
|x2= Return all alive entities on the map:<code>_allalive = [[entities]] <nowiki>[</nowiki>[], [], [[true]], [[true]]];</code>|= EXAMPLE2
|x3= Return dead and alive entities but logic:<code>_notlogic = [[entities]] <nowiki>[</nowiki>[], ["Logic"], [[true]]];</code>|= EXAMPLE3
|x4= Return all alive [[west]] soldiers on foot:<code>_footsoldiers = [[entities]] <nowiki>[</nowiki>["SoldierWB"], [], [[false]], [[true]]];</code>|= EXAMPLE4


____________________________________________________________________________________________
|s2since= arma3 1.66


| [[nearEntities]], [[allUnits]], [[vehicles]], [[agents]], [[allMissionObjects]] |= SEEALSO
|p21= typesInclude: [[Array]] - in format [type1, type2, ...typeN], where type is a [[String]]. Empty array [] means include every entity. Method used for filtering - [[isKindOf]]


| |= MPBEHAVIOUR
|p22= typesExclude: [[Array]] - in format [type1, type2, ...typeN], where type is a [[String]]. Empty array [] means exclude no entity. Method used for filtering - [[isKindOf]]
____________________________________________________________________________________________
 
}}
|p23= includeCrews: [[Boolean]] - (Optional, default [[false]]) include crews currently in vehicles
 
|p24= excludeDead: [[Boolean]] - (Optional, default [[false]]) exclude dead entities
 
|r2= [[Array]]


<h3 style='display:none'>Notes</h3>
|x1= <sqf>_allCars = entities "Car";</sqf>
<dl class='command_description'>
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on Mar 27, 2014 - 20:26
<dt class="note">'''[[User:ffur2007slx2_5|ffur2007slx2_5]]'''<dd class="note">In ArmA3 ver 1.14 type (string) can be any children class under configfile >> "CfgVehicles". e.g.<code>[[entities]] "All"; //or [[entities]] "CAManBase"; etc.</code>
<!-- Note Section END -->
</dl>


<h3 style='display:none'>Bottom Section</h3>
|x2= Return all alive entities on the map:
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
<sqf>_allAlive = entities [[], [], true, true];</sqf>
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
|x3= Return dead and alive entities but logic:
<dl class="command_description">
<sqf>_notLogic = entities [[], ["Logic"], true];</sqf>
<dd class="notedate">Posted on July 12, 2016 - 22:37 (UTC)</dd>
<dt class="note">[[User:MisterGoodson|MisterGoodson]]</dt>
<dd class="note">
In A3 1.62 <code>entities "CAManBase"</code> does not include entities inside vehicles (crew).
</dd>
</dl>
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
|x4= Return all alive [[west]] soldiers on foot:
<dl class="command_description">
<sqf>_footSoldiers = entities [["SoldierWB"], [], false, true];</sqf>
<dd class="notedate">Posted on May 2, 2017 - 20:29 (UTC)</dd>
<dt class="note">[[User:Tankbuster|Tankbuster]]</dt>
<dd class="note">
You can have multiple classnames in both the include and exclude arrays.
<code>entities [["SoldierWB", "SoldierEB"],[]] </code>


</dd>
|seealso= [[nearEntities]] [[allGroups]] [[allUnits]] [[units]] [[vehicles]] [[agents]] [[playableUnits]] [[switchableUnits]] [[allPlayers]] [[allDead]] [[allDeadMen]] [[allUnitsUAV]] [[allCurators]] [[allObjects]] [[allMissionObjects]] [[allSimpleObjects]] [[allMines]]
</dl>
}}
<!-- DISCONTINUE Notes -->

Latest revision as of 18:11, 11 April 2024

Hover & click on the images for description

Description

Description:
Returns a list of all alive and dead entities of the given type or deriving from the given type. Units in vehicles are ignored with the primary syntax.
Optimisation tip: Keep number of types in both includeTypes and excludeTypes arrays to a minimum by possibly using parent/base classes.
If you have to use several types, arrange them in order so that the more common types go at the beginning of the array.
Groups:
Object Detection

Syntax

Syntax:
entities type
Parameters:
type: String - if an empty string "" is provided, all entities are returned
Return Value:
Array

Alternative Syntax

Syntax:
entities [typesInclude, typesExclude, includeCrews, excludeDead]
Parameters:
typesInclude: Array - in format [type1, type2, ...typeN], where type is a String. Empty array [] means include every entity. Method used for filtering - isKindOf
typesExclude: Array - in format [type1, type2, ...typeN], where type is a String. Empty array [] means exclude no entity. Method used for filtering - isKindOf
includeCrews: Boolean - (Optional, default false) include crews currently in vehicles
excludeDead: Boolean - (Optional, default false) exclude dead entities
Return Value:
Array

Examples

Example 1:
_allCars = entities "Car";
Example 2:
Return all alive entities on the map:
_allAlive = entities [[], [], true, true];
Example 3:
Return dead and alive entities but logic:
_notLogic = entities [[], ["Logic"], true];
Example 4:
Return all alive west soldiers on foot:
_footSoldiers = entities [["SoldierWB"], [], false, true];

Additional Information

See also:
nearEntities allGroups allUnits units vehicles agents playableUnits switchableUnits allPlayers allDead allDeadMen allUnitsUAV allCurators allObjects allMissionObjects allSimpleObjects allMines

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note