Jump to content
Sign in to follow this  
Leh2012

Ammo boxes on parachute. Script from gerasimow9 and Leh2012

Recommended Posts

Translator Leh2012, creators gerasimow9 and Leh2012.

So, two scripts fulfilling identical function, but having small distinctions became a fruit of mine with gerasimow9 common efforts.

I want to pay attention that has written the main part of the code gerasimow9, I have only rectified some errors and have made the script version in sqf!

Also I have made two examples, one for pure ArmA2, the second for ArmA2 OA.

Here also there was a new version of a script, it happens thanks to council of comrade DICS. In the new version I have left only SQF a file.

The list of changes:

The ammo box appears precisely on a fit place.

Unnecessary lines in the code are corrected some.

I'm written an explanation of a corrected script.

Script activation:

In the trigger or a script write

p=[sam] execVM "sbros.sqf";

The script version SQF

sam - the name of the airplane which will be transferred in a script, can be any!

Further there is an explanation of this script!

// Translator Leh2012, creators gerasimow9 and Leh2012.

// _c130 name of the  airplane, local variable!
// _chute name of the parachute, local variable!
// _box name of the ammo box, local variable!
// _bam name of the new ammo box,local variable!

// "ParachuteMediumWest_EP1" name of the parachute, You can enter any! 
// "USBasicAmmunitionBox_EP1" name of the ammo box, You can enter any!

_c130 = _this select 0; // Transmission of a title of the airplane in the script.
_chute = "ParachuteMediumWest_EP1" createVehicle [0, 0, 0]; // create parachute
_chute setPos [(getpos _c130 select 0), (getPos _c130 select 1), (getPos _c130 select 2)]; // Parachute teleport to airplane coordinates
_box = "USBasicAmmunitionBox_EP1" createVehicle [0, 0, 0]; // create ammo box
_box setpos [(getpos _c130 select 0), (getpos _c130 select 1), (getpos _c130 select 2)]; // Ammo box teleport to airplane coordinates
_box attachto [_chute, [0, 0, 0]]; // ammo box attachment to a parachute 
waitUntil {((getPos _box) select 2) < 1}; // Waiting of a landing of a ammo box
detach _box; // Unhitching of a box from a parachute
_box setpos [(getpos _box select 0), (getpos _box select 1), 0]; // Lifting the ammo box on the ground level 
_bam ="USBasicAmmunitionBox_EP1" createVehicle [(getpos _box select 0),(getpos _box select 1),(getpos _box select 2)+0]; // create new ammo box
deletevehicle _box; // delete old ammo box

Example for ArmA2. Version 1.1

Example for ArmA2 OA. Version 1.1

PS: Excuse for the bad English language!

Edited by Leh2012
Added version 1.1

Share this post


Link to post
Share on other sites

Has updated the first post of the new information!

Share this post


Link to post
Share on other sites

Has updated the first post. Added version 1.1!

Share this post


Link to post
Share on other sites

So, is glad to inform on an output of the new version of this script!

About version 1.2

I did this version already without involvement Gerasimow9 and I put into it very much!

Now the script perfectly works not only with ammo boxes, but also with vehicles!

Next, list of changes.

* The script is completely universal, it is not necessary to displace game any more and to open a script. All can be made through the editor!

* I'm added two variations of a script. With parameter true, the script works for ammo boxes, and with parameter false for vehicle.

* Smoke grenade and lighting rockets which will specify a place of a landing of a ammo box or vehicle are added.

In case of ammo box or vehicle destruction, smoke grenades and lighting rockets won't be created.

* Now, if during flight ammo box it will be destroyed, it won't be replaced new at a landing!

* Some changes in the code!

Next, instructions for the script.

//  How to start this script?

//  1 Create new mission
//  2 Put the script in a folder with a mission 
//  3 Create airplane and give it a name 
//  4 Activate the script from a trigger or from an other script

//  For example: p=[true,sam,"ParachuteBigWest_EP1","M2A2_EP1"] execVM "sbros.sqf"

//  true  mode for boxes, if you gonna reset ammo box, write in script activation true!
//  false  mode for vehicle, if you gonna reset vehicle, write in script activation false!
//  sam The airplane name which reset object, it is necessary to deliver it in the editor!
//  "ParachuteBigWest_EP1" Parachute name(from config)
//  "M2A2_EP1" Name ammo box or vehicle (from config)

