Jump to content

Recommended Posts

Hello!

 

I want to make an air supply in a ww2 mission. Germans are outflanked in the Demyansk pocket and Luftwaffe give them supply . Unfortunatly Ju 52 diseppar from any ww2 mods so I have to use Dakotas. The planes will drop 20 german canisters. I'm using a trigger when the planes reach an area, it's activate the following execVM script (my friend recommended this):

 

_para = createVehicle ["B_Parachute_02_F", [0,0,1700], [], 0, ""];
_para setPosATL (player modelToWorld[0,0,2000]);
obj1 attachTo [_para,[0,0,0]]; 


WaitUntil {((((position obj1) select 2) < 0.6) || (isNil "_para"))};
detach obj1;
obj1 SetVelocity [0,0,-5];
sleep 0.3;
obj1 setPos [(position obj1) select 0, (position obj1) select 1, 1];
obj1 SetVelocity [0,0,0];

 

"obj1" is the 1st canister.  It's working, but only with 1st canister. If I change the "obj" variables, the script didn't work with other canisters only the 1st one. I try with 2 scripts in one sqf file, i try with 2 files don't work too. I try with 1 and 2 triggers don't work.

 

What I have to do I I want to drop my all (20) canisters?

Share this post


Link to post
Share on other sites

If you waitUntil like this:

- very low altitude here 0.6 ...

- or isNil "_para" (never happens if you created an object, even deleted)

- then you create the second crate once the first is on ground....  that fails.

 

Working code, feel free to adapt to your kind of crate:

Here 60 is the simulated direction for a plane

80 is a speed in m/s

"Box_NATO_Ammo_F" is a standard vanilla crate. You can change for any working class and you can add a code for customized content.


 

0 = [60,80,"Box_NATO_Ammo_F"] spawn {
  params ["_simOrient","_simSpeed","_box"];
  for "_i" from 1 to 20 do {
     private _chute = createVehicle ["B_Parachute_02_F", [0,0, 200], [], 0, "FLY"];
      _chute setPos (getpos player vectorAdd [_simSpeed * 0.6 * _i * sin _simOrient,_simSpeed * 0.6 * _i * cos _simOrient, 1200]);
      private _crate = createVehicle [_box, position _chute, [], 0, 'NONE'];
       _crate attachTo [_chute, [0, 0, 0]];
      [_crate,_chute] spawn {
        params ["_crate","_chute"];
        waitUntil {position _crate select 2 < 3 || isNull _chute};
        detach _crate;
        _chute setVelocity [0,5,0];
      };
    uiSleep 0.6;
  };
};

 

  • Thanks 1

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

×