getEntityInfo: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "{{RV|type=command |game1= arma3 |version1= 2.16 |branch= dev |gr1= Object Manipulation |descr= Returns various properties for the given entity. |s1= getEntityInfo enti...")
 
m (Text replacement - "↵|version1= 2.18↵↵|branch= dev↵" to " |version1= 2.18 ")
 
(14 intermediate revisions by 4 users not shown)
Line 2: Line 2:


|game1= arma3
|game1= arma3
|version1= 2.16
|version1= 2.18
|branch= dev


|gr1= Object Manipulation
|gr1= Object Manipulation


|descr= Returns various properties for the given entity.
|descr= Returns various properties for the given entity. Most properties should be checked where entity is [[local]]


|s1= [[getEntityInfo]] entity
|s1= [[getEntityInfo]] entity


|p1= entity: [[Object]] - entity
|p1= entity: [[Object]]


|r1= [[Array]] - array in format [isAnimal, isDeadSet, deadSetTime, lastEntityCausingDamage, lastDamageTime, isUpsideDown, upsideDownTime, isStopped, canFloat, hasTerminalOpened], where:
|r1= [[Array]] in format [isMan, isAnimal, isDeadSet, deadSetTime, lastEntityCausingDamage, lastDamageTime, isUpsideDown, upsideDownTime, isStopped, canFloat, hasTerminalOpened, isWeaponholder, isWreck, isSmoking, isSetForDeletion], where:
* isAnimal: [[Boolean]] - [[true]] if the entity is an animal
* 0 - isMan [[Boolean]] - [[true]] if the entity is a man
* isDeadSet: [[Boolean]] - [[true]] if the entity has dead flag set. Often has the same value as ![[alive]], but is not the same, as [[alive]] checks the total damage.
* 1 - isAnimal: [[Boolean]] - [[true]] if the entity is an animal
* deadSetTime: [[Number]] - for how long the entity was dead
* 2 - isDeadSet: [[Boolean]] - [[true]] if the entity has dead flag set. Often has the same value as ![[alive]], but is not the same, as [[alive]] checks the total damage.
* lastEntityCausingDamage: [[Object]] - [[objNull]] or the entity that last caused damage to this entity. Is not the same as the killer but could be the same. Killed entity might not have this set either. The entity doesn't have to be dead in order to have last entity that cased damage assigned.
* 3 - deadSetTime: [[Number]] - for how long the entity was dead
* lastDamageTime: [[Number]] - how long ago the lastEntityCausingDamage was assigned
* 4 - lastEntityCausingDamage: [[Object]] - [[objNull]] or the entity that last caused damage to this entity. Is not the same as the killer but could be the same. Killed entity might not have this set either. The entity does not have to be dead in order to have last entity that caused damage assigned.
* isUpsideDown: [[Boolean]] - [[true]] if entity is upside down. The engine considers this to be <sqf>vectorUp ent select 2 < 0.3</sqf>
* 5 - lastDamageTime: [[Number]] - how long ago was ''lastEntityCausingDamage'' assigned
* upsideDownTime: [[Number]] - how long the entity was upside down.
* 6 - isUpsideDown: [[Boolean]] - [[true]] if the entity is upside down. The engine considers this to be <sqf inline>vectorUp ent select 2 < 0.3</sqf>
* isStopped: [[Boolean]] - [[true]] when the entity does not need to be actively simulated.
* 7 - upsideDownTime: [[Number]] - how long the entity was upside down.
* canFloat: [[Boolean]] - [[true]] if the entity is able to float on water.
* 8 - isStopped: [[Boolean]] - [[true]] when the entity does not need to be actively simulated.
* hasTerminalOpened: [[Boolean]] - [[true]] if the UAV terminal is opened for the given entity.
* 9 - canFloat: [[Boolean]] - [[true]] if the entity is able to float on water.
* 10 - hasTerminalOpened: [[Boolean]] - [[true]] if the UAV terminal is opened for the given entity.
* 11 - isWeaponholder: [[Boolean]] - [[true]] if the entity is weaponholder.
* 12 - isWreck: [[Boolean]] - [[true]] if the entity is wreck.
* 13 - isSmoking: [[Boolean]] - [[true]] if the entity has smoke and fire destruction effect active.
* 14 - isSetForDeletion: [[Boolean]] - [[true]] if the entity was set for deletion, but is not yet removed from the simulation. Simple Object is supported.


