Jump to content
TheDragon117

Helo "HOOK"/"UNHOOK" waypoints in a script.

Recommended Posts

I've been fighting with this script for a couple of days now, I've searched every resource I can find and I can't figure out why the "HOOK" AND "UNHOOK" waypoints won't work. Unfortunately the waypoints sections of the wiki are oddly empty on any information regarding these two waypoints. The idea of the script was so that instead of having all kinds of vehicles at the beginning of my mission I could save some frame rate have players request a vehicle and it would be lifted and dropped off at designated locations. I did get it working where the helo would fly to the area and just drop the vehicle from the standard 100 meter flight height, but it just looks terrible and would always drop about 100 meters or so before it actually got to the marker. So what I really need is to figure out how to either get the helicopter to go exactly to the waypoint and not decide 100 meters away is close enough, or to actually get the "HOOK"/"UNHOOK" way points to work the way they do in the Eden editor. 

 

AL_FNC_REQARMYJEEP = {
		private
		["_JEEP","_LIFTER","_LIFTERGROUP", "_POS1", "_POS2", "POS3"];
		
		//sleep 20;
		
		_JEEP = createVehicle ["I_C_Offroad_02_unarmed_F",[(getMarkerPos "ARMYliftable" select 0),(getMarkerPos "ARMYliftable" select 1),(getMarkerPos "ARMYliftable" select 2)],[],0,"Can_Collide"];
			[_JEEP,["Olive",1],["hideLeftDoor",1,"hideRightDoor",1,"hideFenders",1,"hideHeadSupportRear",1,"hideSpareWheel",1]] call BIS_fnc_initVehicle;
            

//SLING LOAD HELO AND WAYPOINTS.
				
				_LIFTER = createVehicle ["B_Heli_Transport_03_F",[(getMarkerPos "ARMYlifter" select 0),(getMarkerPos "ARMYlifter" select 1),(getMarkerPos "ARMYlifter" select 2)+100],[],0,"FLY"];
				[_LIFTER,["Green",1],["Minigun",0.333333,"Minigun2",0.333333,"AddCargoHook_COver",0]] call BIS_fnc_initVehicle;

					
				createVehicleCrew _LIFTER;
				
				_Sling = _LIFTER setSlingLoad _JEEP;
				AJEEPLIFTER = _LIFTER;
				AJEEPLIFTERGROUP = GROUP (DRIVER AJEEPLIFTER);
				_POS1 = (getMarkerPos "ARMYDELIVERLIFTED");
				_POS2 = (getMarkerPos "ARMYDELETELIFTED");
				_POS3 = (getMarkerPos "PREPARETOLAND");
					_WP0 = AJEEPLIFTERGROUP  ADDWAYPOINT [_POS3, 0];
						_WP0 setWPPos [(getMarkerPos "PREPARETOLAND" SELECT 0),(getMarkerPos "PREPARETOLAND" SELECT 1), (getMarkerPos "PREPARETOLAND" select 2)];
						_WP0 setWaypointType "MOVE";
						_WP0 setWaypointSpeed "NORMAL";
						_WP0 setWaypointBehaviour "CARELESS";
						_WP0 setWaypointCombatMode "GREEN";
						_wp0 setWaypointStatements  ["true", "AJEEPLIFTER flyInHeight 12;"];
					_WP1 =  AJEEPLIFTERGROUP addWaypoint [_POS1,1];
						_WP1 setWPPos [(getMarkerPos "ARMYDELIVERLIFTED" SELECT 0),(getMarkerPos "ARMYDELIVERLIFTED" SELECT 1),(getMarkerPos "ARMYDELIVERLIFTED" select 2)];
						_WP1 waypointAttachObject ARMYDELIVERLIFTED;
						_wp1 setWaypointType "UNHOOK";
						_WP1 setWaypointSpeed "LIMITED";
						_WP1 setWaypointBehaviour "CARELESS";
						_WP1 setWaypointCombatMode "GREEN";
						_wp1 setWaypointTimeout [20, 20, 20];
						_wp1 setWaypointStatements  ["true", "_Sling1 = AJEEPLIFTER setSlingLoad objNull;"];
					_wp2 = AJEEPLIFTERGROUP addWaypoint [(getMarkerPos "ARMYdeletelifted"),0];
						_wp2 setWaypointType "MOVE";
						_WP2 setWaypointBehaviour "CARELESS";
						_WP2 setWaypointCombatMode "GREEN";
						_wp2 setWaypointStatements  ["true", "{deleteVehicle _x;}forEach crew AJEEPLIFTER;deleteVehicle AJEEPLIFTER;"];
	};
	

