Created
July 13, 2016 21:04
-
-
Save jameslkingsley/83625a2ac8b8d2d3d747d76bfcc0566c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Author: <insert human> | |
* Creates lightning bolt effects in area | |
* | |
* Arguments: | |
* 0: Center of area (x, y, z) <ARRAY> | |
* 1: Radius of area <NUMBER> | |
* 2: Interval (seconds) <NUMBER> | |
* | |
* Return Value: | |
* None | |
* | |
* Example: | |
* [getMarkerPos "lscenter", 1000, 10] spawn ARC_fnc_lightningBolts; | |
*/ | |
if (!isServer) exitWith {}; | |
if (!canSuspend) exitWith {_this spawn ARC_fnc_lightningBolts}; | |
params [ | |
["_center", [], [[]]], | |
["_radius", 2000, [0]], | |
["_interval", 60, [0]] | |
]; | |
if (_center isEqualTo []) exitWith {}; | |
private _strikePos = [_center, _radius] call CBA_fnc_randPos; | |
private _bolt = createVehicle ["LightningBolt", _strikePos, [], 0, "CAN_COLLIDE"]; | |
_bolt setPosATL _strikePos; | |
_bolt setDamage 0.3; | |
private _light = "#lightpoint" createVehicle _strikePos; | |
_light setPosATL (_strikePos vectorAdd [0, 0, 10]); | |
_light setLightDayLight true; | |
_light setLightBrightness 300; | |
_light setLightAmbient [0.05, 0.05, 0.1]; | |
_light setLightColor [1, 1, 2]; | |
sleep 0.1; | |
_light setLightBrightness 0; | |
sleep (random 0.1); | |
private _class = selectRandom ["lightning1_F", "lightning2_F"]; | |
_lightning = _class createVehicle _strikePos; | |
_lightning setDir (random 360); | |
for "_i" from 0 to (random 2) do { | |
private _time = time + 0.1; | |
_light setLightBrightness (100 + random 100); | |
waitUntil {time > _time}; | |
}; | |
deletevehicle _lightning; | |
deletevehicle _light; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment