Jump to content
typhoontiger

Winch script for mission

Recommended Posts

Hi, this topic has been brought up before but with no conclusion. I'm interested in building a working winch script for a mission called Fly Tanoa Air. The winch script would come hand in hand with the already working search and rescue script used in the mission. The idea we have is for the script to be almost universal by being able to use it in almost any mission with almost any helicopter (Providing the classnames for them of course similar to SCmod's winch script) Unfortunately I have little scripting experience but am willing to learn in order to build this. Any help would be great! Thanks

  • Like 2

Share this post


Link to post
Share on other sites

We have to:

a) Identify what exactly we expect the winch to do;
b) determine how to accomplish that.

First let's find out what (if any) function the game has for such a thing.
ropeCreate,
looks promising.
Check out see also on this page.
@typhoontiger

Quote

... a working winch script for a mission called Fly Tanoa Air.

Don't worry about FTA.  This should be totally modular.

  • Like 1

Share this post


Link to post
Share on other sites
4 minutes ago, wogz187 said:

We have to:

a) Identify what exactly we expect the winch to do;
b) determine how to accomplish that.

First let's find out what (if any) function the game has for such a thing.
ropeCreate,
looks promising.
@typhoontiger

Don't worry about FTA.  This should be totally modular.

Even better. I've looked a lot at SCmod's winch scripts but they are SQS and are in my opinion a little difficult to translate, especially with them being synced to multiple other scripts in that mod. Hopefully we can base a template off of it.

  • Like 1

Share this post


Link to post
Share on other sites

This?

So try to isolate the elements that winch, post it here and we'll all look together.

  • Like 1

Share this post


Link to post
Share on other sites

/////////First part

_pilot = _this select 0;
_veh = assignedVehicle _pilot;
_id = _this select 2;
_pilot removeAction _id;
~0.1
_slingcargo = getSlingLoad _veh;
~0.1
?(isNull _slingcargo) : goto "GetslingloadchkOK";
_pilot sidechat "not possible to deploy the winch rope, because a charge is under the helicopter.";
goto "ExitScript";

 

///////Second part

#GetslingloadchkOK
_cargoEmpty = _veh emptyPositions "cargo";
? _cargoEmpty == 0 : goto "ExitScript2";

#GetslingloadchkOK_cargo
~0.1
_veh animateDoor ['PuertaDerecha',1];
_veh animateDoor ['door_r',1];
_veh animateDoor ['door_back_R',1];
_veh animateDoor ['Door_R_source',1];
_veh animate ['DoorARD',1];
_veh animate ['Door',1];

 

 

////////Third part (Script identifies helicopter class)

~0.1
?_veh isKindOf "I_Heli_Transport_02_F" : goto "CH49";
?_veh isKindOf "Heli_Transport_02_base_F" : goto "CH49";
?_veh isKindOf "B_Heli_Transport_03_unarmed_F" : goto "CH67";
?_veh isKindOf "SCmod_cougar" : goto "PointBasketLoad0";
?_veh isKindOf "SCmod_puma_base" : goto "PointBasketLoad0";
?_veh isKindOf "SCmod_SA321_base" : goto "PointBasketLoad0";
?_veh isKindOf "jf_as350_3" : goto "AS350";
?_veh isKindOf "jf_as350" : goto "AS350";
?_veh isKindOf "hh60j_base_F" : goto "UH60";
?_veh isKindOf "yup_sh60b" : goto "UH60";
?_veh isKindOf "yup_US_Navy_sh60b" : goto "UH60";
?_veh isKindOf "vvv_hh60j" : goto "UH60";
?_veh isKindOf "mac_as365" : goto "AS365";
?_veh isKindOf "Xiphoid87_as365_base" : goto "AS365";

 

 

 

////////fourth part (Identified heli class is synced to a custom or pre made attach pos)

#PointBasketLoad0
_AttachPos = "BasketLoad0";
goto "RopeAttachPos";
#CH49
_AttachPos = [1.9,1.8,-0.1];
goto "RopeAttachPos";
#CH67
_AttachPos = [1.9,4.05,-0.12];
#AS350
_AttachPos = [-1.7,2.0,0.5];
goto "RopeAttachPos";
#UH60
_AttachPos = [1.421,2.17,-0.2];
goto "RopeAttachPos";
#AS365
_AttachPos = [1.55,1.63,0.28];
goto "RopeAttachPos";

