Jump to content
Beerkan

Simple ParaDrop Script

Recommended Posts

Hey Beer,

 

Since you said "original script", I went ahead an applied this to the 0.96 version, re-pbo'd and put up on server. I noticed that player was not ejected, AI were ejected. AI did not have chutes and plummeted to their death. I did a manual eject with same result :(. Below is the code i used with the suggested replacements where applicable. Thanks for looking into this.

 

/*
    Filename: Simple ParaDrop Script v0.96 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"
   i.e put this in move waypoint >> _drop = [UH60_a,75] execVM "scripts\eject.sqf";
*/ 


if (isServer || isDedicated) then {
private ["_paras","_vehicle","_chuteHeight","_dir"];
_vehicle = _this select 0;
_chuteheight = if ( count _this > 1 ) then { _this select 1 } else { 350 };
_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};
    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;// Trying to prevent damage.
    _x addBackPack "B_parachute";
    unassignvehicle _x;
    moveout _x;
    _x setDir (_dir + 90);// Exit the chopper at right angles.
    sleep 0.3;
} forEach _paras;

_vehicle allowDamage true;

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

Share this post


Link to post
Share on other sites

Hey Beerkan
I got part of it to work in multiplayer with me hosting a coop mission. 

Now when my friend is ejected he gets a parachute on his back and it opens fine (this was the part not working before), he lands, doesn't get damaged, its just atm all the backpacks don't spawn back on the back but are replaced by the parachute backpack on the ground. What i'm sure can be fixed with some more tweaking. 
So instead of 
_x addBackPack "B_parachute";// Add parachute on exit of _vehicle. AI will immediately open it, players can open it at any height above _chuteheight
i replaced it with
 [_x,"B_LIB_US_Parachute" ] remoteExec ["addbackpack"]; (im using IFA3 parachute, but it was tested with other types as well)
I read remoteExec is used for functions and stuff on multiplayer so i got it to work with that it seems. Now  so i was going to go through and change parts to use remoteExec.

 

Also instead of if (!isServer) exitWith {}; at the start of the script i just blanked it out with //if (!isServer) exitWith {};

 

 

Share this post


Link to post
Share on other sites

Hey Beerkan

 

I'm trying to use your script in a mission i'm making, and locally it works fine but when i upload it to dedicated server, things get messy

 

  1. The drop is issued waaaaay to late. The plane is long past the waypoint before it starts ejecting players out
  2. No parachute..... at all

 

Does it need any modifications to work on dedi?

Share this post


Link to post
Share on other sites

NyteMyre and Beercan,

 

Sorry for the delayed response. I was messing about with this script a while back and did finally get it to word in MP on a dedi. I replayed the mission today with a friend overseas on my server just to make sure all was still good. Automatic aircraft exit on waypoint - check, automatic chute deployment at specified height - check. Switch to backpack on landing (this mission is also a water landing so pretty sure should be good on land) - check. Any AI you have in mission on MP will also exit and deploy chute. Just make sure your players don't try to open the chutes manually it will muck up for sure.

 

First off, in your Move waypoint for the drop site put this:

 

Condition:

true

On Activation:

[[],{_drop = [VX1,300] execVM "scripts\eject.sqf";}] remoteExec ["BIS_FNC_SPAWN",0]; [[],{hint "Green Light GO GO GO"}] RemoteExec ["BIS_FNC_SPAWN",0];   

 

//VX is the name of the transport (a Blackfish) and 300 is the height of automatic chute opening. Note that I put this script inside of a "scripts" folder so take that part out if you are not running it embedded in another folder in the main mission folder. I added the "hint" for ambiance and as a ghetto debug of when the drop should initiate - not necessary to include.

 

The entire code for the eject.sqf I used is posted below, I kept Beercan's admin headers as displayed. Cheers!:

/* 
	Filename: Simple ParaDrop Script v0.96 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"
   i.e put this in move waypoint >> _drop = [UH60_a,75] execVM "scripts\eject.sqf"; 
*/

