getAllUnitTraits: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Some wiki formatting)
m (2.16 -> 2.18)
(3 intermediate revisions by 3 users not shown)
Line 4: Line 4:
|version1= 2.00
|version1= 2.00


|arg= <!-- local, to be confirmed -->
|arg= local


|gr1= Object Manipulation
|gr1= Object Manipulation


|descr= Returns unit traits, native or set by [[setUnitTrait]].
|descr= Returns unit traits (native or set by [[setUnitTrait]]).


|s1= [[getAllUnitTraits]] unit
|s1= [[getAllUnitTraits]] unit


|p1= unit: [[Object]]
|p1= unit: [[Object]] or {{GVI|arma3|2.18|size= 0.75}} [[String]] - a unit or a class name


|r1= [[Array]] of [[Array]]s in format [name, value] where:
|r1= [[Array]] of [[Array]]s in format [name, value] where:
Line 19: Line 19:


|x1= <sqf>
|x1= <sqf>
/* can return:
/*
Could return something like this:
[
[
["Medic", false],
["Medic", false],
Line 40: Line 41:
</sqf>
</sqf>


|seealso= [[setUnitTrait]]
|x3= Since {{GVI|arma3|2.18|size= 0.75}}:
<sqf>
/*
[
["Medic", false],
["Engineer", true],
["ExplosiveSpecialist", true],
["UavHacker", false],
["CamouflageCoef", 1],
["AudibleCoef", 1],
["LoadCoef", 1]
]
*/
hint str getAllUnitTraits "O_Engineer_F";
</sqf>
 
|seealso= [[getUnitTrait]] [[setUnitTrait]]
}}
 
{{Note
|user= Unknown
|text= Local argument assumed, may need confirmation
}}
}}

Revision as of 16:11, 8 February 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:
/* Could return something like this: [ ["Medic", false], ["Engineer", false], ["ExplosiveSpecialist", false], ["UavHacker", false], ["CamouflageCoef", 1], ["AudibleCoef", 1], ["LoadCoef", 1], ["test", "custom"] ] */ private _playerTraits = getAllUnitTraits player;
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:
/* [ ["Medic", false], ["Engineer", true], ["ExplosiveSpecialist", true], ["UavHacker", false], ["CamouflageCoef", 1], ["AudibleCoef", 1], ["LoadCoef", 1] ] */ hint str getAllUnitTraits "O_Engineer_F";

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
Unknown - c
Date unknown
Local argument assumed, may need confirmation