Jump to content
Beerkan

Simple ParaDrop Script

Recommended Posts

Is there anyway to add a supply box C_T_supplyCrate_F so that it gets para dropped with the players or AI via the script?

 

Thank you.

Share this post


Link to post
Share on other sites

 

Put this at the very end of the script. This will spawn a crate behind _vehicle and ParaDrop it from the Helo

 

_cargo = "C_T_supplyCrate_F" createVehicle getpos _vehicle;
_cargo setPos [(position _vehicle select 0) - (sin (getdir _vehicle)* 15), (position _vehicle select 1) - (cos (getdir _vehicle) * 15), (position _vehicle select 2)];
[objnull, _cargo] call BIS_fnc_curatorobjectedited;

Share this post


Link to post
Share on other sites

You are awesome.

 

One last question, how would I make C_T_supplyCrate_F an arsenal once its safe on the ground?

Share this post


Link to post
Share on other sites

Try this. Added Virtual Arsenal to _cargo and cleared crate of content.

_cargo = "C_T_supplyCrate_F" createVehicle getpos _vehicle;
_cargo setPos [(position _vehicle select 0) - (sin (getdir _vehicle)* 15), (position _vehicle select 1) - (cos (getdir _vehicle) * 15), (position _vehicle select 2)];
[objnull, _cargo] call BIS_fnc_curatorobjectedited;
clearMagazineCargoGlobal _cargo;// Empty Supply Crate and replace with Virtual Arsenal
clearWeaponCargoGlobal _cargo;
clearItemCargoGlobal _cargo;
clearbackpackCargoGlobal _cargo;
_cargo addaction ["<t color = '#006400'>Open Virtual Arsenal</t>",{["Open",true] call BIS_fnc_arsenal;}];

 

 

Edited by Beerkan
Fixed for Arma idiosyncrasies

Share this post


Link to post
Share on other sites

For some reason this spawns the cargo 20ft underground

 

_cargo setPos [getPos _vehicle select 0, getPos _vehicle select 1, -20];

 

Share this post


Link to post
Share on other sites

 

20 hours ago, Jnr4817 said:

For some reason this spawns the cargo 20ft underground...

 

 

You're right.

 

I wrote this and forgot that Arma would return the _vehicle height as 0 regardless of it's actual height. So -20 is indeed underground. Welcome to the idiosyncrasies of Arma.

 

I've fixed it in my last post, tested it and it's working. Update will spawn it 15m behind _vehicle and paradrop it.

 

 

Share this post


Link to post
Share on other sites

Hey Beerkan,

 

I've been trying your script for some time now but cant quite get it to work for my needs. I'm using the 0.97 version copied directly from your BI post but it doesn't work the way you described it. When my aircraft reaches its waypoint it ejects the AI passengers and the player at the designated altitude but only deploys the AI chutes. The player chute will only open at 120m regardless of what altitude I specify in the parameters or the script. Some AI are even killed as they eject. Any idea what I'm doing wrong here? I've changed the chute type in your script and tested a few different altitudes in _chuteheight that's all I've altered. I've attached the script and on act. line I've been using for you to view. 

 

I appreciate any help you can offer.

 

Cheers

 

Spoiler

ON ACT:

 

_drop =[transport,200] execVM "eject.sqf";

 

SCRIPT:

 

/*
    Filename: Simple ParaDrop Script v0.97 eject.sqf
    Author: Beerkan
    
    Description:
     A Simple Paradrop Script
   
    Parameter(s):
    0: VEHICLE  - vehicle that will be doing the paradrop (object)
    1: ALTITUDE - (optional) the altitude where the group will open their parachute (number)
   
   Example:
   0 = [vehicle, altitude] execVM "eject.sqf"
*/  

if (!isServer) exitWith {};
private ["_paras","_vehicle","_chuteHeight","_dir"];
_vehicle = _this select 0;
_chuteheight = if ( count _this > 1 ) then { _this select 1 } else { 200 };
_vehicle allowDamage false;
_paras = assignedcargo _vehicle;
_dir = direction _vehicle;    

