BIS fnc unitHeadgear: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (1 revision imported: BIS Functions update 2/7)
m (Text replacement - "{{HashLink" to "{{Link")
 
(22 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 1.48


| arma3 |= Game name
|arg= local


|1.48|= Game version
|gr1= Inventory
____________________________________________________________________________________________


| <pre>/*
|descr= Randomise headgear and facewear of a character.
Author: Julien VIDA <@tom_48_97>
{{Feature|important|If the randomization is disabled, only strings parameters will be processed, array will be ignored and considered as false.}}


Description:
|s1= [unit, headgear, facewear] call [[BIS_fnc_unitHeadgear]]
This function is used for randomizing headgear and facewear of a character.
https://community.bistudio.com/wiki/BIS_fnc_unitHeadgear


If the randomization is disabled, only strings parameters, will be processed, array will be ignored and considered as false.
|p1= unit: [[Object]]


Parameter(s):
|p2= headgear: [[Boolean]], [[String]] or [[Array]] - (Optional, default [[false]]) can be one of:
_this select 0: Object - Unit
* [[Boolean]] - if [[false]], change nothing to the headgear
_this select 1: Headgear
* [[String]] - valid Headgear class or a valid class from [[Description.ext#CfgUnitTemplates|Description.ext CfgUnitTemplates]]
Array - Headgear list with individual probability
* [[Array]] - headgear list with individual probability|p3= facewear: [[Boolean]], [[String]] or [[Array]] - (Optional, default [[false]]) can be one of:
Bool - false, change nothing to the headgear
* [[Boolean]] - if [[false]], change nothing to the facewear
String - valid Headgear class or a valid class from CfgUnitTemplates (mission config file)
* [[String]] - valid facewear class or a valid class from [[Description.ext#CfgUnitTemplates|Description.ext CfgUnitTemplates]]
_this select 2: Facewear
* [[Array]] - facewear list with individual probability
Array - facewear list with individual probability
Bool - false, change nothing to the facewear
String - valid facewear class


Returns:
|r1= [[Boolean]] - [[true]] when done
Bool - True when done


Examples:
|x1= <sqf>
1) Do nothing because the Headgear and the face wear will be considered as False
[this] call BIS_fnc_unitHeadgear; // headgear and face wear, same as [this, [], []]
result = [this] call BIS_fnc_unitHeadgear;
[this, [], []] call BIS_fnc_unitHeadgear; // headgear only
 
[this, nil, []] call BIS_fnc_unitHeadgear; // facewear only
2) Use the default randomization (as defined in the config)
[this, "myTemplate"] call BIS_fnc_unitHeadgear; // class defined in Description.ext - CfgUnitTemplates
result = [this, [], []] call BIS_fnc_unitHeadgear; // Headgear and face wear
</sqf>
result = [this, []] call BIS_fnc_unitHeadgear // Headgear only
result = [this, nil, []] call BIS_fnc_unitHeadgear // Face wear only. Note that nil can be replaced by false
 
3) Usage of classes defined in the CfgUnitTemplates (mission config file). It will use the headgearList[] and facewearList[]
result = [this, "MyClassName"] call BIS_fnc_unitHeadgear
 
*/
</pre> |= Description
____________________________________________________________________________________________
 
| <!-- [unitName, [], []] call BIS_fnc_unitHeadgear; --> |= Syntax
 
|p1=  |= Parameter 1
 
| |= Return value
____________________________________________________________________________________________
 
|x1= <code>[this] [[call]] [[BIS_fnc_unitHeadgear]];</code> |=
 
|x2= <code>[this, [[nil]], []]  [[call]] [[BIS_fnc_unitHeadgear]]</code> |=
____________________________________________________________________________________________
 
| [[Description.ext#CfgUnitTemplates|Description.ext, CfgUnitTemplates]] |= See also


|seealso= {{Link|Description.ext#CfgUnitTemplates}} [[addGoggles]] [[addHeadgear]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Functions|{{uc:unitHeadgear}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:unitHeadgear}}]]

Latest revision as of 18:43, 4 January 2023

Hover & click on the images for description

Description

Description:
Randomise headgear and facewear of a character.
If the randomization is disabled, only strings parameters will be processed, array will be ignored and considered as false.
Execution:
call
Groups:
Inventory

Syntax

Syntax:
[unit, headgear, facewear] call BIS_fnc_unitHeadgear
Parameters:
unit: Object
headgear: Boolean, String or Array - (Optional, default false) can be one of:
facewear: Boolean, String or Array - (Optional, default false) can be one of:
Return Value:
Boolean - true when done

Examples

Example 1:
[this] call BIS_fnc_unitHeadgear; // headgear and face wear, same as [this, [], []] [this, [], []] call BIS_fnc_unitHeadgear; // headgear only [this, nil, []] call BIS_fnc_unitHeadgear; // facewear only [this, "myTemplate"] call BIS_fnc_unitHeadgear; // class defined in Description.ext - CfgUnitTemplates

Additional Information

See also:
Description.ext - CfgUnitTemplates addGoggles addHeadgear

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