Jump to content

MF-Tow (a towing script for DayZ Epoch mod)


Recommended Posts

FIX WALL HACK

 

edit init.sqf

 

 

 

Also, I fixed so that you don't get teleported to the other side of the car when towing because it can be used for bugging in to buildings.

 

and add repair sound:

	[player,20,true,(getPosATL player)] spawn player_alertZombies; // Alert nearby zombies
	[1,1] call dayz_HungerThirst; // Use some hunger and thirst to perform the action
	[player,"repair",0,false,10] call dayz_zombieSpeak;
	// Attach the player to the tow truck temporarily for safety so that they aren't accidentally hit by the vehicle when it gets attached
	/*
	player attachTo [_towTruck, 
		[
			(boundingBox _towTruck select 1 select 0),
			(boundingBox _towTruck select 0 select 1) + 1,
			(boundingBox _towTruck select 0 select 2) - (boundingBox player select 0 select 2) + _offsetZ
		]
	];
	*/

	//player setDir 270;
	//player setPos (getPos player);
	player playActionNow "Medic"; // Force the animation

THX Defent!

Link to comment
Share on other sites

FIX BY F507DMT #2:

 

inif.sqf

hide all menu if vehicles LOCK new: if(!(_cursorTarget getVariable ["MF_Tow_Cannot_Tow", false])) then {

// Add the action to the players scroll wheel menu if the cursor target is a vehicle which can tow.
if(_towableVehiclesTotal > 0) then {
	if (s_player_towing < 0) then {	
		if(!(_cursorTarget getVariable ["MF_Tow_Cannot_Tow", false])) then {
			if(!(_cursorTarget getVariable ["MFTowIsTowing", false])) then {
						if(!(_cursorTarget getVariable ["MFTowInTow", false])) then {
				s_player_towing = player addAction [("<t color=""#dddd00"">" + ("Attach nearest...") +"</t>"), format["%1\tow_AttachTow.sqf", MF_Tow_Base_Path], _cursorTarget, 0, false, true, "",""];
	};			
			} else {
				s_player_towing = player addAction [("<t color=""#dddd00"">" + ("Detach...") +"</t>"), format["%1\tow_DetachTow.sqf", MF_Tow_Base_Path], _cursorTarget, 0, false, true, "",""];	
																		
	};
																		};
	};
} 
else {
	player removeAction s_player_towing;
	s_player_towing = -1;
};

.

 

 

FIX WALL HACK (video on the top)

in tow_AttachTow.sqf del:

detach player; - IF U DEL player attachTo IN INIF.sqf (fix bag wall hack)
_vehicle lock true;  

add:

				
				//Can`t sit in a car if car towing
				_vehicle addEventHandler ["GetIn", {
				if (_this select 0 getVariable ["VehicleInTow", true]) then {
				player action ["eject", _this select 0];
				cutText [format["Can`t sit in a car if car towing"], "PLAIN DOWN"];
				};}];
				_vehicle setVariable ["VehicleInTow", true, true];
				//Can`t sit in a car if car towing
				
				_vehicle setVariable ["MFTowInTow", true, true];
				_towTruck setVariable ["MFTowIsTowing", true, true];

Del in tow_DetachTow.sqf

detach player; - IF U DEL player attachTo IN INIF.sqf (fix bag wall hack)
_vehicle lock false; 

add:

		//force save
		
		detach _vehicle;
			
		//Can`t sit in a car if car towing
		_vehicle setVariable ["VehicleInTow", false, true];
		//Can`t sit in a car if car towing		
			
		_vehicle setVariable ["MFTowInTow", false, true];
Link to comment
Share on other sites

 

FIX WALL HACK

 

edit init.sqf

 

 

and add repair sound:

	[player,20,true,(getPosATL player)] spawn player_alertZombies; // Alert nearby zombies
	[1,1] call dayz_HungerThirst; // Use some hunger and thirst to perform the action
	[player,"repair",0,false,10] call dayz_zombieSpeak;
	// Attach the player to the tow truck temporarily for safety so that they aren't accidentally hit by the vehicle when it gets attached
	/*
	player attachTo [_towTruck, 
		[
			(boundingBox _towTruck select 1 select 0),
			(boundingBox _towTruck select 0 select 1) + 1,
			(boundingBox _towTruck select 0 select 2) - (boundingBox player select 0 select 2) + _offsetZ
		]
	];
	*/

	//player setDir 270;
	//player setPos (getPos player);
	player playActionNow "Medic"; // Force the animation

THX Defent!

 

 

This is awesome @F507DMT. Can you please fork the repo (https://github.com/matt-d-rat/mf-tow/fork) and open a pull request to my repo with your changes so that I can include them into the next official release. When I get a chance (sorry for being quiet recently... lots of personal stuff going on in my life at the moment) I will also assist in trying to find a fix for your fix :-) 

Link to comment
Share on other sites

This is awesome @F507DMT. Can you please fork the repo (https://github.com/matt-d-rat/mf-tow/fork) and open a pull request to my repo with your changes so that I can include them into the next official release. When I get a chance (sorry for being quiet recently... lots of personal stuff going on in my life at the moment) I will also assist in trying to find a fix for your fix :-) 

Done! https://github.com/F507DMT/mf-tow

Need help whitch addEventHandler

 

ideas:

1. Speed limit if u tow! some like this code:


_veh   = vehicle player;
_reduc = 1.0050;
_aaa = true;
while {_aaa} do
{
_veh setvelocity [((velocity _veh) select 0)/_reduc, ((velocity _veh) select 1)/_reduc, ((velocity _veh) select 2)];
sleep 0.05;


};
 
 

2. chouse what car i want Tow

Link to comment
Share on other sites

Done! https://github.com/F507DMT/mf-tow

Need help whitch addEventHandler

 

ideas:

1. Speed limit if u tow! some like this code:


_veh   = vehicle player;
_reduc = 1.0050;
_aaa = true;
while {_aaa} do
{
_veh setvelocity [((velocity _veh) select 0)/_reduc, ((velocity _veh) select 1)/_reduc, ((velocity _veh) select 2)];
sleep 0.05;


};
 
 

2. chouse what car i want Tow

 

Awesome, can you issue the pull request from your fork onto my repo so I can approve it into the official release.

 

I like these ideas, I thought about how we could emulate an objects mass and effect the speed of the towing vehicle. Needs exploring, but certainly if more people contribute to the project things will get released quicker. Thanks for contribution.

Link to comment
Share on other sites

v1.1.2
  • Fixed bug which allowed players to enter towed vehicles, allowing them to ghost through walls to gain access to modular bases.
  • Added a check to interupt the attaching of the tow if a player enters the vehicle during the attachment phase.

 

Just curious how that works. I've installed v1.1.2 but am still able to enter a vehicle once it's attached for towing. Does it kick them out of the vehicle if you start driving or am I doing something wrong?

 

Edit: Ok after reading through all the pages I see vehicles are suppose to lock once towed, seems they aren't locking for me so I'm gonna go over everything I've done to ensure I didn't miss something.

 

Edit 2: Everything looks right, but for some reason vehicles just don't lock once towed.

 

On another note, curious where I can find what vehicles are defined by...

{_array = ["Motorcycle","Car"];};

Just doesn't seem right I can attach a ural to the back of a hilux, unless that's another bug I'm encountering.

Link to comment
Share on other sites

@matt_d_rat u cnow why addEventHandler work jast for me? i want add Event Handler to car! 

if we fix this, i easy can do speed limit

 

ps

 

Awesome, can you issue the pull request from your fork onto my repo so I can approve it into the official release.

 

I like these ideas, I thought about how we could emulate an objects mass and effect the speed of the towing vehicle. Needs exploring, but certainly if more people contribute to the project things will get released quicker. Thanks for contribution.

 i sink i do this?

Link to comment
Share on other sites

Hi,

first i want to congratulate you for your hard work.

But i have a problem and would like to know if someone else has it.

Sometimes (1 per 10 or 20 times) when i untow a vehicule it returns its initial position (where i attached it), so i dont know if i've made a mistake during the install or if any conflict....

If anyone has this problem too i would be happy not to be alone,

thx for an eventually answer and have a good day.

Link to comment
Share on other sites

Hi,

first i want to congratulate you for your hard work.

But i have a problem and would like to know if someone else has it.

Sometimes (1 per 10 or 20 times) when i untow a vehicule it returns its initial position (where i attached it), so i dont know if i've made a mistake during the install or if any conflict....

If anyone has this problem too i would be happy not to be alone,

thx for an eventually answer and have a good day.

ALWAYS get in the vehicle you want to tow and start engine, shut down engine, get out, attach to towing vehicle.

This happens because the position for the vehicle hasnt been updated yet in the database and towing it doesnt updated the location in the db for that vehicle, so if you untow it *poof* back at its starting point.

Link to comment
Share on other sites

so i followed the intructions to the letter for this and made it so vehicles cant tow locked vehicles and everything is working fine  ..   but when i UNLOCK and LOCKABLE vehicle  and try to tow it it still wont let me tow it....  do i need to change something to keep locked vehicles to not be towed.... but unlocked vehicles could be towed??

Link to comment
Share on other sites

i think i have a solution for the "vehicle do not save position after tow" problem, but i havent tested it yet.

 

just insert

	PVDZE_veh_Update = [_vehicle,"all"];
	publicVariableServer "PVDZE_veh_Update";

in your tow_DetachTow.sqf after the line:

			_vehicle setvelocity [0,0,1];
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
×
×
  • Create New...