Jump to content
DariusBiersack

[Request] Disguise/Undercover Script

Recommended Posts

Kinda depends on what you're trying to do exactly and how you want to disguise yourself.  I believe you still can't put on opposing faction uniforms, but you can swap to civilian clothes or possibly even swap units entirely.

 

How exactly did you imagine your undercover thing to go?

Share this post


Link to post
Share on other sites

My CORE Project has Covert/Undercover Option. Place Module and turn ON.

 

You can carry a weapon, as long as you are NOT Spotted with it in your hands.

You also CAN NOT be spotted wearing a Vest or you are deemed a combatant.

  • Like 1

Share this post


Link to post
Share on other sites

Maybe try set Captive: Make a trigger, and the activation field add: Unit1 setCaptive true; Unit2 setCaptive true;

 
Bad guys should not go for you as you are seen as "hostage". 
After add another trigger in activation put Unit1 setCaptive false; Unit2 setCaptive false;
 
also I think Ky did something similar a while back in arma2!
http://www.kylania.com/ex/?p=98
 
Worst comes to worse act like bread:
LOL-Undercover-Kitten.jpg
  • Like 1
  • Haha 1

Share this post


Link to post
Share on other sites

 

Maybe try set Captive: Make a trigger, and the activation field add: Unit1 setCaptive true; Unit2 setCaptive true;

 
Bad guys should not go for you as you are seen as "hostage". 
After add another trigger in activation put Unit1 setCaptive false; Unit2 setCaptive false;
 
also I think Ky did something similar a while back in arma2!

http://www.kylania.com/ex/?p=98

 
Worst comes to worse act like bread:
LOL-Undercover-Kitten.jpg

 

I actually did look into those coding and try to make up one for myself, but i messed it all up after day of work and research :(

What i was trying to do is to make a disguise script that can use by players/playable in a random generated mission (etc MCC) for stealth missions .

and 

Here are the coding i found on web and little bit by myself , basically messed up,

init: ( which works fine, for action option added on dead enemies)

 

 
{
  if (side _x == East)
 
then 
{
    _x addAction ["Disguise", "Disguise.sqf", [], 1, false, true, "", "!alive _target"]
};
} forEach allUnits;

 

Disguise.sqf 

 

if !(local player) exitWith {};
 
_Unit = _this select 0;
_Unit_2 = _this select 1;
 
_Unit_Type = typeOf _Unit;
_Damage = damage _Unit_2;
_Magazines = magazines _Unit;
_Weapons = weapons _Unit;
_Items = items _Unit;
 
titleText ["Changing Uniform...", "BLACK OUT"];
 
sleep 1;
 
// hint format ["%1", _Unit_Type];
 
player forceaddUniform "U_O_OfficerUniform_ocamo";
player addheadgear "H_HelmetO_ocamo";
player setCaptive true;

( Did manage to change the uniform to the above options and "disguised")

 
sleep 2;
 
titleText ["You are now disguised.", "BLACK IN"];
 
 
player addEventHandler ["fired",{_this exec "playerfired.sqf"}];

 

 
_x = []; // all EAST units within 10m of player
{
if ((side _x == EAST && (_x distance Player) < 3)) then {
    {_player setcaptive false};
  };
} forEach allUnits;   ( i dont know what i messed up here, no errors, but not working)

playerfired.sqf 

player addEventHandler ["fired",â€player setcaptive falseâ€]; titleText ["You are exposed", "PLAIN"];(message keep poping up when i fired, tried to add if then condition, but messed up.)

actually, i was wondering if i can make a setcaptive false if the captive shot east side. 

Thanks for all the replies :) <3

Share this post


Link to post
Share on other sites

Just dug this up- I started to this write a while a go but I gave up. I've attempted to update the script as much as possible but it should mainly be used as a starting point for a disguise script (AKA it's far from perfect):

/*
	HallyG's Disguise Script v0.1
	
	Put this in the units init line:
	this addAction ["Steal Uniform","_this call HGF",[],1,false,true,"","!alive _target AND (_target distance player) <3"];
*/

