Advertisement

Author Topic: Anti-Air ammo with time-range fuse  (Read 1999 times)

0 Members and 1 Guest are viewing this topic.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Anti-Air ammo with time-range fuse
« Reply #45 on: 17 Feb 2009, 16:52:46 »
how i can explode shells at given times? What is the command?

There is no command to do this. But it is possible to have airburst ammo in ArmA. I'm currently testing some for the Vulcan. Here's what I did:

Step #1: Create a new ammo type
The original ammo for the Vulcan has no explosionTime set. So I created a new ammo type that explodes immediately after creation.

Code: (config.cpp) [Select]
...
class CfgAmmo {
    class B_20mm_AA;
    class B_20mm_AA_Burst : B_20mm_AA {
        explosionTime = 0.00001; // zero won't work properly!
    };
};
...

Step #2: Replace the fired bullet via script
It goes like this:
- Detect when the gun is fired (via the "Fired" event handler)
- Find all bullets near the gun (via nearObjects).
- There may be "foreign" bullets around so find all bullets that were fired from this gun (comparison of two vectors: bullet velocity and weaponDirection).
- If the bullet was fired from the gun, start a tiny "fuse script" that waits and then replaces the old bullet (the non-exploding one) with the new one (that explode immediately after creation).


This approach works pretty well considering the high RPM rate of the M168. I'll try to create example mission so you can have a look at it. Just give me a day or two.
try { return true; } finally { return false; }

Offline Centerbe

  • Members
  • *
Re: Anti-Air ammo with time-range fuse
« Reply #46 on: 17 Feb 2009, 17:14:15 »
Well, i use just now a fired event handler for initialize this script execution, i will initialize with init event handler i think....

My bullet have just a time airburst... i need redefine it as 0.0000001sec
But i dont understand why explode it immediately and then replace with other?

Afther you simply create an explosion at given time? But the targets between the barrel and predicted explosion dosent inpact in any object? U can hit only if target is at determinate point?

 ???

The mandoble script work.... this is the code
Code: [Select]
////////////////////////////////////////
//                                    //
//      Mandoble Time Fuse Shells     //
//                //
//                //
////////////////////////////////////////

  private["_ship", "_trigger", "_planes", "_msg", "_dist", "_target", "_atarget", "_wvdir", "_aweapon", "_diff"];
   _ship = _this select 0;
   _target = _this select 0;
   _maxrange = 5000;
   _trigger = createTrigger ["EmptyDetector", getPos _ship];
   _trigger setTriggerActivation ["ANY", "PRESENT", false];
   _trigger setTriggerArea [_maxrange, _maxrange, 0, false];
   _trigger setTriggerType "NONE";
   _trigger setTriggerStatements ["this", "", ""];
   _trigger setTriggerTimeout [0, 0, 0, false ];
   Sleep 1;
   while {true} do
   {
      _trigger setPos getPos _ship;
      _planes = [];
     
      {
         if (_x isKindOf "Air") then
         {
            if ((isEngineOn _x) && (side _x == east)) then
            {
               _planes = _planes + [_x];
             
            };
         };
      } forEach list _trigger;
                   
        if (count _planes > 0) then
            {
               
          _msg = "";
         {
       _target = _x;
       _atarget = ((getPos _target select 0)-(getPos _ship select 0)) atan2 ((getPos _target select 1)-(getPos _ship select 1));
             _wvdir = _ship weaponDirection "5inch"; // If 5inch is any weapon ...
             _aweapon = (_wvdir select 0) atan2 (_wvdir select 1);
             _diff = _atarget - _aweapon;
           
            if ((_diff < 4) && (_diff > -4)) then
            {
             _dist = _x distance _ship;
             _times = _dist / 790;            //   if 790 is the muzzle velocity in m/s
             _msg = _msg + format["Target:%1 - Range: %2\n", _x, _times];
            };
           
         } forEach _planes;
         hint format ["%1",_msg];          // show the times for predicted targets
      };
      Sleep 0.5;
   };


« Last Edit: 17 Feb 2009, 18:05:36 by Centerbe »

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Anti-Air ammo with time-range fuse
« Reply #47 on: 17 Feb 2009, 18:05:44 »
I think we have a language problem here. Let me explain again what happens:

1. The gun fires a regular, non-exploding bullet ("BulletA").
2. A script ("Script1") detects this bullet and starts another script ("Script2").
3. "Script2" waits 1s, 2s, whatever and then deletes "BulletA".
4. "Script2" then creates a new bullet ("BulletB") at the same position where the "BulletA" was. "BulletB" has a explosionTime of 0.0001s so it will explode immediately.
« Last Edit: 17 Feb 2009, 22:40:33 by Worldeater »
try { return true; } finally { return false; }

Offline Centerbe

  • Members
  • *
Re: Anti-Air ammo with time-range fuse
« Reply #48 on: 17 Feb 2009, 18:16:52 »
im sorry.... english isnt my mother leanguage as you can see.
you can not understand how much I'm ashamed now...   ::)

i imagine that bullet B will be created only if buttet A havent inpacted anything.... in other case we have 2 explosions   :D
« Last Edit: 17 Feb 2009, 18:27:38 by Centerbe »

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Anti-Air ammo with time-range fuse
« Reply #49 on: 17 Feb 2009, 18:30:05 »
I have to appologize for making you feel bad. It wasn't my intent to do so.

I'm just trying to help since I think this destroyer is a great project and should get all available support!
try { return true; } finally { return false; }

Offline Centerbe

  • Members
  • *
Re: Anti-Air ammo with time-range fuse
« Reply #50 on: 17 Feb 2009, 18:42:08 »
sure... its a great and also FREE project.... because my addons are all free for editing, who want partecipate to this project is wellcome. But its an hard work, much textures, models, polygons, turrets, guns, ammos, configs to do... ...ecc ecc

have u see the video of fletcher in action?
http://www.armaholic.com/forums.php?m=posts&p=44615&n=last#bottom
« Last Edit: 17 Feb 2009, 21:42:07 by Centerbe »

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Anti-Air ammo with time-range fuse
« Reply #51 on: 19 Feb 2009, 12:10:38 »
Yes, I saw this video. The whole thing just looks great!

And about the airburst ammo: yes, my script checks if bullet A still exists.
« Last Edit: 19 Feb 2009, 13:33:31 by Worldeater »
try { return true; } finally { return false; }