Difference between revisions of "cmf common fnc setRole"

From cluster wiki
Jump to navigation Jump to search
m (fixed typo)
 
(14 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{CMF Function
{{CMF Function


|game1=cmf3
|game1=arma3
|version1=2.1.0
|version1=0.50


|descr=This function sets the team and squad role of a playerunit, due to how i use EMF in missions it is required for a lot of functions in EMF. it is recommended you run this function for each playable unit in your mission.
|game2=cmf3
|version2=2.1.0
 
|descr=This function sets the team and squad role of a playerunit, due to how CMF3 functions it is recommended you run this function for each playable unit in your mission.


|exec=Call
|exec=Call
Line 14: Line 17:
|p1= unit: [https://community.bistudio.com/wiki/Object Object] - The unit to assign a role and team to
|p1= unit: [https://community.bistudio.com/wiki/Object Object] - The unit to assign a role and team to


|p2= role: [https://community.bistudio.com/wiki/String String] - (Optional, deafult "RFL") Role to assign unit
|p2= role: [https://community.bistudio.com/wiki/String String] - (Optional, default "RFL") Role to assign unit


|p3= team: [https://community.bistudio.com/wiki/Number Number] - (Optional, default 0) Which team to assign unit, when 0 will use the first supplied loadoutfile
|p3= team: [https://community.bistudio.com/wiki/Number Number] - (Optional, default 0) Which team to assign unit, when 0 will use the first supplied loadoutfile
Line 20: Line 23:
|r1=None
|r1=None


|x1= <code>// Set myUnit's role to "SL"
|x1= {{code|lang=scilab|// Set myUnit's role to "SL"
[myUnit, "SL"] call emf_gameplay_fnc_setRole;
[myUnit, "SL"] call cmf_common_fnc_setRole;}}
</code>
 
|x2= {{code|lang=scilab|// Set this object's role to "MED" and team to 1
[this, "MED", 1] call cmf_common_fnc_setRole;}}
 
|seealso= [[cmf_common_fnc_getConfigParam]] [[cmf_common_fnc_isRole]] [[cmf_common_fnc_setCallsign]]
 
|var1= {{!}} GLOBAL {{!}}{{!}} Unit {{!}}{{!}} cmf_common_role {{!}}{{!}} A [https://community.bistudio.com/wiki/String String] variable containing the assigned unit's CMF role. e.g. "RFL"
|var2= {{!}} GLOBAL {{!}}{{!}} Unit {{!}}{{!}} cmf_common_team {{!}}{{!}} A [https://community.bistudio.com/wiki/String String] variable containing the assigned unit's CMF team. e.g. 0


|x2= <code>// Set this object's role to "MED" and team to 1
|event1= {{!}} UNITLOCAL {{!}}{{!}} cmf_common_onUnitRoleChanged {{!}}{{!}} [unit, role, team] {{!}}{{!}} Is fired locally for unit when the unit's role is changed.
[this, "MED", 1] call emf_gameplay_fnc_setRole;
</code>
}}
}}

Latest revision as of 19:08, 28 November 2023


Hover & click on the images for description
Description
Description:
This function sets the team and squad role of a playerunit, due to how CMF3 functions it is recommended you run this function for each playable unit in your mission.
Execution:
Call
Groups:
CMF3: common
Syntax
Syntax:
[unit, role, team] call cmf_common_fnc_setRole
Parameters:
unit: Object - The unit to assign a role and team to
role: String - (Optional, default "RFL") Role to assign unit
team: Number - (Optional, default 0) Which team to assign unit, when 0 will use the first supplied loadoutfile
Return Value:
None
Examples
Example 1:
// Set myUnit's role to "SL"
[myUnit, "SL"] call cmf_common_fnc_setRole;
Example 2:
// Set this object's role to "MED" and team to 1
[this, "MED", 1] call cmf_common_fnc_setRole;
Additional Information
See also:
cmf_common_fnc_getConfigParam cmf_common_fnc_isRole cmf_common_fnc_setCallsign
Internal Variables
Locality Namespace Name Description
GLOBAL Unit cmf_common_role A String variable containing the assigned unit's CMF role. e.g. "RFL"
GLOBAL Unit cmf_common_team A String variable containing the assigned unit's CMF team. e.g. 0
Events
Locality Name Variables Description
UNITLOCAL cmf_common_onUnitRoleChanged [unit, role, team] Is fired locally for unit when the unit's role is changed.
Notes