#RopeAttachPos
_SideRope = ropeCreate [_veh, _AttachPos, 4];
~0.1
_ropePos = ropeEndPosition _SideRope select 1;
~0.1
[_pilot] exec "\SCmod_fire\script\SCmod_Catch.sqs";
~0.1
_id1 = _pilot addAction ["<t color='#FFFFFF'>RS winch</t>","\SCmod_basic_waterkit\functions\SCmod_bambyRS.sqs","",4.6,false,true]; _pilot setVariable ["Raise", _id1];

_id2 = _pilot addAction ["<t color='#FFFFFF'>LW winch</t>","\SCmod_basic_waterkit\functions\SCmod_bambyLW.sqs","",4.5,false,true]; _pilot setVariable ["Lower", _id2];

 

 

 

///////fifth

#RopelengthControl
~0.1
_length = ropeLength _SideRope;
~0.1
?(_length <=1) : goto "RopeLow";
goto "RopelengthControl";

#RopeLow
~0.1
_id1 = _pilot getVariable "Raise"
_pilot removeAction _id1;
_id2 = _pilot getVariable "Lower";
_pilot removeAction _id2;
~0.1
ropeDestroy _SideRope;
~0.1
_veh animateDoor ['PuertaDerecha',0];
_veh animateDoor ['door_r',0];
_veh animateDoor ['door_back_R',0];
_veh animateDoor ['Door_R_source',0];
_veh animate ['DoorARD',0];
_veh animate ['Door',0];
~2
goto "ExitScript";

#ExitScript2
_pilot sidechat "the maximum capacity of passengers is reached.";

#ExitScript
[_pilot] exec "\SCmod_fire\script\SCmod_Basket.sqs";
~0.1
exit

 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Here is the synced script which is mentioned at the end of the one posted above.

///////SCmod_Basket.sqs//////

_pilot = _this select 0;
_deployBasket = _pilot addAction ["<t color='#FFFFFF'>Deploy winch rope</t>", "\SCmod_fire\script\SCmod_BasketD.sqs","",4.62,false,true];
~0.1
exit

  • Like 1

Share this post


Link to post
Share on other sites

Let's see what @JohnKalo says. And what the rest of the community thinks.

Have you used the above mod? Does the winch system work well?

I still need somebody to answer question a) what exactly we expect the winch to do.
Run me through a typical usage scenario like I have no clue. Because I don't. Are there multiple cradles/harnesses, ect. involved? I'm sure there are!

  • Like 2

Share this post


Link to post
Share on other sites
1 minute ago, wogz187 said:

Let's see what @JohnKalo says. And what the rest of the community thinks.

Have you used the above mod? Does the winch system work well?

I still need somebody to answer question a) what exactly we expect the winch to do.
Run me through a typical usage scenario like I have no clue. Because I don't. Are there multiple cradles/harnesses, ect. involved? I'm sure there are!

It works great, but only in singleplayer since sqs is an older way to write scripts and my experience does not allow me to translate lol. It is easy to configure however, I have been able to add my own custom helicopters into the script by finding the winch position coordinates and adding my classname. However the mod is extremely complex and I don't believe it would be a good start after all. I forgot how much is needed to get this working with an aircraft. Unfortunately there are no hooks or baskets with the mod. We were able to attach a rescue board to the end of the winch but with some bugs and I cannot remember how we did it. 

  • Like 1

Share this post


Link to post
Share on other sites

The script parts you posted look like it uses the in-game slingload in a modified way. Like it is parented near the door frame. Or, some kind of marker is attached relative to the actual slingload position and there is a custom rope object displayed in the position near the door frame. This way the slingload function stays the same but all of the model positions are moved relative so the visual representation and the basket actually come to the door. SOMEthing like that.

Maybe forget about the mod for now and try to see how BI uses the slingload function. Have you tried to UNpbo a mission file and see their scripts? 

  • Like 1

Share this post


Link to post
Share on other sites
6 minutes ago, wogz187 said:

The script parts you posted look like it uses the in-game slingload in a modified way. Like it is parented near the door frame. Or, some kind of marker is attached relative to the actual slingload position and there is a custom rope object displayed in the position near the door frame. This way the slingload function stays the same but all of the model positions are moved relative so the visual representation and the basket actually come to the door. SOMEthing like that.

Yes I believe there is a custom rope model the mod uses which could easily be replaced by the default Arma physX rope. I wish there was a basket already working but I can provide a model and hopefully we can figure it out. ArmA 2 had a nice rescue winch/basket mod but I don't think anyone has had luck porting it over

 

  • Like 1

