Jump to content
Beerkan

Simple ParaDrop Script

Recommended Posts

A simple ParaDrop script that lets a unit keep it's original backpack and loadout without the need to have a parachute.

 

You can assign any backpack you want, let the unit board a Helo then paradrop and keep their original assigned backpack.

 

This script will save the unit's loadout, remove their backpack, then add a parachute and throw the unit out of the helo.

Once the unit hits the ground, the parachute disappears and the unit gets his original loadout back again.

2014_04_05_00002.jpg2014_04_05_00006.jpg


DOWNLOAD EXAMPLE FROM ARMAHOLIC
news_download_a3_3.png


Here's how to set it up.

Put down an UH80 on the map and name it 'UH80'.
Now set it's parameters to 'Special' = 'Flying' and set it's init to

this flyInHeight 120;

Now create a Group of units and in the group leader's init, add this to get everyone onboard the helo.

Paras = group this;{_x assignasCargo UH80;_x moveinCargo UH80} forEach units group this;

So far so good. 'Paras = Group this' means the group are now called Paras.

Now create a trigger or waypoint with this as the ON ACT:
 

_drop =[UH80,100] execVM "eject.sqf";

Where:
UH80 = The name of your Transport Helo (named in the editor)
100 = The height in metres you want the chutes to auto open @

CARGOITEM = (optional) item, vehicle or ammocrate you wish to paradrop with the paras. CARGOITEM will also have Virtual Arsenal. (object)


And finally with this as the eject.sqf script. Put it in the mission folder.

UPDATE Beta 0.99d New. Saves Unit's inventory, then adds parachute after dismbarking from vehicle  so script can then restore original inventory after landing. Also adds optional ammocrate or vehicle item to be dropped as well.

/*
    Filename: Simple ParaDrop Script v0.99d eject.sqf
    Author: Beerkan

    Description:
    A Simple Paradrop Script which will eject ALL assigned units (except crew) from a vehicle
    add a parachute and when landed will respawn their original backpacks.

    Parameter(s):
    0: VEHICLE  - vehicle that will be doing the paradrop (object)
    1: ALTITUDE - (optional) the altitude where the group & Cargo Item (if used) will open their parachute (number)
    2: CARGOITEM - (optional) the item, vehicle or ammocrate you wish to paradrop with the paras. CARGOITEM will also have Virtual Arsenal. (object)

    Working Example without Cargo
    0 = [UH80, 150] execVM "eject.sqf"

    Working Example with Cargo "B_supplyCrate_F"
    0 = [UH80,150,"B_supplyCrate_F"] execVM "eject.sqf"
*/

if (!isServer) exitWith {};
private ["_paras","_vehicle","_item"];
_vehicle = _this select 0;
_paras = [];
_crew = crew _vehicle;

//Get everyone except the crew.
{
    _isCrew = assignedVehicleRole _x;
        if(count _isCrew > 0) then
    {
        if((_isCrew select 0) == "Cargo") then
        {
        _paras pushback _x
        };
    };
} foreach _crew;

_chuteheight = if ( count _this > 1 ) then { _this select 1 } else { 120 };// Height to auto-open chute, ie 120 if not defined.
_item = if ( count _this > 2 ) then {_this select 2} else {nil};// Cargo to drop, or nothing if not selected.
_vehicle allowDamage false;
_dir = direction _vehicle;

ParaLandSafe =
{
    private ["_unit"];
    _unit = _this select 0;
    _chuteheight = _this select 1;
    (vehicle _unit) allowDamage false;
    [_unit,_chuteheight] spawn AddParachute;//Set AutoOpen Chute if unit is a player
    waitUntil { isTouchingGround _unit || (position _unit select 2) < 1 };
    _unit action ["eject", vehicle _unit];
    sleep 1;
    _unit setUnitLoadout (_unit getVariable ["Saved_Loadout",[]]);// Reload Saved Loadout
    _unit allowdamage true;// Now you can take damage.
};

AddParachute =
{
    private ["_paraUnit"];
    _paraUnit = _this select 0;
    _chuteheight = _this select 1;
    waitUntil {(position _paraUnit select 2) <= _chuteheight};
    _paraUnit addBackPack "B_parachute";// Add parachute
    If (vehicle _paraUnit IsEqualto _paraUnit ) then {_paraUnit action ["openParachute", _paraUnit]};//Check if players chute is open, if not open it.
};

