Jump to content

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


Recommended Posts

Alright I was able to get everything working perfectly I just need help understanding something, If I am using the basic setup shown below. How can I get anything to two a C130J_US_EP1?

 

{_array = ["Motorcycle","Car","Truck","Wheeled_APC","Tracked_APC","Air"];};

 

Is it not seen as an Air type?

You probably need to increase the tow distance, I know the distance is calculated from underneath the wings on that thing and it is far longer than 10 meters!

Link to comment
Share on other sites

[FIX for MultiTow false]

 

I have tested the way Phail was doing a few posts upper mine, but then i dont can tow anymore.

So, for all who have still problems with disabling multitow though the option is set to false, i have figured out a solution and its working perfect for me !

 

Open your MF_Tow init.sqf and find:

if(_towableVehiclesTotal > 0) then {
if (s_player_towing < 0) then {
if(!(_cursorTarget getVariable ["MFTowIsTowing", false])) then {
s_player_towing = player addAction ["Attach Tow", format["%1\tow_AttachTow.sqf", MF_Tow_Base_Path], _cursorTarget, 0, false, true, "",""];
} else {
s_player_towing = player addAction ["Detach Tow", format["%1\tow_DetachTow.sqf", MF_Tow_Base_Path], _cursorTarget, 0, false, true, "",""]; 
};
};
} else {
player removeAction s_player_towing;
s_player_towing = -1;
};

and change it to this:

if(_towableVehiclesTotal > 0) then {
if (s_player_towing < 0) then {
if (!(_cursorTarget getVariable ["MFTowIsTowing",false]) && (!(_cursorTarget getVariable ["MFTowInTow", false])))then {
s_player_towing = player addAction ["Attach Tow", format["%1\tow_AttachTow.sqf", MF_Tow_Base_Path], _cursorTarget, 0, false, true, "",""];
};
if ((_cursorTarget getVariable ["MFTowIsTowing",false]) && (!(_cursorTarget getVariable ["MFTowInTow",false]))) then {
s_player_towing = player addAction ["Detach Tow", format["%1\tow_DetachTow.sqf", MF_Tow_Base_Path], _cursorTarget, 0, false, true, "",""];
};
};
} else {
player removeAction s_player_towing;
s_player_towing = -1;
};

cheers

Link to comment
Share on other sites

I dont have tested to tow locked vehicles until now.

This function i have disabled because i have another problem.

 

Towed vehicles are still enterable and 2 players can cheat into some bases.

 

So i decided to script a new function for locking towed vehicles. (The implemented query "_vehicle lock true;" doesnt work).

Iam now scripting at this for 2 days without success. The only success was that the towed vehicle was locked only for myself. But other players was still able to enter the towed vehicle.

Now i was trying everthing which was possible for me and i have to go other steps. I will now try to eject all players from the towed vehicle if it was entered.

 

If anybody have another solution, please share it with me.

Should i successfull finish my work, i will post it here, but if anybody is faster then share please :P

Link to comment
Share on other sites

So i decided to script a new function for locking towed vehicles. (The implemented query "_vehicle lock true;" doesnt work).

 

_vehicle lock true; is a local client only command, try pasting this handy epoch variable logic after it

VDZE_veh_Lock = [_vehicle,true];
publicVariable "PVDZE_veh_Lock";
Link to comment
Share on other sites

I thought I would post the changes I made for my server since it doesn't appear matt seems to be doing much updating any more.. and there are still some bugs in his version remaining (though I have requested the github push)

 

Realistic class type towing

 

The class arrays have been revamped to be much smaller and easier to add/remove vehicles, towing must be done just like you would in real life by reversing up to the front of the vehicle you wish to tow, this will prevent being able to tow stuff out of walls if you face vehicles away from them, all the bugs that I am aware of have been updated, including global locking of towed vehicles so you can't glitch players inside walls

 

(and towing tractors can tow c130's now)

Link to comment
Share on other sites

 

_vehicle lock true; is a local client only command, try pasting this handy epoch variable logic after it

VDZE_veh_Lock = [_vehicle,true];
publicVariable "PVDZE_veh_Lock";

Are you able to elaborate on this for me?  Where do I add this code?  and do I need to add it to any battleye scripts too?

Link to comment
Share on other sites

Listen the sentence again, then you know it.

 

_vehicle lock true; is a local client only command, try pasting this handy epoch variable logic after it

And there is an error in the line. It have to be PVDZE_veh_Lock and not VDZE_veh_Lock.

 

So the code in tow_attach.sqf have to be:

_vehicle lock true;
PVDZE_veh_Lock = [_vehicle,true];
publicVariable "PVDZE_veh_Lock";

and for the tow_detach.sqf it have to be:

_vehicle lock false;
PVDZE_veh_Lock = [_vehicle,false];
publicVariable "PVDZE_veh_Lock";
Link to comment
Share on other sites

 

Listen the sentence again, then you know it.

 

_vehicle lock true; is a local client only command, try pasting this handy epoch variable logic after it

And there is an error in the line. It have to be PVDZE_veh_Lock and not VDZE_veh_Lock.

 

So the code in tow_attach.sqf have to be:

_vehicle lock true;
PVDZE_veh_Lock = [_vehicle,true];
publicVariable "PVDZE_veh_Lock";

and for the tow_detach.sqf it have to be:

_vehicle lock false;
PVDZE_veh_Lock = [_vehicle,false];
publicVariable "PVDZE_veh_Lock";

Thankyou Sparky you sexy man!

Link to comment
Share on other sites

Hey guys,

 

Sorry I have been a bit absent of late, real life stuff (work, family, friends etc..) have taken priority for me these past few months so I haven't been able to address the issues raised with the script lately.

 

There has been some fantastic work done on the script though by the community, and I am currently in the process in reviewing 3 pull requests on the repo. I aim to bring all of these changes into the next release of the script very soon.

 

I just wanted to thank everyone who have helped to improve this script, and to everyone for giving their feedback and testing the changes.

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

I have actually started using this script along side the =BTC= Lift (which is awesome) instead of the logistics tow and lift because players were glitching through bases too easily. However, there are even a few issues with this one. I've looked at the previous posts but still cant seem to find a couple of answers to my questions.

 

Ive got it working so that if u tow a vehicle it is locked, but if u tow a vehicle that has a key you can unlock it and get in,leaving it open to exploit into bases. Can anyone help me on a fix for this?

 

And how do you get the colour option for the scoll menu? ( I tried the suggestion on a previous post but it wont work).

 

Cheers

Max

Link to comment
Share on other sites

my local_lockUnlock work very good for locked vehicle
 

private ["_vehicle","_status","_sounddist","_tvih"];
_vehicle = _this select 0;
_status = _this select 1;
_sounddist = 50;

if (local _vehicle) then {
	if(_status) then {
		_vehicle setVehicleLock "LOCKED";
		player action ["lightOn", _vehicle];
		_vehicle setVariable ["MF_Tow_Cannot_Tow",true,true];
		_vehicle setVariable ["BTC_Cannot_Lift",true,true];
		_nul = [objNull, _vehicle, rSAY, "carLock", "lock", _sounddist] call RE;
		sleep 0.5;
		player action ["lightOff", _vehicle];
		
	} else {
		_vehicle setVehicleLock "UNLOCKED";
		player action ["lightOn", _vehicle];
		_vehicle setVariable ["MF_Tow_Cannot_Tow",false,true];
		_vehicle setVariable ["BTC_Cannot_Lift",false,true];
		_nul = [objNull, _vehicle, rSAY, "carLock", "unlock", _sounddist] call RE;
		sleep 0.5;
		player action ["lightOff", _vehicle];
		
		
	};
};
[_vehicle,500,true,(getPosATL _vehicle)] spawn player_alertZombies;
Link to comment
Share on other sites

  • 3 weeks later...
Hi there,
 
first of all thanks to all of you for the great Input you are contributing to this Plugin, but i do have a few little Questions I would like to ask into this Round of Experts:
 
1.) No towing Option
 