if (isServer || hasInterface) then {
private ["_paras","_vehicle","_chuteHeight","_dir"];
_vehicle = _this select 0; 
_chuteheight = if ( count _this > 1 ) then { _this select 1 } else { 300 };
_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};
	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;// Trying to prevent damage.
	_x addBackPack "B_parachute";
	[_x] orderGetIn false;
	[_x] allowGetIn false;
	unassignvehicle _x;
	moveout _x;
	_x setDir (_dir + 90);// Exit the chopper at right angles.
	sleep 0.3;
	_x setvelocity [0,0,-5];
} forEach _paras;

_vehicle allowDamage true;

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

 

  • Thanks 1

Share this post


Link to post
Share on other sites

@4-325Ranger

 

Sweet! I will test it later. I'm currently also struggling with a MoveInCargo script on dedi as well :P

Also, it seems you edited v0.96. Is it easy to apply the changes to v0.99d as well? 

Share this post


Link to post
Share on other sites

@4-325Ranger

 

I tried the script in a mission in a dedicated server, and a few issues still occurred.

Backpack is randomly restored. Sometimes you have your backpack, sometimes you still have a parachute, and sometimes.. you have nothing. :(

Share this post


Link to post
Share on other sites
6 hours ago, NyteMyre said:

@4-325Ranger

 

I tried the script in a mission in a dedicated server, and a few issues still occurred.

Backpack is randomly restored. Sometimes you have your backpack, sometimes you still have a parachute, and sometimes.. you have nothing. :(

 

That will be the case if you move your player while taking back his former backpack. I had to manage that for my own script (HALO jump).

For any jump, 2 solutions:

- you create a parachute vehicle and you don't bother with your initial backpack. Everything goes as boarding/dismounting a car. The Arma engine brings back the backpack.

 It's weird to jump without parachute the create one in flight, then getInDriver in, not exactly when you want

- or, you jump as you do, with a parachute but manage your old packPack (the object with its inventory, not the class).

  • Like 1

Share this post


Link to post
Share on other sites
On 1/4/2018 at 3:46 PM, NyteMyre said:

I tried the script in a mission in a dedicated server, and a few issues still occurred.

Backpack is randomly restored. Sometimes you have your backpack, sometimes you still have a parachute, and sometimes.. you have nothing. :(

 

Do you have a player flying the aircraft, or the AI flying waypoint-to-waypoint? I use AI to fly the aircraft in my mission. You have to make sure all of the flight crew slots are filled with AI crew. I do have issues if a player slot AI takes a crew seat or if I do. Players/Player slot AI should fill in passenger-only seats with the above script. I'll put something simple together this weekend that's pure vanilla. If it tests out, I'll PM it to you and let you break it apart.

 

Share this post


Link to post
Share on other sites
On 6-1-2018 at 12:04 AM, 4-325Ranger said:

 

Do you have a player flying the aircraft, or the AI flying waypoint-to-waypoint? I use AI to fly the aircraft in my mission. You have to make sure all of the flight crew slots are filled with AI crew. I do have issues if a player slot AI takes a crew seat or if I do. Players/Player slot AI should fill in passenger-only seats with the above script. I'll put something simple together this weekend that's pure vanilla. If it tests out, I'll PM it to you and let you break it apart.

 

 

The way i have it setup in my mission.

 

 

  1. (AI) Plane (RHS C-130) is hidden (hideObject true) and has waypoints. The plane will stay in place until hideObject is set to false. Also added 1 additional AI for cockpit seat.
  2. After all players green up, perform script that:
    1. Set plane to visible
    2. Move all players to cargo of plane after 10 seconds
    3. Ungroup all players after 10 seconds
  3. Plane moves to waypoint with eject.sqf
  4. Players are ejected out of plane after reaching waypoint
  5. Parachutes open at designated height
  6. After landing, backpacks are either present, gone or people still have parachutes as backpack.

 

I do not user AI in player-slots

Share this post


Link to post
Share on other sites

So i did another testing with 8 players, and i THINK i saw a locality problem, since there were various empty parachutes around players. Maybe an additional parachute spawns for every player on the server?

Share this post


Link to post
Share on other sites

NyteMyre,

Sorry been busy of late. Had a friend recode the equipment storage and retrieval. I had to keep turning NVGs back on upon landing and the left shoulder unit patch would disappear. Localized the equipment to just the backpack to be stored and retrieved. Just about done with the sample mission as well. I'll post the updated code and mission link hopefully soon. One thing I consistently find, is that if players open their chute and don't wait for the auto-open, they will get the multiple chute issue. I haven't localized the problem, but also pretty easy to just brief the players to wait for auto-open ;) I also saw your post on using the RHS C-130. Look into using the RHS waypoint for paradrops as an alternative. I go with that for RHS missions, but use this script when not using RHS.

Share this post


Link to post
Share on other sites

For Pierremgi and NyteMyre,

 

Here is the latest code. I was having an issue with needing to turn my NVGs back on and loosing the set left shoulder unit patch upon landing. A friend of mine, Neko-Arrow, made some edits so that only the backpack was removed and respawned instead of the whole loadout. Here is is the code below. It is running just fine on LAN Hosted SP and on my dedi for MP. FYI alot of people I've been dealing with keep questioning this line if (isServer || hasInterface) then {}, at this point I do not know why if !(isServer) exitWith {False}; doesn't work. When I upload my missions to the server, the previous code works for just players or if I play with a combo of real players and AI so...you can experiment for yourself. Please continue to give Beerkan credit for the original script if you use this edited version, my friend is not looking for any recognition. Nyte, I'm hoping to post my SP version to steam this weekend of a short, but fun mission, with the MP version not too far behind. I'll message you the links. Thanks.

 

/*
    Filename: Simple ParaDrop Script v0.96 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"
   i.e put this in move waypoint >> _drop = [UH60_a,75] execVM "scripts\eject.sqf";
*/  
 
//if !(isServer) exitWith {False};
if (isServer || hasInterface) then {
private ["_paras","_vehicle","_chuteHeight","_dir"];
_vehicle = _this select 0;
_chuteheight = if ( count _this > 1 ) then { _this select 1 } else { 300 };
_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};
    waitUntil { isTouchingGround _unit || (position _unit select 2) < 1 };
    _unit action ["eject", vehicle _unit];
    sleep 1;
   
    // Restore backpack.
    _Var = _Unit getVariable "Ranger_Backpack";
    _Var Params ["_Backpack","_BackpackItems"];
    _Unit addBackpack _Backpack;
    ClearAllItemsFromBackpack _Unit;
    sleep 0.25;
    {_Unit addItemToBackpack _x} forEach _BackpackItems;   
    _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.
};
 
{
    // Save backpack and its items.
    _Backpack = Backpack _x;
    _BackpackItems = BackpackItems _x;
    _x setVariable ["Ranger_BackPack",[_Backpack,_BackpackItems]];   
    removeBackpack _x;
//    _x disableCollisionWith _vehicle;// Sometimes units take damage when being ejected.
    _x allowdamage false;// Trying to prevent damage.
    _x addBackPack "B_parachute";
    [_x] orderGetIn false;
    [_x] allowGetIn false;
    unassignvehicle _x;
    moveout _x;
    _x setDir (_dir + 90);// Exit the chopper at right angles.
    sleep 0.3;
    _x setvelocity [0,0,-5];
} forEach _paras;
 
_vehicle allowDamage true;
 
{
    [_x,_chuteheight] spawn paraLandSafe;
} forEach _paras;
};

Share this post


Link to post
Share on other sites

Thanks for replying Ranger. I will update my mission and test it out later this week.

 

Quote

I also saw your post on using the RHS C-130. Look into using the RHS waypoint for paradrops as an alternative.

 

I tested RHS paradrop waypoint, but as far as i'm away, it doesn't allow for a HALO jump. Players instantly open their parachute when they are kicked out of the plane. And since i have my team start at 5000m, it will be a long boring drop down :p

 

 

-edit-  

 

Still didn't work correctly. Tested with 6 players on dedi, and everyone still had their parachute when they landed.

Also, the multiple parachutes appearing happened even when nobody opened their parachute manually

 

https://imgur.com/Wm58SEq

I'm making this mission for ~30 players, and if we have 30x30 parachutes in the air.. the server will definitely not survive

Share this post


Link to post
Share on other sites

Hi Everyone,

I have read through the thread but I think my google-fu has failed me. I'm using v1.5 of Beerkan's script and just can't get it to work.

 

/* ----------------------------------------------------------------------------
Script Name: Simple ParaDrop Script v1.5

File Name: Paradrop.sqf

Author: Beerkan

Description: Simple ParaDrop script which saves backpack and loadout.

Parameters:
            0: GROUP : String - Name of group that will paradrop
            1: VEHICLE : String - name of vehicle that will be doing the paradrop (object)
            2: ALTITUDE : Number (optional) - the altitude where the group will open their parachute (number)

Usage: TRIGGER/WAYPOINT - On Act
_drop = [VEHICLE, ALTITUDE] execVM "paradrop.sqf";

---------------------------------------------------------------------------- */

if (!isServer) exitWith {};
private ["_paras","_chopper","_chuteHeight","_dir"];
_paras = _this select 0;
_chopper = _this select 1;
_chuteheight = if ( count _this > 1 ) then { _this select 2 } else { 100 };
_chopper allowDamage false;
_dir = direction _chopper;    
 
paraLandSafe =
{
    private ["_unit"];
    _unit = _this select 0;
    _chuteheight = _this select 1;
    (vehicle _unit) allowDamage false;
    0=[_unit,_chuteheight] spawn OpenPlayerchute;
    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};
    _paraPlayer action ["openParachute", _paraPlayer];
};
 
