Jump to content

Recommended Posts

handlecargolift1.jpg

 

Story

A few weeks ago a buddy asked me to write a script for a helicopter to lift and transport cargo, the 'Helikopterfrachttransportskript', that finally provides the desired solution. At first I thought that there would be something out there already. However, according to his research there are no scripts or tutorials that let you have an AI helicopter reliably hovering over a cargo in ArmA 3 (having it meter-precise is imperative). This hovering and the whole process of picking up and setting down the cargo was supposed to look more realistic than just an attachTo. And so this script was written. It provides a precise hovering over the cargo, great looking attachment of the sling rope and picking up of the cargo as well as putting the load down in the same way at the target position. There are several routine integrated to avoid script errors in cases of explosions or deaths of the vehicle or AI. A description can be found inside the SQF file, how to execute the script. Have fun.

 

Content

It is a single ~250Code-Line-Big Script to let an AI controlled helicopter lift diferrent freight goods to a single destination.

 

Purpose

The aim of this script is to make it easier to lift freight goods from A to B without having to have a player pilot.

 

Download

Missions and Script on GitHub

 

ArmaHolic

Link

 

Credits

Script & Media: Rockhount

Translation: Dorsal

 

Examples

 

 

 

handlecargolift2.jpg

  • Like 5

Share this post


Link to post
Share on other sites

First, let's all take a minute to appreciate the word "Helikopterfrachttransportskript". Oh, how beautiful our German language can be. :D

 

Anyway, looks great, thanks! Having a quick glance at the code on GitHub, I suppose it's written with multiplayer / dedicated servers in mind?

 

  • Like 2

Share this post


Link to post
Share on other sites
25 minutes ago, IndeedPete said:

I suppose it's written with multiplayer / dedicated servers in mind?

 

 

No half things.

 

And before I forget:

 

@BI developers: We need a script command, to have a helicoper hovering exactly over a position! The only currently working solution is a very 'dirty' one. You have to 'jog' the helicopter there using setVelocity. Otherwise these stupid AI pilots would never hover exactly over a position. And, don't get me started on accuracy of waypoints and the doMove command. Even the old ArmA II cheat with HeliH and landing command doesn't work anymore.

Example for the new command: PilotAI1 hoverOver [[1,2,0], 50, 345];
PilotAI1 = The Pilot (Unit, Aircraft)
[1,2,0] = The Position to exactly(+-0,5m) hover over(Object, 2DPosition, 3DPosition)
50 = The altitude
345 = The direction

'Hovering exactly over a position' would mean that the 2D distance between the center of the aircraft and the given position would not be greater than 0,5 meters. Without such command, for beginners it will always remain difficult to write any script for air freight activities.


And an exitLoopStep command to stop the execution of the current code of the current loop step inside the for, forEach or count loop and move forward to the next step. On count it should return false.
And an exitSQF command to exit the whole SQF-Script regardless of the current scope.

  • Like 1

Share this post


Link to post
Share on other sites

This is a superb piece of coding!  Reminds me of stuff Norrin did in the past !

Share this post


Link to post
Share on other sites

I've been struggling with the editor slingload waypoints and whatnot precision....and this solved my headaches..Thank you!

Share this post


Link to post
Share on other sites

Thanks for this great bit of code.

On some vehicles while mounting it generate an error about line 81:

 

 Error in expression <l_var_Cargo];
_Local_var_Ropes pushBack _Local_var_Rope;
ropeUnwind [_Local_var_>
 Error position: <_Local_var_Rope;
ropeUnwind [_Local_var_>
 Error Undefined variable in expression: _local_var_rope

Then it cut the ropes and heli fly away, vehicle stays.

Looks like ropecreate problem.

Share this post


Link to post
Share on other sites
On 30.12.2016 at 6:29 AM, davidoss said:

Thanks for this great bit of code.

On some vehicles while mounting it generate an error about line 81:

 


 Error in expression <l_var_Cargo];
_Local_var_Ropes pushBack _Local_var_Rope;
ropeUnwind [_Local_var_>
 Error position: <_Local_var_Rope;
ropeUnwind [_Local_var_>
 Error Undefined variable in expression: _local_var_rope

Then it cut the ropes and heli fly away, vehicle stays.

Looks like ropecreate problem.

 

Provide an example mission with no mods, so I can help you. If you use broken mods, then you should report this to the mod author, so they can fix their config entries.

Share this post


Link to post
Share on other sites

I have already fixed this by organizing vehicle list to only those where : <heli canSlingload vehicle>  returns true.

I think you could somehow include this in your script, because simple check for "slingLoadCargoMemoryPoints" is obviously not enough.

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

×