Guest User

fn_lightningBolt.sqf

a guest
Jul 7th, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.66 KB | None | 0 0
  1. /*
  2.     Author: Karel Moricky edit by KiloSwiss
  3.     Original script: BIS_fnc_moduleLightning
  4.  
  5.     Description:
  6.     Non-Lethal Zeus lightning strike
  7.  
  8.     Parameter(s):
  9.     _target : The target Object (does not take damage).
  10.  
  11.     Returns:
  12.     NONE
  13. */
  14.  
  15. params [ ["_target", objNull, [objNull]] ];
  16. if (isNull _target) exitWith {};
  17. private _pos = getPosATL _target;
  18.  
  19. /* 
  20. soundHit1[] = {"\A3\Sounds_F\ambient\thunder\thunder_02",10,1,3000};
  21. soundHit2[] = {"\A3\Sounds_F\ambient\thunder\thunder_03",10,1,3000};
  22. soundHit3[] = {"\A3\Sounds_F\ambient\thunder\thunder_06",10,1,3000};
  23. */
  24.  
  25. private _sound = selectRandom ["soundHit1","soundHit2","soundHit3"];
  26. getArray(configfile >> "CfgAmmo" >> "LightningBolt" >> _sound) params ["_path","_volume","_pitch","_distance"];
  27. _path = _path select [1, count _path];
  28. _sound = format["%1.wss", _path];
  29.  
  30. playSound3D [_sound, _target, false, ATLtoASL _pos, _volume, _pitch, _distance];
  31.  
  32. [_pos] spawn
  33. {
  34.     params ["_pos"];
  35.    
  36.     private _light = "#lightpoint" createvehicle _pos;
  37.     _light setposatl [_pos select 0,_pos select 1,(_pos select 2) + 10];
  38.     _light setLightDayLight true;
  39.     _light setLightBrightness 300;
  40.     _light setLightAmbient [0.05, 0.05, 0.1];
  41.     _light setlightcolor [1, 1, 2];
  42.    
  43.     uisleep 0.1;
  44.     _light setLightBrightness 0;
  45.     uisleep (random 0.1);
  46.    
  47.     private _class = selectRandom ["lightning1_F","lightning2_F"];
  48.     private _lightning = _class createvehicle [100,100,100];
  49.     _lightning setDir (random 3600);
  50.     _lightning setPos _pos;
  51.    
  52.     for "_i" from 0 to 1 do {
  53.         _light setLightBrightness (100 + random 100);
  54.         uisleep 0.1;
  55.     };
  56.    
  57.     deletevehicle _lightning;
  58.     deletevehicle _light;
  59.    
  60.     //--- Disable engine lightnings
  61.     0 setlightnings 0;
  62. };
Advertisement
Add Comment
Please, Sign In to add comment