|x1= <sqf>_entityInfo = getEntityInfo ent1;</sqf>
{{Feature|informative|
In multiplayer, following values update properly only when entity is [[local]]:
* lastEntityCausingDamage
* lastDamageTime
* isStopped
Other values are either static or update depending on how your client sees the entity right now.


|seealso= [[cursorObject]] [[cursorTarget]] [[createSimpleObject]] [[getObjectType]] [[getObjectTextures]] [[objectParent]] [[setVelocityTransformation]] [[getUnitFreefallInfo]] [[getModelInfo]]
Timer values are never exact between clients and vary slightly depending on latency, JIP clients end up with large timer values close to game's [[time]] but get normal once associated value changes again:
* deadSetTime
* lastDamageTime
* upsideDownTime
}}
 
|s2= entity [[getEntityInfo]] index
|p21= entity: [[Object]]
|p22= index: [[Number]] - property index (see main syntax, 2 - isDeadSet for example)
|r2= [[Anything]] - depends on the requested property, or [[Nothing]]
 
|x1= <sqf>private _entityInfo = getEntityInfo ent1;</sqf>
|x2= <sqf>private _isMan = ent1 getEntityInfo 0;</sqf>
 
|seealso= [[cursorObject]] [[cursorTarget]] [[createSimpleObject]] [[getObjectType]] [[getObjectTextures]] [[objectParent]] [[setVelocityTransformation]] [[getUnitFreefallInfo]] [[getModelInfo]] [[getShotInfo]] [[getRespawnVehicleInfo]]
}}
}}

Latest revision as of 16:08, 8 October 2024

Hover & click on the images for description

Description

Description:
Returns various properties for the given entity. Most properties should be checked where entity is local
Groups:
Object Manipulation

Syntax

Syntax:
getEntityInfo entity
Parameters:
entity: Object
Return Value:
Array in format [isMan, isAnimal, isDeadSet, deadSetTime, lastEntityCausingDamage, lastDamageTime, isUpsideDown, upsideDownTime, isStopped, canFloat, hasTerminalOpened, isWeaponholder, isWreck, isSmoking, isSetForDeletion], where:
  • 0 - isMan Boolean - true if the entity is a man
  • 1 - isAnimal: Boolean - true if the entity is an animal
  • 2 - isDeadSet: Boolean - true if the entity has dead flag set. Often has the same value as !alive, but is not the same, as alive checks the total damage.
  • 3 - deadSetTime: Number - for how long the entity was dead
  • 4 - lastEntityCausingDamage: Object - objNull or the entity that last caused damage to this entity. Is not the same as the killer but could be the same. Killed entity might not have this set either. The entity does not have to be dead in order to have last entity that caused damage assigned.
  • 5 - lastDamageTime: Number - how long ago was lastEntityCausingDamage assigned
  • 6 - isUpsideDown: Boolean - true if the entity is upside down. The engine considers this to be vectorUp ent select 2 < 0.3
  • 7 - upsideDownTime: Number - how long the entity was upside down.
  • 8 - isStopped: Boolean - true when the entity does not need to be actively simulated.
  • 9 - canFloat: Boolean - true if the entity is able to float on water.
  • 10 - hasTerminalOpened: Boolean - true if the UAV terminal is opened for the given entity.
  • 11 - isWeaponholder: Boolean - true if the entity is weaponholder.
  • 12 - isWreck: Boolean - true if the entity is wreck.
  • 13 - isSmoking: Boolean - true if the entity has smoke and fire destruction effect active.
  • 14 - isSetForDeletion: Boolean - true if the entity was set for deletion, but is not yet removed from the simulation. Simple Object is supported.
In multiplayer, following values update properly only when entity is local:
  • lastEntityCausingDamage
  • lastDamageTime
  • isStopped

Other values are either static or update depending on how your client sees the entity right now.

Timer values are never exact between clients and vary slightly depending on latency, JIP clients end up with large timer values close to game's time but get normal once associated value changes again:

  • deadSetTime
  • lastDamageTime
  • upsideDownTime

Alternative Syntax

Syntax:
entity getEntityInfo index
Parameters:
entity: Object
index: Number - property index (see main syntax, 2 - isDeadSet for example)
Return Value:
Anything - depends on the requested property, or Nothing

Examples

Example 1:
private _entityInfo = getEntityInfo ent1;
Example 2:
private _isMan = ent1 getEntityInfo 0;

Additional Information

See also:
cursorObject cursorTarget createSimpleObject getObjectType getObjectTextures objectParent setVelocityTransformation getUnitFreefallInfo getModelInfo getShotInfo getRespawnVehicleInfo

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