Advertisement

Author Topic: Secondary Explosions for Ammo Boxes and Vehicles (ACCEPTED)  (Read 2212 times)

0 Members and 1 Guest are viewing this topic.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Here's my scripts for secondary explosions attached to ammo boxes and vehicles.  This is featured in my Last Tango in Bagango mission.

Updated Sept. 3, 2007:  Now MP compatible thatnks to Mondoble's suggestion.
Previously updated to work on vehicles as well as ammo boxes (Thanks for the suggestion Bardosy!)

To use:

1. Copy these two scripts into your mission folder:  ammo_burn.sqf, ammo_burn_replace.sqf

2. Put this code in the ammobox init line:

  this setdammage .9; dummy = [this, 90, true] execvm "ammo_burn.sqf";

 Or, put this in a vehicle init (an ammo truck or stryker for example):

  dummy = [this, 90, false] execvm "ammo_burn.sqf";


The setdammage line is optional, but makes it easier to destroy the box, and activate the secondary explosions.

The parameters to the script are:

1. The ammo object (ammo box or vehicle)
2. Duration in seconds for how long the secondary explosions will last.
3. Disappear Boolean.  For ammo box, use true, so ammo box removed at end of script.  For vehicles use false, as you want the wreck to remain.

The secondary explosions will be intense at first, and then lessen frequency over time.  After the duration expires, there are no more explosions, but the fire will continue to burn another 60 seconds.

Note that this is NOT MP tested, and likely needs work to be MP compatible, since I am using createVehicle to replace the ammobox every 15 seconds (to keep it burning).

The funniest thing that happened while testing this, was an AA rocket that shot out of the box actually took down a helicopter flying over head.  I did not expect that!   :D

OFPEC Download
« Last Edit: 06 Feb 2009, 18:38:05 by hoz »
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Re: Secondary Explosions for Ammo Boxes
« Reply #1 on: 27 Aug 2007, 10:56:05 »
Is this script works for other stuffs too? I mean ammo truck or a Stryker (with hypotetically full of explosions)?

The story of the downed helicopter is GREAT!!!  :D


EDIT: Can I ask you to create a readme file (the same text as in the first post) in the zip file? It could be great if anybody want to use it in the future.
« Last Edit: 27 Aug 2007, 11:13:08 by bardosy »
Fix bayonet!

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Secondary Explosions for Ammo Boxes
« Reply #2 on: 27 Aug 2007, 19:24:30 »
Bardosy, thanks for the excellent suggestion.

I have modified the scripts so they now work on vehicles also. 

Changes:

- Script works on any object.
- Launch height for AA missles calculated using max height from boundingBox function.
- If object is a vehicle, the explosions will bounce it around some.
- Added third "disappear_boolean" parameter to control romoval of object at end of script.  For ammo boxes, we set this to true, so player doesn't see the perfect-looking ammo box after all the explosions (because BIS did not create a damaged texture for this object).  For vehicles, we set this to false, so we see the damaged object always.

I will make a ReadMe file tonight after work and re-upload.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: Secondary Explosions for Ammo Boxes
« Reply #3 on: 29 Aug 2007, 18:32:11 »
Thats pretty neat. Will the AI shoot at the ammo boxes?
Xbox Rocks

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Secondary Explosions for Ammo Boxes
« Reply #4 on: 30 Aug 2007, 02:14:54 »
Quote
Will the AI shoot at the ammo boxes?

No.  The ammo boxes are standard ARMA ammo boxes, which AI will not target on their own.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Secondary Explosions for Ammo Boxes
« Reply #5 on: 01 Sep 2007, 16:12:08 »
To ensure MP compatibility add the following line to ammo_burn.sqf just after
_disappear = _this select 2;
Code: [Select]
if (!local _ammo) exitWith {};




Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Secondary Explosions for Ammo Boxes
« Reply #6 on: 04 Sep 2007, 03:37:22 »
I updated this script per Mandoble's instructions, so it should now be MP compatible.

I also updated the comments at the top of ammo_burn.sqs to contain all the usage instructions that are in my first post.  Since all the info is in ammo_burn.sqs, I don't think this needs a readme file.

I think this is complete.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Secondary Explosions for Ammo Boxes and Vehicles (TESTING)
« Reply #7 on: 18 Sep 2007, 21:49:21 »
johnnyboy, a proposal/request to do not have secondary explosions happening far from where the original object is: use the bounding box or the "sizeof" of the object to find out the area where you may generate the explosions.