I installed this whole Plugin by following the instructions on Page one, in super short version 
 
1.) Downloaded Version from https://github.com/matt-d-rat/mf-tow
2.) Moved my compile.sqf & fn_selfActions.sqf into the mission file 
 
2a.) Added the compile.sqf into the inti.sqf via:
call compile preprocessFileLineNumbers "custom\compiles.sqf";
2b.) Modified the compiles.sqf to load fn_selfActions.sqf from new Path via:
fnc_usec_selfActions = compile preprocessFileLineNumbers "custom\fn_selfActions.sqf";
 
3.) Modified the file ( custom/fn_selfActions.sqf ) accoring to the Howto:
 
//Towing with tow truck
/*
//if(_typeOfCursorTarget == "TOW_DZE") then {
//if (s_player_towing < 0) then {
// if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
// s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""]; 
// } else {
// s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""]; 
// };
// };
//} else {
// player removeAction s_player_towing;
// s_player_towing = -1;
//};
// MF-Tow Script by Matt Fairbrass (matt_d_rat)
call compile preprocessFileLineNumbers 'custom\towing\init.sqf';
*/
 
4.) Modified the file (custom\towing\init.sqf) according to the Howto:
 
private ["_cursorTarget", "_towableVehicles", "_towableVehiclesTotal"];


// Public variables
MF_Tow_Base_Path = "custom\towing";  // The base path to the MF-Tow Folder.
MF_Tow_Distance = 10; // Minimum distance (in meters) away from vehicle the tow truck must be to tow.
MF_Tow_Multi_Towing   = false; // Allow a vehicle which is towing another vehicle already to be towed by another tow. Disabled by default.


// Functions