{
    _x setVariable ["Saved_Loadout",getUnitLoadout _x];// Save Loadout
    removeBackpack _x;
    _x disableCollisionWith _vehicle;// Sometimes units take damage when being ejected.
    _x allowdamage false;// Good Old Arma, they still can take damage on Vehcile exit.
    unassignvehicle _x;
    moveout _x;
    _x setDir (_dir + 90);// Exit the chopper at right angles.
    _x setvelocity [0,0,-5];// Add a bit of gravity to move unit away from _vehicle
    sleep 0.3;//space the Para's out a bit so they're not all bunched up.
} forEach _paras;

{
    [_x,_chuteheight] spawn ParaLandSafe;
} forEach _paras;

if (!isNil ("_item")) then
{
_CargoDrop = _item createVehicle getpos _vehicle;
_CargoDrop allowDamage false;
_CargoDrop disableCollisionWith _vehicle;
_CargoDrop setPos [(position _vehicle select 0) - (sin (getdir _vehicle)* 15), (position _vehicle select 1) - (cos (getdir _vehicle) * 15), (position _vehicle select 2)];
clearMagazineCargoGlobal _CargoDrop;clearWeaponCargoGlobal _CargoDrop;clearItemCargoGlobal _CargoDrop;clearbackpackCargoGlobal _CargoDrop;
waitUntil {(position _item select 2) <= _chuteheight};
[objnull, _CargoDrop] call BIS_fnc_curatorobjectedited;
_CargoDrop addaction ["<t color = '#00FF00'>Open Virtual Arsenal</t>",{["Open",true] call BIS_fnc_arsenal;}];
};

_vehicle allowDamage true;
 



