Jump to content
x3djokerx

Simple ammo crate drop script

Recommended Posts

About

This script gives the player the ability to add a scroll wheel command to paradrop an ammo crate out of any flying vehicle. I was searching around for one that worked the way I wanted it to and could not find any, so I tossed one together myself. I hope this can be of use for others in the community.

How it Works

It's all done through addActions.

Should be Multiplayer and JIP compatible, let me know if it isn't.

If you have any suggestions or problems, please post!

Installation

create a file named aw_drop.sqf in your mission folder.

put the following code in that file.

aw_drop.sqf

/*
     ::: ::: :::             ::: :::             :::
    :+: :+:   :+:           :+:   :+:           :+:
   +:+ +:+     +:+         +:+     +:+         +:+
  +#+ +#+       +#+       +#+       +#+       +#+
 +#+ +#+         +#+     +#+         +#+     +#+
#+# #+#           #+#   #+#           #+#   #+#
### ###             ### ###             ### ###

Helicopter ammo box drop script (aw_drop.sqf) was written by Jester [AW] of AhoyWorld.co.uk
You may add or alter this code to your liking as long as you leave the authors name in place.
set _reloadtime = 30 to however many seconds you want before it is available to use again.
place "this addAction ["<t color='#0000f6'>Ammo Drop</t>", "aw_drop.sqf",[1],0,false,true,""," driver  _target == _this"];" in the helicopter/plane init field.
change the loadouts to the crate to your likings.
*/

private ["_heli", "_reloadtime"];

	// lets set some local variables
	_heli = _this select 0;
   _chuteType = "B_Parachute_02_F";	//parachute for blufor, for opfor and greenfor replace the 'B' with 'O' or 'G' respectively
   _crateType =  "B_supplyCrate_F";	//ammocrate class for blufor, feel free to change to whichever box you desire
   _smokeType =  "SmokeShellPurple";  //smoke shell color you want to use
   _lightType =  "Chemlight_blue";  //chemlightcolor you want used
   _reloadtime = 600;  // time before next ammo drop is available to use
   _minheight = 55;  // the height you have to be before you can actually drop the crate
   _HQ = [West,"HQ"];  // do not touch this!
   _toLow = format
   	[
   	"<t align='center'><t size='2.2' color='#ed3b00'>TO LOW</t><br/><t size='1.2' color='#9ef680'>You need to be above</t><br/><t size='1.5' color='#ed3b00'>%1 meters</t><br/><t size='1.2' color='#9ef680'>in order to drop an ammo crate.</t></t>",
   		_minheight
   	];  //text to display when not high enough to drop

       if (!isServer && isNull player) then {isJIP=true;} else {isJIP=false;};
       // Wait until player is initialized
if (!isDedicated) then
{
	waitUntil {!isNull player && isPlayer player};
};

