Fiddi 68 Posted April 7, 2016 Hi, I have a script where I spawn a Huron helicopter and want it to hook to a box (a vehicle ammo box). In the editor it works fine, the helicopter fly to the box and picks it up, but when I try to do the same via scripts the helicopter just hovers 40-50m from the box indefinitely. This is my code to spawn and add the waypoint. _huron1 = createVehicle ["B_Heli_Transport_03_unarmed_F", getPos _HQ_dropOff, [], 0, "FLY"]; createVehicleCrew _huron1; sleep 0.1; _huron1WP = group _huron1 addWaypoint [_box, 0]; _huron1WP waypointAttachObject _box; _huron1WP setWaypointType "Hook"; Share this post Link to post Share on other sites
sarogahtyp 1106 Posted April 7, 2016 I cant see such WP-type here: https://community.bistudio.com/wiki/Waypoint_types Share this post Link to post Share on other sites
Fiddi 68 Posted April 7, 2016 I cant see such WP-type here: https://community.bistudio.com/wiki/Waypoint_types https://community.bistudio.com/wiki/waypointType Check at the bottom of the page. It exists. There's "HOOK" and "UNHOOK". You can find them in the mission.sqm if you have placed the waypoints in the editor. Which is strange since it works almost perfectly with pre-placed waypoints but not spawned ones via script. Share this post Link to post Share on other sites
sarogahtyp 1106 Posted April 7, 2016 ok i missed that.another try. you r setting the waypoint for the group of the huron. it can be that ur huron has its own group which maybe another than the group of the pilot who should execute the given order.I think u should try to set the waypoint for the pilots group. _huron1WP = (group (driver _huron1)) addWaypoint [_box, 0]; Share this post Link to post Share on other sites
Fiddi 68 Posted April 7, 2016 ok i missed that. another try. you r setting the waypoint for the group of the huron. it can be that ur huron has its own group which maybe another than the group of the pilot who should execute the given order. I think u should try to set the waypoint for the pilots group. _huron1WP = (group (driver _huron1)) addWaypoint [_box, 0]; Okay, tried that. Same thing happens. :( Share this post Link to post Share on other sites
sarogahtyp 1106 Posted April 7, 2016 ok, try to get a "MOVE" waypoint work first to see if its dependend on type. EDIT: how and where is _box defined? Share this post Link to post Share on other sites
Fiddi 68 Posted April 7, 2016 ok, try to get a "MOVE" waypoint work first to see if its dependend on type. EDIT: how and where is _box defined? Okay, I'll try that. '_box' should actually be only 'box'. It is placed in the editor for the sake of testing, in the finished script it too will be spawned like the helicopter. Share this post Link to post Share on other sites
sarogahtyp 1106 Posted April 7, 2016 Okay, I'll try that. '_box' should actually be only 'box'. It is placed in the editor for the sake of testing, in the finished script it too will be spawned like the helicopter. okay if the box is named box in the editor and u r using _box in the script then thats the mistake. another thing is that setCurrentWaypoint would not hurt :) Share this post Link to post Share on other sites
Fiddi 68 Posted April 7, 2016 Nope, that did not work. _huron1 = createVehicle ["B_Heli_Transport_03_unarmed_F", getPos HQ_dropOff, [], 0, "FLY"]; createVehicleCrew _huron1; sleep 0.1; _huron1WP = group (driver _huron1) addWaypoint [box, 0]; _huron1WP setWaypointType "MOVE"; _huron1WP setWaypointBehaviour "CARELESS"; Sleep 1; _huron2WP = group (driver _huron1) addWaypoint [box, 0]; _huron2WP waypointAttachVehicle box; _huron2WP setWaypointType "HOOK"; I hope I wrote it the right way. I was not 100% sure how I would create multiple waypoints in script. Share this post Link to post Share on other sites
sarogahtyp 1106 Posted April 7, 2016 try this as last command of the first WP: group (driver _huron1) setCurrentWaypoint _huron1WP; and delete ur second waypoint creation because its set at same position as the first one. this could produce odd behavior. additionally u should take a look to ur .rpt file for any related errors. paste this to the adress line of ur file browser: %userprofile%\AppData\Local\Arma 3 there armas .rpt file should be. Share this post Link to post Share on other sites
Fiddi 68 Posted April 7, 2016 Still nothing. Thing is it flies to the location where the box is and stops. The waypoint seem to work it just doesn't either fire the slingload command from the waypoint, in which case the type itself is broken, or it doesn't find the box. EDIT: Also, nothing in the .rpt. Last line after firing the script and waiting a while is 14:33:09 Save game type and that's before I activated the script. Share this post Link to post Share on other sites
Fiddi 68 Posted April 7, 2016 Yep, doing this: hint format["%1", waypointAttachedObject _huron1WP]; returns <NULL-object> so there's something wrong with this: _huron1WP waypointAttachObject box; Switching to _huron1WP waypointAttachVehicle box; returns box, but it still doesn't pick it up. Share this post Link to post Share on other sites
sarogahtyp 1106 Posted April 7, 2016 thats odd and I ve no idea whats going wrong. maybe you should think about tryin a scripted waypoint instead of that hooked one and use setSlingLoad to get that thing up. Share this post Link to post Share on other sites
Fiddi 68 Posted April 7, 2016 thats odd and I ve no idea whats going wrong. maybe you should think about tryin a scripted waypoint instead of that hooked one and use setSlingLoad to get that thing up. Yeah, I guess the "easy" way is off the table. Thing is I don't really know where to start on how to write a scripted waypoint.. Can I get AI to fly to a very specific spot without using waypoints? Share this post Link to post Share on other sites
sarogahtyp 1106 Posted April 7, 2016 yes u can do that.Giova's comment at the addWaypoint page describes it.What I meant was a waypoint of type "SCRIPT" where u can pass the setSlingLoad command. but maybe that it could be easier to do all without waypoint. Share this post Link to post Share on other sites
Fiddi 68 Posted April 7, 2016 yes u can do that. Giova's comment at the addWaypoint page describes it. What I meant was a waypoint of type "SCRIPT" where u can pass the setSlingLoad command. but maybe that it could be easier to do all without waypoint. Oh, you meant 'move', I tried that also, the helicopter always flies to the same position, which when I think of it can be a good think cause the I can offset another pos to counteract the stupidness, a FlyInHeight to lower and then use a waitUntil to see when the helicopter is just above the box. That might work. I'll get back to you, thanks! Share this post Link to post Share on other sites
Fiddi 68 Posted April 8, 2016 This is what I came up with. It's the most jury-rigged script I have ever written, and kind of works. I have to have the "heliInsert" exactly north of the "HQ_dropOff" in order for the helicopter to stop where I want it, and after that force it down to a height where the box doesn't teleport up to the helicopter when using "setSlingLoad". But all in all, it works. Would have preferred the waypoint version, though... _huron1 = createVehicle ["B_Heli_Transport_03_unarmed_F", getMarkerPos "heliInsert", [], 0, "FLY"]; createVehicleCrew _huron1; sleep 0.1; _huron1 setDir 180; group _huron1 move [(getPos HQ_dropOff select 0)-5, (getPos HQ_dropOff select 1)-95, 10]; waitUntil{Sleep 1; unitReady _huron1}; _huron1 disableAI "MOVE"; Sleep 3; waitUntil {sleep 0.25; _huron1 setVelocity [0,0,-5]; getPos _huron1 select 2 < 10;}; Sleep 2; _huron1 setSlingLoad box; Sleep 2; _huron1 enableAI "MOVE"; Sleep 1; group _huron1 move getMarkerPos "heliInsert"; waitUntil{Sleep 1; _huron1 distance2D getMarkerPos "heliInsert" < 100}; {_huron1 deleteVehicleCrew _x} count crew _huron1; deleteVehicle _huron1; Share this post Link to post Share on other sites
pierremgi 4751 Posted February 27, 2017 The scripted "hook" waypoint or the equivalent "Lift cargo" in editor breaks for some weird reasons. I spent hours, testing without enemy units or harsh environment, on air field or invisible helipad or on bare ground. I tested with and without waypointAttachVehicle and much more ways: This waypoint works sometimes and fails most of the time, the helicopter jingling around the position. I didn't find any solution to make a rotation pattern with hook unhook sequence on the same load (at different places of course). Too fragile feature. Share this post Link to post Share on other sites
Fiddi 68 Posted February 27, 2017 1 hour ago, pierremgi said: The scripted "hook" waypoint or the equivalent "Lift cargo" in editor breaks for some weird reasons. I spent hours, testing without enemy units or harsh environment, on air field or invisible helipad or on bare ground. I tested with and without waypointAttachVehicle and much more ways: This waypoint works sometimes and fails most of the time, the helicopter jingling around the position. I didn't find any solution to make a rotation pattern with hook unhook sequence on the same load (at different places of course). Too fragile feature. I have had great success with this, with it working all the time. _Waypoint = _Group addWaypoint [_container, 0]; _Waypoint setWaypointType "HOOK"; _Waypoint waypointAttachVehicle _container; Share this post Link to post Share on other sites
pierremgi 4751 Posted February 28, 2017 6 hours ago, Fiddi said: I have had great success with this, with it working all the time. _Waypoint = _Group addWaypoint [_container, 0]; _Waypoint setWaypointType "HOOK"; _Waypoint waypointAttachVehicle _container; Not for me! It's one of my first attempt! It works from time to time and surely fails if you create a loop for lifting / dropping / lifting / dropping... the same container. No possible noria. The only way have found is to land "get in" and setSlingLoad , with some cautions of course. Share this post Link to post Share on other sites
Fiddi 68 Posted February 28, 2017 2 hours ago, pierremgi said: Not for me! It's one of my first attempt! It works from time to time and surely fails if you create a loop for lifting / dropping / lifting / dropping... the same container. No possible noria. The only way have found is to land "get in" and setSlingLoad , with some cautions of course. Okay, I can only speak for myself and have had helicopters pick up stuff in many cases, this might help, you can try it in any case: _Pilot setSkill 1; _Pilot setBehaviour "SAFE"; _Pilot disableAI "AUTOCOMBAT"; _Pilot disableAI "CHECKVISIBLE"; I can add that when I first started with the AI slingload, they wouldn't pick up or drop off crates either, but then something clicked and it started working flawlessly, and I don't remember quite what it was I did. Share this post Link to post Share on other sites
pierremgi 4751 Posted March 1, 2017 No problem, thanks, I abandoned "hook" waypoint. I work with MOVE waypoints + land "get in" just to have a decent altitude, then setSlingLoad + land "none", then "unhook waypoint (at least this one works), then a loop for noria. I skip here some details to synchronize the work, along with altitude of the helo. With a behavior sets to "CARELESS", that works even in combat ambiance. Share this post Link to post Share on other sites
mallinga 4 Posted December 19, 2021 Hello, I know its kind of late to answer this, but after almost exploding my head trying to get a decent sling loading script for AI, I know the solution to this problem: Using a helo placed in editor this works fine, but when using a script and spawning the crew with "createVehicleCrew" some waypoints are broken for helicopters. Use "spawnGroup" instead: _myHelo = createVehicle ["B_Heli_Transport_03_unarmed_F", getPos _HQ_dropOff, [], 0, "FLY"]; _myHeloGroup = [[0,0,0], west, ["B_helipilot_F", "B_helipilot_F"]] call BIS_fnc_spawnGroup; {_x moveInAny _myHelo} forEach (units _myHeloGroup ); your example: _huron1 = createVehicle ["B_Heli_Transport_03_unarmed_F", getPos _HQ_dropOff, [], 0, "FLY"]; _huron1Group = [[0,0,0], west, ["B_helipilot_F", "B_helipilot_F"]] call BIS_fnc_spawnGroup; {_x moveInAny _huron1 } forEach (units _huron1Group ); sleep 0.1; _huron1_WP1 = _huron1Group addWaypoint [_box, 0]; _huron1_WP1 waypointAttachObject _box; _huron1_WP1 setWaypointType "Hook"; // if you want a drop off wp: _huron1_WP2 = _huron1Group addWaypoint [_destination, 0]; _huron1_WP2 setWaypointType "Unhook"; Share this post Link to post Share on other sites