Advertisement
Guest User

skyFlares.sqf

a guest
Jun 17th, 2015
2,008
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. // skyFlares.sqf
  2. // startFlares = 1; null = [<max distance>, <base delay>, <max added delay>, <base height>, <random added or subtracted height>, <color>, <speed (must be negative)>, <object pos>] execVM "skyFlares.sqf";
  3.  
  4. // declare a few variables we need and make _sign randomly negative
  5. _sign = 1;
  6. _random = false;
  7. if (floor random 10 > 4) then { _sign = -1 };
  8. _flareArray = ["WHITE", "RED", "GREEN", "YELLOW", "IR"];
  9.  
  10. // organize our arguments
  11. _flareDist = _this select 0;
  12. _delay = _this select 1;
  13. _delayRandom = _this select 2;
  14. _flareHeight = _this select 3;
  15. _flareHeightRandom = _this select 4;
  16. _flareType = _this select 5;
  17. _flareSpeed = _this select 6;
  18. _flarePos = _this select 7;
  19.  
  20. // create loop for spawning flares
  21. while { startFlares == 1 } do
  22. {
  23. // check if random
  24. if (_flareType == "RANDOM") then { _flareType = _flareArray call BIS_fnc_selectRandom; _random = true };
  25. // assign colors
  26. switch (_flareType) do
  27. {
  28. case "WHITE": { _flareType = "F_40mm_White" };
  29. case "RED": { _flareType = "F_40mm_Red" };
  30. case "GREEN": { _flareType = "F_40mm_Green" };
  31. case "YELLOW": { _flareType = "F_40mm_Yellow" };
  32. case "IR": { _flareType = "F_40mm_CIR" };
  33. };
  34. // get a random spot around the target
  35. _pos = [_flarePos, random _flareDist, random 360] call BIS_fnc_relPos;
  36. _pos = [_pos select 0, _pos select 1, _flareHeight + (random _flareHeightRandom * _sign)];
  37. // make the flare at that spot
  38. _flare = _flareType createVehicle _pos;
  39. // set its speed
  40. _flare setVelocity [0, 0, _flareSpeed];
  41. // delay plus random delay
  42. sleep _delay + random _delayRandom;
  43. // reset random if it was there before
  44. if (_random) then { _flareType = "RANDOM" };
  45. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement