Advertisement
Guest User

Untitled

a guest
May 24th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.64 KB | None | 0 0
  1. /*
  2.     Author: Karel Moricky
  3.     Modified by Shpook.
  4.     Description:
  5.     Destroys everything in given area.
  6.  
  7.     Parameter(s):
  8.     _this select 0: OBJECT - Destruction center
  9.     _this select 1 (Optional): NUMBER - Destruction area diameter
  10.     _this select 2 (Optional): NUMBER - Random seed
  11.  
  12. */
  13. if (!isserver) exitwith {};
  14.  
  15. private ["_center","_areaSize","_seed","_blacklist","_buildings","_pos","_posX","_posY","_posTotal","_seedLocal","_fire","_explo"];
  16. _center = _this select 0;
  17. _areaSize = if (count _this > 1) then {_this select 1} else {1000};
  18. _seed = if (count _this > 2) then {_this select 2} else {1138};
  19. _blacklist = if (count _this > 3) then {_this select 3} else {[]};
  20.  
  21. if (typename _center == typename "") then {_center = markerpos _center};
  22. if (typename _center == typename objnull) then {_center = position _center};
  23.  
  24. if (_areaSize < 0) then {_areaSize = 100;};
  25.  
  26. if (_seed < 0) then {_seed = 1138;};
  27. _seed =  round(_seed % 42);
  28. if (_seed == 0) then {_seed = 42;};
  29.  
  30. // Use this for destruction of houses and house objects only.
  31. //_buildings = _center nearobjects ["house",_areaSize];
  32.  
  33. // Use this for destruction of everything.
  34. _buildings = nearestObjects [_center, [], _areaSize];
  35.  
  36. _buildings = _buildings - _blacklist;
  37.  
  38. {
  39.     _pos = position _x;
  40.     _posX = _pos select 0;
  41.     _posY = _pos select 1;
  42.     _posTotal = _posX + _posY;
  43.     _seedLocal = (_posTotal % _seed) / _seed;
  44.     if (_seedLocal > 0.99) then {                                    // Change this value to change how much smoke is spawned. Lower number = more smoke
  45.         _fire = createvehicle ["test_EmptyObjectForFireBig",position _x,[],0,"none"];
  46.     };
  47.     _x setdamage 1;
  48. } foreach _buildings;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement