getAllUnitTraits: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (2.16 -> 2.18)
m (Some wiki formatting)
 
Line 3: Line 3:
|game1= arma3
|game1= arma3
|version1= 2.00
|version1= 2.00
 
<!--
|arg= local
|arg= local
 
-->
|gr1= Object Manipulation
|gr1= Object Manipulation


Line 19: Line 19:


|x1= <sqf>
|x1= <sqf>
private _playerTraits = getAllUnitTraits player;
/*
/*
Could return something like this:
Could return something like this:
Line 32: Line 33:
]
]
*/
*/
private _playerTraits = getAllUnitTraits player;
</sqf>
</sqf>


Line 43: Line 43:
|x3= Since {{GVI|arma3|2.18|size= 0.75}}:
|x3= Since {{GVI|arma3|2.18|size= 0.75}}:
<sqf>
<sqf>
hint str getAllUnitTraits "O_Engineer_F";
/*
/*
[
[
Line 54: Line 55:
]
]
*/
*/
hint str getAllUnitTraits "O_Engineer_F";
</sqf>
</sqf>


Line 61: Line 61:


{{Note
{{Note
|user= Unknown
|user= BrettMayson
|text= Local argument assumed, may need confirmation
|timestamp= 20231127025400
|text= Local argument assumed, needs confirmation
}}
}}

Latest revision as of 00:27, 30 April 2024

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.png2.18 String - a unit or a class name
Return Value:
Array of Arrays in format [name, value] where:

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.png2.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 or on the Forums.
Only post proven facts here! Add Note
BrettMayson - c
Posted on Nov 27, 2023 - 02:54 (UTC)
Local argument assumed, needs confirmation