entities: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{since" to "{{Since")
m (Text replacement - "_{10,} " to "")
Line 1: Line 1:
{{Command|Comments=
{{Command|Comments=
____________________________________________________________________________________________


| arma2oa |Game name=
| arma2oa |Game name=
Line 7: Line 6:


|gr1= Object Detection |GROUP1=
|gr1= Object Detection |GROUP1=
____________________________________________________________________________________________


| 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.
| 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.
{{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.}} |DESCRIPTION=
{{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.}} |DESCRIPTION=
____________________________________________________________________________________________


| [[entities]] type |SYNTAX=
| [[entities]] type |SYNTAX=
Line 18: Line 15:


| [[Array]] |RETURNVALUE=
| [[Array]] |RETURNVALUE=
____________________________________________________________________________________________


|s2= [[entities]] [typesInclude, typesExclude, includeCrews, excludeDead] {{Since|arma3|1.65.138685|y}} |SYNTAX2=
|s2= [[entities]] [typesInclude, typesExclude, includeCrews, excludeDead] {{Since|arma3|1.65.138685|y}} |SYNTAX2=
Line 31: Line 27:


|r2= [[Array]] |RETURNVALUE2=
|r2= [[Array]] |RETURNVALUE2=
____________________________________________________________________________________________


|x1= <code>_allcars = [[entities]] "Car";</code> |EXAMPLE1=  
|x1= <code>_allcars = [[entities]] "Car";</code> |EXAMPLE1=  
Line 40: Line 35:


|x4= Return all alive [[west]] soldiers on foot:<code>_footsoldiers = [[entities]] [<nowiki/>["SoldierWB"], [], [[false]], [[true]]];</code> |EXAMPLE4=
|x4= Return all alive [[west]] soldiers on foot:<code>_footsoldiers = [[entities]] [<nowiki/>["SoldierWB"], [], [[false]], [[true]]];</code> |EXAMPLE4=
____________________________________________________________________________________________


| [[nearEntities]], [[allUnits]], [[vehicles]], [[agents]], [[allMissionObjects]] |SEEALSO=
| [[nearEntities]], [[allUnits]], [[vehicles]], [[agents]], [[allMissionObjects]] |SEEALSO=

Revision as of 02:21, 17 January 2021

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] Template:Since
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:
nearEntitiesallUnitsvehiclesagentsallMissionObjects

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

Notes

Bottom Section