I gave up on hook and used set slingload to have the jeep just automatically hook to the bottom of the helicopter, but then the unhook wouldn't work. I've fought with trying to get the helicopter to just "MOVE" to the location and then fly in height, but it refuses to go to the exact location of the markers, then it will lower heights at _wp1 it goes pretty much anywhere it wants around my markers but never on my markers. it always stops somewhere around 100 meters short or too far. so when I setslingload objnull it drops too far away from where its supposed to be delivered. I can't wrap my head around why placed in the editor waypoints work just fine, but when I try to script it  everything just falls apart. Any help would be GREATLY appreciated.

Share this post


Link to post
Share on other sites

Here you go:

GOM_fnc_chopperHookCargo = {

	params ["_chopper","_cargo"];

	_wp = group _chopper addWaypoint [getposatl _cargo,0,count waypoints group _chopper,format ["Hook %1",typeof _cargo]];
	_wp setWaypointType "HOOK";
	_wp waypointAttachVehicle _cargo;

};

GOM_fnc_chopperUnHookCargo = {

	params ["_chopper","_unHookPos"];

	_wp = group _chopper addWaypoint [_unHookPos,0,count waypoints group _chopper,""];
	_wp setWaypointType "UNHOOK";

};

_test = [chopper,cargo] call GOM_fnc_chopperHookCargo;
_test = [chopper,getposatl droppos] call GOM_fnc_chopperUnHookCargo;

Cheers

Share this post


Link to post
Share on other sites

@Grumpy Old Man First off, I really appreciate your response, I've actually gotten help from you before, not to a direct question but through numerous google searches I've already done as I try to learn this scripting thing, so thanks for your help in that way also.

 

I've been trying to get your script to work reducing my functions down to just the createvehicle for the jeep and the createvehicle and crew for the helicopter. I define them at the end of their respective functions with

 

JEEP = _JEEP;

AJEEPLIFTER = _AJEEPLIFTER;

 

 I assigned those to radio channels alpha and bravo respectively. then your function to charlie and delta. changing chopper for AJEEPLIFTER and cargo for JEEP.  When I call charlie, the hook way point, it pops up (using curator to see the way points) but the helicopter approaches the jeep and just hovers. If I use curator to move the jeep the way point will snap to it a few seconds later but the helicopter won't move from that initial spot that it stopped at to try and lift the jeep.

Share this post


Link to post
Share on other sites

Seems that the jeep is too heavy for the helicopter to lift.

Had this too when testing the function prior to posting it, the ghosthawk is unable to lift the prowler, or unable to move while lifting the prowler.

Try using a bigger chopper, huron should do the trick in most cases, though it can have problems picking up the cargo and always swerving sideways a moment before slingloading it.

 

Cheers

Share this post


Link to post
Share on other sites

I'm using a Huron and a Wrangler so I don't think its the weight. it doesn't even reach the point that it attempts to descend to lift.

 

I know if the few very old threads I'd found about this it was commented that part of the issue is that the waypoints can't snap to a spawned vehicle for some reason (well beyond my understanding assuming it is still true.)

 If I'm fully understanding your function to hook the jeep, the helo should be looking to pick up that type of cargo at the waypoint which I would imagine should  correct the snapping to a spawned vehicle issue. The thing I can't seem to fully wrap my head around, is the way I tried to work around it, the helicopters seem to clear the waypoint long before reaching it. somewhere between 50-100 meters. I'm wondering if you think switching from markers to invisible helipads might make the waypoint completion radius smaller. currently I'm using empty markers. 

 

Edited by TheDragon117
additional information.

Share this post


Link to post
Share on other sites
On 5/9/2017 at 5:11 PM, TheDragon117 said:

I'm using a Huron and a Wrangler so I don't think its the weight. it doesn't even reach the point that it attempts to descend to lift.

 

I know if the few very old threads I'd found about this it was commented that part of the issue is that the waypoints can't snap to a spawned vehicle for some reason (well beyond my understanding assuming it is still true.)

 If I'm fully understanding your function to hook the jeep, the helo should be looking to pick up that type of cargo at the waypoint which I would imagine should  correct the snapping to a spawned vehicle issue. The thing I can't seem to fully wrap my head around, is the way I tried to work around it, the helicopters seem to clear the waypoint long before reaching it. somewhere between 50-100 meters. I'm wondering if you think switching from markers to invisible helipads might make the waypoint completion radius smaller. currently I'm using empty markers. 

 

 

Hi. I would be interested in that too. Did you finally get the solution?

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

×