getAllUnitTraits: Difference between revisions
Jump to navigation
Jump to search
m (2.00 update) |
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
||
Line 12: | Line 12: | ||
|gr1= Object Manipulation |GROUP1= | |gr1= Object Manipulation |GROUP1= | ||
|descr= Returns unit traits, native or set by [[setUnitTrait]]. |Description= | |descr= Returns unit traits, native or set by [[setUnitTrait]]. |Description= | ||
Line 19: | Line 18: | ||
|pr= |Problems= | |pr= |Problems= | ||
|s1= [[getAllUnitTraits]] unit |Syntax= | |s1= [[getAllUnitTraits]] unit |Syntax= | ||
Line 26: | Line 24: | ||
|r1= [[Array]] of [[Array]]s of [<nowiki/>[[String]], [[String]]/[[Boolean]]] - to format [["traitName1",value1], ["traitName2", value2]] |Return Value= | |r1= [[Array]] of [[Array]]s of [<nowiki/>[[String]], [[String]]/[[Boolean]]] - to format [["traitName1",value1], ["traitName2", value2]] |Return Value= | ||
|x1= <code>{{codecomment|/* can return: | |x1= <code>{{codecomment|/* can return: | ||
Line 45: | Line 42: | ||
[[private]] _indexes = [_unitTraits, "Medic"] [[call]] [[BIS_fnc_findNestedElement]]; | [[private]] _indexes = [_unitTraits, "Medic"] [[call]] [[BIS_fnc_findNestedElement]]; | ||
[[private]] _unitCanHeal = _unitTraits [[select]] (_indexes [[select]] 0) [[select]] 1;</code> |Example 2= | [[private]] _unitCanHeal = _unitTraits [[select]] (_indexes [[select]] 0) [[select]] 1;</code> |Example 2= | ||
|seealso= [[setUnitTrait]] |See Also= | |seealso= [[setUnitTrait]] |See Also= |
Revision as of 01:14, 17 January 2021
Description
- Description:
- Returns unit traits, native or set by setUnitTrait.
- Groups:
- Object Manipulation
Syntax
- Syntax:
- getAllUnitTraits unit
- Parameters:
- unit: Object
- Return Value:
- Array of Arrays of [String, String/Boolean] - to format [["traitName1",value1], ["traitName2", value2]]
Examples
- Example 1:
/* can return: [ ["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;
Additional Information
- See also:
- 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