MF_Tow_Towable_Array =
{
   private ["_array","_towTruck"];
   _towTruck = _this select 0;
_array = [];


switch (typeOf _towTruck) do
{
   //Motorbikes can tow (bikes,motorbikes)
case "ATV_CZ_EP1":  {_array = ["Old_bike_TK_INS_EP1","TT6,"ATV_US_EP1"];};
case "ATV_US_EP1":  {_array = ["Old_bike_TK_INS_EP1",","ATV_US_EP1"];};
<brabbel brabbel brabbel more stuff brabbel brabbel> 


};
5.) Updated my local_lockUnlock.sqf and all his buddys with:
 
vehicle setVariable ["MF_Tow_Cannot_Tow",true,true];
vehicle setVariable ["MF_Tow_Cannot_Tow",false,true];

( at page ten of this Topic () there some other solutions, but i will stick with this once for now )

 
6.) Repacked both of my Files ( Mission PBO | Dayz Server PBO ) and uploaded it to the server
 
7.) Restarted 
 
 
Sadly i am not able to see any kind of Tow Option in the Scroll down Menu, first i though oh this is because you dont have your MF_Tow_Towable_Array not filled 
with Informations, so i grabbed an already finished once this once ( https://github.com/SJossy/mf-tow ) it looked to me to be complete, but still no towing option.
 
Started to check the usual Logfiles:
 
arma2OAserver.rpt


=====================================================================
== C:\SERVICES\ni338672_2\dayz\arma2oaserver.exe
== arma2oaserver.exe     -cpuCount=2 -exThreads=1 -maxmem=2047 -noCB -malloc=tbb4malloc_bi -noSound -ip=5.62.69.128 -port=2302 -config=dayz_1.epoch.panthera2\server_config.cfg -cfg=dayz_1.epoch.panthera2\basic.cfg -profiles=dayz_1.epoch.panthera2 -name=Bliss -mod=@DayZ_Epoch;@DayZ_Epoch_Server;@panthera;@DayzOverwatch; 
=====================================================================
Exe timestamp: 2014/07/15 17:45:14
Current time:  2014/10/07 13:23:29


Version 1.63.125548
File nissan_350z\config.cpp, line 244: '/CfgVehicles/350zBase/Library.libTextDesc': Missing ';' prior '}'
Unsupported language English in stringtable
Unknown entity: 'C inatallations and equipment, fuel and ammunition storage facilities and parked tactical aircraft. The original BS-1 system was designed for the 7.62mm Kalashnikov AKMS assault rifle with PBS-1 silencers. When the Soviet army switched over to 5.45x39mm ammunition, they were replaced with AKS-74UB compact assault rifles with PBS-4 silencers. The original GSN-19 grenade launcher system was slightly reworked, primarily to use different launching ammunition new mounting brackets better suited
< Brabbel Brabbel Stupid Stuff >


Conflicting addon dayz_code in 'z\addons\dayz_code\', previous definition in 'dayz_code\'
Conflicting addon DZ_DebriefingRemoved in 'z\addons\dayz_code\', previous definition in 'dayz_code\'
< Brabbel Brabbel Stupid Stuff >


Updating base class ->NonStrategic, by Ca\config.bin/CfgVehicles/HouseBase/
< Brabbel Brabbel Stupid Stuff >
Obsolete class Animations defined in bin\config.bin/RscCompass/
Obsolete class Animations defined in bin\config.bin/RscWatch/
Unrecognized CfgVehicles simulation  in bin\config.bin/CfgVehicles/Offroad_SPG9_Gue/
< Brabbel Brabbel Stupid Stuff >


14:25:05 Server error: Player without identity [TIW] Apraxas (id 359834714)
< Brabbel Brabbel Stupid Stuff >
14:25:16 Warning: looped for animation: ca\anims\characters\data\anim\sdr\mov\erc\wlk\non\non\amovpercmwlksnonwnondf.rtm differs (looped now 0)! MoveName: amovpercmstpsnonwnondnon_amovpercmstpsraswpstdnon
14:25:16 Warning: looped for animation: ca\anims\characters\data\anim\sdr\mov\erc\wlk\non\non\amovpercmwlksnonwnondf.rtm differs (looped now 1)! MoveName: amovpercmrunsnonwbindf_rfl
14:25:18 "DayZ Epoch: PRELOAD Functions\init [[<No group>:0 (FunctionsManager)],any]"
14:25:18 "DayZ Epoch: MPframework inited"
< Brabbel Brabbel Stupid Stuff >


14:25:28 "infiSTAR.de - Waiting for bis_fnc_init..."
14:25:28 "infiSTAR.de - bis_fnc_init done - AntiHack STARTING...!"
14:25:28 "infiSTAR.de - Your AHconfig.sqf is missing Variables!"
< Brabbel Brabbel Stupid Stuff >


14:25:28 "Res3tting B!S effects..."
14:25:30 "HIVE: Starting"
14:25:30 "HIVE: trying to get objects"
14:25:30 "HIVE: found 363 objects"
14:25:30 "HIVE: Commence Object Streaming..."
14:25:30 "HIVE: got 0 Epoch Objects and 363 Vehicles"
< Brabbel Brabbel Stupid Stuff >


14:25:39 "infiSTAR.de - Player-Log: [TIW] Apraxas(76561197962545003) - 0h 00min | ******ADMIN******"
< Brabbel Brabbel Stupid Stuff >


14:28:02 "infiSTAR.de PVAH_WriteLog: [B 1-1-B:1 ([TIW] Apraxas) REMOTE,"[TIW] Apraxas (76561197962545003) spawned Ural_CDF @042026"]"
14:28:04 "infiSTAR.de AdminReq: [0,B 1-1-B:1 ([TIW] Apraxas) REMOTE,"UAZ_CDF",[4241.06,7626.18,0]]"
14:28:04 "infiSTAR.de AdminReqProceed: B 1-1-B:1 ([TIW] Apraxas) REMOTE"
14:28:04 "infiSTAR.de PVAH_WriteLog: [B 1-1-B:1 ([TIW] Apraxas) REMOTE,"[TIW] Apraxas (76561197962545003) spawned UAZ_CDF @042026"]"

( snipped out the usual Error messages )

 
But I didnt find anything ... next i though hmm maybe mr Chris ( infinistar ) is doing something bad to me, but as I am a Superadmin...
 
Next I checked my local Client Logs, i learnd that quite a lot of times, you find errors in there which are not shown in the Server logs. 
 
arma2OA.rpt


"infiSTAR.de - XXXXXXXXXIAHATXXX - Successfully Loaded on Client ID509 (31.849)"
2nd UV set needed, but not defined in ReportStack not available
Error in expression <hen {
_losCheck = 0;
_cantSee = [_agent,_target] call dayz_losCheck;
};
>
 Error position: <_target] call dayz_losCheck;
};
>
 Error Undefined variable in expression: _target
Error in expression < = alive _agent;
_targetPos = getPosATL _target;






_agent moveTo _targetPos;
_a>
 Error position: <_target;






_agent moveTo _targetPos;
_a>
 Error Undefined variable in expression: _target
Error in expression <hen {
_losCheck = 0;
_cantSee = [_agent,_target] call dayz_losCheck;
};
>
 Error position: <_target] call dayz_losCheck;
};
>
( also snipped the crap away)
 
 
Do you Guy can give me any kind of hint what going wrong here ?
 
Cheers
 
- Apraxas
Link to comment
Share on other sites

 

Modified the file ( custom/fn_selfActions.sqf ) accoring to the Howto:

 

//Towing with tow truck

/*

//if(_typeOfCursorTarget == "TOW_DZE") then {

//if (s_player_towing < 0) then {

// if(!(_cursorTarget getVariable ["DZEinTow", false])) then {

// s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""];

// } else {

// s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""];

// };

// };

//} else {

// player removeAction s_player_towing;

// s_player_towing = -1;

//};

// MF-Tow Script by Matt Fairbrass (matt_d_rat)

call compile preprocessFileLineNumbers 'custom\towing\init.sqf';

*/

 