Share this post


Link to post
Share on other sites
Quote

 I wish there was a basket already working...

@typhoontiger,
They can ride up on a can of tactical beans as long as it works. The model is the last of our worries. 😄

  • Like 1

Share this post


Link to post
Share on other sites

In the simple version a winch script should allow the pilot to throw a rope with an AI attached to it. Once that AI gets close to the victim the victim is attached to him. Last but not least the rope is pulled up and both units get in the chopper. That is a feature that exists in BI game Take on Helicopters. I have used it myself in one mission and it was really cool. Sadly they have not implemented the feature in Arma 3. Not BI nor any other scripter. And it is not like people have not requested it... Once we were really close but a bug was reported unable to be fixed and hence the project was abandoned. Sadly the scripts used remained classified.

 

https://www.youtube.com/watch?v=IHxBUvQQS6I

 

A really strange thing is that although this http://www.armaholic.com/page.php?id=31254 exists a winch script does not. With the later you can fastrope or climb up the same rope. A simple get in chopper action could be more than enough but nothing there either. So in short yeah it would be cool but nobody has created such a feature.

 

 

  • Like 1

Share this post


Link to post
Share on other sites

The arma 3 life communities have gotten some pretty nice looking winch and basket scripts to work but they are connected to a server database I believe. 

Share this post


Link to post
Share on other sites

@JohnKalo,
 @typhoontiger


That's pretty cool.

Unless one of you two can use blender, or some other 3D model tools, that result is out of reach. We can't do that in the EDEN editor.

Ultimately, with a model designer, this task is relatively simple. Without one, pretty much un-doable.

We must solicit a model designer.

  • Like 1

Share this post


Link to post
Share on other sites

Here is the arma 3 life scripts for the winch. I'm sure I'm missing parts of them but this is what we got

/////////////////////////////////////////////////

['A3PL_Create_RescueBasket', {

    _veh = vehicle player;
    _basket = "A3PL_RescueBasket" createVehicle [0,0,0];
    _basket allowdamage false;
    _basket setVariable ["locked",false,true];
    _basket attachTo [_veh, [0,999999,0] ];
    _veh setVariable ["basket",_basket,true];
    _basket setVariable ["vehicle",_veh,true];

}, false] call Server_Setup_Compile;

 

 

 

 