ParaLandSafe =
{
    private ["_unit"];
    _unit = _this select 0;
    _chuteheight = _this select 1;
    (vehicle _unit) allowDamage false;
    if (isPlayer _unit) then {[_unit,_chuteheight] spawn OpenPlayerchute};//Set AutoOpen Chute if unit is a player
    waitUntil { isTouchingGround _unit || (position _unit select 2) < 1 };
    _unit action ["eject", vehicle _unit];
    sleep 1;
    _inv = name _unit;
    [_unit, [missionNamespace, format["%1%2", "Inventory",_inv]]] call BIS_fnc_loadInventory;// Reload Loadout.
    _unit allowdamage true;// Now you can take damage.
};

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

{
    _inv = name _x;// Get Unique name for Unit's loadout.
    [_x, [missionNamespace, format["%1%2", "Inventory",_inv]]] call BIS_fnc_saveInventory;// 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.
    sleep 0.3;//space the Para's out a bit so they're not all bunched up.
    _x addBackPack "CUP_T10_Parachute_backpack";
} forEach _paras;

_vehicle allowDamage true;

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

 

 

 

Share this post


Link to post
Share on other sites

In the original script All units got a B_parachute backpack once they were hoofed out of the _vehcile. AI opened their chutes as soon as they were assigned a  B_parachute regardless of _chuteheight settings, where as players got an "Open Chute" prompt and could deploy at any height.

 

Anyway, latest update has improved all that. (with thanks to gc8 for code to get all units except crew).

In this verison you will not get a chute intil you reach the _chutehight. As normal you still get to keep your original backpack.

I have also added an optional Cargo Crate that can be added to the ParaDrop. If included it will include a crate with the Arma Virtual Arsenal.

 

I will look to create an update that will allow, _addChuteheight & new variable _autoOpenheight. Hopefully that will accomodate ALL users.

 