//  Script from within

//  _c130 Name airplane, local variable!
//  _chute Name parachute, local variable!
//  _box Name ammo box or vehicle, local variable!
//  _bam Name new ammo box or vehicle, local variable!

_nm = TypeOf (_this select 1);
if (_this select 0) then {    // if true, make next code, edit in trigger!(for ammo box)

_c130 = _this select 1;  // transfer airplane name in script
_chute = (_this select 2) createVehicle [0, 0, 0];  // Create parachute
_chute setPos [(getpos _c130 select 0), (getPos _c130 select 1)-10, (getPos _c130 select 2)-10];  // Parachute teleport to airplane coordinates 
_box = (_this select 3) createVehicle [0, 0, 0];  // create ammo box
_box setpos [(getpos _c130 select 0), (getpos _c130 select 1)-10, (getpos _c130 select 2)-10];  // ammo box teleport to airplane coordinates
_box attachto [_chute, [0, 0, 0]];  // ammo box attachment to a parachute  
waitUntil {((getPos _box) select 2) < 1};  // Waiting of a landing of a ammo box
switch (true) do
{
 case not (alive _box): {detach _box;_box setpos [(getpos _box select 0), (getpos _box select 1), 0];};  // If ammo box destroyed, make this code
 case alive _box: {detach _box;_box setpos [(getpos _box select 0), (getpos _box select 1), 0];_bam =(_this select 3) createVehicle [(getpos _box select 0),(getpos _box select 1),(getpos _box select 2)+0];deletevehicle _box;"SmokeShellgreen" createVehicle getPos _bam;_flare = "F_40mm_White" createVehicle [getPos _bam select 0,getPos _bam select 1,+150];}; // If alive ammo box, make this code
};  
_chute setPos [(getpos _box select 0)+2, (getPos _box select 1), (getPos _box select 2)];  // Parachute teleport to ammo box edge 

} else {  // if false, make next code, edit this variable in trigger!(for vehicle) 

_c130 = _this select 1;  // transfer airplane name in script
_chute = (_this select 2) createVehicle [0, 0, 0];  // Create parachute
_chute setPos [(getpos _c130 select 0), (getPos _c130 select 1)-10, (getPos _c130 select 2)-10];  // Parachute teleport to airplane coordinates
_box = (_this select 3) createVehicle [0, 0, 0];  // create vehicle
_box setpos [(getpos _c130 select 0), (getpos _c130 select 1)-10, (getpos _c130 select 2)-10];  // Vehicle teleport to airplane coordinates 
_box attachto [_chute, [0, 0, 0]];  // Vehicle attachment to a parachute
waitUntil {((getPos _box) select 2) < 1};  // Waiting of a landing of a vehicle
switch (true) do 
{
 case not (alive _box): {detach _box;};  // if not alive vehicle, then Unhitching vehicle from parachute.
 case alive _box: {detach _box;"SmokeShellgreen" createVehicle getPos _box;_flare = "F_40mm_White" createVehicle [getPos _box select 0,getPos _box select 1,+150];};  // if alive vehicle, then Unhitching vehicle from parachute; Create smoke grenade; create the lighting rocket;
}; 
_chute setPos [(getpos _box select 0)+2, (getPos _box select 1), (getPos _box select 2)];  // Parachute teleport to vehicle edge 
};           

PS: I hope you understand me. If not, drop me a PM.

What in the archive?

* Example for ArmA2

* Example for ArmA2 OA

* Readme on two languages

PS: Excuse for the bad English language:)

Share this post


Link to post
Share on other sites

Has anyone else looked this script ?

Share this post


Link to post
Share on other sites

Thanks for this, I added some stuff I'd already done and now looks less static.

