Jump to content

[Release] Enhanced Vehicle Deployment (with right click option)


Recommended Posts

This is different then the problem you said before.  You said before that the problem was people could pack vehicle from anywhere that the option would not go away.  That would typically be an issue with fn_selfActions.

 

As a reference here is what my fn_selfActions looks like.  Obviously I have renamed things a bit to fit my desire but it works like a charm. 

 

//Pack Vehicles

if (_typeOfCursorTarget in StaticVehicleArray and _hasToolbox and !(locked _cursorTarget) and (damage _cursorTarget < 1)) then {

if (s_player_packvehicle < 0) then {

s_player_packvehicle = player addAction ["Pack Vehicle", "Scripts\static_pack.sqf",_cursorTarget, 0, false, true, "",""];

};

} else {

player removeAction s_player_packvehicle;

s_player_packvehicle = -1;

};

// All Traders

 

But you said now the problem is the vehicle doesn't disapear, no refund, and don't get an option to pack, then there's something wrong with your script.  I'm going to guess in the common file?

 

Apologies for the misunderstanding in how I worded it. Yes, people were able to pack vehicles from any distance as long as they walk up to the vehicle and scroll on it to get the 'pack vehicle' option. So, I edited the script to check to see if the vehicle is within 5m of the player before packing (see reply #73 for edited code). However, once I made that change, I started encountering a different problem: you would get the option to pack vehicle --> choose to pack vehicle --> player would go through the animation --> vehicle would not delete --> parts would not get refunded --> no longer have the option to pack vehicle if you scroll wheel on the vehicle again.

 

So, on my production server players are still able to pack vehicles from a long distance. On my test server, my changes aren't deleting the vehicle or refunding parts.

 

Sorry about the confusion.

 

EDIT: Do you think I should remove the check for the vehicle within 5m from EVD_Pack.sqf and move it into the fn_selfActions.sqf script? Maybe something like:

//Pack Vehicles
if (_typeOfCursorTarget in StaticVehicleArray and !(locked _cursorTarget) and (damage _cursorTarget < 1) and (_cursorTarget distance player <= 5)) then {
if (s_player_packvehicle < 0) then {
s_player_packvehicle = player addAction ["Pack Vehicle", "Scripts\static_pack.sqf",_cursorTarget, 0, false, true, "",""];
};
} else {
player removeAction s_player_packvehicle;
s_player_packvehicle = -1;
};
// All Traders

I will test this and see. I am still very new to Arma scripting (and coding in general as I only took 1 semester of C++ coding in high school, which was a decade ago), so I apologize for the trouble but I greatly appreciate your input and help. I understand coding logic and syntax in general, so I'm not flying completely blind when it comes to coding, but I am still very new at this.

 

EDIT 2: Issue resolve via PM from @Hardened.

 

 

If the problem of people packing vehicles from anywhere persists...

This is the part that removes the option to pack vehicle: IE. If your cursor is not on the target anymore.

player removeAction s_player_packvehicle;

s_player_packvehicle = -1;

Try adding it after this block of code:

player removeAction s_player_fillfuel;

s_player_fillfuel = -1;

player removeAction s_player_studybody;

s_player_studybody = -1;

(near the bottom of fn_selfActions)

 

This fix did indeed work. MUCH easier. Thank you!

Link to comment
Share on other sites

Apologies for the misunderstanding in how I worded it. Yes, people were able to pack vehicles from any distance as long as they walk up to the vehicle and scroll on it to get the 'pack vehicle' option. So, I edited the script to check to see if the vehicle is within 5m of the player before packing (see reply #73 for edited code). However, once I made that change, I started encountering a different problem: you would get the option to pack vehicle --> choose to pack vehicle --> player would go through the animation --> vehicle would not delete --> parts would not get refunded --> no longer have the option to pack vehicle if you scroll wheel on the vehicle again.

 

So, on my production server players are still able to pack vehicles from a long distance. On my test server, my changes aren't deleting the vehicle or refunding parts.

 

Sorry about the confusion.

 

EDIT: Do you think I should remove the check for the vehicle within 5m from EVD_Pack.sqf and move it into the fn_selfActions.sqf script? Maybe something like:

//Pack Vehicles
if (_typeOfCursorTarget in StaticVehicleArray and !(locked _cursorTarget) and (damage _cursorTarget < 1) and (_cursorTarget distance player <= 5)) then {
if (s_player_packvehicle < 0) then {
s_player_packvehicle = player addAction ["Pack Vehicle", "Scripts\static_pack.sqf",_cursorTarget, 0, false, true, "",""];
};
} else {
player removeAction s_player_packvehicle;
s_player_packvehicle = -1;
};
// All Traders

I will test this and see. I am still very new to Arma scripting (and coding in general as I only took 1 semester of C++ coding in high school, which was a decade ago), so I apologize for the trouble but I greatly appreciate your input and help. I understand coding logic and syntax in general, so I'm not flying completely blind when it comes to coding, but I am still very new at this.

 

EDIT 2: Issue resolve via PM from @Hardened.

 

This fix did indeed work. MUCH easier. Thank you!

 

No problemo.

 

Here's a video of what I did with this amazing script to deploy mounted weapons: http://youtu.be/oASs2_RUX88

Link to comment
Share on other sites

  • 2 weeks later...

I think we are having the same problem since the 332 update from Infistar.

The line below appears in the publicvariable.log, (restriction #11 I think),

"04.07.2014 02:59:41: PlayerName (IP) UID - #11 "PVAHR_0_hharrcqnfwtb" =

["PlayerName","ID",

[73,110,118,97,108,105,100,32,73,68,58,32,79,108,100,95,98,105,107,101,95,84,75,95,73,78,83,95,69,80,49,32,64,49,57,49,49

,52,56],[66,65,78,78,69,68]]"

I have tried the above fix (_VTC =  true;) and a few tweaks to BE publicvariable.txt but nothing seems to solve this yet.

Battleye is not my first language so I know little of it. Still fiddling while server burns.

Link to comment
Share on other sites

replaced my old deploy script with this one today

is this set default to not check for required parts to build ??

I can build as many muzzie, motorcycles and bikes as I want without any parts..

I have read other posts with this same issue but I cannot find the solution..

anyone have the updated version of this that uses the required parts  ??? please share maybe again.

Link to comment
Share on other sites

OK so attachments on the forum do not allow me to add .rar files - why??

 

Secondly please see link for files (Modded with all the "fixes" included in this thread): https://www.dropbox.com/s/tev2vuowlu3dik9/EVD.rar

 

Hope it helps :)

 

Pry

 

Edit: The above linked file will remove the toolbox upon deploying the bike / other items. If you don't want this then change EVD_deploy to the following:

 

/*
	Enhanced Vehicle Deployment by TheFarix
*/

call compile preprocessFileLineNumbers "custom\EVD\EVD_common.sqf";

if (dayz_combat == 1) exitwith { cutText ["\n\nYou are in combat and cannot perform that action!", "PLAIN DOWN"] };

private ["_type","_inVehicle","_onLadder","_canDo","_materials","_proceed","_qty","_missing","_missingQty","_objectID"];

_type = _this select 0;

_inVehicle = (vehicle player != player);
_onLadder =	(getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder and !_inVehicle);

if (_canDo) then {
	_materials = [_type] call EVDGetMaterials;

	// Dry run to see if all parts are available.
	_proceed = true;
	if (count _materials > 0) then {
		{
			_itemIn = _x select 0;
			_countIn = _x select 1;
		
			_qty = { _x == _itemIn } count magazines player;

			if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
		} forEach _materials;
	};

	if (_proceed) then {
		closeDialog 1;

		cutText ["\n\nDeploying vehicle started", "PLAIN DOWN"];

		[1,1] call dayz_HungerThirst;
		player playActionNow "Medic";

		[player,"repair",0,false] call dayz_zombieSpeak;
		[player,50,true,(getPosATL player)] spawn player_alertZombies;

		r_interrupt = false;
		_animState = animationState player;
		r_doLoop = true;
		_started = false;
		_finished = false;

		while {r_doLoop} do {
			_animState = animationState player;
			_isMedic = ["medic",_animState] call fnc_inString;
			if (_isMedic) then {
				_started = true;
			};
			if (_started and !_isMedic) then {
				r_doLoop = false;
				_finished = true;
			};
			if (r_interrupt) then {
				r_doLoop = false;
			};
			sleep 0.1;
		};
		r_doLoop = false;

		if (_finished) then {
			_removed_total = 0; // count total of removed items
			_tobe_removed_total = 0; // count total of all to be removed items
			// Take items
			{
				_removed = 0;
				_itemIn = _x select 0;
				_countIn = _x select 1;
				_tobe_removed_total = _tobe_removed_total + _countIn;

				{
					_configParent = configName(inheritsFrom(configFile >> "cfgMagazines" >> _x));
					if( (_removed < _countIn) && ((_x == _itemIn) || (_configParent == _itemIn))) then {
						_num_removed = ([player,_x] call BIS_fnc_invRemove);
						_removed = _removed + _num_removed;
						_removed_total = _removed_total + _num_removed;
						if(_num_removed >= 1) then {
							_temp_removed_array set [count _temp_removed_array,_x];
						};
					};

				} forEach magazines player;

			} forEach _materials;
		
			// Only proceed if all parts were removed successfully
			if(_removed_total == _tobe_removed_total) then {
				if (EVDSellVehicles) then {
					_objectID = str(round(random 999999));
				} else {
					_objectID = "0";
				};

				_pos = getPos player;
				_dir = getDir player;
				_infrontdist = 5;
				_object = createVehicle [_type,[(_pos select 0)+_infrontdist*sin(_dir),(_pos select 1)+_infrontdist*cos(_dir),0],[], 0, "NONE"];
				_object setVariable ["ObjectID", _objectID, true];
				_object setVariable ["ObjectUID", _objectID, true];
				_object addEventHandler ["GetIn",{
					_nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: This vehicle will disappear on server restart!","PLAIN DOWN",5] call RE;
				}];

				clearWeaponCargoGlobal _object;
				clearMagazineCargoGlobal _object;
				_object setVehicleAmmo 0;

				player reveal _object;

				cutText ["\n\nYou've built a vehicle!", "PLAIN DOWN"];
			} else {
				// Refund parts since we failed
				{player addMagazine _x;} forEach _temp_removed_array;

				cutText [format[(localize "str_epoch_player_151"),_removed_total,_tobe_removed_total], "PLAIN DOWN"];
			};
		} else {
			r_interrupt = false;
			player switchMove "";
			player playActionNow "stop";
			cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
		};
	} else {
		_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
		cutText [format["Missing %1 more of %2",_missingQty, _textMissing], "PLAIN DOWN"];
	};
} else {
	cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
};

 

Sorry about that.

 

Pry

Edited by PryMary
Link to comment
Share on other sites

  • 2 weeks later...

The bike despawns after about 30 seconds on my server, also the option to repack does not appear

Can anyone help me to fix this ?

 

Epoch 1.0.5.1

Beta:112555

 

My fn_selfactions.sqf

//Pack Vehicles
	if (_typeOfCursorTarget in EVDVehicleArray and !(locked _cursorTarget) and (damage _cursorTarget < 1)) then {
		if (s_player_packvehicle < 0) then {
			s_player_packvehicle = player addAction ["<t color=""#008aff"">Pack Vehicle</t>", "Scripts\EVD\EVD_pack.sqf",_cursorTarget, 0, false, true, "",""];
		};
	} else {
		player removeAction s_player_packvehicle;
		s_player_packvehicle = -1;
	};

Thanks :)

Link to comment
Share on other sites

Yep, I've got exactly the same problems KrisiS, even bought bikes and mozzies of the same type will teleport back to where they were last used on restart. Going to have to pull this mod and use another toolbox bike script for now, which is a pity because this one looks really good.

Link to comment
Share on other sites

Im trying to install this on my server.  I have redone each step about four times now.... everytime I load my server it crashes and says

 

"include file vilayercodecustom\mission\epoch.chernrus\custom\extra_rc.hpp"

 

im certain that im placing this file in the proper location as it is in this exact location..

 

 

any help?

Link to comment
Share on other sites

I have been using this script and it worked fine UNTIL 1.0.5.1 125548

When someone gets on any of the three items, after about 14 seconds they disappear. I have checked and double checked and then checked one more time my install.

Did it like i have done 5 other servers. Need help.

btw this is on Napf overpoch version shown above. 

Link to comment
Share on other sites

Hello,

I've installed this today and it seems to work but I have some problems. If I try to spawn a bike without the needed items I get the message: "Missing 1 more of ". With the items I still get the same message.

When I try to deploy a Motocykle it shows nothing. It doesn't show me what items I need or which are missing. Not even this message "Missing 1 more of ".

The only thing I can deploy is the Mozzie. This can show me what items are missing and I can deploy a Mozzie when I have the needed items. But I can't pack it. 

8b9dc0c996.png

//////////////////////////////////////////////////////////////////////////////////////////
//                                     Configuration                                    //
//////////////////////////////////////////////////////////////////////////////////////////

// Do you want vehicles to be sold at traders?
EVDSellVehicles = false;

//////////////////////////////////////////////////////////////////////////////////////////
//                                   Common Functions                                   //
//////////////////////////////////////////////////////////////////////////////////////////
EVDGetMaterials = {
	private ["_type","_materials"];

	_type = _this select 0;

	switch (_type) do {
		case "MMT_Civ":		{ _materials = [["ItemCompass", 1], ["ItemWatch", 1]]; };
		case "TT650_Civ":	{ _materials = [["PartEngine", 1], ["PartWheel", 1]]; };
		case "CSJ_GyroC":	{ _materials = [["PartVRotor", 1], ["PartGeneric", 1]]; };
	};

	_materials;
};

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...