Jump to content

A3E Take Clothes


Grahame

Recommended Posts

ARMA3 Take Clothes Script

As some of you are aware, one of my pet peeves with ARMA3 is that Bohemia added detachable uniforms but then made it so you could not wear all of them by siding each. Thus, in Epoch, if you are female, you can wear female and NATO uniforms, but not CSAT or AAF. Males have a similar issue being bared from wearing NATO or AAF. While some mods like Tryk's unlock all their uniforms, unfortunately many do not (including CUP). Here is my work-in-progress solution to the problem that allows you to take and wear any uniform that a dead adversary is wearing.

Installation

UPDATE: 2/27/2018 @ 1916EST: Updated the code and installation instructions based on feedback from the community.

UPDATE: 3/21/2018 @ 0943EST: Updated the code based on feedback from the community and a rewrite by He-Man.

Create a file in your favourite text editor called TakeClothes.sqf with the following code:

/*
	Author: Grahame/He-Man

	Description:
	Take and wear any clothes from a dead player or AI

	Licence:
	Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
*/

private ["_target_uniform","_player_uniform"];
params ["_target","_player"];

_nearentities = (((_player nearEntities 7) select {isplayer _x && alive _x && !(_x iskindof "HeadlessClient_F")}) - [_player]);
if !(_nearentities isequalto []) exitwith {
    ["Cannot take clothes when other players are nearby",5] call epoch_message;
};
if (uniform _target isequalto "") exitwith {
    ["Target has no uniform to take",5] call epoch_message;
};
_playerloadout = getunitloadout _player;
_targetloadout = getunitloadout _target;

_player_uniform = _playerloadout param [3,""];
_target_uniform = _targetloadout param [3,""];

_playerloadout set [3,_target_uniform];
_targetloadout set [3,_player_uniform];

_player setunitloadout _playerloadout;
_target setunitloadout _targetloadout;

Put that file in your mission, for example as custom/TakeClothes.sqf.

Add the following lines to your mission's init.sqf:

if(hasInterface) then{
	TakeClothes  = compileFinal  preprocessFileLineNumbers "custom\TakeClothes.sqf";
};

In your mission file, edit the epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp, adding the following lines to the end:

// Take Clothes

class take_clothes
{
	condition = "((!alive dyna_cursorTarget) && ((dyna_cursorTarget isKindOf 'SoldierWB') || (dyna_cursorTarget isKindOf 'SoldierEB') || (dyna_cursorTarget isKindOf 'SoldierGB')))";
	action = "[dyna_cursorTarget, player] call TakeClothes;";
	icon = "x\addons\a3_epoch_code\Data\UI\buttons\group_requests_ca.paa";
	tooltip = "Take Clothes";
};

Rebuild the mission file and upload to the server.

Voila! You can now look at any dead player or AI and take and wear their uniform no matter what it is! 

Acknowledgements

Though no code was needed from the DayZ/ARMA2/Epoch Take Clothes script, it is the reason I have always been so bugged about not being able to wear uniforms from dead adversaries. Yeah, I'm a bit of a bandit that way for sure :ph34r:

Anyway, cheers guys:

 

Link to comment
Share on other sites

Have you seen that happen @Kenobi If so can you let me know the steps to reproduce? The enemy uniform should be empty after the first run - unless the second run happens before the first is completed (it just finishes so quick for me that I did not think about that). Did say better error handling was necessary :wink:

Link to comment
Share on other sites

This is video from my view. My friend will send me video from his view. I can upload his video tomorrow.
PS: I killed cultist and then try to take his clothes. Cultists dead body was changed to woman ghillie with this takeclothes script. Maybe this can help you. Cheers.

 

 

Link to comment
Share on other sites

Okay folks, I have made some changes (will update the first post with them) based on suggestions and good video reports from @Kenobi- Cheers mate!

First, a small change to the take clothes code in CfgActionMenu_target.hpp so that the option to take clothes will not be provided when looking at dead things with no uniforms, like the vanilla Epoch adversaries like sappers, cloakers and zombies and the Ryan's Zombies zombies (which are not the same):

// Take Clothes

class take_clothes
{
	condition = "((!alive dyna_cursorTarget) && ((dyna_cursorTarget isKindOf 'SoldierWB') || (dyna_cursorTarget isKindOf 'SoldierEB') || (dyna_cursorTarget isKindOf 'SoldierGB')))";
	action = "[dyna_cursorTarget, player] call TakeClothes;";
	icon = "x\addons\a3_epoch_code\Data\UI\buttons\group_requests_ca.paa";
	tooltip = "Take Clothes";
};

The definition of the base classes for west, east and guer soldiers should catch most AI wearing uniforms from any mod. That definitely is the case for CUP.

Changed the custom/TakeClothes.sqf script to set a variable on the corpse so a uniform can only be changed once, even if you subsequently take the uniform off them (thanks @Ghostrider-GRG) and present a message to the player if they attempt to take it again:

/*
	Author: Grahame

	Description:
	Take and wear any clothes from a dead player or AI

	Licence:
	Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
*/

private ["_target","_player","_target_uniform","_player_uniform","_target_carried_items","_player_carried_items","_clothes_taken"];

_target = _this select 0;
_player = _this select 1;
_target_carried_items = [];
_player_carried_items = [];
_items_to_add = [];

_clothes_taken = _target getvariable ["CLOTHESTAKEN", "false"];

if (_clothes_taken != "true") then {
	_target setvariable ["CLOTHESTAKEN", "true", true];
	_target_uniform = uniform _target;
	_player_uniform = uniform _player;

	_target_carried_items = uniformItems _target;
	_player_carried_items = uniformItems _player;
	_items_to_add = _player_carried_items + _target_carried_items;

	_target forceAddUniform _player_uniform;
	_player forceAddUniform _target_uniform;

	{
		_player addItem _x;
	} foreach _items_to_add;
} else {
	["Clothes have already been taken from this body", 5] call Epoch_message;
};

As a result of that change you will also need to add !"CLOTHESTAKEN" to your setvariable.txt BattlEye filter.

Please let me know if you find any other issues.

Link to comment
Share on other sites

  • 2 weeks later...

Grahame, thanks. But items copy is still possible, but only once. Steps to reproduce:
1) Throw away actual uniform from your body.
2) Take uniform from dead body through inventory to your body.
3) On dead body use TakeClothes through space key.

This will cause, that you will have the same uniform on your body and on dead body and items in uniform will be copied.

Link to comment
Share on other sites

New version of the script provided by @He-Man (cheers buddy!):

private ["_target_uniform","_player_uniform"];
params ["_target","_player"];

_nearentities = (((_player nearEntities 7) select {isplayer _x && alive _x && !(_x iskindof "HeadlessClient_F")}) - [_player]);
if !(_nearentities isequalto []) exitwith {
    ["Cannot take clothes when other players are nearby",5] call epoch_message;
};
if (uniform _target isequalto "") exitwith {
    ["Target has no uniform to take",5] call epoch_message;
};
_playerloadout = getunitloadout _player;
_targetloadout = getunitloadout _target;

_player_uniform = _playerloadout param [3,""];
_target_uniform = _targetloadout param [3,""];

_playerloadout set [3,_target_uniform];
_targetloadout set [3,_player_uniform];

_player setunitloadout _playerloadout;
_target setunitloadout _targetloadout;

Tested on my server this afternoon. If others can check it out and confirm no issues then I will update the thread's first post.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...