Some day in the past i have created something like which could be usefully
MP friendly.
It was a reamobox holding the action to get incognito but it could be any object.
It saves player current gear and wear player like locals,
changing the speaker as locals have, and sends info on system chat that player turns into incognito.
Player can get his gear back on the object again.
While incognito, when player pickup any gun, he gets immediately compromised.
takeCiv_clothes.sqf
private ["_box", "_taker", "_isTFR","_civUniform", "_civHeadGear", "_civGoggles", "_civAssignedItems", "_civSpeakers", "_pWeapons", "_pPrimaryWeaponItems", "_pSecWeaponItems", "_pItems", "_pAssignedItems", "_pUniform", "_pVest", "_pBackpack", "_pHeadGear", "_pGoggle", "_pSpeaker"]; _box = _this select 0; _taker = _this select 1; _isTFR = !isnull (configfile >> "CfgPatches" >> "task_force_radio"); //define incognito gear _civUniform = [ "U_mas_med_C_Civil_1_1", "U_mas_med_C_Civil_2_4", "U_mas_med_C_Civil_2_3", "U_mas_med_C_Civil_2_2", "U_mas_med_C_Civil_2_1", "U_mas_med_C_Civil_1_3", "U_mas_med_C_Civil_1_4", "U_mas_med_C_Civil_1_2" ]; _civHeadGear = [ "H_mas_med_afghat_O", "H_mas_med_arab_I", "H_mas_med_arab_O", "H_mas_med_turban_O", "H_mas_med_afghat_O", "H_mas_med_arab_O", "H_mas_med_arab_I", "H_mas_med_turban_O" ]; _civGoggles = [ "G_mas_wpn_shemag", "G_Aviator", "G_Bandanna_blk" ]; _civAssignedItems = [ "ItemMap", "ItemCompass", "ItemWatch" ]; _civSpeakers = [ "Male03PER", "Male01PER", "Male02PER" ]; //storage current player gear _pWeapons = weapons _taker; _pPrimaryWeaponItems = primaryWeaponItems _taker; _pSecWeaponItems = secondaryWeaponItems _taker; _pItems = itemsWithMagazines _taker; _pAssignedItems = assignedItems _taker; _pUniform = uniform _taker; _pVest = vest _taker; _pBackpack = backpack _taker; _pHeadGear = headgear _taker; _pGoggle = goggles _taker; _pSpeaker = speaker _taker; _taker setVariable ["myWeapons",_pWeapons,false]; _taker setVariable ["myPrimaryWeaponItems",_pPrimaryWeaponItems,false]; _taker setVariable ["mySecWeaponItems",_pSecWeaponItems,false]; _taker setVariable ["myItems",_pItems,false]; _taker setVariable ["myAssignedItems",_pAssignedItems,false]; _taker setVariable ["myUniform",_pUniform,false]; _taker setVariable ["myVest",_pVest,false]; _taker setVariable ["myBackpack",_pBackpack,false]; _taker setVariable ["myHeadGear",_pHeadGear,false]; _taker setVariable ["myGoggle",_pGoggle,false]; _taker setVariable ["mySpeaker",_pSpeaker,false]; //change clothes removeAllWeapons _taker; removeAllItems _taker; removeAllAssignedItems _taker; removeUniform _taker; removeVest _taker; removeBackpack _taker; removeHeadgear _taker; removeGoggles _taker; _taker forceAddUniform (selectRandom _civUniform); _taker addHeadgear (selectRandom _civHeadGear); _taker addGoggles (selectRandom _civGoggles); { _taker linkItem _x; } forEach _civAssignedItems; if (_isTFR) then { _taker linkItem "tf_anprc152"; }; [_taker, (selectRandom _civSpeakers)] remoteExecCall ["setSpeaker", 0, true]; _taker setCaptive true; [profileName + " has turned into incognito.", "systemChat"] call BIS_fnc_MP; _box addaction ["<t color='#58FAF4'>Get back your gear</t>","scripts\takeback_clothes.sqf",nil,6.0,false,true,"","(_target distance _this) < 5"]; _taker spawn { params ["_incognitoUnit"]; while {(side _incognitoUnit) == CIVILIAN} do { if (!alive _incognitoUnit) exitWith {}; if (count (weapons _incognitoUnit) > 0) then { [profileName + " picked up a gun. Incognito compromised!!", "systemChat"] call BIS_fnc_MP; _incognitoUnit setCaptive false; }; sleep 5; }; };
takeback_clothes.sqf
private ["_box", "_incognito", "_pUniform", "_pVest", "_pBackpack", "_pHeadGear", "_pWeapons", "_pPrimaryWeaponItems", "_pSecWeaponItems", "_pItems", "_pAssignedItems", "_pGoggle", "_pSpeaker"]; _box = _this select 0; _incognito = _this select 1; _id = _this select 2; _box removeAction _id; removeAllWeapons _incognito; removeAllItems _incognito; removeAllAssignedItems _incognito; removeUniform _incognito; removeVest _incognito; removeBackpack _incognito; removeHeadgear _incognito; removeGoggles _incognito; _pUniform = _incognito getVariable "myUniform"; _pVest = _incognito getVariable "myVest"; _pBackpack = _incognito getVariable "myBackpack"; _pHeadGear = _incognito getVariable "myHeadGear"; _pWeapons =_incognito getVariable "myWeapons"; _pPrimaryWeaponItems = _incognito getVariable "myPrimaryWeaponItems"; _pSecWeaponItems = _incognito getVariable "mySecWeaponItems"; _pItems = _incognito getVariable "myItems"; _pAssignedItems = _incognito getVariable "myAssignedItems"; _pGoggle = _incognito getVariable "myGoggle"; _pSpeaker = _incognito getVariable "mySpeaker"; _incognito addUniform _pUniform; _incognito addVest _pVest; _incognito addBackpack _pBackpack; _incognito addHeadgear _pHeadGear; { _incognito addWeapon _x; } forEach _pWeapons; { _incognito addPrimaryWeaponItem _x; } forEach _pPrimaryWeaponItems; { _incognito addSecondaryWeaponItem _x; } forEach _pSecWeaponItems; { _incognito addItem _x; } forEach _pItems; { _incognito linkItem _x; } forEach _pAssignedItems; _incognito linkItem "tf_anprc152"; _incognito addGoggles _pGoggle; [_incognito, _pSpeaker] remoteExecCall ["setSpeaker", 0, true]; _incognito setCaptive false; [profileName + " has turned back into combat.", "systemChat"] call BIS_fnc_MP; _incognito setVariable ["myWeapons",nil,false]; _incognito setVariable ["myPrimaryWeaponItems",nil,false]; _incognito setVariable ["mySecWeaponItems",nil,false]; _incognito setVariable ["myItems",nil,false]; _incognito setVariable ["myAssignedItems",nil,false]; _incognito setVariable ["myUniform",nil,false]; _incognito setVariable ["myVest",nil,false]; _incognito setVariable ["myBackpack",nil,false]; _incognito setVariable ["myHeadGear",nil,false]; _incognito setVariable ["myGoggle",nil,false]; _incognito setVariable ["mySpeaker",nil,false];
You need to edit takeCiv_clothes.sqf
to change gear arrays that will fit your scenario.
Put both files in missionroot\scripts folder
Place code below into any object init field:
this addAction [ "<t color='#01DF01'>Turn into Incognito</t>", "scripts\takeCiv_clothes.sqf", nil, 0, false, true, "", "(_target distance _this) < 5 && (side _this) == WEST" ];