Delete */(it's comment) under the line:

 

 

call compile preprocessFileLineNumbers 'custom\towing\init.sqf';

 

See my fn_selfActions.sqf:

 

//Towing with tow truck

/*
if(_typeOfCursorTarget == "TOW_DZE") then {
if (s_player_towing < 0) then {
if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""];
} else {
s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""];
};
};
} else {
player removeAction s_player_towing;
s_player_towing = -1;
};
*/
 
// ###################### TOW ##################################
call compile preprocessFileLineNumbers "scripts\tow\init.sqf";
// #############################################################
 
    //Sleep
Link to comment
Share on other sites

First off i would like to thnx u Matt for this great script i have it working on a Overpochins sever. The only thing iv ran in to is some of my orgins trucks and thing where a little off with the x,y and z of the car being towed. Now iv fixed the Z and Y, but when it comes the X movement iv tryed diffrent ways to try and get movment. But im not getting anything at all. If u have any ideas on this that would be great.

 

thnx again for this great script

Link to comment
Share on other sites

OK, I have a problem others have seen but I haven't been able to fix.  Everything was done by the book but I get no scroll option for towing.

 

I already have a custom compiles.sqf and fn_selfaction.sqf for other scripts so I know that it is at least using the right compiles.sqf and fn_selfactions.sqf.I am using the local_lockunlock.sqf from a few posts back that sets both _vehicle setVariable ["MF_Tow_Cannot_Tow",true,true];and   _vehicle setVariable ["BTC_Cannot_Lift",true,true]; since I'm using the BTC Logistic script for lifting with helis and that works flawlessly!  I've gone through all posts in this thread both forward and backward multiple times and cannot see anything wrong.  I also ran the files through Squint to do syntax checking including looking for missing commas, semicolons, or brackets.   I've also commented out all the DZE_ code blocks that call for the Epoch lift and tow functions.  I put all my scripts in a folder called "scripts" so I've changed all the paths.

 

So here's my scripts:

 

mf-tow/init.sqf

/**


* mf-tow/init.sqf
* The main script for initalising towing functionality.
*
* Created by Matt Fairbrass (matt_d_rat)
* Version: 1.1.2
* MIT Licence
**/

private ["_cursorTarget", "_towableVehicles", "_towableVehiclesTotal"];

// Public variables
MF_Tow_Base_Path = "scripts\mf-tow"; // The base path to the MF-Tow Folder.
MF_Tow_Distance = 10; // Minimum distance (in meters) away from vehicle the tow truck must be to tow.
MF_Tow_Multi_Towing = false; // Allow a vehicle which is towing another vehicle already to be towed by another tow. Disabled by default.

// Functions

/**
* Returns an array of towable objects which can be pulled by the tow truck.
* Configure this as required to set which vehicles can pull which types of other vehicles.
**/
MF_Tow_Towable_Array =
{
private ["_array","_towTruck"];
_towTruck = _this select 0;
_array = [];

switch (typeOf _towTruck) do
{
case "ATV_CZ_EP1": {_array = ["Motorcycle"];};
case "ATV_US_EP1": {_array = ["Motorcycle"];};
case "hilux1_civil_3_open": {_array = ["Motorcycle","Car"];};
case "hilux1_civil_3_open_EP1": {_array = ["Motorcycle","Car"];};
case "ArmoredSUV_PMC": {_array = ["Motorcycle","Car"];};
case "ArmoredSUV_PMC_DZ": {_array = ["Motorcycle","Car"];};
case "ArmoredSUV_PMC_DZE": {_array = ["Motorcycle","Car"];};
case "UAZ_Unarmed_TK_CIV_EP1": {_array = ["Motorcycle","Car"];};
case "HMMWV_M1151_M2_CZ_DES_EP1_DZE": {_array = ["Motorcycle","Car","Truck"];};
case "HMMWV_M1151_M2_CZ_DES_EP1": {_array = ["Motorcycle","Car","Truck"];};
case "tractor": {_array = ["Motorcycle","Car","Truck"];};
case "TowingTractor": {_array = ["Motorcycle","Car","Truck","Wheeled_APC","Tracked_APC","Air"];};
};

_array
};

/**
* Animate the player in a towing action, whilst attaching them to the tow vehicle to ensure safety.
**/
MF_Tow_Animate_Player_Tow_Action =
{
private ["_towTruck","_offsetZ"];
_towTruck = _this select 0;
_offsetZ = 0.1;

// Bounding box on UAZ is screwed, offset z-axis correctly
if(_towTruck isKindOf "UAZ_Base") then {
_offsetZ = 1.8;
};

[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

// 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
};

MF_Tow_Get_Vehicle_Name =
{
private ["_vehicle", "_configVeh", "_vehicleName"];
_vehicle = _this select 0;

_configVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicle);
_vehicleName = getText(_configVeh >> "displayName");

_vehicleName
};

// Initialise script
_cursorTarget = cursorTarget;
_towableVehicles = [_cursorTarget] call MF_Tow_Towable_Array;
_towableVehiclesTotal = count (_towableVehicles);

// 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 ["MFTowIsTowing", false])) then {
s_player_towing = player addAction ["Attach Tow", format["%1\tow_AttachTow.sqf", MF_Tow_Base_Path], _cursorTarget, 0, false, true, "",""];
} else {
s_player_towing = player addAction ["Detach Tow", format["%1\tow_DetachTow.sqf", MF_Tow_Base_Path], _cursorTarget, 0, false, true, "",""];
};
};
}
else {
player removeAction s_player_towing;
s_player_towing = -1;
};

 

Tow_Attachtow.swf

/**


* mf-tow/tow_AttachTow.sqf
* The action for attaching the tow to another vehicle.
*
* Created by Matt Fairbrass (matt_d_rat)
* Version: 1.1.2
* MIT Licence
**/

private ["_vehicle","_started","_finished","_animState","_isMedic","_abort","_vehicleNameText","_towTruckNameText","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle","_towTruck","_towableVehicles","_towableVehiclesTotal","_vehicleOffsetY","_towTruckOffsetY","_offsetZ","_hasToolbox"];

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_96") , "PLAIN DOWN"] };
DZE_ActionInProgress = true;

player removeAction s_player_towing;
s_player_towing = 1;

// Tow Truck
_towTruck = _this select 3;
_towableVehicles = [_towTruck] call MF_Tow_Towable_Array;
_towableVehiclesTotal = count (_towableVehicles);
_towTruckNameText = [_towTruck] call MF_Tow_Get_Vehicle_Name;