HGF = {
	params [
		["_Enemy", objNull, [objNull]],
		["_Friendly", objNull, [objNull]],
		["_ID", 0, [0]],
		["_arg",[],[[]]],
		["_radius", 25, [0]]
	];

	if !(vehicle _Friendly isEqualTo _Friendly) exitWith {systemChat "YOU CANT CHANGE CLOTHES WHILE IN A VEHICLE!"};
	if (({(_x distance vehicle _Friendly) < 3} count _Enemies) > 0) exitWith {systemChat "You are too close to an enemy!"};
	if (({[objNull, "VIEW"] checkVisibility [getPosASL _x, getPosASL player] >0} count _Enemies) > 0) exitWith {systemChat "An enemy can see you!"};

	private _Enemies = ((getposATL _Friendly) nearEntities [["Man"], _radius]) select {!(side _x in [CIVILIAN, playerSide]) && {(vehicle _x isEqualTo _x) && (_x != player)}};
	_Enemies pushBack objNull;

	private _Uniform_Friendly = [uniformItems _Friendly];
	_Uniform_Friendly pushBack [uniform _Friendly, headgear _Friendly];

	private _Uniform_Enemy = [uniformItems _Enemy];
	_Uniform_Enemy pushBack [uniform _Enemy, headgear _Enemy];

	_Enemy removeAction _ID;

	[_Friendly, _Enemy, _Uniform_Enemy, _Uniform_Friendly, "AinvPknlMstpSnonWnonDnon_medic0"] spawn {
		params ["_Friendly", "_Enemy", "_Uniform_Enemy", "_Uniform_Friendly", "_Anim"];

		_Friendly playMoveNow _Anim;
		waitUntil {animationState _Friendly != _Anim};
		
		{removeUniform _x; removeHeadgear _x;} forEach [_Enemy, _Friendly];
			
		_Friendly forceAddUniform ((_Uniform_Enemy select 1) select 0);
		_Friendly addHeadgear ((_Uniform_Enemy select 1) select 1);

		_Enemy forceAddUniform ((_Uniform_Friendly select 1) select 0);
		_Enemy addHeadgear ((_Uniform_Friendly select 1) select 1);
		
		private _grWH = createVehicle ["WeaponHolderSimulated", _Friendly modelToWorld [0,1,0], [], 0, "CAN_COLLIDE"];
			
		{
			_grWH addItemCargoGlobal [_x, 1];
		} forEach ((_Uniform_Enemy select 0) + (_Uniform_Friendly select 0));
	};

	private _oGroup = group _Friendly;
	[_Friendly] joinSilent createGroup (side _Enemy);
	deleteGroup  _oGroup;
		
	systemChat "SUCCESS";
};
  • Like 1

Share this post


Link to post
Share on other sites

 

I actually did look into those coding and try to make up one for myself, but i messed it all up after day of work and research :(

 

 

Here's a version of what you had that seems to be working for me.

// Called from dead unit's addAction:  _x addAction ["Disguise", "Disguise.sqf", [], 1, false, true, "", "!alive _target"]

// Function to replace uniform items
fn_replaceUniformItems = {
	params["_unit", "_items"];
	{
		_x params ["_i", "_c", ["_r", 1]];
		for "_y" from 1 to _r do {_unit addItemToUniform _i;};
	} forEach _items;
	true
};

// addAction input
params ["_body", "_unit", "_id"];

// Grab enemy uniform information
_disguiseUniform = uniform _body;
_disguiseHeadgear = headgear _body;
_disguiseVest = vest _body;

// Remove addAction
_body removeAction _id;

// Grab player's current items
_currentLoadout = getUnitLoadout _unit;
_uniform =  _currentLoadout select 3 select 0;
_uniformItems =  _currentLoadout select 3 select 1;
_helmet = _currentLoadout select 6;

// Fade to black
titleText ["Changing Uniform...", "BLACK OUT"];
sleep 1;

// Strip the bad guy. 
removeUniform _body; 

// Dress the player
_unit forceAddUniform _disguiseUniform;
_unit addHeadgear _disguiseHeadgear;
[_unit, _uniformItems] call fn_replaceUniformItems;

// Protect the player
_unit setCaptive true;

// Add fired handler to expose the player
_unit addEventHandler ["fired",{player removeEventHandler ["fired", 0]; player setCaptive false;}];
 
// Create and attach a nearby trigger to the player to expose, 3m distance.
_trigger = createTrigger ["EmptyDetector", [0,0,0]];
_trigger setTriggerArea [3, 3, 0, false, 3];
_trigger setTriggerActivation ["EAST", "PRESENT", false];
_trigger setTriggerStatements ["this", "player setCaptive false; {_x reveal [player, 3]} forEach thislist;  deleteVehicle thisTrigger;", ""];
_trigger attachTo [_unit, [0,0,0]];

// Fade back in
sleep 2;
titleText ["You are now disguised.", "BLACK IN"];

// Wait till he's exposed.
waitUntil {!(captive player)};

// Warning
titleText ["You are exposed *tearaway pants time!*", "PLAIN"];

// Grab current uniform gear.
_currentLoadout = getUnitLoadout _unit;
_uniformItems =  _currentLoadout select 3 select 1;  // Array

// Strip and redress
removeUniform _unit;
_unit addUniform _uniform;
_unit addHeadgear _helmet;

// Put back whatever the player currently had.
[_unit, _uniformItems] call fn_replaceUniformItems;

  • Like 1

Share this post


Link to post
Share on other sites

 

Here's a version of what you had that seems to be working for me.


this is exactly what i wanted :) nice work :)

Share this post


Link to post
Share on other sites

Regarding the uniform problems, there is an easy to work-around it.

 

Place any civ unit as player; place any Blufor unit and group the civ player to it. Delete the Blufor unit : your civilian is now a Blufor unit and can wear any uniform ingame.

Share this post


Link to post
Share on other sites

so i cant get this to work, im really new to scripting in arma3 and im un sure what needs to go into the init, i tried putting the entire script from Kylaina but that doesnt seem to work. 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×