Jump to content
Sign in to follow this  
mokeyii

Lower Weapon During Action?

Recommended Posts

So I have been working on a Co-Op mission for a while and I am trying to figure out how to get a player to lower or holster their weapon when executing the Hack Laptop Script.
 

I've been looking around for this, However I'm at a standstill on this. I know you are thinking. Why would you need to lower your weapon? Well I see it as ugly looking to hack a laptop while aiming at it. If anyone could help I would greatly appreciate it.

Here's the script:

T8L_var_fileSize = 122880;  								// Filesize ... smaller files will take shorter time to download!

T8L_var_TLine01 = "Download Aborted: Lost Connection To Host!";				// download aborted
T8L_var_TLine02 = "Secure Ports Blocked!";			// download already in progress by someone else
T8L_var_TLine03 = "Download Started! File Size 120GB!";				// download started
T8L_var_TLine04 = "Download Complete! Please Exit The Prompt To Continue!";			// download finished
T8L_var_TLine05 = "<t color='#FF0000'>01001000 01100001 01100011 01101011 00100000 01001100 01100001 01110000 01110100 01101111 01110000</t>"; //"01101000 01100001 01100011 01101011";				// line for the addaction
T8L_var_TLine06 = "Connecting ...";
T8L_var_TLine07 = "Connected:";

T8L_var_DialogAbort = false;
T8L_var_DialogSucce = false;



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

T8L_fnc_abortActionLaptop =
{
	if ( T8L_var_DialogSucce ) then 
	{
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
	
	} else {
		cutText [ T8L_var_TLine01, "PLAIN" ];	
		T8L_var_DialogAbort = true; 
		T8L_var_DialogSucce = false; 
	};
};


T8L_fnc_addActionLaptop =
{
	{
		if !( _x getVariable [ "T8L_pvar_dataDownloaded", false ] ) then
		{
			_x addAction [ T8L_var_TLine05, { call T8L_fnc_ActionLaptop; }, [], 10, false, false ];
		};
	} forEach _this;	
};


T8L_fnc_removeActionLaptop =
{
	_laptop = _this select 0;
	_id = _this select 1;
	_laptop removeAction _id;
};


T8L_fnc_ActionLaptop =
{
	private [ "_laptop", "_caller", "_id" ];
	_laptop = _this select 0;
	_caller = _this select 1;
	_id = _this select 2;
	
	if ( _laptop getVariable [ "T8L_pvar_inUse", false ] ) exitWith { cutText [ T8L_var_TLine02, "PLAIN" ]; };
	if ( _laptop getVariable [ "T8L_pvar_dataDownloaded", false ] ) exitWith { cutText [ T8L_var_TLine04, "PLAIN" ]; };
	
	cutText [ T8L_var_TLine03, "PLAIN" ];
	
	_laptop setVariable [ "T8L_pvar_inUse", true, true ];
		
	[ _laptop, _id ] spawn 
	{
		private [ "_laptop", "_id", "_newFile", "_dlRate", "_percent" ];
		
		_laptop		= _this select 0;
		_id			= _this select 1;
		
		_newFile = 0;
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
		
		createDialog "T8L_DataDownloadDialog";
		
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine06 ];
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine07 ];		
		ctrlSetText [ 8003, format [ "%1 kb", T8L_var_FileSize ] ];		
		ctrlSetText [ 8004, format [ "%1 kb", _newFile ] ];		
		
		while { !T8L_var_DialogAbort } do
		{
			_dlRate = 200 + random 80;
			_newFile = _newFile + _dlRate;

			if ( _newFile > T8L_var_FileSize ) then 
			{
				_dlRate = 0;		
				_newFile = T8L_var_FileSize;
				
				ctrlSetText [ 8001, T8L_var_TLine04 ];			
				cutText [ T8L_var_TLine04, "PLAIN" ];
				
				T8L_var_DialogAbort = true;
				T8L_var_DialogSucce = true;
				_laptop setVariable [ "T8L_pvar_dataDownloaded", true, true ];			

				[ [ _laptop, _id ], "T8L_fnc_removeActionLaptop", true, true ] spawn BIS_fnc_MP;
			};
			
			// percentage part by cuel!
			ctrlSetText [ 8002, format [ "%1 kb/t", _dlRate ] ];        
			_percent =  ( _newFile / T8L_var_FileSize );
			_percent = toArray str _percent;
			{ _percent set [_x,-1] } forEach [ 0, 1 ]; 
			_percent = _percent - [-1];
			_percent resize 2;
			_percent = toString _percent;
			ctrlSetText [ 8004, format [ "%1 kb (%2%3)", _newFile, (if ( T8L_var_DialogAbort ) then { 100 } else { _percent }), "%" ]];
			
			sleep 0.25;
		};
		
		T8L_var_DialogAbort = false;

		_laptop setVariable [ "T8L_pvar_inUse", false, true ];	
	};
};

T8L_var_INITDONE = true;

Share this post


Link to post
Share on other sites

What you're looking for is:

player action ["WEAPONONBACK", player];

I haven't read the laptop script, so keep in mind the locality. If the script's running local to each client, it should work okay.

Share this post


Link to post
Share on other sites

So when you say Locality, you are meaning "player"?

Share this post


Link to post
Share on other sites

So when you say Locality, you are meaning "player"?

 

If the script was running on a dedicated server, there'd be no "player".

 

But it's irrelevant here: addAction is local to players. You can paste the line inside the T8L_fnc_ActionLaptop function

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
Sign in to follow this  

×