// Get all nearby vehicles that can be towed by the towTruck within the minimum tow distance
_findNearestVehicles = nearestObjects [_towTruck, _towableVehicles, MF_Tow_Distance];
_findNearestVehicle = [];
{
if (alive _x && _towTruck != _x) then {
_findNearestVehicle set [(count _findNearestVehicle),_x];
};
} foreach _findNearestVehicles;

_IsNearVehicle = count (_findNearestVehicle);

if(_IsNearVehicle > 0) then {
// select the nearest one
_vehicle = _findNearestVehicle select 0;
_vehicleNameText = [_vehicle] call MF_Tow_Get_Vehicle_Name;
_hasToolbox = "ItemToolbox" in (items player);

// Check the player has a toolbox
if(!_hasToolbox) exitWith {
cutText ["Cannot attach tow without a toolbox.", "PLAIN DOWN"];
};

// Check if the vehicle we want to tow is locked
if((_vehicle getVariable ["MF_Tow_Cannot_Tow", false])) exitWith {
cutText [format["Cannot tow %1 because it is locked.", _vehicleNameText], "PLAIN DOWN"];
};

// Check that the vehicle we want to tow is not already being towed by something else.
if((_vehicle getVariable ["MFTowInTow", false])) exitWith {
cutText [format["Cannot tow %1 because it is already being towed by another vehicle.", _vehicleNameText], "PLAIN DOWN"];
};

// Check that the vehicle we want to tow is not already towing something else
if(!MF_Tow_Multi_Towing && (_vehicle getVariable ["MFTowIsTowing", false])) exitWith {
cutText [format["Cannot tow %1 because it is already towing another vehicle.", _vehicleNameText], "PLAIN DOWN"];
};

// Check if the vehicle has anyone in it
if ((count (crew _vehicle)) != 0) exitWith {
cutText [format["Cannot tow %1 because it has people in it.", _vehicleNameText], "PLAIN DOWN"];
};

_finished = false;

[_towTruck] call MF_Tow_Animate_Player_Tow_Action;

r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = 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;
};

// Check if anyone enters the vehicle while we are attaching the tow and stop the action
if ((count (crew _vehicle)) != 0) then {
cutText [format["Towing aborted because the %1 was entered by another player.", _vehicleNameText], "PLAIN DOWN"];
r_interrupt = true;
};

if (r_interrupt) then {
detach player;
r_doLoop = false;
};

sleep 0.1;
};
r_doLoop = false;

if(!_finished) then {
r_interrupt = false;

if (vehicle player == player) then {
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
};
_abort = true;
};

if (_finished) then {
if(((vectorUp _vehicle) select 2) > 0.5) then {
if( _towableVehiclesTotal > 0 ) then {
_towTruckOffsetY = 0.8;
_vehicleOffsetY = 0.8;
_offsetZ = 0.1;

// Calculate the offset positions depending on the kind of tow truck
switch(true) do {
case (_towTruck isKindOf "ArmoredSUV_Base_PMC");
case (_towTruck isKindOf "SUV_Base_EP1") : {
_towTruckOffsetY = 0.9;
};
case (_towTruck isKindOf "UAZ_Base" && !(_vehicle isKindOf "UAZ_Base")) : {
_offsetZ = 1.8;
};
};

// Calculate the offset positions depending on the kind of vehicle
switch(true) do {
case (_vehicle isKindOf "Truck" && !(_towTruck isKindOf "Truck")) : {
_vehicleOffsetY = 0.9;
};
case (_vehicle isKindOf "UAZ_Base" && !(_towTruck isKindOf "UAZ_Base")) : {
_offsetZ = -1.8;
};
};

// Attach the vehicle to the tow truck
_vehicle attachTo [ _towTruck,
[
0,
(boundingBox _towTruck select 0 select 1) * _towTruckOffsetY + (boundingBox _vehicle select 0 select 1) * _vehicleOffsetY,
(boundingBox _towTruck select 0 select 2) - (boundingBox _vehicle select 0 select 2) + _offsetZ
]
];

detach player;
_vehicle lock true; // Disable entering the vehicle while it is in tow.

_vehicle setVariable ["MFTowInTow", true, true];
_towTruck setVariable ["MFTowIsTowing", true, true];
_towTruck setVariable ["MFTowVehicleInTow", _vehicle, true];

cutText [format["%1 has been attached to %2.", _vehicleNameText, _towTruckNameText], "PLAIN DOWN"];
};
} else {
cutText [format["Failed to attach %1 to %2.", _vehicleNameText, _towTruckNameText], "PLAIN DOWN"];
};
};
} else {
cutText [format["No vehicles nearby to tow. Move within %1m of a vehicle.", MF_Tow_Distance], "PLAIN DOWN"];
};
DZE_ActionInProgress = false;
s_player_towing = -1;

 

Tow_DetachTow.sqf:

/**


* mf-tow/tow_DetachTow.sqf
* The action for detaching the tow from another vehicle.
*
* Created by Matt Fairbrass (matt_d_rat)
* Version: 1.1.2
* MIT Licence
**/

private ["_vehicle","_started","_finished","_animState","_isMedic","_vehicleNameText","_towTruckNameText","_towTruck","_isTowing","_hasToolbox"];

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_96") , "PLAIN DOWN"] };
DZE_ActionInProgress = true;

player removeAction s_player_towing;
s_player_towing = 1;

// Tow Truck
_towTruck = _this select 3;
_towTruckNameText = [_towTruck] call MF_Tow_Get_Vehicle_Name;

// exit if no vehicle is in tow.
_isTowing = _towTruck getVariable ["MFTowIsTowing", false];

