Advertisement

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

0 Members and 1 Guest are viewing this topic.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Secondary Explosions for Ammo Boxes and Vehicles (ACCEPTED)
« Reply #15 on: 27 Feb 2008, 04:15:28 »
@GaReb:  Have you tried the sample mission in the 1st post?  It has an ammo truck example, and you can see how the script was called for that.

For an armored vehicle, it might look funny for missles to be flying out of it while its burning though...

Which type of armored vehicle are you using?   If you tell me, I will try a quick test on that particular vehicle.

Edit:  I have tested with armored vehicle, and there is definitely a problem.  Thanks for reporting this.  I am now looking into this, but it make take a few days, as I am buried with job and real life right now.

Edit2:  I know what the problem is. 

The problem is that I am using a Mine object as a marker object around which to center the explosions:

Code: [Select]
     _marker = "MINE" createvehicle _orig_pos;
As we all know, armored vehicles set off mines, so the object is destroyed, which makes this script not work for armored vehicles.

I needed an object other than the original object to serve as a marker because ammo boxes did not burn very long, and I needed to create and replace them with new ammo box objects.  An object is also needed by the modelToWorld commands used later for random placement of explosions:

Code: [Select]
           _pos = _marker modelToWorld [-5 + floor (random 10), -5 + floor(random 10),.2];
           _obj="B_25mm_HE" createvehicle _pos;     

I have tried using other objects as markers, like the HeliHEmpty and RoadCone, but the engine incorrectly places these objects a few  meters away from the original object's center (probably to avoid object collision).  This results in the effects being centered in the wrong position.

To fix this I have 2 options:

1. Find another small or invisible object that the engine will place precisely under the vehicle (rather than engine choosing to offset the placement).  Or...

2. Significantly re-write the code to not use marker objects.

I don't have time for option 2, so I am hoping to find another small or invisible object that can be created under a vehicle via this command:

Code: [Select]
     _marker = "smallObjectName" createvehicle _orig_pos;
Any ideas anyone?  What about the crater burn object...anybody know the name for that?
« Last Edit: 27 Feb 2008, 09:20:19 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 #16 on: 27 Feb 2008, 10:16:12 »
Code: [Select]
_marker = "logic" createVehicleLocal _orig_pos;

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Secondary Explosions for Ammo Boxes and Vehicles (ACCEPTED)
« Reply #17 on: 27 Feb 2008, 19:04:01 »
@Mandoble: 

Gracias dude!  The logic object got me half-way there.  However, it was still placed at an offset from the vehicle's position in the editor.  So I thought of temporarily moving the vehicle before placing the object, which works!

I changed the following...

Code: [Select]
_orig_pos = getpos _ammo;
_marker = "logic" createvehicle _orig_pos;

...to...

Code: [Select]
_orig_pos = getpos _ammo;
_ammo setpos [0,0,0];
sleep .05;
_marker = "logic" createvehicle _orig_pos;
_ammo setpos _orig_pos;

@GaReb: 

I attached the modified ammo_burn.sqf script to this post.  Replace the one you are using with this.

@All:

I will update sample mission and re-upload it later, and then request an Admin to re-Accept the resource.  Now that it works for Armored Vehicles, there are few more details to fix:

1. Add a parameter to drive whether or not AA rockets will shoot out of vehicle (it look silly to see AA rockets shooting out of a burning Abrams!).
2. Modify vehicle jump code.  For Car type vehicles (like ammo truck), I have setVelocity commands that make it jump 1  or 2 meters during explosions.  The exact same SetVelocity command used on an armored vehicle makes it jump 10 to 30 meters.  I don't understand this, as I would think a heavier vehicle would move less, not more.  In the .sqf attached this post, I have disabled jumping for armored vehicles.
« Last Edit: 27 Feb 2008, 19:07:21 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...