Difference between revisions of "cmf common fnc setRole"

From cluster wiki
Jump to navigation Jump to search
Line 7: Line 7:
|version2=2.1.0
|version2=2.1.0


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

Revision as of 21:10, 17 December 2022


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, deafult "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:
See also needed
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
LOCAL cmf_common_onUnitRoleChanged [Unit, Role, Team] Is fired locally for unit when the unit's role is changed.
Notes