Jump to content
oddHawky

Script for Undercover (kinda)

Recommended Posts

Hi Guys.

I am doing already a mission in Eden, where players are basically some kind of agents. Part of my mission is dedicated to being played in RolePlay, I mean Zeus is taking control of some AI in some situations and for example get someone interogated. At some point I want to give them a warning to go away, and if they would shoot me, I want to AI shoot them back. I tried to script that by myself but I just stuck... I tried  also by default, I mean Return Fire Only etc, but it didint work as well.  I hope that I would get some help here. Thanks for any wasted time for me ;) 

Share this post


Link to post
Share on other sites

Here's a script for checking if a player has no weapons in hands to  be "undercover":
In this script a player can walk to a box and will be clothed in civilian clothes, but keeps a small arms weapon.
If the player holster its weapons, he will be undercover.
 

// clothing.sqf
// Purpose: Re-cloth a player via addAction
// need an Objekt in editor (wardrobe, clothes, locker, box, etc.) with addAction in Init-line:
// clothes = this addAction ["change clothes", "scripts\clothing.sqf", nil, 6, true, true, "", "alive _target && _target distance _player < 2"];
//  This script is executed client-sited (only on PC of the clicking player)!

// ------------------------------------------------------------------------------------------


// Only for testing: Show Knowsabout value (remove in mission)
[] spawn {
	while {true} do {
		_KAvalue = EAST knowsAbout player;
		_Cstatus = captive player;
		hintsilent format ["KnowsAbout Wert:\n%1\nCaptive Status:\n%2",_KAvalue,_Cstatus];
		sleep 0.5;
	};
};


_container = _this select 0; // The wardrobe or the box
_player = _this select 1; // the clicking player

// Delete the locker, box, wardrobe, whatever you used
// deleteVehicle _container;  // or change it with another same object.

// Use your own equipment, these are some pieces of a mod-set 
removeAllWeapons _player;
removeAllItems _player;
removeAllAssignedItems _player;
removeUniform _player;
removeVest _player;
removeBackpack _player;
removeHeadgear _player;
removeGoggles _player;
_spieler forceAddUniform "U_C_ConstructionCoverall_Blue_F";
_spieler addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {_player addItemToUniform "ACE_fieldDressing";};
for "_i" from 1 to 2 do {_player addItemToUniform "ACE_CableTie";};
for "_i" from 1 to 5 do {_player addItemToUniform "ACE_morphine";};
_player addItemToUniform "BWA3_DM25";
_player addItemToUniform "BWA3_40Rnd_46x30_MP7";
_player addVest "V_Safety_yellow_F";
_player addBackpack "B_LegStrapBag_coyote_F";
for "_i" from 1 to 2 do {_player addItemToBackpack "ACE_fieldDressing";};
for "_i" from 1 to 2 do {_player addItemToBackpack "ACE_M84";};
for "_i" from 1 to 5 do {_player addItemToBackpack "BWA3_40Rnd_46x30_MP7";};
_player addHeadgear "H_Construction_basic_yellow_F";                           
_player addWeapon "BWA3_MP7";
_player addHandgunItem "BWA3_muzzle_snds_MP7";
_player addHandgunItem "BWA3_acc_LLM01_irlaser";
_player addHandgunItem "BWA3_optic_RSAS";
_player linkItem "ItemMap";
_player linkItem "ItemCompass";
_player linkItem "ItemWatch";
_player linkItem "tf_anprc152";
_player linkItem "BWA3_ItemNaviPad";
hint "You are ready for undercover.";

// endless-check, if undercover
while {true} do {
// if (EAST knowsAbout player < 1.5 && currentWeapon player == "") then {player setCaptive true} else {if (currentWeapon player != "") then {player setCaptive false}};
if (currentWeapon player == "") then {player setCaptive true} else {if (currentWeapon player != "") then {player setCaptive false; sleep 5;}};
sleep 1;	
};

If you don't need the clothing stuff, you don't need to use it.
Remember:
Setting the player to "captive" he will be CIVILIAN, so just keep it in mind, if he should use e.g. an uav-terminal.

 

The "EAST Knows about player" in the last section will keep a detected player visible for a longer time, until it is reset by time.
the current weapon-part below, will set the player immediatly "unvisible.
You can choose, which method you prefer.

 

Share this post


Link to post
Share on other sites

Thanks, Im gonna check this one asap and give a sign if this 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

×