Comrades in Arms Discussion Board

Full Version: Supply Drop
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all.

We've talked about TFA Radio and HALO missions - I mentioned I have a script that can do a supply drop.

Here's the script I use.

How to use:

Place the box you want to paradrop. Give it a name.
Fill the box. I use the following for a mission, it adds the TFA radios IF they are installed
Code:
_box = _this;

clearWeaponCargoGlobal _box;
clearItemCargoGlobal _box;
clearMagazineCargoGlobal _box;

_box addMagazineCargoGlobal ["30Rnd_mas_556x45_Stanag", 30];
_box addMagazineCargoGlobal ["30Rnd_mas_556x45_T_Stanag", 30];
_box addMagazineCargoGlobal ["20Rnd_mas_762x51_Stanag", 30];
_box addMagazineCargoGlobal ["mas_MAAWS", 3];
_box addBackpackCargoGlobal ["B_mas_Kitbag_black", 4];

// Check for TFA Radio
if (isClass (configFile >> "CfgVehicles" >> "tf_rt1523g")) then {
    _box addBackpackCargoGLobal ["tf_rt1523g", 3];
};

You can go with the default loadout as well.

You can either set the box's altitude by using the appropriate field in the editor, or using setpos. I have the following in my init field:

Code:
this setPos [(getpos this) select 0, (setpos this) select 1, 2800];
this call compile preprocessFileLineNumbers "scripts\ammobox.sqf";
_null = [this, 300] spawn compile preprocessFileLineNumbers "library\supplyDrop.sqf";


supplyDrop.sqf:
Code:
/*
* Parameters:
*
* _this select 0: Crate to drop. Move to the desired position before calling
*                 Â   this script
* _this select 1: Height at which the chute should open. Default 100
*/
if (!isserver) exitWith {};

_crate = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
_openHeight = [_this, 1, 200, [0]] call BIS_fnc_param;

if (isnull _crate) exitWith{};

_signal = "SmokeShellYellow";
/*if (sunOrMoon == 0) then {
    _signal = "B_IRStrobe";
};*/

waitUntil {((getPos _crate) select 2) < _openHeight};

_chute = createVehicle ["B_Parachute_02_F", [100, 100, 200], [], 0, 'FLY'];
_chute setPos [(position _crate) select 0, (position _crate) select 1,
    ((position _crate) select 2) + 1.5];
_crate attachTo [_chute, [0, 0, -1.3]];

_signalItem = _signal createVehicle [100, 100, 200];
_signalItem setPos [(position _crate) select 0, (position _crate) select 1,
    ((position _crate) select 2) + 1.5];
_signalItem attachTo [_chute, [0,0,-1.3]];

waitUntil {position _crate select 2 < 0.5 || isNull _chute};
detach _crate;
_crate setPos [position _crate select 0, position _crate select 1, 0];



_signalItem = _signal createVehicle [100, 100, 200];
_signalItem setPos [(position _crate) select 0, (position _crate) select 1,
    ((position _crate) select 2) + 1.3];
//_signalItem attachto [_crate,[0,0,1.2]];
_marker = createMarker ["supplyDrop" + str time, getpos _crate];
_marker setMarkerType "waypoint";
_marker setMarkerShape "ICON";
_marker setMarkerText "Supplies";