///////////////////////////////////////////////

    }],
    ["Toggle Rescue Basket", {
        private["_veh", "_rope"];
        _veh = vehicle player;
        _basket = _veh getVariable "basket";
        if (((count(crew _basket)) > 0) && (_veh animationPhase "Basket" > 0.5)) exitwith {
            [localize "STR_INTER_TOGGLERBD", Color_Red] call A3PL_Player_Notification;
        };
        if (_basket isEqualTo objNull) then {
            [] call A3PL_Create_RescueBasket;
        };
        if (count ropes _veh > 0) exitwith {
            {
                ropeDestroy _x;
            }
            foreach(ropes _veh);
            _basket attachTo[_veh, [0, 999999, 0]];
            _veh animate["Basket", 0];
        };
        [(driver _veh), _veh, _basket] remoteExec ["Server_Vehicle_AtegoHandle", 2];
        detach _basket;
        _veh animate["Basket", 1];
        _basket setpos(_veh modelToWorld[4, 2, -1]);
        _rope = ropeCreate[_veh, "rope", _basket, [-0.3, 0.2, 0.25], 3];
    }, {
        ((typeOf(vehicle player) == "A3PL_Jayhawk") && ((player == ((vehicle player) turretUnit[0])) OR(player == ((vehicle player) turretUnit[1])) OR(player == (driver vehicle player))) && ((speed vehicle player) < 30))
    }],
    ["Exit Into Heil", {
        [] spawn {
            private["_veh"];
            _veh = vehicle player;
            _heli = vehicle player getVariable "vehicle";
            _crew = crew _heli;
            _available = true; {
                if ((_heli getCargoIndex _x) == 6) exitwith {
                    _available = false;
                };
            }
            foreach(crew _heli);
            if (!_available) exitwith {
                _veh lock 0;
                unassignVehicle player;
                player leaveVehicle _veh;
                player action["GetOut", _veh];
                sleep 1.5;
                _veh lock 0;
                player moveInCargo _heli;
                [localize "STR_INTER_EXITINTOHEILD", Color_Red] call A3PL_Player_Notification;
            };
            _veh lock 0;
            unassignVehicle player;
            player leaveVehicle _veh;
            player action["GetOut", _veh];
            sleep 1.5;
            _veh lock 0;
            player moveInCargo[_heli, 6];
        };
    }, {
        (("A3PL_rescueBasket" == (typeOf(vehicle player))))
    }],
    ["Increase Rope Length", {
        private["_veh"];
        _veh = vehicle player;
        if (typeOf _veh != "A3PL_Jayhawk") exitwith {};
        if (count ropes _veh < 1) exitwith {};
        ropeUnwind[(ropes _veh) select 0, 2, (ropeLength((ropes _veh) select 0)) + 5];

    }, {
        ((typeOf(vehicle player) == "A3PL_Jayhawk") && (local vehicle player) && ((player == ((vehicle player) turretUnit[0])) OR(player == ((vehicle player) turretUnit[1])) OR(player == (driver vehicle player))))
    }],
    ["Decrease Rope Length", {
        private["_veh"];
        _veh = vehicle player;
        if (typeOf _veh != "A3PL_Jayhawk") exitwith {};
        if (count ropes _veh < 1) exitwith {};
        ropeUnwind[(ropes _veh) select 0, 2, (ropeLength((ropes _veh) select 0)) - 5];

    }, {
        ((typeOf(vehicle player) == "A3PL_Jayhawk") && (local vehicle player) && ((player == ((vehicle player) turretUnit[0])) OR(player == ((vehicle player) turretUnit[1])) OR(player == (driver vehicle player))))

  • Like 1

Share this post


Link to post
Share on other sites

@typhoontiger,

Reverse engineering and creating a Frankenstein of code snippets won't ever solve this. To make it like others have we need a model which supports the system. To make it modular will never be perfect. It has to be attached to a specific helicopter (or set of helicopters) or it has to be a kind of lame but ultimately universal rig.

To accomplish any of that,
 

Quote

We must solicit a model designer.

CfgVehicles

  • Like 1

Share this post


Link to post
Share on other sites
53 minutes ago, wogz187 said:

@typhoontiger,

Reverse engineering and creating a Frankenstein of code snippets won't ever solve this. To make it like others have we need a model which supports the system. To make it modular will never be perfect. It has to be attached to a specific helicopter (or set of helicopters) or it has to be a kind of lame but ultimately universal rig.

To accomplish any of that,
 

CfgVehicles

https://imgur.com/a/2wE5aaG

 

Shows the way you can add different helicopters and their attachpos for the rope. pretty cool.

  • Like 1

Share this post


Link to post
Share on other sites

More of the A3PL script for the basket. Hopefully someone could put this together

 

['A3PL_Vehicle_CreateRescueBasket', {

    private ['_veh'];
    _veh = vehicle player;
    _basket = "A3PL_RescueBasket" createVehicle [0,0,0];
    _basket allowdamage false;
    _basket setVariable ["locked",false,true];
    _basket attachTo [_veh, [0,999999,0] ];
    _veh setVariable ["basket",_basket,true];
    _basket setVariable ["vehicle",_veh,true];

}, false] call Server_Setup_Compile;


['A3PL_Vehicle_Init_A3PL_Jayhawk', {

    private ['_veh','_basket'];
    _veh = _this;
    _veh addEventHandler ["GetIn",
    {
        _veh = param [0,objNull];
        _position = param [1,""];
        _unit = param [2,objNull];
        if (!local _unit) exitwith {};
        if (_position IN ["gunner","driver"]) then
        {
            [_veh] spawn A3PL_ATC_GetInAircraft;
        };
    }];


['Server_Vehicle_Init_A3PL_JayHawk', {

    private ['_veh'];
    _veh = _this;
    _basket = "A3PL_RescueBasket" createVehicle [0,0,0];
    _basket allowdamage false;
    _basket setVariable ["locked",false,true];
    _basket attachTo [_veh, [0,999999,0] ];
    _veh setVariable ["basket",_basket,true];
    _basket setVariable ["vehicle",_veh,true];    


['A3PL_Create_RescueBasket', {

    _veh = vehicle player;
    _basket = "A3PL_RescueBasket" createVehicle [0,0,0];
    _basket allowdamage false;
    _basket setVariable ["locked",false,true];
    _basket attachTo [_veh, [0,999999,0] ];
    _veh setVariable ["basket",_basket,true];
    _basket setVariable ["vehicle",_veh,true];

}, false] call Server_Setup_Compile;    

  • Like 2

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

×