OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Resources Beta Testing & Submission => Topic started by: Mandoble on 13 Aug 2007, 03:00:50

Title: Mando Tractor, time to park these planes
Post by: Mandoble on 13 Aug 2007, 03:00:50
Makes any vehicle able to hook plane's noses or tails and then pull to park them.

Edit: Updated to v1.1

The elacticity of the link is now minimized.
Probably now fully MP compatible.
Title: Re: Mando Tractor, time to park these planes
Post by: smoke52 on 15 Aug 2007, 17:20:30
nice!!

im going to have to play around with this later, all we need now is someone to model a real one :D
Title: Re: Mando Tractor, time to park these planes
Post by: myke13021 on 19 Aug 2007, 21:03:03
Excellent script as usual, Mandoble. But there are some things i would point at.

MP-compatibility:
At first it didn't worked in MP but by adding if (! local player) exitwith {}; it worked...as long only 1 tractor was in use. I saw you use a global variable (mando_tractor_hook) and i guess this variable messes up as soon a second tractor tries to hook. If this can be fixed (my thought was to createvehicle a gamelogic when hooked, name it something unique, and delete it when unhook, but i bet you'll find a better way) it would be great for big Coop MP maps.

Towing Planes/Choppers:
It seems that the planes/choppers are attached with some kind of elastic rubberband. If it's possible something more stable (makin it better controllable and also closer to realistic) would be nice. Look at JasonO's picture (http://www.ofpec.com/forum/index.php?topic=30030.msg205480#msg205480) there you can see what i mean.

This script might not be one of those groundbreaking stuff, no superkewl new special effects. But it's a step to a more realistic behaviour on airfields as usually Choppers don't start right out of the hangar. Keep your excellent work up, mate.


Myke out
Title: Re: Mando Tractor, time to park these planes
Post by: Mandoble on 19 Aug 2007, 21:33:25
For addAction the unit and the effects are always local so if (! local player) exitwith {} is not needed as only the local player may activate any action availabe on this game. Unless the documentation about addAction (http://community.bistudio.com/wiki/addAction) is wrong.

mando_tractor_hook is global, but it is not published, so it doesnt mess with the corresponding mando_tractor_hook variables in other machines. So you may have two tractors trying to pull from a plane to opposite directions.

Good point about the elasticity, I have now a version where you may choose between elastic link or fixed one. With the latter the elasticity is minimum (while still exists, like in the tractor of the picture, but almost not noticeable). I will update to the new version later or tomorrow.

EDIT: v1.1 available.
Title: Re: Mando Tractor, time to park these planes
Post by: JasonO on 21 Aug 2007, 23:38:54
Version 1 was really weird where you would gain speed and then stop and the plane had to catch up with you. Didn't like that at all  :no:...

Version 1.1 doesnt really work? I attach it and drive off and it follows me for a bit, then I turn around and its not following me, just moving very very slowly on the grass. I still have the unhook option.

Quote
Good point about the elasticity, I have now a version where you may choose between elastic link or fixed one. With the latter the elasticity is minimum (while still exists, like in the tractor of the picture, but almost not noticeable).

How do I make it fixed?

Also, is there a way of adapting this for a tow script for vehicles?
Title: Re: Mando Tractor, time to park these planes
Post by: Mandoble on 21 Aug 2007, 23:51:30
You need to keep low speed to keep with the plane, else it will unhook and you will need to hook it again.

Adapting it for vehicles is quite easy. Change this line in mando_hook.sqf
Code: [Select]
_planes = nearestObjects [_tractor, ["Air"], 20];by
Code: [Select]
_planes = nearestObjects [_tractor, ["LandVehicle"], 20];or
Code: [Select]
_planes = nearestObjects [_tractor, ["Air", "LandVehicle"], 20];for planes and vehicles.
Title: Re: Mando Tractor, time to park these planes
Post by: JasonO on 22 Aug 2007, 00:01:56
Thanks

Is this a script/Arma engine limitation of having to keep a certain speed, because I want to be able to go a bit faster.

Also, when I do LandVehicle, the vehicle hooks itself. I haven't managed to grasp SQF yet so I don't know how to skip the vehicle if its the players vehicle.
Title: Re: Mando Tractor, time to park these planes
Post by: myke13021 on 22 Aug 2007, 00:03:07
Quote
Version 1.1 doesnt really work? I attach it and drive off and it follows me for a bit, then I turn around and its not following me, just moving very very slowly on the grass. I still have the unhook option.
I can second that, although i was driving as slow as i could (which isn't easy at all in ArmA) and i was driving backwards where speed is even more limited.

Myke out
Title: Re: Mando Tractor, time to park these planes
Post by: Mandoble on 22 Aug 2007, 00:14:04
Look for this in mando_tractor.sqdf and change the 10 by 1000 and try.
Code: [Select]
   while {((_plane modelToWorld [0,_planelength*_inversion,0] distance _log) > (4+accTime)) && (((_plane modelToWorld [0,_planelength*_inversion,0]) distance _tofollow) < 10) && mando_tractor_hook} do

The automatic unhook when further than 10m away, was coded because while the plane will try to keep with you (will try to match your speed), due different localities in MP, a tractor driver may actually gain distance over and over along the time.

LOL, yep, the vehicle will hook itself with LandVehicle.

Do this in mando_hook.sqf:
Code: [Select]
_planes = nearestObjects [_tractor, ["LandVehicle"], 20];
if (count _planes < 2) exitWith {};
_plane = _planes select 1;
Title: Re: Mando Tractor, time to park these planes
Post by: Wolfrug on 22 Aug 2007, 09:04:01
So how hard is it to convert this to work for AI as well? As in, letting the AI hook/unhook vehicles and towing them around? (for those sweet-ass SP missions for eyecandy). is it possible to use for instance this:

Quote
USER
unitName ["USER", <target unit>, <action index>]

Soldier 'unitName' does nothing. Executes the custom action with the given index of the the target unit. Indexes are based upon the order in which the actions are added to the unit. See addAction.

Example:
gameLogic action ["USER", player, 3]

From the BIKI (http://community.bistudio.com/wiki/ArmA:_Actions#USER)?  :D Would be quite, as they say, sweeeet. Your coding is generally too hard for me otherwise (I suck at math) and I can't quite pierce .sqf syntax yet.

Wolfrug out.
Title: Re: Mando Tractor, time to park these planes
Post by: Mandoble on 22 Aug 2007, 19:00:51
if you know the plane and you know the tractor, you may simply execute mando_tractor.sqf directly, you dont need any action. Making the AI to drive accurately is a different story ...  :whistle:
Title: Re: Mando Tractor, time to park these planes
Post by: Morticus on 20 Sep 2007, 16:06:23
Is there any way we can convert this script to get trucks to pull Static Guns ?

This would be great,
Title: Re: Mando Tractor, time to park these planes
Post by: Mandoble on 20 Sep 2007, 16:16:35
Open mando_hook.sqf and change:
Code: [Select]
_planes = nearestObjects [_tractor, ["Air"], 20];

by
Code: [Select]
_planes = nearestObjects [_tractor, [PUT THERE THE LIST OF OBJECTS TYPES YOU WANT TO BE ABLE TO HOOK], 20];

And for a  list of types:
CfgVehicles Class Tree (http://www.ofpec.com/COMREF/armavehicles.php)

But, are the current static weapons able to use their wheels?
Title: Re: Mando Tractor, time to park these planes
Post by: Wolfrug on 20 Sep 2007, 17:34:55
They are not. I tried to use mandotractor to drag the D-30's for the intro cutscene to Operation Dawning Hope,  but it sadly didn't work. Also another fun little event:

(not the best picture, but yeah)

Basically, if you drive your tractor downhill, your towable object will just quietly glide away above you.  ::) Seems like someone forgot to check the actual height above ground of the towable object/another ArmA bug.

Wolfrug out.

Title: Re: Mando Tractor, time to park these planes
Post by: Mandoble on 20 Sep 2007, 17:52:04
Open mando_tractor.sqf and change
Code: [Select]
      _vz = -0.01; 

by
Code: [Select]
      _vz = -0.5; 
Title: Re: Mando Tractor, time to park these planes
Post by: murkz on 23 Sep 2009, 10:30:35
Sorry to drag up an old thread, I have a small problem. I can hook and unhook but the plane will not move. What am i doing wrong?
Title: Re: Mando Tractor, time to park these planes
Post by: bedges on 23 Sep 2009, 17:38:13
Have you tried putting it in neutral?
Title: Re: Mando Tractor, time to park these planes
Post by: murkz on 23 Sep 2009, 19:49:46
I'm sorry but i do not understand, the tractors are automatic :)
Title: Re: Mando Tractor, time to park these planes
Post by: Mandoble on 23 Sep 2009, 23:25:13
Does it work for you the demo mission?
Title: Re: Mando Tractor, time to park these planes
Post by: murkz on 23 Sep 2009, 23:34:51
unfortunately not. I was using the demo mission to test it :)
Title: Re: Mando Tractor, time to park these planes
Post by: Mandoble on 24 Sep 2009, 15:33:07
Now that is weird, can you try it without any extra addon/mod active?
Title: Re: Mando Tractor, time to park these planes
Post by: murkz on 27 Sep 2009, 14:35:36
It works fine in vanilla armed assault.
Title: Re: Mando Tractor, time to park these planes
Post by: zwobot on 28 Jan 2011, 13:47:07
Could someone re-upload this resource please? The link in the very first post leads to a 404 page.