if(_isTowing) then {

// Select the vehicle currently in tow
_vehicle = _towTruck getVariable ["MFTowVehicleInTow", objNull];

if(!(isNull _vehicle)) then {
_vehicleNameText = [_vehicle] call MF_Tow_Get_Vehicle_Name;
_finished = false;
_hasToolbox = "ItemToolbox" in (items player);

// Check the player has a toolbox
if(!_hasToolbox) exitWith {
cutText ["Cannot detach tow without a toolbox.", "PLAIN DOWN"];
};

[_towTruck] call MF_Tow_Animate_Player_Tow_Action;

r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = 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 {
detach player;
r_doLoop = false;
};
sleep 0.1;
};
r_doLoop = false;

if(!_finished) then {
r_interrupt = false;

if (vehicle player == player) then {
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
};
};

if (_finished) then {
detach _vehicle;
detach player;
_vehicle lock false; // Enable players to re-enter the vehicle now it has been detached.

_vehicle setVariable ["MFTowInTow", false, true];
_towTruck setVariable ["MFTowIsTowing", false, true];
_towTruck setVariable ["MFTowVehicleInTow", objNull, true];
cutText [format["%1 has been detached from %2.", _vehicleNameText, _towTruckNameText], "PLAIN DOWN"];

_vehicle setvelocity [0,0,1];
};
} else {
_towTruck setVariable ["MFTowIsTowing", false, true];
_towTruck setVariable ["MFTowVehicleInTow", objNull, true];
};
} else {
cutText ["No vehicles in tow.", "PLAIN DOWN"];
};
DZE_ActionInProgress = false;
s_player_towing = -1;

 

Compiles.sqf:

if (!isDedicated) then {



//Custom Self Actions
fnc_usec_selfActions = compile preprocessFileLineNumbers "custom\fn_selfActions.sqf";

//No Idea
player_removeObject = compile preprocessFileLineNumbers "custom\remove.sqf";


//Snap Build
player_build = compile preprocessFileLineNumbers "custom\snap_pro\player_build.sqf";
snap_build = compile preprocessFileLineNumbers "custom\snap_pro\snap_build.sqf";
dayz_spaceInterrupt = compile preprocessFileLineNumbers "custom\snap_pro\dayz_spaceInterrupt.sqf";


//Maca's Right Click Feature
player_selectSlot = compile preprocessFileLineNumbers "custom\ui_selectSlot.sqf";

local_lockUnlock = compile preprocessFileLineNumbers "compile\local_lockUnlock.sqf"; //When vehicle is local to unit perform locking vehicle

//Faster Trading
call compile preprocessFileLineNumbers "custom\player_traderMenuHive.sqf";

//Stronghold
player_buildStronghold = compile preprocessFileLineNumbers "custom\build\stronghold\s.sqf";

//Code Changer
ckc_button = compile preprocessFileLineNumbers "ckc\ckc_button.sqf";
ckc_upddoor = compile preprocessFileLineNumbers "ckc\ckc_upddoor.sqf";
ckc_updSafe = compile preprocessFileLineNumbers "ckc\ckc_updSafe.sqf";

//SUV and MV22 Actions
mv22_pack = compile preprocessFileLineNumbers "\ca\air2\mv22\scripts\pack.sqf";
};

 

The part of fn_SelfActions.sqf that calls mf-tow:


//Towing with tow truck - commented out to not conflict with mf-tow
/*
if(_typeOfCursorTarget == "TOW_DZE") then {
if (s_player_towing < 0) then {
if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""];
} else {
s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""];
};
};
} else {
player removeAction s_player_towing;
s_player_towing = -1;
};
*/

// MF-Tow Script by Matt Fairbrass (matt_d_rat)
call compile preprocessFileLineNumbers "scripts\mf-tow\init.sqf";

Link to comment
Share on other sites

Could this be causing the problem?  I have =BTC=_Logistic installed and working for heli lifting.  It works.  Steps 16 and 17 of the mf-tow instructions talk about replacing several lines of code in server_monitor.sqf and server_publishVehicle2.sqf with _object setVariable ["MF_Tow_Cannot_Tow",true,true];.  But they already have lines with _object setVariable ["BTC_Cannot_Lift",true,true]; for the BTC script.  How should I modify those sections to allow both the cannot lift and cannot tow?

 

Thanks,

Bob

Link to comment
Share on other sites

Progress... I at least get the "Attach nearest..." selection on the scroll wheel but nothing else.  I think it's because I've been trying to step through all the suggested changes by many people.   I think some of my applied fixes conflict with some others.  I like the fixes that F507DMT has made.  So is there any place we can go to get the latest with all the fixes in the thread in-place?  If not, I'll just step through the entire thread trying to get all the fixes working right.

Link to comment
Share on other sites

Hi, I've taken Matt's  base script, merged it with F507's fixes and additions, and all the other minor fixes and glitch fixes in this thread, and then merged it wit Jossy's scripts.  I've got all working properly except for tow_AtttachTow.sqf.  It worked every step of the way until I added Jossy's script.  Then I got the mousewheel action to attach a vehicle, but it never attaches.  And all the variables are set so it thinks I'm in a "start towing" state.  If I go to another vehicle, the start tow option no longer appears (until I log out and back in).  

 

So I've added Jossy's in piece-by-piece.  The version that is attached mostly works but it is as close as I can get it to being totally functional.  But it doesn't do the check whether the vehicles are facing each other or not or whether the towing vehicle is in front or back.  So it flips the vehicles around if I initiate towing from the back vehicle.  I know this is due to the part I commented out in lines 60 - 96. For the life of me, I cannot get that part working properly. Does anyone have any ideas?  Here it is...

 

 

/**

* mf-tow/tow_AttachTow.sqf
* The action for attaching the tow to another vehicle.
*
* Created by Matt Fairbrass (matt_d_rat)
* Version: 1.1.2
* MIT Licence
**/

private ["_vehicle","_started","_finished","_animState","_isMedic","_abort","_vehicleNameText","_towTruckNameText","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle","_towTruck","_towableVehicles","_towableVehiclesTotal","_vehicleOffsetY","_towTruckOffsetX","_towTruckOffsetY","_offsetZ","_hasToolbox","_searchLoc","_facing","_towTruckRelX","_towTruckRelY","_towableVehicleDir","_towTruckX","_towTruckY","_towTruckDir","_towOffset","_behind"];

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_96") , "PLAIN DOWN"] };
DZE_ActionInProgress = true;

