[Help/Discussion] Zabns Take Clothes

Zabn fixed the animal bug, added a check to make sure action is not in progress already and added the fancy interrupt code. Also it is fixed so you do not do the medic action if the clothes have already been taken.

Other than that it is the same. Not sure why Zabn changed _this select 3 to (_this select 3) select 0. That will not work, since cursorTarget returns an object not an array.

I modified it a bit, so instead of setting clothestaken variable on the body it deletes it and replaces it with a corpse (wasteland style) with all the gear on it. This way it looks better, since the body isn't still there with the same clothes on after you take them:

eSSo2y2mfkmX.jpg


@Zabn feel free to use this code in your release if you like:
Code:
private["_itemNew","_onLadder","_skin","_body","_okSkin","_result","_bag","_bmags","_bweps","_corpse","_mags","_object","_weps"];
_body = _this select 3;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText ["You can not perform this action while on a ladder!" , "PLAIN DOWN"]};

if (vehicle player != player) exitWith {cutText ["You can not take clothes while in a vehicle.", "PLAIN DOWN"]};

player removeAction s_player_clothes;
s_player_clothes = -1;

_skin = (typeOf _body);
_itemNew = _skin;

switch (_itemNew) do {
   case "Survivor3_DZ": {
     _itemNew = "Soldier_Sniper_PMC_DZ";
   };
   case "Bandit1_DZ": {
     _itemNew = "Bandit2_DZ";
   };
};

_itemNew = "Skin_" + _itemNew;
_okSkin = isClass (configFile >> "CfgMagazines" >> _itemNew);

if (_okSkin) then {
   player playActionNow "Medic";
   sleep 3;
   _result = [player,_itemNew] call BIS_fnc_invAdd;
   if (_result) then {
     _mags = magazines _body;
     _weps = weapons _body;
     _bag = unitBackpack _body;
     _corpse = createVehicle ["Body", position _body, [], 0, "CAN_COLLIDE"];
     _object = createVehicle ["WeaponHolder", position _corpse, [], 0, "CAN_COLLIDE"];
     _object setVariable ["permaLoot",true];
     {_object addMagazineCargoGlobal [_x, 1];} forEach _mags;
     {_object addWeaponCargoGlobal [_x, 1];} forEach _weps;
     if (!isNull _bag) then {
       _bmags = getMagazineCargo _bag;
       _bweps = getWeaponCargo _bag;
       _object addBackpackCargoGlobal [(typeOf _bag), 1];
       {_object addMagazineCargoGlobal [_x, ((_bmags select 1) select _forEachIndex)];} forEach (_bmags select 0);
       {_object addWeaponCargoGlobal [_x, ((_bweps select 1) select _forEachIndex)];} forEach (_bweps select 0);
     };
     if (!isNull _body) then {deleteVehicle _body};
     cutText ["Clothes have been added to your inventory.", "PLAIN DOWN"];
   } else {
     cutText ["You do not have enough room in your inventory.", "PLAIN DOWN"];
     player switchMove "";
     player playActionNow "stop";
   };
} else {
   cutText [format["The clothes are destroyed, you cannot take them.",_skin], "PLAIN DOWN"];
   player switchMove "";
   player playActionNow "stop";
};


Hi ebay,

I would really like to use your addition to Zabn's fantastic script as I really like the idea of the bodybag! :)

However, although I can get Zabn's latest v2 working working, I can't get yours to work.

I simply pasted your code above and overwrote the v2 code in the sqf. Was I supposed to do this or append it somehow?

I noticed your code didn't have an "_isEpoch" in the private line. Was your script just for DayZ and not Epoch? If so, can you post an update with your code merged for Zabn's v2 that works with Epoch 1042?

Please forgive my n00bishness to all this, I am very junior to scripting having only started admin on my server 2.5 months ago.


Thanks,



BaroN
GoG's World
 
I've been sort of fumbling my way towards an almost functional way of taking clothes from custom skinned AI.
I have a redirect to a custom CfgSurvival and CfgMagazines, and now when using take clothes I perform the action, and then get "You didn't have enough room to store a (skin name) :("
For examples I have added the following to CfgMagazines:
Code:
    class Skin_gsc_eco_stalker_mask_duty : SkinBase {
        scope = public;
        displayName = "Duty Mask";
        descriptionShort = "Duty Mask";
    };