So what happens is when the helo gets to the waypoint or activates the trigger, it hoofs out EVERYONE onboard (except aircraft crew) and the helo continues on to it's next waypoint. Para's will descend until they reach your specified ALTITUDE (or 100m if you don't specify) where they will deploy a Parachute. No need to assign one, and you can keep your existing backpack.

N.B.
Unfortunately there seems to be a bug in the game when a unit is ejected from the helo, both the helo and the unit can suffer damage. Hence in my sctripy the brief "allowDamage false" arguments.
UPDATE: THIS HAS BEEN FIXED IN LATEST VERSION

It seems it can also depend on which vehicle you paradrop from. There's also another issue that once the unit hits the ground there's a chance that unit can suffer damage or their parachute destroys a building, hence the brief invulnerability here also. (The down side of this fix is that Paratroopers are invulnerable while in the air, and the helo is invulnerable while units are exiting it.)
UPDATE: THIS HAS BEEN FIXED IN LATEST VERSION OF SCRIPT

Download latest proof of concept mission file here...

 

http://www.mediafire.com/download/z5eor6fob65tcox/Beerkan_Simple_ParaDrop.Stratis.zip

 

As a bonus, I've included my latest F.A.R.P. (Forward Arming and Repair Point) update.

Please feel free to use this in your missions.

Just remember to credit me if you use any of my scripts or assets in any mission file you share with friends or publish.

 

rgds

 

 

Beer.

  • Like 1

Share this post


Link to post
Share on other sites
"Steerable_Parachute_F" :cool:
Doh! My bad.

Thanks for correcting me, Goblin.

However, the change now causes the units to leave the helo (with a parachute) but now causes my PC to crash the game. And some units still didn't get a parachute, they still fell.

Is this a bug causing the crash?

Share this post


Link to post
Share on other sites

Latest beta update just now doesn't crash it for me. All the AI got parachutes when they jumped out, but it would appear BIS was too lazy to teach the AI how to land without splattering on the ground with their parachutes (some of them just touch the ground and die instantly, lol).

Share this post


Link to post
Share on other sites

Hey,

Are you trying to paradrop AI? Or players?

I have nice function for AI which I can give you if you can wait till monday as I'm not at home ^^

It uses upsmon for the group which gets dropped but you can pretty easily change that.

I also have one for players which we used on our public server. It's pretty simple though and I'm looking to refine it, but if you want it let me know.

Cheers.


Alright,

Para =
{
 private ["_pos","_chute","_location","_locationSize","_dir","_dest","_transport","_transportGrp","_wp","_grp"];
 if (!isServer) exitWith {};


 /* declare variables etc */


 _locMark = _this select 0;
 _location = gerMarkerPos _locMark; 
_locationSizearray = (getMarkerSize _locMark);
 _locationSize = _locationSizearray select 0;
 _dir = random 359;
 _pos = [_location, 2500, _dir] call bis_fnc_relPos;

 _dest = [_location,2500, (_dir - 180)] call bis_fnc_relPos;


 _transport = [_pos,(_dir - 180),"O_Heli_Light_02_unarmed_F",EAST] call BIS_fnc_spawnVehicle;
 //player setPos _pos;
 _transportGrp = (_transport select 2);
 {_x setBehaviour "CARELESS"; _x flyinHeight 60;} forEach units _transportGrp;
 _wp = _transportGrp addWaypoint [_location,(_locationSize - (_locationSize / 10)),0];
 _wp = _transportGrp addWaypoint [_dest,0,1];
 _wp setWaypointSpeed "FULL";




 _grp = [_pos, EAST, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad"),[],[],[0.25,0.4]] call bis_fnc_spawnGroup;
 {_x MoveInCargo (_transport select 0); _x assignasCargo (_transport select 0)} forEach units _grp;
 waitUntil {sleep 1;(getPos (_transport select 0)) distance _location < (_locationSize + (_locationSize / 10))};

 /* Initial Drop */

 {
  unAssignVehicle _x; 
  _x allowDamage false; 
  moveOut _x; 
  sleep 0.35; 
  _chute = createVehicle ["NonSteerable_Parachute_F", (getPos _x), [], 0, "NONE"];
  _chute setPos (getPos _x);
  _x moveinDriver _chute;
  _x allowDamage true;
  sleep 0.5;
 } forEach units _grp;

 /* Assign a task */

 //[_grp, _location, _locationSize] call CBA_fnc_taskAttack;
  null = [leader _grp, _locMark, "spawned", "showmarker", "full"] execVM "scripts\UPSMON.sqf";
  /* Initiate CleanUp */
  _i = 0;
  waitUntil {sleep 1;_i = _i + 1; ((getpos (_transport select 0)) distance _location > 1750) || _i >= 70;};

 {deleteVehicle _x} foreach units _transportGrp;
 deleteGroup _transportGrp;
 deleteVehicle (_transport select 0);

 /* Return handle */
 /* _____________ */

  _grp

};

just call it like:

["marker"] spawn para;

or via ExecVM.

Edited by mantls

Share this post


Link to post
Share on other sites

Thanks mantls. My script is for anyone in the helo. Could be AI or could be the players group. However, the vital part of your script is this bit

_chute = createVehicle ["NonSteerable_Parachute_F", (getPos _x), [], 0, "NONE"];

Of which if I include this in my script, this it works perfectly. I've updated the first post with the fix.

Thanks.

Edited by Beerkan

Share this post


Link to post
Share on other sites

Now is there a possible way to make it so I get an option on a flagpole to teleport anywhere or a set location on the map like in Domination for example?

Share this post


Link to post
Share on other sites

I just tried this out and everything works fine apart from one thing. My group isn't attached to their chutes. The chutes come down with nothing in them at all. Everything else works ok. The group I selected are sitting in the cargo hold when I select a soldier as 'player' and sit in the aircraft. |I've tried a number of things to try and fix it to no avail.

I'm missing something very simple aren't I? Your help would be appreciated. thanks.

Share this post


Link to post
Share on other sites
... I'm missing something very simple aren't I? Your help would be appreciated. thanks.
Here's my proof of concept mission (updated to use latest script from first post)

See link in first post.

Uses the above scripts and init's.

Updated original post as well.

Edited by Beerkan

Share this post


Link to post
Share on other sites

Many thanks Beerkan. My script was correct from looking at yours.

Turns out I did it right but for some reason the C130J port newly released on Armaholic doesn't work with this script. Chutes deploy but no troops attached. Its beyond me. It works with all the choppers including some add on ones but not the C130J.

Share this post


Link to post
Share on other sites
Many thanks Beerkan. My script was correct from looking at yours.

Turns out I did it right but for some reason the C130J port newly released on Armaholic doesn't work with this script. Chutes deploy but no troops attached. Its beyond me. It works with all the choppers including some add on ones but not the C130J.

Try replacing

 _x action ["EJECT", _vehicle];

with

moveOut _x;

Share this post


Link to post
Share on other sites

I've updated the script on the main page so it now uses "Steerable_Parachute_F" instead of "NonSteerable_Parachute_F". I have tried the script with all troop carrying helos and it works. Everyone survives and has their own parachute. They can also have their own backpacks. I'm having to use work arounds so as not to kill the paras or damage the helo. Hence the "setdamage" variables.

Please feel free to suggest a better solution for using "Steerable_Parachute_F".

Share this post


Link to post
Share on other sites

Trying to do a C130 para insertion into the sea with a SDV or assault boat for a SEALs/SBS-style mission. Grouped the boat with the squad (already done as boat team) but it didn't even go on the C130 to begin with. Is there a way to do this? I'd like to have 2 4 man SDV teams deploy this way if possible. A second aircraft would be fine if that's the only way.

Share this post


Link to post
Share on other sites

Hey Beerkan,

really like your script.

Have you thought of using enableCollisionWith instead of allowDammage for the chopper+paratroops, so all grumpy AA units would still be able to damage the chopper/paratroops during ejection phase, keeping it more authentic?

Cheers

Share this post


Link to post
Share on other sites
Hey Beerkan,

really like your script.

Have you thought of using enableCollisionWith instead of allowDammage for the chopper+paratroops, so all grumpy AA units would still be able to damage the chopper/paratroops during ejection phase, keeping it more authentic?

Agreed. It would be nice not to have to use an un-realistic work-around. I tried using "enableCollisionWith" false type command syntax, but this didn't work and I couldn't find any examples that did. I also tried disableCollisionWith playing around with
_x disableCollisionWith _vehicle

Unfortunately according to the wiki disableCollisionWith

This commmand doesn't disable collision between PhysX objects.
of which the player is.

If anyone knows a better solution, please let us know.

Share this post


Link to post
Share on other sites

Oh really?

I could swear that it significantly decreased the death rate of ejecting paratroops last time I used it,

maybe it's just desperation taking over, who knows.

Share this post


Link to post
Share on other sites

Made improvements to the scripts:-

Namely Chute will now not deploy until unit is @ 100m from ground.

Unit exits Helo facing 90 degrees out the side.

See changes in first post.

Share this post


Link to post
Share on other sites

V2.2 update.

You can now set the height you want he chutes to auto open at.

Share this post


Link to post
Share on other sites

Very cool, quick question, I was testing this and noticed sometimes units explode upon hitting the ground, like artillery. See this screenshot.

Any way to fix this? Has pretty high priority for me!

Share this post


Link to post
Share on other sites
Very cool, quick question, I was testing this and noticed sometimes units explode upon hitting the ground, like artillery. See this screenshot.

Any way to fix this? Has pretty high priority for me!

Yea, welcome to ArmA3. Could be bug in the game.

Is it AI or player that causes the explosion?

Can I confirm you're using v2.2? If you have v2.1 can you try it?

Also can you try switching between 'NonSteerable_Parachute_F' and 'Steerable_Parachute_F'

Share this post


Link to post
Share on other sites

It's AI, it still happens in v2.2 but now they survive (still damage objects though).

I don't think NonSteerable would help at all, since they just crash into houses more often.

Share this post


Link to post
Share on other sites

Hi all,

All you have to do to stop the explosions is to not allow the parachute to take any damage.

(vehicle player) allowdamage false

Now you can slam into the ground at 60mph and not turn into a giant fireball of awesomeness!!!

Updated Script

/* 
Filename: Simple ParaDrop Script v2.3 eject.sqf
Author: Beerkan

Description:
    A simple paradrop script

Parameter(s):
0: GROUP    - group that will be doing the paradrop (group)
1: VEHICLE  - vehicle that will be doing the paradrop (object)
2: ALTITUDE - (optional) the altitude where the group will open their parachute (number)

  Example:
  0 = [group , vehicle, altitude] execVM "eject.sqf"
*/  

if (!isServer) exitWith {};
private ["_group","_vehicle","_chuteHeight"];
_group       =  _this select 0;
_vehicle     = _this select 1; 
_chuteheight = if ( count _this > 2 ) then { _this select 2 } else { 150 };

_vehicle allowDamage false;

private ["_dir"];
_dir = direction _vehicle;    

{    
unassignVehicle _x;
   _x allowDamage false;
   _x action ["EJECT", _vehicle];
   _x setDir (_dir + 90);
   sleep 1;
} forEach (units _group);

{
waitUntil {(position _x select 2) < _chuteheight};
   _chute = createVehicle ["Steerable_Parachute_F", position _x, [], ((_dir)- 5 + (random 10)), 'FLY'];
   _chute setPos (getPos _x);
   _x moveInDriver _chute;
} forEach (units _group);

_vehicle allowDamage true;

paraLandSafe = 
{
private ["_unit"];
_unit = _this select 0;

(vehicle _unit) allowDamage false;	

waitUntil { isTouchingGround _unit || (position _unit select 2) < 1 };
   _unit action ["eject", vehicle _unit];
   _unit allowDamage true;
};

{ 
[_x] spawn paraLandSafe;
} forEach (units _group);

Edited by cobra4v320
  • Like 1

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

×