getAllUnitTraits: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "_{10,} " to "")
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 |Game name=
|game1= arma3


|version= 2.00 |Game version=
|version= 2.00


|arg= <!-- local, to be confirmed --> |Multiplayer Arguments ("local" or "global")=
|arg= <!-- local, to be confirmed -->


|eff=  |Multiplayer Effects ("local" or "global")=
|eff=


|serverExec=  |Multiplayer Execution ("server" or empty)=
|serverExec=


|gr1= Object Manipulation |GROUP1=
|gr1= Object Manipulation


|descr= Returns unit traits, native or set by [[setUnitTrait]]. |Description=
|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 |Syntax=
|s1= [[getAllUnitTraits]] unit


|p1= unit: [[Object]] |Parameter 1=
|p1= unit: [[Object]]


|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]]


|x1= <code>{{codecomment|/* can return:
|x1= <code>{{codecomment|/* can return:
Line 37: Line 37:
]
]
<nowiki/>*/}}
<nowiki/>*/}}
[[private]] _playerTraits = [[getAllUnitTraits]] [[player]];</code> |Example 1=
[[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> |Example 2=
[[private]] _unitCanHeal = _unitTraits [[select]] (_indexes [[select]] 0) [[select]] 1;</code>


|seealso= [[setUnitTrait]] |See Also=
|seealso= [[setUnitTrait]]
}}
}}



Revision as of 01:38, 18 January 2021

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
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

Bottom Section