player removeAction s_player_towing;
s_player_towing = 1;

// Tow Truck
_towTruck = _this select 3;
_towableVehicles = [_towTruck] call MF_Tow_Towable_Array;
_towableVehiclesTotal = count (_towableVehicles);
_towTruckNameText = [_towTruck] call MF_Tow_Get_Vehicle_Name;

_towTruckX = getPosATL _towTruck select 0;
_towTruckY = getPosATL _towTruck select 1;
_towTruckDir = getDir _towTruck;

_towOffset = (boundingBox _towTruck select 1 select 1) / 2;

//_findNearestVehicles = nearestObjects [_towTruck, _towableVehicles, MF_Tow_Distance + 15];
_findNearestVehicle = [];

// select the nearest vehicle behind us
for "_i" from _towOffset to MF_Tow_Distance + _towOffset do {
_towTruckRelX = (sin (_towTruckDir + 180)) * _i;
_towTruckRelY = (cos (_towTruckDir + 180)) * _i;
_searchLoc = [_towTruckX + _towTruckRelX, _towTruckY + _towTruckRelY, 0];
_findNearestVehicles = nearestObjects [_searchLoc, _towableVehicles, 8];
{
if (alive _x && _towTruck != _x) then {
_findNearestVehicle set [(count _findNearestVehicle),_x];
};
} foreach _findNearestVehicles;
if (count _findNearestVehicle > 0) exitWith { };
};
if(count _findNearestVehicle > 0) then {
// select the nearest one
_vehicle = _findNearestVehicle select 0;
_towableVehicleDir = getDir _vehicle;
_vehicleNameText = [_vehicle] call MF_Tow_Get_Vehicle_Name;
_hasToolbox = "ItemToolbox" in (items player);

/*
_towVector = vectorDir _towTruck;
_vehVector = vectorDir _vehicle;
_difference = (_towVector select 0) * (_vehVector select 0) + (_towVector select 1) * (_vehVector select 1);
_facing = (_difference < 1 && _difference > .93);

_towVector = vectorDir _towTruck;
_vehVector = vectorDir _vehicle;
_difference = (_towVector select 0 * _vehVector select 0) + (_towVector select 1 * _vehVector select 1);
diag_log(format ["Difference: %1", _difference]);

_facing = ((_towableVehicleDir > _towTruckDir - 25) && (_towableVehicleDir < _towTruckDir + 25));


_towableVehicleX = getPosATL _vehicle select 0;
_towableVehicleY = getPosATL _vehicle select 1;

_towableOffset = (boundingBox _vehicle select 1 select 1) / 2;
_towOffset = (boundingBox _towTruck select 1 select 1);

// TowVehicle Bounding Box
_maxTowDistance = MF_Tow_Distance + (_towableOffset * 2);

for "_i" from _towOffset to MF_Tow_Distance * 6 do {
_towTruckRelX = (sin (_towTruckDir + 180)) * _i / 8;
_towTruckRelY = (cos (_towTruckDir + 180)) * _i / 8;
_towableRelX = (sin (_towableVehicleDir)) * _i / 8;
_towableRelY = (cos (_towableVehicleDir)) * _i / 8;

_location1 = [_towTruckX + _towTruckRelX, _towTruckY + _towTruckRelY, 0];
_location2 = [_towableVehicleX + _towableRelX, _towableVehicleY + _towableRelY, 0];

//cutText [ format ["distance: %1", _location1 distance _location2], "PLAIN DOWN"];
_behind = (_location1 distance _location2 < 2);
//cutText [ format ["Distance: %1 _towableOffset: %2", (getPos _vehicle) distance _location, _towableOffset], "PLAIN DOWN"];
if (_behind) exitWith {};
};
*/

// Check the player has a toolbox
if(!_hasToolbox) exitWith {
cutText ["Cannot attach tow without a toolbox.", "PLAIN DOWN"];
};

// Check for vehicle behind tow vehicle
if(!_behind) exitWith {
cutText[ format["%1 must be behind %2 to tow.", _vehicleNameText, _towTruckNameText], "PLAIN DOWN"];
};

// Make sure towing vehicle is in front of vehicle to be towed
if(!_facing) exitWith {
cutText[ format["%1 must be facing %2 to tow.", _vehicleNameText, _towTruckNameText, _towTruckDir, _towableVehicleDir], "PLAIN DOWN"];
};

// Check if the vehicle we want to tow is locked
if((_vehicle getVariable ["MF_Tow_Cannot_Tow", false])) exitWith {
cutText [format["Cannot tow %1 because it is locked.", _vehicleNameText], "PLAIN DOWN"];
};

// Check that the vehicle we want to tow is not already being towed by something else.
if((_vehicle getVariable ["MFTowInTow", false])) exitWith {
cutText [format["Cannot tow %1 because it is already being towed by another vehicle.", _vehicleNameText], "PLAIN DOWN"];
};

// Check that the vehicle we want to tow is not already towing something else
if(!MF_Tow_Multi_Towing && (_vehicle getVariable ["MFTowIsTowing", false])) exitWith {
cutText [format["Cannot tow %1 because it is already towing another vehicle.", _vehicleNameText], "PLAIN DOWN"];
};

// Check that the vehicle we want to tow with is not already being towed
if(!MF_Tow_Multi_Towing && (_towTruck getVariable ["MFTowInTow", false])) exitWith {
cutText [format["Cannot tow %1 because %2 is already being towed.", _vehicleNameText, _towTruckNameText], "PLAIN DOWN"];
};
// Check if the vehicle has anyone in it
if ((count (crew _vehicle)) != 0) exitWith {
cutText [format["Cannot tow %1 because it has people in it.", _vehicleNameText], "PLAIN DOWN"];
};

_finished = false;

[_towTruck] call MF_Tow_Animate_Player_Tow_Action;

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

cutText [format["Start tow %1...", _vehicleNameText], "PLAIN DOWN"];
[player,"repair",0,false,10] call dayz_zombieSpeak;

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;
};

