getAllUnitTraits: Difference between revisions

From Bohemia Interactive Community
mNo edit summary
mNo edit summary
 
Line 14: Line 14:
|p1= unit: [[Object]] or {{GVI|arma3|2.18|size= 0.75}} [[String]] - a unit or a class name
|p1= unit: [[Object]] or {{GVI|arma3|2.18|size= 0.75}} [[String]] - a unit or a class name


|r1= [[Array]] of [[Array]]s with [name, value]:
|r1= [[Array]] of [[Array]]s with [name, value]
* name: [[String]] - trait's name
* name: [[String]] - trait's name
* value [[String]] or [[Boolean]] - trait's value
* value [[String]] or [[Boolean]] - trait's value

Latest revision as of 10:02, 2 January 2026

Hover & click on the images for description

Description

Description:
Returns unit traits (native or set by setUnitTrait).
Groups:
Object Manipulation

Syntax

Syntax:
getAllUnitTraits unit
Parameters:
unit: Object or Arma 3 logo black.png 2.18 String - a unit or a class name
Return Value:
Array of Arrays with [name, value]

Examples

Example 1:
private _playerTraits = getAllUnitTraits player; /* Could return something like this: [ ["Medic", false], ["Engineer", false], ["ExplosiveSpecialist", false], ["UavHacker", false], ["CamouflageCoef", 1], ["AudibleCoef", 1], ["LoadCoef", 1], ["test", "custom"] ] */
Example 2:
private _unitTraits = getAllUnitTraits _unit; private _indexes = [_unitTraits, "Medic"] call BIS_fnc_findNestedElement; private _unitCanHeal = _unitTraits select (_indexes select 0) select 1;
Example 3:
Since Arma 3 logo black.png 2.18:
hint str getAllUnitTraits "O_Engineer_F"; /* [ ["Medic", false], ["Engineer", true], ["ExplosiveSpecialist", true], ["UavHacker", false], ["CamouflageCoef", 1], ["AudibleCoef", 1], ["LoadCoef", 1] ] */

Additional Information

See also:
getUnitTrait setUnitTrait

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note
BrettMayson - c
Posted on Nov 27, 2023 - 02:54 (UTC)
Local argument assumed, needs confirmation