{
    _inv = name _x;
    [_x, [missionNamespace, format["%1%2", "Inventory",_inv]]] call BIS_fnc_saveInventory;// Save Loadout
    removeBackpack _x;
    _x disableCollisionWith _chopper;// Sometimes units take damage when being ejected.
    _x allowdamage false;// Trying to prevent damage.
    _x addBackPack "B_parachute";
    unassignvehicle _x;
    moveout _x;
    _x setDir (_dir + 90);// Exit the chopper at right angles.
    sleep 0.3;
} forEach _paras;
 
_chopper allowDamage true;
 
{
    [_x,_chuteheight] spawn paraLandSafe;
} forEach _paras;

 I don't understand what I replace with what and if I have multiple groups jumping, how do I account for that?

I have a multiplayer mission that I'm setting up for a fun-op for my realism unit where I need players to jump from a CH-47F and insert into a hot AO. 

I want to have them be able to keep their backpacks rather than dropping in an arsenal or something else like that, that's why I'm using this. 

Anyway, I can't get it to work and am not really sure where I'm messing up. As a complete amateur to the scripting side of Arma 3, could anyone point me in the right direction?

 

Thank you!!

Share this post


Link to post
Share on other sites

 

Hello, thanks to the author for this script, I use it in my mod. I would like to point out one mistake that prevents parachutes from opening at small altitudes. This mistake is in this part of the code:

{
    _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;

The block that triggers the distance check and the opening of the parachute (ParaLandSafe) is only spawned after all paratroopers have jumped out with an interval of 0.3 seconds. If the number of paratroopers is, lets say, 15 units, then this is a total of 4.5 seconds. During this time, the first paratrooper has already flown more than 150 meters. The corrected part of the code will look like this:

{
    _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.
	[_x,_chuteheight] spawn ParaLandSafe; /// <---- HERE
} forEach _paras;

 

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

×