Introduced in

Version:3.4

Description

Description:

Sets the MOPP level for a specific unit.

The change is visual (different uniform), as well as functional (protection against gas).

For the function to have an effect, the unit type has to support different MOPP levels (class NBCProtection has to be defined). If the function is applied to an incompatible unit, or the MOPP level selected is not available, no change is applied.

Syntax

Syntax:[unit, level, animate] call fn_vbs_setUnitNBCLevel
Parameters:
  • unit: Object - Unit to apply MOPP level to.
  • level: String - Name of MOPP level to apply.
  • animate: Boolean - If true, the uniform-change animation is played. If false, the change happens instantaneously (without animation) (optional, default: false).
Return Value:Nothing

Alternative Syntax

Syntax:[unit, level, animate] call fn_vbs_setUnitNBCLevel (V3.6+)
Parameters:
  • unit: Object - Unit to apply MOPP level to.
  • level: String or Number - Name or index of MOPP level to apply. When using a number, the index value corresponds to the sequence in which the protection levels were defined in class NBCProtection.
  • animate: Boolean - If true, the uniform-change animation is played. If false, then the change happens instantaneously (without animation) (optional, default: false).
Return Value:String - Name of MOPP level that was applied (empty string if a non-existing level was specified).

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
[player, "mopp3"] call fn_vbs_setUnitNBCLevel
_lvl = [player, 3, true] call fn_vbs_setUnitNBCLevel; // Might return "level3"

Additional Information

See also:
Multiplayer:
Problems:

Notes








Posted on Mar 28, 2014
Kronzky
To check which protection modes are available for a specific unit, you can use the following script:


_unitType = typeOf player; // unit to check

_config = configFile >> "CfgVehicles" >> _unitType >> "NBCProtection";
_info = format["Available MOTT levels for\n%1:",_unitType];
for "_i" from 0 to count (_config)-1 do {
  _protection = _config select _i;
  if (isClass _protection) then {
    _info = format["%1\n  %2",_info,configName(_protection)];
  };
};
hint _info;