Advertisement
Guest User

Illuminating flares

a guest
Jan 25th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.72 KB | None | 0 0
  1. // illuminatingFlares.sqf
  2. // startFlares = 1; null = [<max distance>, <base delay>, <max added delay>, <base height>, <random added or subtracted height>, <color>, <speed (must be negative)>, <flareIntensity>, <flareRange>, <object pos>] execVM "illuminatingFlares.sqf";
  3.  
  4. //A is the maximum distance each flare can spawn from the given position. The distance ranges from 0 meters to the number you supply.
  5.  
  6. //B is the base number of seconds before a new flare can be spawned.
  7.  
  8. //C is the maximum amount of more seconds randomly added to this delay.
  9.  
  10. //D is the base height of each flare.
  11.  
  12. //E is a maximum amount of meters that can be randomly added to or subtracted from the base height.
  13.  
  14. //F is the color of the flare. Available colors are "WHITE", "RED", "GREEN", "YELLOW", or "IR". If you make this "RANDOM" each flare will be a random color.
  15.  
  16. //G is the speed of the flare. Same velocity command you used. Must be negative or flares will tend to freeze in the air.
  17.  
  18. //H is the object the flares will be centered around. The player for example.
  19.  
  20. //I is the flare light intensity (If you set it too high, you will burn your eyes)
  21.  
  22. //J will change the illuminated area. (Dont set it too high because it will cause problems)
  23.  
  24. //null = [A, B, C, D, E, F, G, H, I, J]
  25. // Standard example: startFlares = 1; null = [150, 10, 5, 250, 10, "WHITE", -10, 50, 300, player] execVM "illuminatingFlares.sqf";
  26. // To stop the flares, replace 1 in startFlares = 1 with a different number. Example: startFlares = 0;
  27.  
  28. // declare a few variables we need and make _sign randomly negative
  29. _sign = 1;
  30. _random = false;
  31. if (floor random 10 > 4) then { _sign = -1 };
  32. _flareArray = ["WHITE", "RED", "GREEN", "YELLOW", "IR"];
  33.  
  34. // organize our arguments
  35. _flareDist = _this select 0;
  36. _delay = _this select 1;
  37. _delayRandom = _this select 2;
  38. _flareHeight = _this select 3;
  39. _flareHeightRandom = _this select 4;
  40. _flareType = _this select 5;
  41. _flareSpeed = _this select 6;
  42. _flareIntensity = _this select 7;
  43. _flareRange = _this select 8;
  44. _flarePos = _this select 9;
  45.  
  46.  
  47. // create loop for spawning flares
  48. while { startFlares == 1 } do
  49. {
  50. // check if random
  51. if (_flareType == "RANDOM") then { _flareType = _flareArray call BIS_fnc_selectRandom; _random = true };
  52. // assign flares
  53. switch (_flareType) do
  54. {
  55. case "WHITE": { _flareType = "F_40mm_White" };
  56. case "RED": { _flareType = "F_40mm_Red" };
  57. case "GREEN": { _flareType = "F_40mm_Green" };
  58. case "YELLOW": { _flareType = "F_40mm_Yellow" };
  59. case "IR": { _flareType = "F_40mm_CIR" };
  60. };
  61.  
  62. // get a random spot around the target
  63. _pos = [_flarePos, random _flareDist, random 360] call BIS_fnc_relPos;
  64. _pos = [_pos select 0, _pos select 1, _flareHeight + (random _flareHeightRandom * _sign)];
  65. // make the flare at that spot
  66. _flare = _flareType createVehicle _pos;
  67. // set its speed
  68. _flare setVelocity [0, 0, _flareSpeed];
  69.  
  70. sleep 3;
  71. _light = "#lightpoint" createVehicleLocal getPosATL _flare;
  72.  
  73. // light colors and ambient light colors for flares
  74. if(_flaretype == "F_40mm_White") then { _light setLightAmbient [0.7,0.7,0.8] };
  75. if(_flaretype == "F_40mm_Red") then { _light setLightAmbient [0.7,0.15,0.1] };
  76. if(_flaretype == "F_40mm_Green") then { _light setLightAmbient [0.2,0.7,0.2] };
  77. if(_flaretype == "F_40mm_Yellow") then { _light setLightAmbient [0.7,0.7,0] };
  78.  
  79. if(_flaretype == "F_40mm_White") then { _light setLightColor [0.7,0.7,0.8] };
  80. if(_flaretype == "F_40mm_Red") then { _light setLightColor [0.7,0.15,0.1] };
  81. if(_flaretype == "F_40mm_Green") then { _light setLightColor [0.2,0.7,0.2] };
  82. if(_flaretype == "F_40mm_Yellow") then { _light setLightColor [0.7,0.7,0] };
  83.  
  84. //flare_intensity = 30;
  85. //_light setLightBrightness 1.0;
  86. //_light setLightIntensity flare_intensity;
  87. _light setLightUseFlare true;
  88. _light setLightFlareSize 10;
  89. _light setLightFlareMaxDistance 2000;
  90.  
  91. flare_range = _flareRange;
  92. _light setLightAttenuation [/*start*/ flare_range, /*constant*/1, /*linear*/ 100, /*quadratic*/ 0, /*hardlimitstart*/50,/* hardlimitend*/flare_range-10];
  93. _light setLightDayLight true;
  94.  
  95. flare_brightness = _flareIntensity;
  96. _inter_flare = 0;
  97.  
  98. while {!isNull _flare /*_inter_flare<21*/} do {
  99. _int_mic = 0.05 + random 0.01;
  100. sleep _int_mic;
  101. _flare_brig = flare_brightness+random 10;
  102. _light setLightIntensity _flare_brig;
  103. _inter_flare = _inter_flare + _int_mic;
  104. _light setpos (getPosATL _flare);
  105. };
  106.  
  107. // delay plus random delay
  108. sleep _delay + random _delayRandom;
  109. // reset random if it was there before
  110. if (_random) then { _flareType = "RANDOM" };
  111.  
  112. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement