getAllUnitTraits: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...) |
||
Line 1: | Line 1: | ||
{{Command | {{Command | ||
|game1= arma3 | |game1= arma3 | ||
|version= 2.00 | |version= 2.00 | ||
|arg= <!-- local, to be confirmed --> | |arg= <!-- local, to be confirmed --> | ||
|eff | |eff= | ||
|serverExec | |serverExec= | ||
|gr1= Object Manipulation | |gr1= Object Manipulation | ||
|descr= Returns unit traits, native or set by [[setUnitTrait]]. | |descr= Returns unit traits, native or set by [[setUnitTrait]]. | ||
|mp= |Multiplayer Behaviour= | |mp= |Multiplayer Behaviour= | ||
Line 19: | Line 19: | ||
|pr= |Problems= | |pr= |Problems= | ||
|s1= [[getAllUnitTraits]] unit | |s1= [[getAllUnitTraits]] unit | ||
|p1= unit: [[Object]] | |p1= unit: [[Object]] | ||
|r1= [[Array]] of [[Array]]s of [<nowiki/>[[String]], [[String]]/[[Boolean]]] - to format [["traitName1",value1], ["traitName2", value2]] | |r1= [[Array]] of [[Array]]s of [<nowiki/>[[String]], [[String]]/[[Boolean]]] - to format [["traitName1",value1], ["traitName2", value2]] | ||
|x1= <code>{{codecomment|/* can return: | |x1= <code>{{codecomment|/* can return: | ||
Line 37: | Line 37: | ||
] | ] | ||
<nowiki/>*/}} | <nowiki/>*/}} | ||
[[private]] _playerTraits = [[getAllUnitTraits]] [[player]];</code> | [[private]] _playerTraits = [[getAllUnitTraits]] [[player]];</code> | ||
|x2= <code>[[private]] _unitTraits = [[getAllUnitTraits]] _unit; | |x2= <code>[[private]] _unitTraits = [[getAllUnitTraits]] _unit; | ||
[[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> | [[private]] _unitCanHeal = _unitTraits [[select]] (_indexes [[select]] 0) [[select]] 1;</code> | ||
|seealso= [[setUnitTrait]] | |seealso= [[setUnitTrait]] | ||
}} | }} | ||
Revision as of 00:38, 18 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