/*
    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 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;

 

Edited by Beerkan
Revision 99d to include opening _CargoDrop @ _chuteheight

Share this post


Link to post
Share on other sites

Okay I've tried v0.99c, again it works great for the AI and the crate is a great addition but it still doesn't allow me to specify the _chuteheight for the player. I want to deploy the player chute at 200m but no matter what I change it will always open at 150m.

Share this post


Link to post
Share on other sites

Is _vehicle definitely above 200m when the script is called?

Is _vehicle over the sea by chance when the script is called?

 

Also, can you give me your trigger settings on how you call eject.sqf

 

i.e. 

 

0 = [UH80, 150] execVM "eject.sqf"

 

If you use 

 

0 = [UH80] execVM "eject.sqf"

 

then try this change.

 

Change this line from 

_chuteheight = if ( count _this > 1 ) then { _this select 1 } else { 120 };

to 

 

_chuteheight = if ( count _this > 1 ) then { _this select 1 } else { 200 };

Share this post


Link to post
Share on other sites

Excellent. I'm glad you kept the addition of the supply crate as an option.

 

Share this post


Link to post
Share on other sites

BeerKan,

 

I love your script.

 

Is there anyway to convert your script over to vehicle (Blackfish) dropping another vehicle(prowler)?

If so, can this me augmented with the vanilla BIS supply drop module?

 

Thanks for considering,

Reed

Share this post


Link to post
Share on other sites
On 2017/2/28 at 8:32 PM, Beerkan said:

Is _vehicle definitely........

 

Hi author, I find a strange bug, when heli drop the troop.

 

Then pilot will hover the heli and start to land, can you fix this problem let heli just fly away and don't stop.

 

Thanks :)

Share this post


Link to post
Share on other sites
On 26/03/2017 at 10:18 PM, Jnr4817 said:

BeerKan,

 

I love your script.

 

Is there anyway to convert your script over to vehicle (Blackfish) dropping another vehicle(prowler)?

If so, can this me augmented with the vanilla BIS supply drop module?

 

Thanks for considering,

Reed

 

Change how you call the script from this

0 = [UH80,150,"B_supplyCrate_F"] execVM "eject.sqf"

to this

0 = [UH80,150,"B_T_LSV_01_armed_F"] execVM "eject.sqf"

Or what ever class of vehicle you wish to drop.

Share this post


Link to post
Share on other sites
8 hours ago, God of Monkeys said:

 

Hi author, I find a strange bug, when heli drop the troop.

 

Then pilot will hover the heli and start to land, can you fix this problem let heli just fly away and don't stop.

 

Thanks :)

 

Sample Working Mission file where Pilot continues on to waypoint after the ParaDrop. See waypoints.

 

Get if from Beerkan's Simple ParaDrop Script Example Mission

Share this post


Link to post
Share on other sites

Is it possible to have the server start with the players in prowlers loaded up in Vehicle Blackfish's and have them airdropped using your script?

 

Share this post


Link to post
Share on other sites

Oh if I could get this working on mapclick that would be sweet!

 

Share this post


Link to post
Share on other sites
On 30/5/2016 at 4:37 AM, RaptorElite said:

A very noob question sorry but could you tell Where to put the eject.sqf file? Like very specifically, I dont have much knowledge in using scripts, for Arma 3

 

It goes in the same folder that the game you have made is called. like this  ~\Documents\Arma 3 - Other Profiles\OURNAME\missions\missionname

Share this post


Link to post
Share on other sites

I've been trying for a good bit and I need some help getting this to work in MP. I'm only trying to get the paras to open chutes, not working with the cargo/veh portion. I have 4 player/AI spots with a group leader.

 

I have VX with this in its init: this flyInHeightASL [1500,1500,1500];   for flying constant height

 

In the group leader I have: Paras = group this;{_x assignasCargo VX1;_x moveinCargo VX1} forEach units group this; 

 

In the drop waypoint (which is a "move" wp type), I have:  [[],{_drop = [VX1,500] execVM "scripts\eject.sqf";}] remoteExec ["BIS_FNC_SPAWN",0];  the MP execution code that works with everything else trigger and waypoint that I have going.

 

I was using the original 0.96 script which works flawlessly in the editor (of course). I too like how the player/ai exit with a parachute on their back, but since I could not get this to work, I went ahead and tried the set up with version 0.99d. I downloaded the sample mission from the April 20 post. I added this to my mission init.sqf:

 

if (isServer) then
        {
            [] spawn {while {true} do
                {
                    if ( (getPosATL player select 2 > 100) && (vehicle player IsEqualto player) && (alive player)) then
                        {
                        waitUntil {(position player select 2) <= 500};// 500 is the height to spawn opened chute.
                        [player] spawn Bis_Fnc_Halo;
                        };
                    sleep 2;
                    };
                };
        };

Not exactly sure that it would help, but it had (isServer) and looked like a backup to get the player to have a chute open at 500 (which i changed from 100). I also changed the VX's follow-on wp from a "Land" to a "GET OUT" like the sample mission.

 

Loaded all back into the server; myself and the AI, all exit without chutes as expected. I then have a fantastic view of my custom objective from 1500m all the way to my spectacular death! Also no option to manually open a chute. For a workaround I was going to add the "backpackonchest" mod to get set up before the jump so i'd have something to open after the forced exit. However, being a script, I am really trying to avoid any mods. If anyone has any suggestions, I'd greatly appreciate it. Oh yeah, I love this mod, just need to get it working on server.

 

Share this post


Link to post
Share on other sites
19 minutes ago, 4-325Ranger said:

I've been trying for a good bit and I need some help getting this to work in MP. I'm only trying to get the paras to open chutes, not working with the cargo/veh portion. I have 4 player/AI spots with a group leader...

 

If you've based it on my sample mission then most likely you have your waypoint settings wrong calling the script. Check your waypoint settings against my sample mission.

 

If you're still struggling, zip me up your mission folder including all associated files, PM me the file and I'll have a look at it over this weekend.

Share this post


Link to post
Share on other sites

Hey 
Just seeing if anyone got this to work in MP, as the host it works for me and the AI but for my friend he just falls to the ground.
Thanks in advance for any help. 

Share this post


Link to post
Share on other sites
On 2017-6-15 at 10:46 AM, Reece_BASE said:

Hey 
Just seeing if anyone got this to work in MP, as the host it works for me and the AI but for my friend he just falls to the ground.
Thanks in advance for any help. 

For those having a problem with the original script, can you try the following:-

Change this line of code

if (!isServer) exitWith {};

to this

if (isServer || isDedicated) then {

And then add an additional

};

at the very end of the script and let me know if this works?

 

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

×