// Check if anyone enters the vehicle while we are attaching the tow and stop the action
if ((count (crew _vehicle)) != 0) then {
cutText [format["Towing aborted because the %1 was entered by another player.", _vehicleNameText], "PLAIN DOWN"];
r_interrupt = true;
};

if (r_interrupt) then {
detach player;
r_doLoop = false;
};

sleep 0.1;
};
r_doLoop = false;

if(!_finished) then {
r_interrupt = false;

if (vehicle player == player) then {
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
};
_abort = true;
};

if (_finished) then {



if(((vectorUp _vehicle) select 2) > 0.5) then {
if( _towableVehiclesTotal > 0 ) then {
_towTruckOffsetX = 0;
_towTruckOffsetY = 0.8;
_vehicleOffsetY = 0.8;
_offsetZ = 0.1;

// Calculate the offset positions depending on the kind of tow truck
switch(true) do {
case (_towTruck isKindOf "ArmoredSUV_Base_PMC");
case (_towTruck isKindOf "SUV_Base_EP1") : {
_towTruckOffsetY = 0.9;
};
case (_towTruck isKindOf "UAZ_Base" && !(_vehicle isKindOf "UAZ_Base")) : {
_offsetZ = 1.8;
};
case (_towTruck isKindOf "TowingTractor") : {
_towTruckOffsetX = .3;
};
};

// Calculate the offset positions depending on the kind of vehicle
switch(true) do {
case (_vehicle isKindOf "Truck" && !(_towTruck isKindOf "Truck")) : {
_vehicleOffsetY = 0.9;
};
case (_vehicle isKindOf "C130J_US_EP1_DZ") : { // done
_vehicleOffsetY = .8;
_offsetZ = -.95;
};
case (_vehicle isKindOf "AN2_DZ") : { // done
_vehicleOffsetY = .7;
_offsetZ = -.45;
};
case (_vehicle isKindOf "CH_47F_EP1_DZE") : { // done
_vehicleOffsetY = .45;
_offsetZ = -.6;
};
case (_vehicle isKindOf "CH53_DZE") : { // done
_vehicleOffsetY = .35;
_offsetZ = -9.4;
};
case (_vehicle isKindOf "Mi17_Civilian_DZ") : {
_vehicleOffsetY = .5;
_offsetZ = -.5;
};
case (_vehicle isKindOf "UH60M_EP1_DZE") : { // done
_vehicleOffsetY = .6;
_offsetZ = -.3;
};
case (_vehicle isKindOf "UH1H_DZE") : { // done
_vehicleOffsetY = .6;
_offsetZ = -.2;
};
case (_vehicle isKindOf "UH1Y_DZE") : { // done
_vehicleOffsetY = .05;
_offsetZ = -.2;
};
case (_vehicle isKindOf "MH6J_DZ") : { // done
_vehicleOffsetY = .6;
_offsetZ = -.2;
};
case (_vehicle isKindOf "MV22_DZ") : { // done
_vehicleOffsetY = .6;
_offsetZ = -.85;
};
case (_vehicle isKindOf "UAZ_MG_CDF") : { // done
_offsetZ = -.1;
};
case (_vehicle isKindOf "UAZ_Base" && !(_towTruck isKindOf "UAZ_Base") && !(_vehicle isKindOf "UAZ_MG_CDF")) : {
_offsetZ = -1.8;
};
};

// Attach the vehicle to the tow vehicle
_vehicle attachTo [ _towTruck,
[
_towTruckOffsetX,
(boundingBox _towTruck select 0 select 1) * _towTruckOffsetY + (boundingBox _vehicle select 0 select 1) * _vehicleOffsetY,
(boundingBox _towTruck select 0 select 2) - (boundingBox _vehicle select 0 select 2) + _offsetZ
]
];

_vehicle lock true; // Disable entering the vehicle while it is in tow.
VDZE_veh_Lock = [_vehicle,true];
publicVariable "PVDZE_veh_Lock";

_vehicle setVariable ["VehicleInTow", true, true];
//Can`t sit in a car if car towing
//***only works with player who tow, help***

if !(MF_Tow_Multi_Towing_BTC) then {
_vehicle setVariable ["BTC_Cannot_Lift",true,true];
_towTruck setVariable ["BTC_Cannot_Lift",true,true];
};

_vehicle setVariable ["MFTowInTow", true, true];
_towTruck setVariable ["MFTowIsTowing", true, true];
_towTruck setVariable ["MFTowVehicleInTow", _vehicle, true];

cutText [format["%1 has been attached to %2.", _vehicleNameText, _towTruckNameText], "PLAIN DOWN"];
};
} else {
r_interrupt = false;

// if (vehicle player == player) then {
// [objNull, player, rSwitchMove,""] call RE;
// player playActionNow "stop";
// };
// _abort = true;
cutText [format["Failed to attach %1 to %2.", _vehicleNameText, _towTruckNameText], "PLAIN DOWN"];
};
};

} else {
cutText [format["No vehicles nearby to tow. Move within %1m of a vehicle.", MF_Tow_Distance], "PLAIN DOWN"];
};
DZE_ActionInProgress = false;
s_player_towing = -1;

 

Has anyone successfully merged all the changes and suggestions in the thread?  If so, care to post your tow_AttachTow.sqf?

 

Once I get this working, I have another idea for limiting speed when towing.  I have to dig into vehicle attributes and may have to generate a mass/weight table for classes of vehicles.  Then the max velocity will be a calculation based on the relative weight of the vehicle doing the towing and the vehicle being towed.  I'm planning on making the max towing velocity no more than 75% of the vehicle's maximum speed.  But there's an even bigger benefit.  We wouldn't need the towing arrays.  The ability to tow will be based purely on that calculation.  So the relative weight between a bicycle and a C130 calculation would result in a zero velocity, for example.  No more towing table necessary.  And sure a Skoda may be able to tow a Vodnik, but it probably won't top 15kph!  Seems that would make the entire towing function seem more realistic overall.  But first, I want to get the basic script working.

 

Thanks,

Bob

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...