Example:
Code: [Select]
// sizeof returns the lenght of an existing object type
_size = sizeof typeOf _ammo;

// In length from the center we use half the length of the object as maximum
_radx = random (_size / 2);
// In width from the center we use a quarter of the length of the object as maximum
_rady = random (_size / 4);

_dir = getDir _ammo;
_pos = getPos _ammo;
_direxplosion = random 360;
_posexplosion = [(_pos select 0)+sin(_dir + _direxplosion)*_radx, (_pos select 1)+cos(_dir + _direxplosion)*_rady];

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Secondary Explosions for Ammo Boxes and Vehicles (TESTING)
« Reply #8 on: 19 Sep 2007, 05:20:26 »
Hello Mandoble,

I appreciate the proposal.

However I purposely chose to have secondary explosions occur within about a 10 meter radius of the ammo box or vehicle.

My thinking is some of the ordnance is blasted out of the initial box/vehicle, then explodes.  It works like this:

- Grenades explode randomly within 10 meters of box/vehicle, with a random height up to 10 meters or so.  (I like the explosions in air).
- Large caliber rounds kick up dust on on the ground within 10 or 15 meters of object, randomly.  This simulates bullets flying from the object and impacting the ground nearby.
- AA missles launched from immediately above maximum height of object, at its center.  Angle they launch at is random.  Edit:  AA missles MUST launch outside bounding box of object, or they explode immediately (i.e., do not fly).

(I am going from memory for exact distances of the above, but that is mostly how it works).

I prefer it this way, but people are welcome to tweak it to work any way they want.

Thanks again for thoughts though.

John
« Last Edit: 20 Sep 2007, 06:22:48 by johnnyboy »
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Secondary Explosions for Ammo Boxes and Vehicles (TESTING)
« Reply #9 on: 19 Sep 2007, 12:38:56 »
I've not tested these scripts yet, so I'm basing this comment on this discussion above (probably unwise :scratch:). I see your point Jonny, but I think I'd have all the ammo fired (by using random values for setVelocity, setVectorDir and setVectorUp) from the edge of the object's bounding box, rather than just appearing up to 10m away . I'd rather not have ordinance teleporting through walls and such...
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Secondary Explosions for Ammo Boxes and Vehicles (TESTING)
« Reply #10 on: 20 Sep 2007, 05:59:09 »
Once again guys, I appreciate the suggestions (and the thoughtful time it took to provide suggested code), but I have to respectfully disagree on this one.

This script was designed as a "fun" effect, sort of a fireworks display.  It was featured in my Last Tango in Bagango mission, and people seemed to enjoy it, with the only negative feedback being it lasted too long (so I shortened the duration).

I always want to hear all suggestions, especially from reknowned scripters such as yourselves.   But, I prefer this style of effects, so I feel this is complete. 

If someone wants to make another more subdued/contained version, that's great.  That will just provide more options to choose from for consumers of the scripting resources. 

In fact, I read that Mapfact's Mapfact_misc addon has secondary explosions for their ammo boxes and some vehicles.  I haven't seen them yet...but the point is, people should use whatever effects they prefer for the missions they are making, so the more the better. 

So I hope I'm not offending you guys, especially because I know I'm going to need some math help on some new scripts I'm working on!  ;)
« Last Edit: 20 Sep 2007, 06:19:59 by johnnyboy »
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Secondary Explosions for Ammo Boxes and Vehicles (ACCEPTED)
« Reply #11 on: 20 Sep 2007, 19:35:13 »
Ok, no problem.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Secondary Explosions for Ammo Boxes and Vehicles (ACCEPTED)
« Reply #12 on: 21 Sep 2007, 05:41:55 »
Gracias Mandoble!
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline GaReb

  • Members
  • *
Re: Secondary Explosions for Ammo Boxes and Vehicles (ACCEPTED)
« Reply #13 on: 26 Feb 2008, 23:26:29 »
I hope this thread is still monitored.  I have a problem with certain vehicles and this script.  Any Armored vehicles I use will initiate the explosion and a single rocket will propel out of explosion area....once the rocket lands a good ways away the explosions and sounds are tied to that area thus leaving the vehicle left to just burn with no effects.

Any help would be greatly appreciated.
« Last Edit: 27 Feb 2008, 00:19:14 by GaReb »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Secondary Explosions for Ammo Boxes and Vehicles (ACCEPTED)
« Reply #14 on: 27 Feb 2008, 01:35:43 »
Can you add here more info about how do you execute the script? Parameters, vehicle names, etc.