And in CfgSurvival:
Code:
        class Skin_gsc_eco_stalker_mask_duty: Default {
            sex = "male";
            playerModel = "gsc_eco_stalker_mask_duty";
      };

I feel like this is close to working, but am by no means an expert at Arma 2 or DayZ code. Any ideas on how to overcome this "not enough room" issue?
 
I keep getting this error thrown in my RPT. I can't figure out what the problem is. Does anyone know?

Code:
 Error in expression <nInProgress) exitWith {};
};

_body = (_this select 3) select 0;
_onLadder = (g>
Error position: <_this select 3) select 0;
_onLadder = (g>
Error Undefined variable in expression: _this
File mpmissions\__cur_mp.Chernarus\custom\player_takeClothes_v2.sqf, line 8
 
Hi ebay, so sorry for not writing back sooner, I have been away.

That worked a treat thanks so much!

There is one slight glitch though, the take clothes option flickers on and off even when you're not moving so, you have to catch it quick. Is this something you've come across? Not a massive problem but, would be nice to tidy....

Edited as this seemed to sort itself out! So again, thanks very much for this!!
 
Last edited:
ebay,
Are your edits an entirely new take clothes script or are these edits/addittions to be added along with Zabn's take clothes? It looks like an entirely new script to me but I'm not entirely sure. Zabn's v2 is working flawlessly on my Overpoch server but the body bag looks amazing.

Also I was on an Overwatch server once and they had parcels at heli wrecks of the Stalker and ABH uniforms. Is this possible on Overpoch?
 
Last edited:
Hey guys,

is there anyone got this running on epoch 1.0.5.1? Worked fine for me on 1.0.4.2, now on 1.0.5.1 I got the option "Take Clothes" but if I predd the button, nothing is gonna happen.

Would be nice if someone could help me get this running.

Greetings
 
Hi ebay,

I'm on 1051 and haven't had any problems with your old version, no player complaints and I have just tested it and all OK.

The only issue we were aware of is that the gear can be cleaned too quickly after you have taken clothes so, we all take gear first and take clothes last....But that's always happened.

Are there issues you are aware of that this version fixes? Was Mitscher's problem generic or isolated? Does it solve the issue I mentioned above?

I suppose the question I'm asking is do I need to change it if all is OK for me with your old 1042 version

Thanks for your support!
 
A couple people have been asking me for an updated version of the body bag edit I made of Zabn's script, so I figured I would just post it here. This is for Epoch 1.0.5.1:

Hi I just started using this, but the take clothes option flickers on and off, and its really hard to click on it.

I also get the option to take clothes from zeds, is there anyway to disable that? I just want it on the ai.

I did change the take clothes script, so I had all the skins...

this is the bit I changed, but I can't see that causing the flicker.
switch (_itemNew) do {
case "GUE_Soldier_2_DZ": {
_itemNew = "GUE_Soldier_2_DZ";
};
case "GUE_Soldier_CO_DZ": {
_itemNew = "GUE_Soldier_CO_DZ";
};
case "GUE_Soldier_Crew_DZ": {
_itemNew = "GUE_Soldier_Crew_DZ";
};
case "GUE_Soldier_Sniper_DZ": {
_itemNew = "GUE_Soldier_Sniper_DZ";
};
case "GUE_Soldier_MG_DZ": {
_itemNew = "GUE_Soldier_MG_DZ";
};
case "Graves_Light_DZ": {
_itemNew = "Graves_Light_DZ";
};
case "CZ_Soldier_Sniper_EP1_DZ": {
_itemNew = "CZ_Soldier_Sniper_EP1_DZ";
};
case "FR_Rodriguez_DZ": {
_itemNew = "FR_Rodriguez_DZ";
};
case "FR_OHara_DZ": {
_itemNew = "FR_OHara_DZ";
};
case "TK_INS_Warlord_EP1_DZ": {
_itemNew = "TK_INS_Warlord_EP1_DZ";
};
case "TK_INS_Soldier_EP1_DZ": {
_itemNew = "TK_INS_Soldier_EP1_DZ";
};
case "CZ_Special_Forces_GL_DES_EP1_DZ": {
_itemNew = "CZ_Special_Forces_GL_DES_EP1_DZ";
};
case "Drake_Light_DZ": {
_itemNew = "Drake_Light_DZ";
};
case "Soldier_Bodyguard_AA12_PMC_DZ": {
_itemNew = "Soldier_Bodyguard_AA12_PMC_DZ";
};
case "Soldier_Sniper_PMC_DZ": {
_itemNew = "Soldier_Sniper_PMC_DZ";
};
case "Soldier_TL_PMC_DZ": {
_itemNew = "Soldier_TL_PMC_DZ";
};
case "RU_Policeman_DZ": {
_itemNew = "RU_Policeman_DZ";
};
case "Pilot_EP1_DZ": {
_itemNew = "Pilot_EP1_DZ";
};
case "Haris_Press_EP1_DZ": {
_itemNew = "Haris_Press_EP1_DZ";
};
case "Ins_Soldier_GL_DZ": {
_itemNew = "Ins_Soldier_GL_DZ";
};
case "GUE_Commander_DZ": {
_itemNew = "GUE_Commander_DZ";
};
case "Functionary1_EP1_DZ": {
_itemNew = "Functionary1_EP1_DZ";
};
case "Priest_DZ": {
_itemNew = "Priest_DZ";
};
case "Rocker4_DZ": {
_itemNew = "Rocker4_DZ";
};
case "Rocker3_DZ": {
_itemNew = "Rocker3_DZ";
};
case "Rocker2_DZ": {
_itemNew = "Rocker2_DZ";
};
case "Rocker1_DZ": {
_itemNew = "Rocker1_DZ";
};
case "Rocket_DZ": {
_itemNew = "Rocket_DZ";
};
case "Soldier1_DZ": {
_itemNew = "Soldier1_DZ";
};
case "Camo1_DZ": {
_itemNew = "Camo1_DZ";
};
case "Sniper1_DZ": {
_itemNew = "Sniper1_DZ";
};
case "Soldier_Crew_PMC": {
_itemNew = "Soldier_Crew_PMC";
};
case "BanditW2_DZ": {
_itemNew = "BanditW2_DZ";
};
case "BanditW1_DZ": {
_itemNew = "BanditW1_DZ";
};
case "Bandit2_DZ": {
_itemNew = "Bandit2_DZ";
};
case "Bandit1_DZ": {
_itemNew = "Bandit1_DZ";
};
};
 
ebay said:
Not sure about the flickering. Make sure addactions check in your antihack is disabled or you allow s_player_clothes. If it isn't that then it may be the cursorTarget is not registering as a body, you could use a nearObjects check instead to add the action.

We worked it out in the end, you have to stand about 3m back from the body, then it stops the flicker. Strange, but at least it works lol. thx for script and help
 
@ReDBaroN - My edit is for Epoch 1042. You could use it with other mods, but you would have to change the skin classnames to compatible ones. Here is a full tutorial just for you:

1. Create a file in your mission\scripts folder and put this code inside:
(Note: I used extra skins to allow taking clothes off zombies. You can delete any cases you don't want)
Code:
private["_itemNew","_onLadder","_skin","_body","_okSkin","_result","_bag","_bmags","_bweps","_corpse","_mags","_object","_weps"];
_body = _this select 3;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText ["You can not perform this action while on a ladder!" , "PLAIN DOWN"]};

if (vehicle player != player) exitWith {cutText ["You can not take clothes while in a vehicle.", "PLAIN DOWN"]};

player removeAction s_player_clothes;
s_player_clothes = -1;

_skin = (typeOf _body);
_itemNew = _skin;

switch (_itemNew) do {
   case "Survivor3_DZ": {
     _itemNew = "Soldier_Sniper_PMC_DZ";
   };
   case "Bandit1_DZ": {
     _itemNew = "Bandit2_DZ";
   };
   case "z_soldier": {
  _itemNew = "INS_Soldier_AR_DZ";
  };
  case "z_soldier_heavy": {
  _itemNew = "INS_Soldier_AR_DZ";
  };
  case "z_suit1": {
  _itemNew = "Functionary1_EP1_DZ";
  };
  case "z_suit2": {
     _itemNew = "Functionary1_EP1_DZ";
  };
  case "z_policeman": {
     _itemNew = "RU_Policeman_DZ";
  };
  case "z_priest": {
     _itemNew = "Priest_DZ";
  };
   case "z_worker1": {
     _itemNew = "INS_Worker2_DZ";
  };
   case "z_worker2": {
     _itemNew = "INS_Worker2_DZ";
  };
   case "z_worker3": {
     _itemNew = "INS_Worker2_DZ";
  };
   case "z_new_worker1": {
     _itemNew = "INS_Worker2_DZ";
  };
   case "z_new_worker2": {
     _itemNew = "INS_Worker2_DZ";
  };
   case "z_new_worker3": {
     _itemNew = "INS_Worker2_DZ";
  };
   case "z_new_worker4": {
     _itemNew = "INS_Worker2_DZ";
  };
   case "z_soldier_pilot": {
     _itemNew = "RU_Soldier_Crew_DZ";
  };
   case "z_new_villager1": {
     _itemNew = "GUE_Commander_DZ";
  };
   case "z_new_villager2": {
     _itemNew = "GUE_Commander_DZ";
  };
   case "z_new_villager3": {
     _itemNew = "GUE_Commander_DZ";
  };
   case "z_new_villager4": {
     _itemNew = "GUE_Commander_DZ";
  };
   case "z_villager1": {
     _itemNew = "GUE_Commander_DZ";
  };
   case "z_villager2": {
     _itemNew = "GUE_Commander_DZ";
  };
   case "z_villager3": {
     _itemNew = "GUE_Commander_DZ";
  };
   case "z_hunter": {
     _itemNew = "INS_Soldier_CO_DZ";
  };
};

_itemNew = "Skin_" + _itemNew;
_okSkin = isClass (configFile >> "CfgMagazines" >> _itemNew);

if (_okSkin) then {
   player playActionNow "Medic";
   sleep 3;
   _result = [player,_itemNew] call BIS_fnc_invAdd;
   if (_result) then {
     _mags = magazines _body;
     _weps = weapons _body;
     _bag = unitBackpack _body;
     _corpse = createVehicle ["Body", position _body, [], 0, "CAN_COLLIDE"];
     _object = createVehicle ["WeaponHolder", position _corpse, [], 0, "CAN_COLLIDE"];
     _object setVariable ["permaLoot",true];
     {_object addMagazineCargoGlobal [_x, 1];} forEach _mags;
     {_object addWeaponCargoGlobal [_x, 1];} forEach _weps;
     if (!isNull _bag) then {
       _bmags = getMagazineCargo _bag;
       _bweps = getWeaponCargo _bag;
       _object addBackpackCargoGlobal [(typeOf _bag), 1];
       {_object addMagazineCargoGlobal [_x, ((_bmags select 1) select _forEachIndex)];} forEach (_bmags select 0);
       {_object addWeaponCargoGlobal [_x, ((_bweps select 1) select _forEachIndex)];} forEach (_bweps select 0);
     };
     if (!isNull _body) then {deleteVehicle _body};
     cutText ["Clothes have been added to your inventory.", "PLAIN DOWN"];
   } else {
     cutText ["You do not have enough room in your inventory.", "PLAIN DOWN"];
     player switchMove "";
     player playActionNow "stop";
   };
} else {
   cutText [format["The clothes are destroyed, you cannot take them.",_skin], "PLAIN DOWN"];
   player switchMove "";
   player playActionNow "stop";
};
2. Add this code to your fn_selfactions.sqf:
Code:
_clothesTaken = cursorTarget getVariable["clothesTaken",false];
  if (_isMan and !_isAlive and !_isAnimal and !_clothesTaken) then {
  if (s_player_clothes < 0) then {
  s_player_clothes = player addAction [("<t color='#0096ff'>")+("Take Clothes")+("</t>"), "scripts\takeclothes.sqf",cursorTarget, -10, false, true];
  };
  } else {
  player removeAction s_player_clothes;
  s_player_clothes = -1;
  };

Just below this:
Code:
} else {
     player removeAction s_player_sleep;
     s_player_sleep = -1;
   };

3. Add this code to your fn_selfactions.sqf:
Code:
player removeAction s_player_clothes;
s_player_clothes = -1;

Just below this:
Code:
s_player_fuelauto2 = -1;

Hi ebay, sorry to come back again but, with the new instructions this line from the last instructions will be removed in fn_selfactions:
_clothesTaken = cursorTarget getVariable["clothesTaken",false];

Is that intended? Sorry to question but, just want to be sure it's not needed this time.

Thanks
 
Back
Top