* Inside scripts, use _this, not this. this just happens to work in your test, since this will be the last object created by the game and just happens to be the helocopter in this case (fine in your test mission, but not in a real mission).
* You are actually creating the crate on the ground. It doesn't fall because it isn't a "physics" object, so you have to manually setPos it under an object that can fall, like a parachute.
* The smoke and flare fall separately, so they need to be kept at a constant position.
* NEVER use "removeAction 0". Use the _index to delete the action, or your script will end up deleting other actions by mistake (fine in your test mission, but not in a real mission).
* Don't use createVehicleLocal unless you know you want to do it! Always use createVehicle unless you really do want a local-only object. They are equivalent in SP, but in MP they are very different!
* When you do:
_launchammo = "AmmoBoxWest" createVehicleLocal (getpos this);
_launchammo;
You are not creating and running functions (the code is run in the first line, the second line does nothing). I think you mean to do:
// Define function.
_launchammo = { "AmmoBoxWest" createVehicleLocal (getpos this) };
// Run function.
call _launchammo;
Anyway, here is a fixed version (only thing that isn't MP is that in MP only the player dropping the crate gets the sideChat message):
_helo = _this select 0; // Object that the action was on.
_actor = _this select 1; // The soldier that activated the action.
_index = _this select 2; // Action index, so you can delete it.
_parameters = _this select 3; // Any parameters passed into the action.
if (((getpos _helo) select 2) > 40)
exitWith { hint "Altitude too high"; };
if ((speed _helo) > 75)
exitWith { hint "Speed too high"; };
// Create the box just below the helo, else the helo will crash into it!
_dropPos = _helo modelToWorld [0, 0, -5];
_chute = "ParachuteWest" createVehicle _dropPos;
_chute setPos _dropPos;
_chute setVectorDirAndUp [vectorDir _helo, vectorUp _helo];
// Although we are creating them all at the same position, we will move them
// before they get a chance to collide.
_smoke = "SmokeShellGreen" createVehicle _dropPos;
_crate = "AmmoBoxWest" createVehicle _dropPos; // Will be placed on ground.
_crate setPos _dropPos;
_flare = "F_40mm_Green" createVehicle _dropPos;
_actor sideChat "Ammo crate dropped!";
_helo removeAction _index;
// Keep everything in line until the crate lands.
waitUntil
{
if (((getPos _flare) select 2) < 1) then
{
true; // Exit.
}
else
{
// Put them in a line so they don't collide with each other or the chute.
_crate setPos (_chute modelToWorld [0, 0, -1.5]);
_crate setVectorDirAndUp [vectorDir _chute, vectorUp _chute];
_smoke setPos (_chute modelToWorld [0, 0, -1]);
_flare setPos (_chute modelToWorld [0, 0, -0.5]);
false; // Don't exit.
};
};
// Put crate squarely on the ground.
_pos = getPos _crate;
_pos set [2, 0];
_crate setPos _pos;
_crate setVectorUp [0, 0, 1];