Jump to content

Khalashnikovf

Member
  • Content Count

    114
  • Joined

  • Last visited

  • Medals

Posts posted by Khalashnikovf


  1. So, thanks for all help with this preprocess and spawn thing but i figured out that its still doesnt work for me like I want.

    Well, it works like it should, but after restart of mission.

    For the first time its just completely overloaded and mission got stuck for at least 5 - 10 seconds.

    Any suggestions what with that?

    Here are all script running for that all mess...

    Init:

    waitUntil {player == player};
    ShockpushPreLoad = compile preprocessFileLineNumbers "lk\nuke\shockpush.sqf";
    ShockWavePreLoad = compile preprocessFileLineNumbers "lk\nuke\shockawe.sqf";
    NukePreLoad = compile preprocessFileLineNumbers "lk\nuke\nuke.sqf";

    nuke_countdown.sqf

    //----------------------------------------------------------------------
    // Script for countdown of Nuclear explosion
    //
    // Example nul = [center,10] execvm "lk\nuke\shockawe.sqf";
    // center is center of explosion, 10 is countdown time in seconds
    //
    // Made by Khalashnikovf
    //----------------------------------------------------------------------
    
    _pos = _this select 0;
    _t = _this select 1;
    prelaunch = _this select 2;
    
    _s = 0; _zh = 0;
    _m = 0; _zm = 0;
    _h = 0; _zs = 0;
    _earlier = false;
    
    if (_t < 60) then
    {
    _s = _t;
    };
    
    if (_t >= 60) then
    {
    _m = floor(_t / 60);
    _s = _t - 60*_m;
    if (_m >= 60) then
    	{
    	_h = floor(_m / 60);
    	_m = _m - 60*_h;
    	};
    };
    
    if (_h < 10) then {_zh = "0";} else {_zh = "";};
    if (_m < 10) then {_zm = "0";} else {_zm = "";};
    if (_s < 10) then {_zs = "0";} else {_zs = "";};
    
    hintSilent parseText format ["<t color='#ff3300' size='2.0' shadow='1' shadowColor='#000000' align='center'>%1%2:%3%4:%5%6</t>",_zh,_h,_zm,_m,_zs,_s];
    
    while {_t > 0} do
    {
    if (_s == 0) then
    {
    	_s = 60;
    	_m = _m - 1;
    	if (_m <= 0 and _h > 0) then {_m = 59; _h = _h - 1;};
    };
    
    _s = _s - 1;
    _t = _t - 1;
    
    if (_h < 10) then {_zh = "0";} else {_zh = "";};
    if (_m < 10) then {_zm = "0";} else {_zm = "";};
    if (_s < 10) then {_zs = "0";} else {_zs = "";};
    
    sleep 1;
    hintSilent parseText format ["<t color='#ff3300' size='2.0' shadow='1' shadowColor='#000000' align='center'>%1%2:%3%4:%5%6</t>",_zh,_h,_zm,_m,_zs,_s];
    
    // random launch of Nuke earlier than after countdown	
    _trig = random ceil 80;
    if (_t < 10 and _trig > 0 and _trig < 3 and !_earlier and prelaunch) then
    {
    nul = [_pos] execvm "lk\nuke\nuke.sqf";
    _earlier = true; _t = 0;
    };
    //---------------------------------------------------	
    };
    
    delay = ceil random 5;
    
    while { _t < delay} do {
    hintSilent parseText format ["<t color='#ff3300' size='2.0' shadow='1' shadowColor='#000000' align='center'>%1%2:%3%4:%5%6</t>",_zh,_h,_zm,_m,_zs,_s];
    sleep 0.2;
    hintSilent parseText format ["<t color='#ffaa00' size='2.0' shadow='1' shadowColor='#000000' align='center'>%1%2:%3%4:%5%6</t>",_zh,_h,_zm,_m,_zs,_s];
    sleep 0.2;
    _t = _t + 0.4;
    };
    
    if (!_earlier) then {
    [_pos] spawn NukePreLoad;
    };

    nuke.sqf (by lk with little time modifications (maybe its that problem, that I shorten some first sleep times to minimum to avoid such a long wait for blast))

    _pos = _this select 0;
    
    nul = [] execVM "lk\nuke\nenvi.sqf";
    
    if (player distance _pos < 6000) then {
    // setup of overbrigtness since inpact
    setaperture 3;
    
    "dynamicBlur" ppEffectEnable true;
    "dynamicBlur" ppEffectAdjust [0.5];
    "dynamicBlur" ppEffectCommit 0.5; //2
    
    sleep 0.3;
    
    "dynamicBlur" ppEffectAdjust [2];
    "dynamicBlur" ppEffectCommit 0.4; //1
    
    "dynamicBlur" ppEffectAdjust [1];
    "dynamicBlur" ppEffectCommit 0.5; //2
    
    };
    
    sleep 1; //1
    
    //*******************************************************************
    //*******************************************************************
    
    _Cone = "#particlesource" createVehicleLocal getpos _pos;
    _Cone setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48], "", "Billboard", 1, 10, [0, 0, 0],
    			[0, 0, 0], 0, 1.275, 1, 0, [40,80], [[0.25, 0.25, 0.25, 0], [0.25, 0.25, 0.25, 0.5], 
    			[0.25, 0.25, 0.25, 0.5], [0.25, 0.25, 0.25, 0.05], [0.25, 0.25, 0.25, 0]], [0.25], 0.1, 1, "", "", _pos];
    _Cone setParticleRandom [2, [1, 1, 30], [1, 1, 30], 0, 0, [0, 0, 0, 0.1], 0, 0];
    _Cone setParticleCircle [10, [-10, -10, 20]];
    _Cone setDropInterval 0.005;
    
    _top = "#particlesource" createVehicleLocal getpos _pos;
    _top setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 3, 48, 0], "", "Billboard", 1, 21, [0, 0, 0],
    			[0, 0, 65], 0, 1.7, 1, 0, [100,80,110], [[1, 1, 1, -10],[1, 1, 1, -7],[1, 1, 1, -4],[1, 1, 1, -0.5],[1, 1, 1, 0]], [0.05], 1, 1, "", "", _pos];
    _top setParticleRandom [0, [75, 75, 15], [17, 17, 10], 0, 0, [0, 0, 0, 0], 0, 0, 360];
    _top setDropInterval 0.002;
    
    _top2 = "#particlesource" createVehicleLocal getpos _pos;
    _top2 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 3, 112, 0], "", "Billboard", 1, 22, [0, 0, 0],
    			[0, 0, 60], 0, 1.7, 1, 0, [100,80,100], [[1, 1, 1, 0.5],[1, 1, 1, 0]], [0.07], 1, 1, "", "", _pos];
    _top2 setParticleRandom [0, [75, 75, 15], [17, 17, 10], 0, 0, [0, 0, 0, 0], 0, 0, 360];
    _top2 setDropInterval 0.002;
    
    
    _smoke = "#particlesource" createVehicleLocal getpos _pos;
    _smoke setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48, 1], "", "Billboard", 1, 25, [0, 0, 0],
    			[0, 0, 70], 0, 1.7, 1, 0, [50,20,120], 
    			[[1, 1, 1, 0.4],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0]]
    			, [0.5, 0.1], 1, 1, "", "", _pos];
    _smoke setParticleRandom [0, [10, 10, 15], [15, 15, 7], 0, 0, [0, 0, 0, 0], 0, 0, 360];
    _smoke setDropInterval 0.002;
    
    
    _Wave = "#particlesource" createVehicleLocal getpos _pos;
    _Wave setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48], "", "Billboard", 1, 20/2, [0, 0, 0],
    			[0, 0, 0], 0, 1.5, 1, 0, [50, 100], [[0.1, 0.1, 0.1, 0.5], 
    			[0.5, 0.5, 0.5, 0.5], [1, 1, 1, 0.3], [1, 1, 1, 0]], [1,0.5], 0.1, 1, "", "", _pos];
    _Wave setParticleRandom [2, [20, 20, 20], [5, 5, 0], 0, 0, [0, 0, 0, 0.1], 0, 0];
    _Wave setParticleCircle [50, [-80, -80, 2.5]];
    _Wave setDropInterval 0.0002;
    
    _light = "#lightpoint" createVehicleLocal [((getpos _pos select 0)),(getpos _pos select 1),((getpos _pos select 2)+800)];
    _light setLightAmbient[1500, 1200, 1000];
    _light setLightColor[1500, 1200, 1000];
    _light setLightBrightness 1000000.0;
    
    //*******************************************************************
    //*******************************************************************
    
    sleep 0.5; //3
    
    _Wave setDropInterval 0.001;
    deletevehicle _top;
    deletevehicle _top2;
    
    sleep 0.5;
    
    player spawn envi;
    [_pos] spawn ShockWavePreLoad;
    // -- color correction into red blasted one
    _hndl = ppEffectCreate ["colorCorrections", 1501];
    _hndl ppEffectEnable true;
    _hndl ppEffectAdjust[ 1, 1, 0, [0, 0, 0, 0.5],[1.2, 0.05, -0.12, 0.5],[0.2, 0.59, 0.11, 0]];
    _hndl ppEffectCommit 4;
    
    player spawn quake;
    
    
    if (player distance _pos < 1000) then {playsound "nuke2s";};
    if (player distance _pos > 1000) then {playsound "nuke1s";};
    
    sleep 1;
    setaperture -1;
    
    _top3 = "#particlesource" createVehicleLocal getpos _pos;
    _top3 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 3, 48, 0], "", "Billboard", 1, 24, [0, 0, 450],
    			[0, 0, 49], 0, 1.7, 1, 0, [120,130,150], [[1, 1, 1, -10],[1, 1, 1, -7],[1, 1, 1, -4],[1, 1, 1, -0.5],[1, 1, 1, 0]], [0.05], 1, 1, "", "", _pos];
    _top3 setParticleRandom [0, [75, 75, 15], [17, 17, 10], 0, 0, [0, 0, 0, 0], 0, 0, 360];
    _top3 setDropInterval 0.002;
    sleep 4;
    deletevehicle _top3;
    
    sleep 4;
    // -- color correction into yellow aftershock one
    _hndl = ppEffectCreate ["colorCorrections", 1501];
    _hndl ppEffectEnable true;
    _hndl ppEffectAdjust[ 1, 1, 0, [0, 0, 0, 0.6],[2.8, 2.5, 0.7, 0.4],[0.2, 0.59, 0.11, 0]];
    _hndl ppEffectCommit 5;
    
    if (player distance _pos < 4000) then {
    "dynamicBlur" ppEffectAdjust [0];
    "dynamicBlur" ppEffectCommit 1;
    };
    
    _top4 = "#particlesource" createVehicleLocal getpos _pos;
    _top4 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 3, 48, 0], "", "Billboard", 1, 22, [0, 0, 770],
    			[0, 0, 30], 0, 1.7, 1, 0, [100,120,140], [[1, 1, 1, -10],[1, 1, 1, -7],[1, 1, 1, -4],[1, 1, 1, -0.5],[1, 1, 1, 0]], [0.05], 1, 1, "", "", _pos];
    _top4 setParticleRandom [0, [75, 75, 15], [17, 17, 10], 0, 0, [0, 0, 0, 0], 0, 0, 360];
    _top4 setDropInterval 0.002;
    sleep 3;
    
    _top4 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 3, 48, 0], "", "Billboard", 1, 25, [0, 0, 830],
    			[0, 0, 30], 0, 1.7, 1, 0, [100,120,140], [[1, 1, 1, -10],[1, 1, 1, -7],[1, 1, 1, -4],[1, 1, 1, -0.5],[1, 1, 1, 0]], [0.05], 1, 1, "", "", _pos];
    
    
    
    _Wave setDropInterval 0.001*10;
    _Wave setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48], "", "Billboard", 1, 20/2, [0, 0, 0],
    			[0, 0, 0], 0, 1.5, 1, 0, [50, 100], [[0.1, 0.1, 0.1, 0.5], 
    			[0.5, 0.5, 0.5, 0.5], [1, 1, 1, 0.3], [1, 1, 1, 0]], [1,0.5], 0.1, 1, "", "", _pos];
    _Wave setParticleCircle [50, [-40, -40, 2.5]];
    
    player spawn ash;
    windv=true;
    player spawn wind;
    30 setovercast 0.8;
    
    deleteVehicle _light;
    
    60 setRain 1;
    
    sleep 4;
    // -- color correction into grey cold ash
    _hndl = ppEffectCreate ["colorCorrections", 1501];
    _hndl ppEffectEnable true;
    _hndl ppEffectAdjust[ 1, 1, 0, [0, 0, 0, 0.8],[-0.09, 0.96, 2.63, 0.6],[0.4, 0.59, 0.11, 0]];
    _hndl ppEffectCommit 120; //120
    
    deletevehicle _top4;
    
    _i = 0;
    while {_i < 100} do
    {
    _light setLightBrightness (100.0 - _i)/100;
    _i = _i + 1;
    sleep 0.1;
    };
    
    
    for "_i" from 0 to 15 do {
    _smoke setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48, 1], "", "Billboard", 1, 25, [0, 0, 0],
    				[0, 0, 60+_i], 0, 1.7, 1, 0, [40,15,120], 
    				[[1, 1, 1, 0.4],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0.7],[1, 1, 1, 0]]
    				, [0.5, 0.1], 1, 1, "", "", _pos];
    };
    
    
    _timeNow = time;
    waituntil {(time - _timeNow) > 300}; //300
    
    _smoke setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48, 1], "", "Billboard", 1, 25, [0, 0, 0],
    			[0, 0, 30], 0, 1.7, 1, 0, [40,25+10,80], 
    			[[1, 1, 1, 0.2],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0]]
    			, [0.5, 0.1], 1, 1, "", "", _pos];
    
    _smoke setDropInterval 0.012;
    _Cone setDropInterval 0.02;
    _Wave setDropInterval 0.01;
    
    sleep 10;
    deleteVehicle _Wave;
    deleteVehicle _cone;
    deleteVehicle _smoke;
    deletevehicle snow;
    // -- color correction into almost origin
    _hndl = ppEffectCreate ["colorCorrections", 1501];
    _hndl ppEffectEnable true;
    _hndl ppEffectAdjust[ 1, 1, 0, [0, 0, 0, 0.71],[0.48, 1.19, 0.4, 1.09],[0.2, 0.69, 0.11, 0]];
    _hndl ppEffectCommit 280; //280
    
    sleep 300; //300
    
    
    "filmGrain" ppEffectEnable false;
    sleep 10;
    "colorCorrections" ppEffectEnable false;
    sleep 10;
    60 setovercast 0;
    windv=false;
    
    setwind [0,0,true];
    
    

    shockawe.sqf

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Shockwave script 0.9
    //
    // Made by Khalashnikovf
    // Thanks to lk and his awesome Nuke script
    //
    // Script is working to best of simulates effect caused by huge esplosion which is affecting close by units.
    // Whole effect is based on speed of spreading wave in air and its power according to distance from center of explosion.
    // Function works in hyperbolic and logharithm curves to make most believeble progress of blast
    // It also "waporize" closest units especially men.
    //
    // Example: nul = [center] execvm "lk\nuke\shockawe.sqf"; (center is a center of explosion)
    //
    // Completed work: Almost everything
    // Work to be done: so far so good
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    _pos = _this select 0;
    _spread = 300;  // speed of shockwave in air (speed of sound is 340)
    _spreadHeat = 800; // speed of heat wave in air
    
    deletemarkerlocal "nukemarker";
    
    nul = [_pos] execVM "lk\nuke\shockaweStatic.sqf";
    
    // Instant waporazing of any vehicle or unit in closest area to Blast
    
    heatWaveSpreadDistance = 0;
    shockWaveSpreadDistance = 0;
    
    _array = _pos nearObjects ["Motorcycle",100];
    {deleteVehicle _x;} forEach _array;
    _array = _pos nearObjects ["Car",100];
    {deleteVehicle _x;} forEach _array;
    _array = _pos nearObjects ["StaticWeapon", 100];
    {deleteVehicle _x;} forEach _array;
    _array = _pos nearObjects ["Tank", 75];
    {deleteVehicle _x;} forEach _array;
    _array = _pos nearObjects ["Ship", 100];
    {deleteVehicle _x;} forEach _array;
    _array = _pos nearObjects ["Air",50];
    {deleteVehicle _x;} forEach _array;
    _array = _pos nearObjects ["Man", 150];
    {deleteVehicle _x;} forEach _array;
    _array = _pos nearObjects ["Thing", 600];
    {_x setDamage 1;} forEach _array;
    
    // Shockwave affect
    _array = _pos nearObjects ["Man", 50000];
    {[_x,_pos] spawn ShockpushPreLoad} forEach _array;
    //nul = [_x,_pos] execvm "lk\nuke\shockpush.sqf";
    _array = _pos nearObjects ["Air",50000];
    {[_x,_pos] spawn ShockpushPreLoad} forEach _array;
    
    _array = _pos nearObjects ["Motorcycle",50000];
    {[_x,_pos] spawn ShockpushPreLoad} forEach _array;
    
    _array = _pos nearObjects ["Car",50000];
    {[_x,_pos] spawn ShockpushPreLoad} forEach _array;
    
    _array = _pos nearObjects ["Tank", 50000];
    {[_x,_pos] spawn ShockpushPreLoad} forEach _array;
    
    _array = _pos nearObjects ["Ship", 50000];
    {[_x,_pos] spawn ShockpushPreLoad} forEach _array;
    
    _array = _pos nearObjects ["StaticWeapon", 50000];
    {[_x,_pos] spawn ShockpushPreLoad} forEach _array;
    
    nul = [_pos] execVM "lk\nuke\radzone.sqf";
    
    while {shockWaveSpreadDistance < 9999} do {
    heatWaveSpreadDistance = heatWaveSpreadDistance + ln(30000 - heatWaveSpreadDistance)*78/10;
    shockWaveSpreadDistance = shockWaveSpreadDistance + ln(10000 - shockWaveSpreadDistance)*32/10;
    sleep 0.1;
    };
    

    shockaweStatic.sqf (for everything in closest area and all buildings so far)

    private ["_array","_pos","_rad","_force","_xPos","_yPos","_push","_time","_xVel","_yVel","_zVel","_coef"];
    
    _pos = _this select 0;
    
    sleep (200/180);
    
    {_x setDamage 1} forEach nearestObjects [_pos,[],400];
    
    sleep (300/180);
    
    _array = _pos nearObjects ["Strategic", 900];
    {if (_x distance _pos > 400) then {_x setDamage (0.9999);};} forEach _array;
    _array = _pos nearObjects ["NonStrategic", 900];
    {if (_x distance _pos > 400) then {_x setDamage (0.9999);};} forEach _array;
    
    sleep (400/180);
    
    _array = _pos nearObjects ["Strategic", 1500];
    {if (_x distance _pos > 900) then {_x setDamage (0.5 + random 0.3);};} forEach _array;
    _array = _pos nearObjects ["NonStrategic", 1500];
    {if (_x distance _pos > 900) then {_x setDamage (0.5 + random 0.3);};} forEach _array;

    shockpush.sqf (this script is runned for even a hundred times ... depends on number of unit in world)

    private ["_unit","_pos","_rad","_force","_xPos","_yPos","_xVel","_yVel","_zVel","_coef","_fi",
    "_n","_fi","_dam","_vel","_vecUp","_nX","_nY","_nXX","_nYY","_leanF","_leanX","_leanY","_cyklus","_theta",
    "_diference","_fXX","_fYY","_fZZ","_xxF","_yyF","_zzF","_spread","_omega","_heatRad","_timeAfter","_plus","_radRad",
    "_material","_intenzity","_Sound","_soundPos","_SoundWave","_SoundTurbolence","_lenght","_height","_width","_weight",
    "_weakness1","_weakness2","_cubature","_acc","_steel"];
    
    // -- Declaration
    _unit = _this select 0; 		// unit affected by shockwave
    _pos = _this select 1;  		// centre of explosion
    
    _theta = 0;
    _omega = 0;
    _n = 0;
    _coef = 0;
    _fi = 0;
    _leaner = 0.04; // how quickly will units lean into right position after impact
    
    // -- vehicle properties
    _lenght = 0;
    _height = 0;
    _width = 0;
    _weight = 0;
    _weakness1 = "";
    _weakness2 = "";
    _steel = 0; //1 - Human , 2 - Cars , 3 - Trucks,Choppers,Planes, 4 - HMMWV,Jackal, 8 - T34,T55,APC, 10 - M1A1,T72,T90
    
    // BAF_FV510_D , BAF_ATV_D , BAF_Jackal2_GMG_D , BAF_Jackal2_L2A1_D , BAF_Offroad_D
    
    // -- Declaration of Unit type
    if (_unit isKindOf "Car") then {_coef = 140; _lenght = 4.5; _height = 1.3; _width = 1.6; _weight = 800;};
    if (_unit isKindOf "Bus") then {_coef = 140;  _lenght = 10; _height = 3; _width = 2.5; _weight = 5800;};
    if (_unit isKindOf "HMMWV_Base") then {_coef = 140; _lenght = 4.6; _height = 1.8; _width = 1.8; _weight = 2340;};
    if (_unit isKindOf "SUV_Base_EP1") then {_coef = 140; _lenght = 4.8; _height = 1.7; _width = 1.8; _weight = 2340;};
    if (_unit isKindOf "ArmoredSUV_Base_PMC") then {_coef = 140; _lenght = 4.8; _height = 1.7; _width = 1.8; _weight = 2540;};
    if (_unit isKindOf "Lada_base") then {_coef = 140; _lenght = 4.0; _height = 1.3; _width = 1.6; _weight = 800;};
    if (_unit isKindOf "Offroad_DSHKM_base") then {_coef = 140; _lenght = 4.12; _height = 1.8; _width = 1.64; _weight = 800;};
    if (_unit isKindOf "Pickup_PK_base") then {_coef = 140; _lenght = 4.1; _height = 1.8; _width = 1.6; _weight = 1000;};
    if (_unit isKindOf "LandRover_Base") then {_coef = 140; _lenght = 4.1; _height = 1.8; _width = 1.6; _weight = 1500;};		
    if (_unit isKindOf "SkodaBase") then {_coef = 140; _lenght = 4.16; _height = 1.4; _width = 1.595; _weight = 800;};
    if (_unit isKindOf "tractor") then {_coef = 140; _lenght = 3.67; _height = 2.71; _width = 1.91; _weight = 3740;};
    if (_unit isKindOf "Truck") then {_coef = 140; _lenght = 7.35; _height = 3.09; _width = 2.40; _weight = 10210;};
    if (_unit isKindOf "MAZ_543_SCUD_Base_EP1") then {_coef = 120; _lenght = 12.35; _height = 4.09; _width = 3.80; _weight = 16300;};
    if (_unit isKindOf "ATV_Base_EP1") then {_coef = 140; _lenght = 2.12; _height = 1.09; _width = 1.20; _weight = 100;};
    if (_unit isKindOf "UAZ_Base") then {_coef = 140; _lenght = 4.02; _height = 2.05; _width = 1.78; _weight = 1650;};
    if (_unit isKindOf "Wheeled_APC") then {_coef = 140; _lenght = 5.50; _height = 2.35; _width = 2.30; _weight = 5300;};
    if (_unit isKindOf "Motorcycle") then {_coef = 150; _lenght = 1.33; _height = 0.83; _width = 0.3; _weight = 105;};
    if (_unit isKindOf "Tank") then {_coef = 120; _lenght = 9.82; _height = 2.72; _width = 3.79; _weight = 48200;};
    if (_unit isKindOf "2S6M_Tunguska") then {_coef = 120; _lenght = 9.82; _height = 2.72; _width = 3.79; _weight = 48200;};
    if (_unit isKindOf "APC") then {_coef = 120; _lenght = 5.50; _height = 2.35; _width = 2.30; _weight = 5300;};
    if (_unit isKindOf "StrykerBase_EP1") then {_coef = 120; _lenght = 6.95; _height = 2.64; _width = 2.72; _weight = 24000;};
    if (_unit isKindOf "Tracked_APC") then {_coef = 120; _lenght = 7.94; _height = 3.26; _width = 3.27; _weight = 29100;};
    if (_unit isKindOf "M1A1") then {_coef = 120; _lenght = 7.93; _height = 2.4; _width = 3.66; _weight = 61300;};
    if (_unit isKindOf "M2A2_Base") then {_coef = 120; _lenght = 6.55; _height = 2.98; _width = 3.60; _weight = 27600;};
    if (_unit isKindOf "T34") then {_coef = 120; _lenght = 6.68; _height = 2.45; _width = 3.00; _weight = 26500;};
    if (_unit isKindOf "T72_Base") then {_coef = 120; _lenght = 6.95; _height = 2.23; _width = 3.59; _weight = 41500;};
    if (_unit isKindOf "T90") then {_coef = 120; _lenght = 9.53; _height = 2.22; _width = 3.78; _weight = 46500;};
    if (_unit isKindOf "ZSU_Base") then {_coef = 120; _lenght = 6.53; _height = 2.57; _width = 3.12; _weight = 16000;};
    if (_unit isKindOf "MLRS_base") then {_coef = 120; _lenght = 6.85; _height = 2.59; _width = 2.97; _weight = 24950;};
    if (_unit isKindOf "Man") then {_coef = 180; _lenght = 0.35; _height = 1.77; _width = 0.41; _weight = 90;};
    if (_unit isKindOf "Cow") then {_coef = 180; _lenght = 3.03; _height = 1.45; _width = 0.5; _weight = 750;};
    if (_unit isKindOf "Goat") then {_coef = 200; _lenght = 1.53; _height = 0.70; _width = 0.4; _weight = 80;};
    if (_unit isKindOf "Hen") then {_coef = 280; _lenght = 0.30; _height = 0.37; _width = 0.18; _weight = 3.5;};
    if (_unit isKindOf "Rabbit") then {_coef = 280; _lenght = 0.43; _height = 0.27; _width = 0.22; _weight = 12;};
    if (_unit isKindOf "Sheep") then {_coef = 180; _lenght = 1.53; _height = 0.70; _width = 0.4; _weight = 80;};
    if (_unit isKindOf "WildBoar") then {_coef = 180; _lenght = 1.23; _height = 0.90; _width = 0.42; _weight = 70;};
    if (_unit isKindOf "CAManBase") then {_coef = 180; _lenght = 0.35; _height = 1.77; _width = 0.5; _weight = 95;};
    if (_unit isKindOf "Air") then {_coef = 150; _lenght = 18.00; _height = 4.5; _width = 2.5; _weight = 4000;};
    if (_unit isKindOf "AH1_Base") then {_coef = 150; _lenght = 16.20; _height = 4.12; _width = 2.00; _weight = 3550;};
    if (_unit isKindOf "AH64_base_EP1") then {_coef = 150; _lenght = 17.73; _height = 3.87; _width = 2.2; _weight = 8000;};
    if (_unit isKindOf "AW159_Lynx_BAF") then {_coef = 150; _lenght = 15.24; _height = 3.73; _width = 1.8; _weight = 4300;};
    if (_unit isKindOf "BAF_Merlin_HC3_D") then {_coef = 150; _lenght = 22.81; _height = 6.65; _width = 3.2; _weight = 11550;};
    if (_unit isKindOf "Ka60_GL_BASE_PMC") then {_coef = 150; _lenght = 14.50; _height = 4.93; _width = 2.8; _weight = 9800;};
    if (_unit isKindOf "Mi17_base") then {_coef = 150; _lenght = 18.46; _height = 4.76; _width = 3.55; _weight = 11100;};
    if (_unit isKindOf "Mi24_Base") then {_coef = 150; _lenght = 17.50; _height = 6.50; _width = 2.65; _weight = 9800;};
    if (_unit isKindOf "UH1Y") then {_coef = 150; _lenght = 17.78; _height = 4.50; _width = 2.8; _weight = 6660;};
    if (_unit isKindOf "UH1H_base") then {_coef = 150; _lenght = 17.40; _height = 4.39; _width = 2.8; _weight = 3600;};
    if (_unit isKindOf "UH60_Base") then {_coef = 150; _lenght = 19.76; _height = 5.13; _width = 2.36; _weight = 9980;};
    if (_unit isKindOf "UH60M_US_base_EP1") then {_coef = 150; _lenght = 19.76; _height = 5.13; _width = 2.36; _weight = 9980;};
    if (_unit isKindOf "CH47_base_EP1") then {_coef = 150; _lenght = 30.1; _height = 5.70; _width = 3.36; _weight = 12100;};
    if (_unit isKindOf "AH6_Base_EP1") then {_coef = 150; _lenght = 9.80; _height = 3.00; _width = 1.9; _weight = 980;};		 
    if (_unit isKindOf "ParachuteBase") then {_coef = 180; _lenght = 5.00; _height = 2.00; _width = 5.00; _weight = 95;};
    if (_unit isKindOf "A10") then {_coef = 150; _lenght = 16.26; _height = 4.47; _width = 6.8; _weight = 13782;};
    if (_unit isKindOf "AV8B2") then {_coef = 150; _lenght = 14.12; _height = 3.55; _width = 7.2; _weight = 10410;};
    if (_unit isKindOf "BIS_Steerable_Parachute") then {_coef = 150; _lenght = 5.00; _height = 2.00; _width = 5.00; _weight = 95;};
    if (_unit isKindOf "C130J") then {_coef = 150; _lenght = 29.79; _height = 11.84; _width = 25.00; _weight = 40000;};
    if (_unit isKindOf "F35_base") then {_coef = 150; _lenght = 15.67; _height = 4.33; _width = 8.3; _weight = 22470;};
    if (_unit isKindOf "MV22") then {_coef = 150; _lenght = 17.50; _height = 6.73; _width = 20.00; _weight = 18000;};
    if (_unit isKindOf "Su25_base") then {_coef = 150; _lenght = 15.33; _height = 4.80; _width = 11.00; _weight = 16990;};
    if (_unit isKindOf "Su34") then {_coef = 150; _lenght = 23.34; _height = 6.09; _width = 11.00; _weight = 39000;};
    if (_unit isKindOf "An2_Base_EP") then {_coef = 150; _lenght = 12.4; _height = 4.1; _width = 14.10; _weight = 4900;};
    if (_unit isKindOf "MQ9PredatorB") then {_coef = 150; _lenght = 11.00; _height = 3.60; _width = 15.00; _weight = 3500;};
    if (_unit isKindOf "Ka137_Base_PMC") then {_coef = 150; _lenght = 1.30; _height = 1.30; _width = 1.3; _weight = 80;};
    if (_unit isKindOf "Pchela1T") then {_coef = 150; _lenght = 2.78; _height = 1.05; _width = 2.2; _weight = 138;};		
    if (_unit isKindOf "StaticWeapon") then {_coef = 130; _lenght = 1.35; _height = 1.07; _width = 1.5; _weight = 100;};
    if (_unit isKindOf "Ship") then {_coef = 100; _lenght = 5.35; _height = 3.27; _width = 2.5; _weight = 395;};
    if (_unit isKindOf "Thing") then {_coef = 10; };
    if (_unit isKindOf "Building") then {_coef = 8; };
    if (_unit isKindOf "Strategic") then {_coef = 5; };
    if (_unit isKindOf "Nonstrategic") then {_coef = 5;};
    
    // -- Check line for good
    if (isPlayer _unit or player in _unit) then { player sidechat "checkPush"; };
    // -- -- -- -- -- -- -- -- 
    
    _rad = _unit distance _pos;
    
    // -- Sound of Vehicle shaking after Explosion
    if ((isPlayer _unit or player in _unit)and(_unit distance _pos < 2500)) then
    {
    if (_coef != 180) then
    {
    	if (player distance _pos < 600) then {_intenzity = "Close";};
    	if (player distance _pos >= 600 and player distance _pos < 1100) then {_intenzity = "Standard";};
    	if (player distance _pos >= 1100 and player distance _pos < 2500) then {_intenzity = "Far";};
    	_SoundTurbolence = "interiorTurbolance"+_intenzity;
    	playsound _SoundTurbolence;
    };
    };
    
    // -- Creation of Invisible Helipod which is spreading to a player
    if ((isPlayer _unit or player in _unit)and(_unit distance _pos < 2500)) then
    {
    _soundPos = "HeliHEmpty" createVehicle (position _pos);
    };
    // -- Cycle which waits for a heatWave comes to a player
    while {heatWaveSpreadDistance < _rad} do
    {
    _rad = _unit distance _pos;
    _xPos = ((position _unit select 0) - (position _pos select 0));
    _yPos = ((position _unit select 1) - (position _pos select 1));
    if (_xPos >= 0 and _yPos >= 0) then {_fi = 0  + atan (abs(_yPos / _xPos));};
    if (_xPos >= 0 and _yPos < 0) then {_fi = 270 + atan (abs(_xPos / _yPos));};
    if (_xPos < 0 and _yPos < 0) then {_fi = 180 + atan (abs(_yPos / _xPos));};
    if (_xPos < 0 and _yPos >= 0) then {_fi = 90 + atan (abs(_xPos / _yPos));};
    _xSpos = shockWaveSpreadDistance * cos (_fi); _ySpos = shockWaveSpreadDistance * sin (_fi);
    _soundPos setPos [((getPos _pos select 0)+_xSPos),((getPos _pos select 1)+_ySPos),(getPos _unit select 2)];
    sleep 0.1;
    };
    
    // Sound of HeatWave impact to a unit or vehicle
    if ((isPlayer _unit or player in _unit)and(_unit distance _pos < 2500)) then
    {
    if (_coef == 180) then {_material = "Body";} else {_material = "Metal";};
    if (player distance _pos < 600) then {_intenzity = "Close";};
    if (player distance _pos >= 600 and player distance _pos < 1100) then {_intenzity = "Standard";};
    if (player distance _pos >= 1100 and player distance _pos < 2500) then {_intenzity = "Far";};
    _Sound = "impact"+_material+"Soft"+_intenzity;
    if (player distance _pos < 2500) then { playsound _Sound;};
    };
    
    // -- Damage applied by a HeatWave to a unit or vehicle
    /*	// -- Overpressure in air
    _xPos = ((position _unit select 0) - (position _pos select 0));
    _yPos = ((position _unit select 1) - (position _pos select 1));
    _zPos = ((position _unit select 2) - (position _pos select 2));
    
    _GR = sqrt(_xPos^2 + _yPos^2);
    _zMaxima = 8 * _GR^0.5;
    _zChange = 15 * _GR^0.5;
    
    if (_zPos > _zChange) then
    	{
    	_rad = _unit distance _pos;
    	_crossXUp = 1/2*(sqrt(4*_rad^2+50625)-225);
    	_crossZUp = 15 * _crossXUp^0.5;
    	_k2 =(_crossZUp + 300)/(_crossXUp - 4000);
    	_q2 = _crossZUp - _crossXUp*_k2;
    	_crossXInter = (- _k2*_q2-8*sqrt(16-_k2*_q2)+32)/_k2^2;
    	_crossZInter = 8 * _crossXInter^0.5;
    	_k1 =(_crossZInter + 500)/(_crossXInter - 150);										
    	_x0 = (-500 + _k1*150)/ _k1;
    	};	
    
    if (_zPos > _zMaxima and _zPos <= _zChange) then
    	{
    	_k2 =(_zPos + 300)/(_GR - 4000);
    	_q2 = _zPos - _GR*_k2;
    	_crossXInter = (- _k2*_q2-8*sqrt(16-_k2*_q2)+32)/_k2^2;
    	_crossZInter = 8 * _crossXInter^0.5;
    	_k1 =(_crossZInter + 500)/(_crossXInter - 150);										
    	_x0 = (-500 + _k1*150)/ _k1;
    	};
    
    if (_zPos <= _zMaxima) then
    	{
    	_k1 =(_zPos + 500)/(_GR - 150);
    	_x0 = (-500 + _k1*150)/ _k1;
    	};
    
    _kT = 1;
    _overPressure =((15.071*_kT^0.5131)*(_x0/1000)^(-0.016*ln(_kT) - 1.4113))*10^9;
    
    _xPos = ((position _unit select 0) - (position _pos select 0));
    _yPos = ((position _unit select 1) - (position _pos select 1));
    if (_xPos >= 0 and _yPos >= 0) then {_fi = 0  + atan (abs(_yPos / _xPos));};
    if (_xPos >= 0 and _yPos < 0) then {_fi = 270 + atan (abs(_xPos / _yPos));};
    if (_xPos < 0 and _yPos < 0) then {_fi = 180 + atan (abs(_yPos / _xPos));};
    if (_xPos < 0 and _yPos >= 0) then {_fi = 90 + atan (abs(_xPos / _yPos));};
    
    if (_fi <= 90) then {_blastDir = 90 - _fi;};
    if (_fi > 90) then {_blastDir = 450 - _fi;};	
    
    _dir = getDir _unit;
    _diference = abs(_fi - _dir);
    _cubature = (_lenght* sin(_diference) + _width * cos(_diference))*_height;
    _force = _overpressure * _cubature;
    _acc = _force / _weight;
    
    _dam = _overPressure / 145; // zapracovat na steel stroje a jeho slabinach a podle toho urcit poskozeni
    
    
    
    
    
    if (_dam > 1) then {_dam = 1;};
    
    
    
    
    
    
    
    
    
    
    
    */
    _dam = _coef^3.5 / _rad^3;
    if (_dam > 1) then {_dam = 1;};
    if (_dam > 0.05) then {nil = [_unit, 0.5, 0.0, false, true] spawn BIS_Effects_Burn;};
    if (_dam > 0.5) then {nil = [_unit, 3, 0.0, false, true] spawn BIS_Effects_Burn;};
    _unit setDamage ((Damage _unit) + _dam);
    
    // -- Cycle which waits for a shockWave comes to a player
    while {shockWaveSpreadDistance < _rad} do {
    _rad = _unit distance _pos;
    _xPos = ((position _unit select 0) - (position _pos select 0));
    _yPos = ((position _unit select 1) - (position _pos select 1));
    if (_xPos >= 0 and _yPos >= 0) then {_fi = 0  + atan (abs(_yPos / _xPos));};
    if (_xPos >= 0 and _yPos < 0) then {_fi = 270 + atan (abs(_xPos / _yPos));};
    if (_xPos < 0 and _yPos < 0) then {_fi = 180 + atan (abs(_yPos / _xPos));};
    if (_xPos < 0 and _yPos >= 0) then {_fi = 90 + atan (abs(_xPos / _yPos));};
    _xSpos = shockWaveSpreadDistance * cos (_fi);
    _ySpos = shockWaveSpreadDistance * sin (_fi);
    _soundPos setPos [((getPos _pos select 0)+_xSPos),((getPos _pos select 1)+_ySPos),(getPos _unit select 2)];
    if (_unit distance _soundPos < ln(10000 - shockWaveSpreadDistance)*32) then {
    if (player distance _pos < 600) then {_intenzity = "Close";};
    if (player distance _pos >= 600 and player distance _pos < 1100) then {_intenzity = "Standard";};
    if (player distance _pos >= 1100 and player distance _pos < 2500) then {_intenzity = "Far";};
    _SoundWave = "shockwave"+_intenzity;
    playsound _SoundWave; playSound "rhumble";
    };
    sleep 0.1;
    };
    
    // -- Sound of ShockWave impact to a unit or vehicle
    if ((isPlayer _unit or player in _unit)and(_unit distance _pos < 2500)) then {
    if (player distance _pos < 600) then {_intenzity = "Close";};
    if (player distance _pos >= 600 and player distance _pos < 1100) then {_intenzity = "Standard";};
    if (player distance _pos >= 1100 and player distance _pos < 2500) then {_intenzity = "Far";};
    _Sound = "impact"+_material+"Hard"+_intenzity;
    if (player distance _pos < 2500) then { playsound _Sound;};
    deleteVehicle _soundPos;
    };
    
    // -- Final Declaration of Shockwave impact into a car
    _xPos = ((position _unit select 0) - (position _pos select 0));
    _yPos = ((position _unit select 1) - (position _pos select 1));
    
    if (_xPos >= 0 and _yPos >= 0) then {_fi = 0  + atan (abs(_yPos / _xPos));};
    if (_xPos >= 0 and _yPos < 0) then {_fi = 270 + atan (abs(_xPos / _yPos));};
    if (_xPos < 0 and _yPos < 0) then {_fi = 180 + atan (abs(_yPos / _xPos));};
    if (_xPos < 0 and _yPos >= 0) then {_fi = 90 + atan (abs(_xPos / _yPos));};
    
    // -- Damage applied by a ShockWave to a unit or vehicle
    _dam = _coef^5 / _rad^4;
    if (_dam > 1) then {_dam = 1;};
    _unit setDamage ((Damage _unit) + _dam);
    
    // -- Part which is counting with Shock Force and Leaning of vehicle or unit
    if (_coef > 10) then
    {
    _force = ln(_coef^2.5 / _rad^1.6)/3*20;
    if (_force < 0) then {_force = 0};
    // Separating elements of Force and velocity into coordinates
    _xF = _force * cos(_fi);
    _yF = _force * sin(_fi);
    _zF = _force / 3;
    // Debug if speed and lean of vehicle is equal to zero
    _vel = velocity _unit;
    if (_vel select 0 == 0) then {_vel = [0.0001,_vel select 1, _vel select 2];};
    if (_vel select 1 == 0) then {_vel = [_vel select 0,0.0001, _vel select 2];};
    if (_vel select 2 == 0) then {_vel = [_vel select 0,_vel select 1, 0.0001];};	
    _vecUp = vectorUp _unit;
    if (_vecUp select 0 == 0) then {_vecUp = [0.0001,_vecUp select 1, _vecUp select 2];};
    if (_vecUp select 1 == 0) then {_vecUp = [_vecUp select 0,0.0001, _vecUp select 2];};
    if (_vecUp select 2 == 0) then {_vecUp = [_vecUp select 0,_vecUp select 1, 0.0001];};
    
    _xVel = _vel select 0;
    _yVel = _vel select 1;
    _zVel = _vel select 2;
    // Check in which way is vehicle moving and some speed correction of it
    if (_xVel >= 0 and _yVel >= 0) then {_omega = 0  + atan (abs(_yVel / _xVel));};
    if (_xVel >= 0 and _yVel < 0) then {_omega = 270 + atan (abs(_xVel / _yVel));};
    if (_xVel < 0 and _yVel < 0) then {_omega = 180 + atan (abs(_yVel / _xVel));};
    if (_xVel < 0 and _yVel >= 0) then {_omega = 90 + atan (abs(_xVel / _yVel));};
    _diferencial = abs(_omega - _fi);
    if (_diferencial > 90 and _diferencial < 270) then
    	{
    	_xVel = _xVel * (cos(_diferencial)+2)/ ln(_coef/7.77);
    	_yVel = _yVel * (cos(_diferencial)+2)/ ln(_coef/7.77);
    	};
    
    _nY = 0; _nX = 0; _nXX = 0; _nYY = 0; _fXX = 0; _fYY = 0; _fZZ = 0;
    _n = (_vecUp select 0)^2 + (_vecUp select 1)^2;
    // -- Setting up for Leaning
    _leanF = ln(_coef^3 / _rad^2) / 3;
    if (_leanF < 0) then {_leanF = 0};
    
    _nX = _leaner * cos (_fi);
    _nY = _leaner * sin (_fi);
    _cyklus = abs((_leanF - _n) / _leaner); if (_cyklus > 1) then {_cyklus = 1;};
    _xxF = _xF/_cyklus;
    _yyF = _yF/_cyklus;
    _zzF = _zF/_cyklus;
    // -- Finfing out on what side unit should lean
    if ((_vecUp select 0) >= 0 and (_vecUp select 1) >= 0) then {_theta = 0  + atan (abs((_vecUp select 1) / (_vecUp select 0)));};
    if ((_vecUp select 0) >= 0 and (_vecUp select 1) < 0) then {_theta = 270 + atan (abs((_vecUp select 0) / (_vecUp select 1)));};
    if ((_vecUp select 0) < 0 and (_vecUp select 1) < 0) then {_theta = 180 + atan (abs((_vecUp select 1) / (_vecUp select 0)));};
    if ((_vecUp select 0) < 0 and (_vecUp select 1) >= 0) then {_theta = 90 + atan (abs((_vecUp select 0) / (_vecUp select 1)));};
    _diference = abs(_theta - _fi);
    
    if (_diference < 270 and _diference > 90) then {_nX = -_nX; _nY = -_nY;};
    // -- Cycle which will Lean unit and push it in wright way (also lock units in vehicle)
    while {_n < _leanF} do
    	{
          		sleep 0.01;
          		_unit setvectorup [(_vecUp select 0)+_nXX,(_vecUp select 1)+_nYY,(_vecUp select 2)];
    		_nXX = _nXX + _nX; _nYY = _nYY + _nY; _n = _n + _leaner;
    		_unit setVelocity [(_xVel+_fXX),(_yVel+_fYY),((_vel select 2)+_zF)];
    		_fXX = _fXX + _xxF; _fyy = _fyy + _yyF; _fzz = _fzz + _zzF;
    		{_x disableAI "MOVE";} forEach crew _unit;
    		_unit lock true;
         	};
    _unit setVelocity [(_xVel+_xF),(_yVel+_yF),(_zVel+_zF)];	
    };
    
    sleep 5;
    // -- Opening vehicle
    		{_x enableAI "MOVE";} forEach crew _unit;
    		_unit lock false;
    
    // -- Aftershock (Cycle which counts with Heat and Radioation in time)
    _timeAfter = 0;
    
    if (damage _unit < 1) then {			   //9000
    while {damage _unit < 1  or _timeAfter < 9000} do { 			   //250
    		if (_timeAfter <= 250) then
    		{
    		_heatRad = (_coef^4/(_unit distance _pos)^4)*(cos(_timeAfter/250*180)+1)/2*3/4;
    		};
    		_radRad  = (_coef^4/(_unit distance _pos)^4)*(cos(_timeAfter/9000*180)+1)/2*1/4;
    		_unit setDamage (Damage _unit + _heatRad + _radRad);
    		{_unit setDamage  (Damage _unit + (_heatRad + _radRad)/ln(_coef / 2))} forEach crew _unit;
    
    		_plus = (2.5 + random 1);
    		sleep _plus;
    		_timeAfter = _timeAfter + _plus;
    		};
    };

    Some parts are in progress like new damage count system, etc.

    This one is just HUGE and needs to be runned for everz single unit alone.

    I hoper that preload will help, but no, not at all.

    Maybe if I run this scrit somewhere in black screen in very distance from any civilization for first time and disable any consequences. Then I could run it without problem for real where I need.


  2. Does ShockpushPreLoad work if you call it without the forEach loop? Such as

    [(_array select 0),_pos] call ShockpushPreLoad;
    

    I don't know the contents of shockpush.sqf, but what you have is structurally sound.

    You can leave out 'nul =' which serves no purpose. I assume you're not returning a value, because you would be overwriting it many times over.

    Also, you may need to spawn ShockpushPreLoad depending on what content is in there. For example, sleep won't work in a function initiated with a call command.

    Well, there is a many sleep and waituntil and while and for and etc functions in that shockpush script :)

    How does it work this spawn thing?

    ----------------

    And that thing with array select 0 works well. SO there is problem with that sleep,etc stuff

    ----------------

    Would be good to add here script it self,hm? :)

    private ["_unit","_pos","_rad","_force","_xPos","_yPos","_xVel","_yVel","_zVel","_coef","_fi",
    "_n","_fi","_dam","_vel","_vecUp","_nX","_nY","_nXX","_nYY","_leanF","_leanX","_leanY","_cyklus","_theta",
    "_diference","_fXX","_fYY","_fZZ","_xxF","_yyF","_zzF","_spread","_omega","_heatRad","_timeAfter","_plus","_radRad",
    "_material","_intenzity","_Sound","_soundPos","_SoundWave","_SoundTurbolence","_lenght","_height","_width","_weight",
    "_weakness1","_weakness2","_cubature"];
    
    // -- Declaration
    _unit = _this select 0; 		// unit affected by shockwave
    _pos = _this select 1;  		// centre of explosion
    
    _theta = 0;
    _omega = 0;
    _n = 0;
    _coef = 0;
    _fi = 0;
    _leaner = 0.04; // how quickly will units lean into right position after impact
    
    // -- vehicle properties
    _lenght = 0;
    _height = 0;
    _width = 0;
    _weight = 0;
    _weakness1 = "";
    _weakness2 = "";
    _steel = 0; //1 - Human , 2 - Cars , 3 - Trucks,Choppers,Planes, 4 - HMMWV,Jackal
    
    // BAF_FV510_D , BAF_ATV_D , BAF_Jackal2_GMG_D , BAF_Jackal2_L2A1_D , BAF_Offroad_D
    
    // -- Declaration of Unit type
    if (_unit isKindOf "Car") then {_coef = 140; _lenght = 4.5; _height = 1.3; _width = 1.6; _weight = 800;};
    if (_unit isKindOf "Bus") then {_coef = 140;  _lenght = 10; _height = 3; _width = 2.5; _weight = 5800;};
    if (_unit isKindOf "HMMWV_Base") then {_coef = 140; _lenght = 4.6; _height = 1.8; _width = 1.8; _weight = 2340;};
    if (_unit isKindOf "SUV_Base_EP1") then {_coef = 140; _lenght = 4.8; _height = 1.7; _width = 1.8; _weight = 2340;};
    if (_unit isKindOf "ArmoredSUV_Base_PMC") then {_coef = 140; _lenght = 4.8; _height = 1.7; _width = 1.8; _weight = 2540;};
    if (_unit isKindOf "Lada_base") then {_coef = 140; _lenght = 4.0; _height = 1.3; _width = 1.6; _weight = 800;};
    if (_unit isKindOf "Offroad_DSHKM_base") then {_coef = 140; _lenght = 4.12; _height = 1.8; _width = 1.64; _weight = 800;};
    if (_unit isKindOf "Pickup_PK_base") then {_coef = 140; _lenght = 4.1; _height = 1.8; _width = 1.6; _weight = 1000;};
    if (_unit isKindOf "LandRover_Base") then {_coef = 140; _lenght = 4.1; _height = 1.8; _width = 1.6; _weight = 1500;};		
    if (_unit isKindOf "SkodaBase") then {_coef = 140; _lenght = 4.16; _height = 1.4; _width = 1.595; _weight = 800;};
    if (_unit isKindOf "tractor") then {_coef = 140; _lenght = 3.67; _height = 2.71; _width = 1.91; _weight = 3740;};
    if (_unit isKindOf "Truck") then {_coef = 140; _lenght = 7.35; _height = 3.09; _width = 2.40; _weight = 10210;};
    if (_unit isKindOf "MAZ_543_SCUD_Base_EP1") then {_coef = 120; _lenght = 12.35; _height = 4.09; _width = 3.80; _weight = 16300;};
    if (_unit isKindOf "ATV_Base_EP1") then {_coef = 140; _lenght = 2.12; _height = 1.09; _width = 1.20; _weight = 100;};
    if (_unit isKindOf "UAZ_Base") then {_coef = 140; _lenght = 4.02; _height = 2.05; _width = 1.78; _weight = 1650;};
    if (_unit isKindOf "Wheeled_APC") then {_coef = 140; _lenght = 5.50; _height = 2.35; _width = 2.30; _weight = 5300;};
    if (_unit isKindOf "Motorcycle") then {_coef = 150; _lenght = 1.33; _height = 0.83; _width = 0.3; _weight = 105;};
    if (_unit isKindOf "Tank") then {_coef = 120; _lenght = 9.82; _height = 2.72; _width = 3.79; _weight = 48200;};
    if (_unit isKindOf "2S6M_Tunguska") then {_coef = 120; _lenght = 9.82; _height = 2.72; _width = 3.79; _weight = 48200;};
    if (_unit isKindOf "APC") then {_coef = 120; _lenght = 5.50; _height = 2.35; _width = 2.30; _weight = 5300;};
    if (_unit isKindOf "StrykerBase_EP1") then {_coef = 120; _lenght = 6.95; _height = 2.64; _width = 2.72; _weight = 24000;};
    if (_unit isKindOf "Tracked_APC") then {_coef = 120; _lenght = 7.94; _height = 3.26; _width = 3.27; _weight = 29100;};
    if (_unit isKindOf "M1A1") then {_coef = 120; _lenght = 7.93; _height = 2.4; _width = 3.66; _weight = 61300;};
    if (_unit isKindOf "M2A2_Base") then {_coef = 120; _lenght = 6.55; _height = 2.98; _width = 3.60; _weight = 27600;};
    if (_unit isKindOf "T34") then {_coef = 120; _lenght = 6.68; _height = 2.45; _width = 3.00; _weight = 26500;};
    if (_unit isKindOf "T72_Base") then {_coef = 120; _lenght = 6.95; _height = 2.23; _width = 3.59; _weight = 41500;};
    if (_unit isKindOf "T90") then {_coef = 120; _lenght = 9.53; _height = 2.22; _width = 3.78; _weight = 46500;};
    if (_unit isKindOf "ZSU_Base") then {_coef = 120; _lenght = 6.53; _height = 2.57; _width = 3.12; _weight = 16000;};
    if (_unit isKindOf "MLRS_base") then {_coef = 120; _lenght = 6.85; _height = 2.59; _width = 2.97; _weight = 24950;};
    if (_unit isKindOf "Man") then {_coef = 180; _lenght = 0.35; _height = 1.77; _width = 0.41; _weight = 90;};
    if (_unit isKindOf "Cow") then {_coef = 180; _lenght = 3.03; _height = 1.45; _width = 0.5; _weight = 750;};
    if (_unit isKindOf "Goat") then {_coef = 200; _lenght = 1.53; _height = 0.70; _width = 0.4; _weight = 80;};
    if (_unit isKindOf "Hen") then {_coef = 280; _lenght = 0.30; _height = 0.37; _width = 0.18; _weight = 3.5;};
    if (_unit isKindOf "Rabbit") then {_coef = 280; _lenght = 0.43; _height = 0.27; _width = 0.22; _weight = 12;};
    if (_unit isKindOf "Sheep") then {_coef = 180; _lenght = 1.53; _height = 0.70; _width = 0.4; _weight = 80;};
    if (_unit isKindOf "WildBoar") then {_coef = 180; _lenght = 1.23; _height = 0.90; _width = 0.42; _weight = 70;};
    if (_unit isKindOf "CAManBase") then {_coef = 180; _lenght = 0.35; _height = 1.77; _width = 0.5; _weight = 95;};
    if (_unit isKindOf "Air") then {_coef = 150; _lenght = 18.00; _height = 4.5; _width = 2.5; _weight = 4000;};
    if (_unit isKindOf "AH1_Base") then {_coef = 150; _lenght = 16.20; _height = 4.12; _width = 2.00; _weight = 3550;};
    if (_unit isKindOf "AH64_base_EP1") then {_coef = 150; _lenght = 17.73; _height = 3.87; _width = 2.2; _weight = 8000;};
    if (_unit isKindOf "AW159_Lynx_BAF") then {_coef = 150; _lenght = 15.24; _height = 3.73; _width = 1.8; _weight = 4300;};
    if (_unit isKindOf "BAF_Merlin_HC3_D") then {_coef = 150; _lenght = 22.81; _height = 6.65; _width = 3.2; _weight = 11550;};
    if (_unit isKindOf "Ka60_GL_BASE_PMC") then {_coef = 150; _lenght = 14.50; _height = 4.93; _width = 2.8; _weight = 9800;};
    if (_unit isKindOf "Mi17_base") then {_coef = 150; _lenght = 18.46; _height = 4.76; _width = 3.55; _weight = 11100;};
    if (_unit isKindOf "Mi24_Base") then {_coef = 150; _lenght = 17.50; _height = 6.50; _width = 2.65; _weight = 9800;};
    if (_unit isKindOf "UH1Y") then {_coef = 150; _lenght = 17.78; _height = 4.50; _width = 2.8; _weight = 6660;};
    if (_unit isKindOf "UH1H_base") then {_coef = 150; _lenght = 17.40; _height = 4.39; _width = 2.8; _weight = 3600;};
    if (_unit isKindOf "UH60_Base") then {_coef = 150; _lenght = 19.76; _height = 5.13; _width = 2.36; _weight = 9980;};
    if (_unit isKindOf "UH60M_US_base_EP1") then {_coef = 150; _lenght = 19.76; _height = 5.13; _width = 2.36; _weight = 9980;};
    if (_unit isKindOf "CH47_base_EP1") then {_coef = 150; _lenght = 30.1; _height = 5.70; _width = 3.36; _weight = 12100;};
    if (_unit isKindOf "AH6_Base_EP1") then {_coef = 150; _lenght = 9.80; _height = 3.00; _width = 1.9; _weight = 980;};		 
    if (_unit isKindOf "ParachuteBase") then {_coef = 180; _lenght = 5.00; _height = 2.00; _width = 5.00; _weight = 95;};
    if (_unit isKindOf "A10") then {_coef = 150; _lenght = 16.26; _height = 4.47; _width = 6.8; _weight = 13782;};
    if (_unit isKindOf "AV8B2") then {_coef = 150; _lenght = 14.12; _height = 3.55; _width = 7.2; _weight = 10410;};
    if (_unit isKindOf "BIS_Steerable_Parachute") then {_coef = 150; _lenght = 5.00; _height = 2.00; _width = 5.00; _weight = 95;};
    if (_unit isKindOf "C130J") then {_coef = 150; _lenght = 29.79; _height = 11.84; _width = 25.00; _weight = 40000;};
    if (_unit isKindOf "F35_base") then {_coef = 150; _lenght = 15.67; _height = 4.33; _width = 8.3; _weight = 22470;};
    if (_unit isKindOf "MV22") then {_coef = 150; _lenght = 17.50; _height = 6.73; _width = 20.00; _weight = 18000;};
    if (_unit isKindOf "Su25_base") then {_coef = 150; _lenght = 15.33; _height = 4.80; _width = 11.00; _weight = 16990;};
    if (_unit isKindOf "Su34") then {_coef = 150; _lenght = 23.34; _height = 6.09; _width = 11.00; _weight = 39000;};
    if (_unit isKindOf "An2_Base_EP") then {_coef = 150; _lenght = 12.4; _height = 4.1; _width = 14.10; _weight = 4900;};
    if (_unit isKindOf "MQ9PredatorB") then {_coef = 150; _lenght = 11.00; _height = 3.60; _width = 15.00; _weight = 3500;};
    if (_unit isKindOf "Ka137_Base_PMC") then {_coef = 150; _lenght = 1.30; _height = 1.30; _width = 1.3; _weight = 80;};
    if (_unit isKindOf "Pchela1T") then {_coef = 150; _lenght = 2.78; _height = 1.05; _width = 2.2; _weight = 138;};		
    if (_unit isKindOf "StaticWeapon") then {_coef = 130; _lenght = 1.35; _height = 1.07; _width = 1.5; _weight = 100;};
    if (_unit isKindOf "Ship") then {_coef = 100; _lenght = 5.35; _height = 3.27; _width = 2.5; _weight = 395;};
    if (_unit isKindOf "Thing") then {_coef = 10; };
    if (_unit isKindOf "Building") then {_coef = 8; };
    if (_unit isKindOf "Strategic") then {_coef = 5; };
    if (_unit isKindOf "Nonstrategic") then {_coef = 5;};
    
    // -- Check line for good
    if (isPlayer _unit or player in _unit) then { player sidechat "checkPush"; };
    // -- -- -- -- -- -- -- -- 
    
    _rad = _unit distance _pos;
    
    // -- Sound of Vehicle shaking after Explosion
    if ((isPlayer _unit or player in _unit)and(_unit distance _pos < 2500)) then
    {
    if (_coef != 180) then
    {
    	if (player distance _pos < 600) then {_intenzity = "Close";};
    	if (player distance _pos >= 600 and player distance _pos < 1100) then {_intenzity = "Standard";};
    	if (player distance _pos >= 1100 and player distance _pos < 2500) then {_intenzity = "Far";};
    	_SoundTurbolence = "interiorTurbolance"+_intenzity;
    	playsound _SoundTurbolence;
    };
    };
    
    // -- Creation of Invisible Helipod which is spreading to a player
    if ((isPlayer _unit or player in _unit)and(_unit distance _pos < 2500)) then
    {
    _soundPos = "HeliHEmpty" createVehicle (position _pos);
    };
    // -- Cycle which waits for a heatWave comes to a player
    while {heatWaveSpreadDistance < _rad} do
    {
    _rad = _unit distance _pos;
    _xPos = ((position _unit select 0) - (position _pos select 0));
    _yPos = ((position _unit select 1) - (position _pos select 1));
    if (_xPos >= 0 and _yPos >= 0) then {_fi = 0  + atan (abs(_yPos / _xPos));};
    if (_xPos >= 0 and _yPos < 0) then {_fi = 270 + atan (abs(_xPos / _yPos));};
    if (_xPos < 0 and _yPos < 0) then {_fi = 180 + atan (abs(_yPos / _xPos));};
    if (_xPos < 0 and _yPos >= 0) then {_fi = 90 + atan (abs(_xPos / _yPos));};
    _xSpos = shockWaveSpreadDistance * cos (_fi); _ySpos = shockWaveSpreadDistance * sin (_fi);
    _soundPos setPos [((getPos _pos select 0)+_xSPos),((getPos _pos select 1)+_ySPos),(getPos _unit select 2)];
    sleep 0.1;
    };
    
    // Sound of HeatWave impact to a unit or vehicle
    if ((isPlayer _unit or player in _unit)and(_unit distance _pos < 2500)) then
    {
    if (_coef == 180) then {_material = "Body";} else {_material = "Metal";};
    if (player distance _pos < 600) then {_intenzity = "Close";};
    if (player distance _pos >= 600 and player distance _pos < 1100) then {_intenzity = "Standard";};
    if (player distance _pos >= 1100 and player distance _pos < 2500) then {_intenzity = "Far";};
    _Sound = "impact"+_material+"Soft"+_intenzity;
    if (player distance _pos < 2500) then { playsound _Sound;};
    };
    
    // -- Damage applied by a HeatWave to a unit or vehicle
    /*	// -- Overpressure in air
    _xPos = ((position _unit select 0) - (position _pos select 0));
    _yPos = ((position _unit select 1) - (position _pos select 1));
    _zPos = ((position _unit select 2) - (position _pos select 2));
    
    _GR = sqrt(_xPos^2 + _yPos^2);
    _zMaxima = 8 * _GR^0.5;
    _zChange = 15 * _GR^0.5;
    
    if (_zPos > _zChange) then
    	{
    	_rad = _unit distance _pos;
    	_crossXUp = 1/2*(sqrt(4*_rad^2+50625)-225);
    	_crossZUp = 15 * _crossXUp^0.5;
    	_k2 =(_crossZUp + 300)/(_crossXUp - 4000);
    	_q2 = _crossZUp - _crossXUp*_k2;
    	_crossXInter = (- _k2*_q2-8*sqrt(16-_k2*_q2)+32)/_k2^2;
    	_crossZInter = 8 * _crossXInter^0.5;
    	_k1 =(_crossZInter + 500)/(_crossXInter - 150);										
    	_x0 = (-500 + _k1*150)/ _k1;
    	};	
    
    if (_zPos > _zMaxima and _zPos <= _zChange) then
    	{
    	_k2 =(_zPos + 300)/(_GR - 4000);
    	_q2 = _zPos - _GR*_k2;
    	_crossXInter = (- _k2*_q2-8*sqrt(16-_k2*_q2)+32)/_k2^2;
    	_crossZInter = 8 * _crossXInter^0.5;
    	_k1 =(_crossZInter + 500)/(_crossXInter - 150);										
    	_x0 = (-500 + _k1*150)/ _k1;
    	};
    
    if (_zPos <= _zMaxima) then
    	{
    	_k1 =(_zPos + 500)/(_GR - 150);
    	_x0 = (-500 + _k1*150)/ _k1;
    	};
    
    _kT = 1;
    _overPressure =((15.071*_kT^0.5131)*(_x0/1000)^(-0.016*ln(_kT) - 1.4113))*10^9;
    
    _xPos = ((position _unit select 0) - (position _pos select 0));
    _yPos = ((position _unit select 1) - (position _pos select 1));
    if (_xPos >= 0 and _yPos >= 0) then {_fi = 0  + atan (abs(_yPos / _xPos));};
    if (_xPos >= 0 and _yPos < 0) then {_fi = 270 + atan (abs(_xPos / _yPos));};
    if (_xPos < 0 and _yPos < 0) then {_fi = 180 + atan (abs(_yPos / _xPos));};
    if (_xPos < 0 and _yPos >= 0) then {_fi = 90 + atan (abs(_xPos / _yPos));};
    
    
    _force = _overpressure * _cubature;
    
    
    _dam = _overPressure / 145;
    
    
    
    
    
    if (_dam > 1) then {_dam = 1;};
    
    
    
    
    
    
    
    
    
    
    
    */
    _dam = _coef^3.5 / _rad^3;
    if (_dam > 1) then {_dam = 1;};
    if (_dam > 0.05) then {nil = [_unit, 0.5, 0.0, false, true] spawn BIS_Effects_Burn;};
    if (_dam > 0.5) then {nil = [_unit, 3, 0.0, false, true] spawn BIS_Effects_Burn;};
    _unit setDamage ((Damage _unit) + _dam);
    
    // -- Cycle which waits for a shockWave comes to a player
    while {shockWaveSpreadDistance < _rad} do {
    _rad = _unit distance _pos;
    _xPos = ((position _unit select 0) - (position _pos select 0));
    _yPos = ((position _unit select 1) - (position _pos select 1));
    if (_xPos >= 0 and _yPos >= 0) then {_fi = 0  + atan (abs(_yPos / _xPos));};
    if (_xPos >= 0 and _yPos < 0) then {_fi = 270 + atan (abs(_xPos / _yPos));};
    if (_xPos < 0 and _yPos < 0) then {_fi = 180 + atan (abs(_yPos / _xPos));};
    if (_xPos < 0 and _yPos >= 0) then {_fi = 90 + atan (abs(_xPos / _yPos));};
    _xSpos = shockWaveSpreadDistance * cos (_fi);
    _ySpos = shockWaveSpreadDistance * sin (_fi);
    _soundPos setPos [((getPos _pos select 0)+_xSPos),((getPos _pos select 1)+_ySPos),(getPos _unit select 2)];
    if (_unit distance _soundPos < ln(10000 - shockWaveSpreadDistance)*32) then {
    if (player distance _pos < 600) then {_intenzity = "Close";};
    if (player distance _pos >= 600 and player distance _pos < 1100) then {_intenzity = "Standard";};
    if (player distance _pos >= 1100 and player distance _pos < 2500) then {_intenzity = "Far";};
    _SoundWave = "shockwave"+_intenzity;
    playsound _SoundWave; playSound "rhumble";
    };
    sleep 0.1;
    };
    
    // -- Sound of ShockWave impact to a unit or vehicle
    if ((isPlayer _unit or player in _unit)and(_unit distance _pos < 2500)) then {
    if (player distance _pos < 600) then {_intenzity = "Close";};
    if (player distance _pos >= 600 and player distance _pos < 1100) then {_intenzity = "Standard";};
    if (player distance _pos >= 1100 and player distance _pos < 2500) then {_intenzity = "Far";};
    _Sound = "impact"+_material+"Hard"+_intenzity;
    if (player distance _pos < 2500) then { playsound _Sound;};
    deleteVehicle _soundPos;
    };
    
    // -- Final Declaration of Shockwave impact into a car
    _xPos = ((position _unit select 0) - (position _pos select 0));
    _yPos = ((position _unit select 1) - (position _pos select 1));
    
    if (_xPos >= 0 and _yPos >= 0) then {_fi = 0  + atan (abs(_yPos / _xPos));};
    if (_xPos >= 0 and _yPos < 0) then {_fi = 270 + atan (abs(_xPos / _yPos));};
    if (_xPos < 0 and _yPos < 0) then {_fi = 180 + atan (abs(_yPos / _xPos));};
    if (_xPos < 0 and _yPos >= 0) then {_fi = 90 + atan (abs(_xPos / _yPos));};
    
    // -- Damage applied by a ShockWave to a unit or vehicle
    _dam = _coef^5 / _rad^4;
    if (_dam > 1) then {_dam = 1;};
    _unit setDamage ((Damage _unit) + _dam);
    
    // -- Part which is counting with Shock Force and Leaning of vehicle or unit
    if (_coef > 10) then
    {
    _force = ln(_coef^2.5 / _rad^1.6)/3*20;
    if (_force < 0) then {_force = 0};
    // Separating elements of Force and velocity into coordinates
    _xF = _force * cos(_fi);
    _yF = _force * sin(_fi);
    _zF = _force / 3;
    
    _vel = velocity _unit;
    _vecUp = vectorUp _unit;	
    
    _xVel = _vel select 0;
    _yVel = _vel select 1;
    _zVel = _vel select 2;
    // Check in which way is vehicle moving and some speed correction of it
    if (_xVel >= 0 and _yVel >= 0) then {_omega = 0  + atan (abs(_yVel / _xVel));};
    if (_xVel >= 0 and _yVel < 0) then {_omega = 270 + atan (abs(_xVel / _yVel));};
    if (_xVel < 0 and _yVel < 0) then {_omega = 180 + atan (abs(_yVel / _xVel));};
    if (_xVel < 0 and _yVel >= 0) then {_omega = 90 + atan (abs(_xVel / _yVel));};
    _diferencial = abs(_omega - _fi);
    if (_diferencial > 90 and _diferencial < 270) then
    	{
    	_xVel = _xVel * (cos(_diferencial)+2)/ ln(_coef/7.77);
    	_yVel = _yVel * (cos(_diferencial)+2)/ ln(_coef/7.77);
    	};
    
    _nY = 0; _nX = 0; _nXX = 0; _nYY = 0; _fXX = 0; _fYY = 0; _fZZ = 0;
    _n = (_vecUp select 0)^2 + (_vecUp select 1)^2;
    // -- Setting up for Leaning
    _leanF = ln(_coef^3 / _rad^2) / 3;
    if (_leanF < 0) then {_leanF = 0};
    
    _nX = _leaner * cos (_fi);
    _nY = _leaner * sin (_fi);
    _cyklus = abs((_leanF - _n) / _leaner);
    _xxF = _xF/_cyklus;
    _yyF = _yF/_cyklus;
    _zzF = _zF/_cyklus;
    // -- Finfing out on what side unit should lean
    if ((_vecUp select 0) >= 0 and (_vecUp select 1) >= 0) then {_theta = 0  + atan (abs((_vecUp select 1) / (_vecUp select 0)));};
    if ((_vecUp select 0) >= 0 and (_vecUp select 1) < 0) then {_theta = 270 + atan (abs((_vecUp select 0) / (_vecUp select 1)));};
    if ((_vecUp select 0) < 0 and (_vecUp select 1) < 0) then {_theta = 180 + atan (abs((_vecUp select 1) / (_vecUp select 0)));};
    if ((_vecUp select 0) < 0 and (_vecUp select 1) >= 0) then {_theta = 90 + atan (abs((_vecUp select 0) / (_vecUp select 1)));};
    _diference = abs(_theta - _fi);
    
    if (_diference < 270 and _diference > 90) then {_nX = -_nX; _nY = -_nY;};
    // -- Cycle which will Lean unit and push it in wright way (also lock units in vehicle)
    while {_n < _leanF} do
    	{
          		sleep 0.01;
          		_unit setvectorup [(_vecUp select 0)+_nXX,(_vecUp select 1)+_nYY,(_vecUp select 2)];
    		_nXX = _nXX + _nX; _nYY = _nYY + _nY; _n = _n + _leaner;
    		_unit setVelocity [(_xVel+_fXX),(_yVel+_fYY),((_vel select 2)+_zF)];
    		_fXX = _fXX + _xxF; _fyy = _fyy + _yyF; _fzz = _fzz + _zzF;
    		{_x disableAI "MOVE";} forEach crew _unit;
    		_unit lock true;
         	};
    _unit setVelocity [(_xVel+_xF),(_yVel+_yF),(_zVel+_zF)];	
    };
    
    sleep 5;
    // -- Opening vehicle
    		{_x enableAI "MOVE";} forEach crew _unit;
    		_unit lock false;
    
    // -- Aftershock (Cycle which counts with Heat and Radioation in time)
    _timeAfter = 0;
    
    if (damage _unit < 1) then {			   //9000
    while {damage _unit < 1  or _timeAfter < 9000} do { 			   //250
    		if (_timeAfter <= 250) then
    		{
    		_heatRad = (_coef^4/(_unit distance _pos)^4)*(cos(_timeAfter/250*180)+1)/2*3/4;
    		};
    		_radRad  = (_coef^4/(_unit distance _pos)^4)*(cos(_timeAfter/9000*180)+1)/2*1/4;
    		_unit setDamage (Damage _unit + _heatRad + _radRad);
    		{_unit setDamage  (Damage _unit + (_heatRad + _radRad)/ln(_coef / 2))} forEach crew _unit;
    
    		_plus = (2.5 + random 1);
    		sleep _plus;
    		_timeAfter = _timeAfter + _plus;
    		};
    };

    Its push made by a shockwave (for my Nuke script recently added here on forum)


  3. Hi, another little trouble...

    I need to

    ShockpushPreLoad = compile preprocessFile "lk\nuke\shockpush.sqf";

    Im doing it in init file.

    But when I call it like this

    _array = _pos nearObjects ["Man", 50000];
    {nul = [_x,_pos] call ShockpushPreLoad;} forEach _array;

    Its not working. There is possible that preloaded script is launched even for a hundred times at once. Is there any diferent way how to preload some script to be used for many diferent units?

    thx for respond.


  4. Where are you trying to use it? If it's in init.sqf or something started from it, then it might try to check the condition before player actually gets hold of the unit. So, try adding

    waituntil {!isnull player};
    

    before it.

    Its used in my nuke script http://forums.bistudio.com/showthread.php?t=112397 where shockwave hit every single unit on map. And what I need is playSound of impact sound when is that unit Player (also to be working in MP).


  5. http://forums.bistudio.com/showthread.php?t=89912

    keep up the good work. looking better :)

    link is not working.

    Well, I guess that Im done with physic part.

    Now I really need help with that shockwave in partical effetcs, thats completely out of my league... :(

    And I also need to get some sound of incoming shockwave and impact (will find some to fit)

    ---------- Post added at 20:13 ---------- Previous post was at 20:02 ----------

    I forgot on: How can I change color theme to Sepia directly in mission like it is in module?


  6. if one looks in the newest mando missiles.. EE did the blast waves for him:)

    Cant find it... how does it work? Can you link me pls?

    Well, I will try to make new functions for damage. Can be damage, like number, hugher than 1 an it still will count like damage 1 ?

    EDIT: Like I said. I was just trying with these function to support old lk's script and his damage system, where were every unit damaged to 1 in 1000 metres around and all rest to another 0.4 in 1500 metres.

    And there is diference between soldier and tank for sure. I will test something....

    ---------- Post added at 11:14 ---------- Previous post was at 10:10 ----------

    Well, is this what you would like to?

    http://img263.imageshack.us/img263/4064/damagedistance.jpg

    New function defined like: Damage = coeficient^5 / distance^4

    That coeficient is just only a number: I would like to create some equation based on material and weight of object.

    ---------- Post added at 12:04 ---------- Previous post was at 11:14 ----------

    And this would be graph of Force (in m/s).

    http://img228.imageshack.us/img228/9476/forcedistance.jpg

    This function: Force = coeficient^3 / distance^2

    ---------- Post added at 12:30 ---------- Previous post was at 12:04 ----------

    and this would be graph of Lean (1 or more is 90°)

    http://img411.imageshack.us/img411/4851/leandistance.jpg

    Function: Lean = ln(coeficient^3 / distance^2) / 3

    ---------- Post added at 13:31 ---------- Previous post was at 12:30 ----------

    New video in first topic :) Works pretty good


  7. Of course that I made it up, what you thought?

    I made this function to at least simulates what lk made within his own nuke script. and than apply some hyperbolic rules (what that cos function works for)

    If I would use only simple triple hyberpolic curve it would just do some damage to 100 metres units and there nothing.

    But: If you have some suggestion to function ... tell me pls, I will make some graphs to watch it and lets see :)


  8. Well, my functions are based on fact, that in original lk script is constant damage set to 1 in radius 1000 metres which i basicaly kept but a bit improved so there could some chance to survive if you are in any armored or whatever else than Man unit.

    your hyperbolic curve would be truly nice, but vehicles in 200 metres distance wouldnt be even scratch by that nuke.

    FYI - whole Nuke blast effect is "quite expensive computationally" thats the reason why i quited damaging of buildings by this same way and I made it in zones.


  9. This is awesome! I love the effects and physics. Have you sent it to LK?

    Not yet, this is just only start of my work.

    In short ... For now: Every type of vehicles have got its own "Coeficient" which defines how much is that type resistant against that blast. That will be a lot of work to do.

    This is the basic equation which defines a Force which affect vehicle:

    _force = (cos (((_rad - _min)/(_max - _min)) * 180)+1)/2*(_coef/ln(_rad));

    This defines size from 1 to 0 according to how far from center is that unit and than some multiplier based on that certain coeficient and natural logarithm of distance. Its makes kinda sense and similar kind of equation fits to damage and that "leaning" of vehicle or any unit.

    I need lot of testing and ppl able to test it for me before I send this to anywhere :)


  10. Hi there. So I was playing in editor with some mission and I stucked at Nuke explosion.

    There were absolutely awesome help in script by lk (in example mission "lkscriptsv08.utes").

    But there was one thing I could not live with it. Damage system and affecting of units.

    So I decide to made some calculating script to make some physical effects.

    UPDATE 22.06.2013 - Hey, Im happy to say Im coming back and starting work on Arma 3 version of my script. I will try to do a little research for some stuff, it will take time, but will do that :)

    UPDATE 06.06.2013 - Since Im not coming here so fast, you can write me mail on Khalashnikovf A gmail.com, I will notice of your message much faster then here :)

    08.21.2011 - New version. Watch for log.

    Lot of New Features

    Vy8c_Bu4WN4

    Latest video.

    SK4Y5kiIUB8

    -----------------------------------------------------------------

    NEW v(08.21.2011)

    Example Arma 2 mission v2.2: https://docs.google.com/file/d/0B7UaDhWVX77hYjJYek9Fd0N0TGs/edit?usp=sharing (Chernarus)

    For those who want to work inside the math side excel for understanding (But its a mess from times when I was making it so it really needs time to study and compare with scripts)

    https://docs.google.com/file/d/0B7UaDhWVX77hT3IxaG52aXBrWVk/edit?usp=sharing

    - there is completely saved original lk script (with lot of modifications in nuke it self + init)

    - to launch nuke pres:

    - 0-0-0 (that will launch 1kT Nuke in 10 seconds after tirgger)

    - Arma 2 version

    -----------------------------------------------------------------

    Change log

    Future

    - Create doMove script to force all Man units run into nearest building and lay down

    - Make it possible to disable countdown timer by easy way

    - Somehow ... lower the hardware exhaustion

    - Improve Aperture overshine after explosion

    - Make some wave turbulence flow in space, so when unit is "hidden" behind hill the shockwave impact will be different according to Huygens–Fresnel principle

    2.2

    - Repaired Soldier survivality by adding Huge list or CoverAble buildings for Arma 2 + OA Maps (Man unit can hide into building, lay on ground and hope for surviving, or cover behind that building)*

    - Lowered another more hardware exhaustion (also a bit)

    - Air units now usually survive shockwave, but their are usually so damage they cant use it anymore

    2.0

    - Repaired Countdown for missiles for zero time

    - Lowered hardware exhaustion (a bit)

    - and other little repairs

    - new function in nuke set up (disabling Fallout)

    2.0b

    - More accurate physical attributes of vehicles

    - Advanced Cloud durability and aftershock color correction timing

    - Precautions when is unit hidden in building to get lower damage if building is not destroyed too (in beta)

    - Different attributes of Blast and Cloud according to Power of Nuke

    - Added Fallout cloud spreading into space (in beta)

    1.1

    - Repaired and improved Lean system

    1.0

    - Added "real" physical attributes to most of vehicles like length, width, height, weight and survivability according to some basic element

    - Completely reworked Force and Damage system according to a wikipedia

    - Added possibility to set up Nuke by your own choice (power,countdown,player indestructibility,random trigger to make more believe that someone want to blast it in "some" time

    - Brightness of screen is functional to a Power of Nuke

    - Added lot of sounds like Incoming Shockwave, impact into metal or body material in close/medium/far distance by a heat/shockwave, Rhumble sound of shaking ground for a little bit longer and at last: sound of shaking vehicle and metal friction according to distance

    0.9

    - Advance Force and Damage system

    - Added countdown system with random trigger

    - Modified colorCorrection system to be look more like aftershock

    0.8

    - Base kinematics were made

    -----------------------------------------------------------------

    Bugs:

    - Random Trigger of Nuke does not work properly :/

    - players as class "Man" are not affected by it in MP ???

    - Sometimes it just happens that some Unit pushed will weirdly lean and just fly compeltely other way than it should

    PLS BE AWARE THAT I NEED HELP WITH PRELOAD... when the Nuke is launched for first time after starting up game

    -----------------------------------------------------------------

    * If you want to use this script on community map where are community buildings, you need to create your own list or add it to one already existing.

    Look in lk/nuke/coverableBuildings.sqf and add your buildings like the rest of there already. You can also share your addition here pls :)

    -----------------------------------------------------------------

    What I need?

    - Does anyone know name of rocket model used in OA placed on SCUDs?

    - I need to test behaviour of diferent types of units (if there is "real" looking force pushed certain unit)

    - I need to try every possible building if unit is inside really hidden

    - create a particular effects with shockwave spreading far into landscape (its really good visible here in 35 seconds)

    - create particles of paint "waporazing" from vehicle (like in video)

    - create particles of some parts like some metal desks, rotor, screws, etc.

    H4uHVFMcpXA

    --------------------------------------------------------------------------------------------

    No force and damage graphs anymore.

    The math is now so complex that there is no graph to be done.

    Just look at http://en.wikipedia.org/wiki/Effects_of_nuclear_explosions.

    This one is how Shockwave now works (of course only approximation with R = 0,91

    500px-Blastcurves_psi.svg.png

    This is showing how damage works

    500px-Abombdamage1945.svg.png

    You can find on wiki url how is determined power of Nuke according to its Blast and Cloud height.

    By my studies is Power of nuke in Arma 2 circa 0,4kT :D

    ---------- Overpressure graph ------------------------------------------

    http://img412.imageshack.us/img412/8569/shockwavep.jpg

    What is that?

    Its a schema how is shockwave powerful in certain area of space.

    There is BLUE CURVE which is Ideal position of maximal Overpressure in air

    The GREEN CURVE is where is happening to change function into circle.

    So if some vehicle (1) is on that position where is ORANGE DOT, it need to be computed on zChange curve then via y = -kx + q compute it on zMaxima curve and than find its cross on Height = 0 because that is the place where is known equation about overpressure force. So the every unit which could actually be on those three curves would be Overpressured within same power.

    Once it gets x0 value you can see how many Overpressure is there by that RED hyperbolic curve which is actually three times larger to be easily readable on this graph

    ----------------System of radiation ----------------------------------

    This graph shows us how much radiation will unit get in time zero of blast for a three seconds.

    http://img59.imageshack.us/img59/5419/radiationinspace.jpg

    And this one shows us what is happening with heat in time of 300 seconds

    http://img16.imageshack.us/img16/900/radiationintime.jpg

    --------------- For show ---------------------------

    This shows how Heat and Shock waves are spreading in space.

    heatWaveSpreadDistance = 0;
    shockWaveSpreadDistance = 0;
    radTime = (ln(_kT)+1) * 6666; // Endurance of Radiation time in air
    heatTime = (ln(_kT)+1) * 167; // Endurance of Heat time in air
    shockDistance = (ln(_kT)+1) * 3333; // How far will shockwave spread
    heatDistance = (ln(_kT)+1) * 6666; // How far will heatwave spread
    AllArray = [];
    timeAfter = 0;
    plus = (2.5 + random 1);
    while {shockWaveSpreadDistance < (shockDistance - 1)} do {
    heatPlus = ln(heatDistance - heatWaveSpreadDistance)*((ln(_kT)+1)*58)/10;
    if (heatPlus > 0) then {heatWaveSpreadDistance = heatWaveSpreadDistance + heatPlus; };
    if (heatWaveSpreadDistance >= (heatDistance - 1)) then {heatWaveSpreadDistance = (heatDistance);};
    shockWaveSpreadDistance = shockWaveSpreadDistance + ln(shockDistance - shockWaveSpreadDistance)*((ln(_kT)+1)*21)/10;
    sleep 0.1;
    };

    This will count Overpressure in air:

    	// -- Overpressure in air
    _xPos = ((position _unit select 0) - (position _pos select 0));
    _yPos = ((position _unit select 1) - (position _pos select 1));
    _zPos = ((position _unit select 2) - (position _pos select 2));
    
    _GR = sqrt(_xPos^2 + _yPos^2); // GR = Ground radius
    _zMaxima = 8 * _GR^0.5;
    _zChange = 15 * _GR^0.5;
    
    // IF VEHICLE IS ABOVE CHANGING CURVE y = 15*x^0.5 AND IS IN y = sqrt(R^2 - x^2)
    if (_zPos > _zChange) then
    	{
    	_rad = _unit distance _pos;
    	_crossXUp = 1/2*(sqrt(4*_rad^2+50625)-225);
    	_crossZUp = 15 * _crossXUp^0.5;
    	_k2 =(_crossZUp + 300)/(_crossXUp - 4000);
    	_q2 = _crossZUp - _crossXUp*_k2;
    	_crossXInter = (- _k2*_q2-8*sqrt(16-_k2*_q2)+32)/_k2^2;
    	_crossZInter = 8 * _crossXInter^0.5;
    	_k1 =(_crossZInter + 500)/(_crossXInter - 150);										
    	_x0 = (500 + _k1*150)/ _k1;
    	};	
    // IF VEHICLE IS BETWEEN CHANGING CURVE y = 15*x^0.5 AND MAXIMUM CURVE y = 8*x^0.5 AND IS IN y = -kx + q
    if (_zPos > _zMaxima and _zPos <= _zChange) then
    	{
    	_k2 =(_zPos + 300)/(_GR - 4000);
    	_q2 = _zPos - _GR*_k2;
    	_crossXInter = (- _k2*_q2-8*sqrt(16-_k2*_q2)+32)/_k2^2;
    	_crossZInter = 8 * _crossXInter^0.5;
    	_k1 =(_crossZInter + 500)/(_crossXInter - 150);										
    	_x0 = (500 + _k1*150)/ _k1;
    	};
    // IF VEHICLE IS BELLOW MAXIMUM CURVE y = 8*x^0.5 AND IS IN y = kx + q
    if (_zPos <= _zMaxima) then
    	{
    	_k1 =(_zPos + 500)/(_GR - 150);
    	_x0 = (500 + _k1*150)/ _k1;
    	};
    //FOR MORE INFO ABOUT THESE APROXIMATED FUNCTIONS VISIT http://en.wikipedia.org/wiki/Effects_of_nuclear_explosions
    
    _overPressure =((15.071*_kT^0.5131)*(_x0/1000)^(-0.016*ln(_kT) - 1.4113));

    And this will set damage:

    _dir = getDir _unit;
    _diference = abs(_blastDir - _dir);
    _cubature = (abs(_lenght* sin(_diference)) + abs(_width * cos(_diference))*_height);
    _force = _overpressure * _cubature;
    
    _acc = 100*(_force / _weight);
    
    // -- Defining damage to a vehicle + extra damage to its own weak parts like Engine,Electronics
    _dam = _overPressure / (_steel * 8);
    
    if (_dam > 1) then {_dam = 1;};
    _unit setDamage ((Damage _unit) + _dam);
    {_x setDamage ((Damage _x) + _dam)} forEach crew _unit;

    How to setup your Wanted Nuke?

    nul = [nukePos,1,true,480,true,false,true,20] execvm "lk\nuke\nuke_countdown.sqf";

    - nukePos = Position where will Nuke detonate or Land

    - 1 = yield of Nuke, it is defined in kT (so Hiroshima is 16)

    - true = if the Nuke should Land like a missile from Air

    - 480 = Countdown to Nuclear Detonation

    - true = Fallout active

    - false = Should be players immortal according to Nuke?

    - true = Should Nuke detonate randomly?

    - 20 = Is time spread when Nuke can detonate earlier before countdown drops to zero or later after zero Contdown.

    The only thing you have to setup is position of the Nuke, anything else is set in default way.


  11. Hi, Im working on my civilian script. But now I have got stucked on this thing.

    This is for checking how many civilians are in area around suspicious person.

    and command my units to target random one of them.

    _stalker = _this select 0; //Unit who is somehow dangerous to a group
    _radius = _this select 1; //checking area
    _disarmSide = _this select 2; // side who can check and disarm civilian
    _Armed = _this select 3; // kind of stuff that civilian handle ("IED","ARM")
    
    
    // ------------ CHECK FOR OTHER CIVILIANS IN CLOSEST AREA OF DANGER ONE ------
    while { Wiseman distance _stalker > _radius } do {
    
    _PatrolArray = nearestObjects [_stalker, ["man"], _radius];
    _civiliansArray = [];
    
    {
    if ((side _x == CIVILIAN)and(alive _x)) then {
    	_civiliansArray = _civiliansArray + [_x];
    	};
    } forEach _PatrolArray;
    
    {
    if ((side _x == _disarmSide)and(alive _x)) then {
    	_RndCiv = floor (random (count _civiliansArray));
    	_targetX = _civiliansArray select _RndCiv;
    	_x doTarget _targetX;
    	};
    } forEach _PatrolArray;
    
    
    sleep 1.5;	
    };
    
    checkCivilian =  _stalker addAction ["Check Civilian", "CivilianDangerArea\CivilianCheck.sqf",[_stalker,_Armed]];

    Then its addAction for check suspicios civilian.

    But here is problem for now.

    This script is launched for every unit who get order to deploy IED. So every unit should be able to addAction Check Civilian. Indeed it is. But: Because of still same Check Civilian Action, it is added somehow to every civilian person who is IED carrier.

    This is Action script in short:

    _array = _this select 3;
    _stalker = _array select 0;
    _Armed = _array select 1;
    
    _stalker removeAction checkCivilian;
    
    if (_Armed == "IED") then {
    
    _stalker doTarget Wiseman;
    sleep 1.5;
    _stalker doWatch Wiseman; 
    _stalker playMove "AmovPercMstpSnonWnonDnon_idle68boxing";
    
    
    };

    Is there any way how to make this action Unique for every single Civilian?

    Thx for replies.

    -------------------------------------------------------------------------

    EDIT: the first script is called:

    nul = [_x,10,_enemySide,"IED"] execVM "CivilianDangerArea\CivilianDisarming.sqf";

    So it is called directly from forEach array.

×