Home   Help Search Login Register  

Author Topic: Generate explosions ina random area  (Read 1397 times)

0 Members and 1 Guest are viewing this topic.

Offline ZapBrannigan

  • Members
  • *
Generate explosions ina random area
« on: 30 Jul 2007, 04:04:59 »
I need the lines of code that will genrate explossions in a radius of 30 meters out from an object. I need to be able to put it in a script.  I just forgot how to do that part. Thanks

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Generate explosions ina random area
« Reply #1 on: 30 Jul 2007, 10:35:12 »
Code: [Select]
// Bomb_area.sqf
//
// nil = [vehicle player, 2, 30, 60, 5, 15]execVM "Bomb_area.sqf"

_object = _this select 0;
_maxdelay = _this select 1;
_min_radius = _this select 2;
_max_radius = _this select 3;
_min_explosions = _this select 4;
_max_explosions = _this select 5;

_nexplosions = _min_explosions + random (_max_explosions - _min_explosions);

for [{_i=0},{_i < _nexplosions},{_i = _i + 1}] do
{
   _rad = _min_radius + random (_max_radius - _min_radius);
   _ang = random 360;
   _bomb = "Bomb" createVehicle [(getPos _object select 0)+sin(_ang)*_rad, (getPos _object select 1)+cos(_ang)*_rad, 0];
   _bomb setDamage 1;
   Sleep (0.5 + random _maxdelay);
};

Offline ZapBrannigan

  • Members
  • *
Re: Generate explosions ina random area
« Reply #2 on: 30 Jul 2007, 21:50:00 »
Excelent, thank you