// meat and potatoes
if ( !(isNil "AW_ammoDrop") ) exitWith {hint "Ammo drop is not currently available"};
if ((getPos player) select 2 < _minheight) exitWith {hint parseText _toLow};
if ((getPos player) select 2 > _minheight) then
{
	AW_ammoDrop = false;
	publicVariable "AW_ammoDrop";

	_chute = createVehicle [_chuteType, [100, 100, 200], [], 0, 'FLY'];
	_chute setPos [getPosASL _heli select 0, getPosASL _heli select 1, (getPosASL _heli select 2) - 50];
	_crate = createVehicle [_crateType, position _chute, [], 0, 'NONE'];
	_crate attachTo [_chute, [0, 0, -1.3]];
	_crate allowdamage false;
	_light = createVehicle [_lightType, position _chute, [], 0, 'NONE'];
	_light attachTo [_chute, [0, 0, 0]];

	// clear crate - leaves medkits in place. add clearItemCargoGlobal _crate; to remove medkits
	clearWeaponCargoGlobal _crate;
	clearMagazineCargoGlobal _crate;

	// fill crate with our junk
	_crate addMagazineCargoGlobal ["7Rnd_408_Mag", 15];
	_crate addMagazineCargoGlobal ["30Rnd_556x45_Stanag", 40];
	_crate addMagazineCargoGlobal ["30Rnd_65x39_caseless_mag_Tracer", 40];
	_crate addMagazineCargoGlobal ["20Rnd_762x51_Mag", 30];
	_crate addMagazineCargoGlobal ["200Rnd_65x39_cased_Box_Tracer", 10];
	_crate addMagazineCargoGlobal ["30Rnd_65x39_caseless_green", 40];
	_crate addMagazineCargoGlobal ["150Rnd_762x51_Box", 10];
	_crate addMagazineCargoGlobal ["30Rnd_65x39_caseless_mag", 40];
	_crate addMagazineCargoGlobal ["SatchelCharge_Remote_Mag", 2];
	_crate addMagazineCargoGlobal ["HandGrenade", 6];
	_crate addMagazineCargoGlobal ["SmokeShell", 6];
	_crate addMagazineCargoGlobal ["SmokeShellGreen", 6];
	_crate addMagazineCargoGlobal ["1Rnd_HE_Grenade_shell", 6];
	_crate addMagazineCargoGlobal ["RPG32_HE_F", 2];
	_crate addMagazineCargoGlobal ["RPG32_F", 2];
	_crate addMagazineCargoGlobal ["NLAW_F", 3];
	_crate addMagazineCargoGlobal ["Titan_AT", 2];
	_crate addMagazineCargoGlobal ["Titan_AA", 1];

	// lets people know stuff happened
	_HQ sideChat "ammo crate has been dropped.";
	hint format ["ammo crate dropped, Next one will be ready in: %1 seconds",_reloadtime];
	waitUntil {position _crate select 2 < 1 || isNull _chute};
	detach _crate;
	_crate setPos [position _crate select 0, position _crate select 1, 0];
	_smoke = _smokeType createVehicle [getPos _crate select 0, getPos _crate select 1,5];

	// let ground forces know they can resupply
	_HQ sideChat "Be advised: ammo crate has touched down!";
	sleep 3;
	_HQ sideChat "I say again, ammo crate has touched down!";

	// time to reload a new ammo crate
	sleep _reloadtime;

	// we are back in action
	vehicle player vehicleChat "Ammo drop available...";
	AW_ammoDrop = nil;
	publicVariable "AW_ammoDrop";
};

Add this to your vehicles init:

this addAction ["<t color='#0000f6'>Ammo Drop</t>", "aw_drop.sqf",[1],0,false,true,""," driver  _target == _this"];

Issues

  • you are able to drop the ammo box from any height. This means that you CAN drop it while landed, which in turn will cause some major damage to your bird. If anyone feels like adding a height check in there, by all means go for it. This is just a base script to build off of that we are going to try. ****** FIXED ******** (you can now set the height the vehicle needs to be before it is allowed to be dropped)
  • anyone on the vehicle can use atm. working on a fix for this. ******FIXED****** (only the pilot of the vehicle will be able to drop cargo, and only when in the driver seat)

Lastly, feel free to post any bugs you may encounter with this so that I may correct them.

Thanx in advance, Jester [AW]

Changelog-

11/22/2013 - JIP compatible

11/22/2013 - added a bunch of stuff. made code pretty. ready to rock and roll.

11/21/2013 - 1.0 Released

Edited by x3djokerx

Share this post


Link to post
Share on other sites

updated with most current script. Added a bunch of bells and whistles.

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

** Thanks for the PM about your account!

==================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Edited by Guest

Share this post


Link to post
Share on other sites

any idea on how to split the the drop so it works for both opfor and blufor seperate and also reappears as an option when the choppers are respawned? cheers for any help

Share this post


Link to post
Share on other sites

I would like to reopen this discussion with the same question like stonie had; is it possible to reactivate the script after helicopter is destroyed and respawned? Keep up a good work :)

Share this post


Link to post
Share on other sites

I'm using the Liberation v.924 Altis map and I can't find the vehicles init that is the second step in the instructions. What is the name of the file in the v.924 that needs the code added.

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

×