_nm = TypeOf (_this select 1);
if (_this select 0) then { 

_c130 = _this select 1; 
_chute = (_this select 2) createVehicle [0, 0, 0]; 
_chute setPos [(getpos _c130 select 0), (getPos _c130 select 1)-10, (getPos _c130 select 2)-10];
_box = (_this select 3) createVehicle [0, 0, 0];
_box setPos [(getpos _c130 select 0), (getPos _c130 select 1)-10, (getPos _c130 select 2)-10];
_box attachto [_chute, [0, 0, 0]];



//-------------------------------------------------------- Rotate
_ndir   = 0;
_ndir   = getdir _chute;
_speed  = (random 0.02)+0.06;
_rotdir = (random 4)-2;

while {((getPos  _box select 2) >2)} do
{
_ndir = _ndir + _rotdir;
	_chute setdir _ndir;
		sleep _speed;
};
//-------------------------------------------------------- End



waitUntil {((getPos _box) select 2) < 1};
switch (true) do 
{
 case not (alive _box): {detach _box;_box setpos [(getpos _box select 0), (getpos _box select 1), 0];};
 case alive _box: {detach _box;_box setpos [(getpos _box select 0), (getpos _box select 1), 0];_bam =(_this select 3) createVehicle [(getpos _box select 0),(getpos _box select 1),(getpos _box select 2)+0]; deletevehicle _box;"SmokeShellgreen" createVehicle getPos _bam;_flare = "F_40mm_White" createVehicle [getPos _bam select 0,getPos _bam select 1,+150];};
};
_vel = 20;// force chute away from vehicle
_chute setvelocity [(_vel)+(sin _ndir* _speed),(_vel)+(cos _ndir* _speed),(_vel)];

} else {

_c130 = _this select 1;
_chute = (_this select 2) createVehicle [0, 0, 0];
_chute setPos [(getpos _c130 select 0), (getPos _c130 select 1)-10, (getPos _c130 select 2)-10];
_box = (_this select 3) createVehicle [0, 0, 0];
_box setPos [(getpos _c130 select 0), (getPos _c130 select 1)-10, (getPos _c130 select 2)-10];
_box attachto [_chute, [0, 0, 1]];



//-------------------------------------------------------- Rotate
_ndir   = 0;
_ndir   = getdir _chute;
_speed  = (random 0.02)+0.06;
_rotdir = (random 4)-2;


while {((getPos  _box select 2) >2)} do
{
_ndir = _ndir + _rotdir;
	_chute setdir _ndir;
		sleep _speed;
};
//-------------------------------------------------------- End

A few things would give it more appeal would be sounds when the stuff hits the ground, I did this for exploding barrels.

Maybe add some dust. I suck at particle effects.

Oh vehicles seem locked BTW..

.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Hi... would like to download the script but nothing I click on works. Don't read Russian!!!

EDIT: AHHH...Got it finally. Thanks for the work.

Share this post


Link to post
Share on other sites

Thanks a lot mate.... I eventually did get it.... but that will be better for others. Thanks again.

Share this post


Link to post
Share on other sites

Excellent - I am using the previous version in my current SP mission - I will swap it out for this one.

The only change I made was that you create the ammo boxes etc at [0,0,0] - on the map I am using this is the ocean which caused the ammo boxes and armour to immediately get destroyed. I instead moved the coordinates to an unused landmass.

Share this post


Link to post
Share on other sites
Excellent - I am using the previous version in my current SP mission - I will swap it out for this one.

The only change I made was that you create the ammo boxes etc at [0,0,0] - on the map I am using this is the ocean which caused the ammo boxes and armour to immediately get destroyed. I instead moved the coordinates to an unused landmass.

a good tip instead of using the [0,0,0] is to replace it with [0,0,200] to spawn it 200 meter in the air, so then you can setpos it to wherever you want, no water will trouble you again.

Share this post


Link to post
Share on other sites

Jedra, very strange. I'm just checking it on a Utes. All worked fine! You have not changed the script? :confused:

a good tip instead of using the [0,0,0] is to replace it with [0,0,200] to spawn it 200 meter in the air, so then you can setpos it to wherever you want, no water will trouble you again.

Good advice!

Share this post


Link to post
Share on other sites

If you use setpos instead of attachto on the ammobox it stops bouncing up and down.

Share this post


Link to post
Share on other sites
Jedra, very strange. I'm just checking it on a Utes. All worked fine! You have not changed the script? :confused:

Good advice!

No, I didn't change the script - I am using it on Isla Duala - I haven't tried it on the other islands as a standalone script (your demos work though).

@Demonized - I originally did just try and spawn them in the air, but the same thing happened - they got destroyed immediately.

Perhaps it's a peculiarity with Duala? Anyway, spawning them to a marker on dry land works for me on that island so there's no great panic!

Share this post


Link to post
Share on other sites

Jedra, ok, thanks for explanation!

PS: I not tested script on another islands!

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
Sign in to follow this  

×