Author: Shpook
Author Website:

Requirements: No addons required

Version: 1.1

Short description: This is a small lightweight script to add ambient lighning to your mission.

Date: 2014-07-13 22:25


Comments: (0)
Rating:



 



Ambient Lightning

by
Shpook


Description:
Here's a small ambient lightning script I made for a mission, I figured people would enjoy using it. It's lightweight, and shouldn't affect mission performance at all. This is based on the Zeus lightning function from Bohemia. You can adjust the center the lightning spawns around, the radius the lightning spawns in, and the maximum duration between strikes.


Installation / Usage:
Place the scripts folder in your mission folder. You can call the script from almost anywhere: init.sqf, a game logic, a player, or any other script. I prefer to use init.sqf.

Parameters:
_center - OBJECT, MARKER, or POSITION. Marker must have quotes(""). Position must be array[]. Default is player.
_radius - Radius around center that lightning is randomly spawned. Default is 800 meters.
_interval - Maximum duration in which lightning strikes. Default is 60 seconds.

nul = [_center, _radius, _interval] execVM "scripts\SHPambientLightning.sqf";

Spawn lightning with defaults of player center, 800m radius, and 60s interval:
nul = [] execVM "scripts\SHPambientLightning.sqf";

Spawn lightning with transportHelicopter as center, 300m radius, and 20s interval:
nul = [transportHelicopter, 300, 20] execVM "scripts\SHPambientLightning.sqf";

Spawn lightning with marker as center, 500m radius, and default interval:
nul = ["lightningCenter", 500] execVM "scripts\SHPambientLightning.sqf";

Spawn lightning with position array as center, default radius, and default interval:
nul = [[2482.0117,32.202206,22100.438]] execVM "scripts\SHPambientLightning.sqf";

To stop the lightning script, type the following in a trigger or script:
SHPLightningRun = false;
publicVariable "SHPLightningRun";


Media:



Armaholic.com has its own Youtube channel where we will cover the Community made releases.
Subscribe to the Armaholic.com Youtube channel


Known issues:
It will most likely act strange in multiplayer, due to the mixture of localities. I haven't noticed any issues with smaller player counts, but it's not tested with more than a few players. Please let me know if you notice anything strange.


To do:
Add a variable check to the loop to allow script cancellation during mission.


Credits & Thanks:
Bohemia for providing both the Arma platform and the lightning function.
TEST Outfit, TEST Arma for helping with testing, especially Vezer0.


License:
Feel free to do anything you want with this script. Also feel free to post any improvements, I'd love to see them.


Changelog:
v1.1
- Added chance of building and structure strikes.
- Added check variable to allow loop cancellation.
- Fixed a bug preventing the center from following a moving player or object.

v1.0
- first release


Forum topic:
- Armaholic forums
- BI forums




Enable javascript to be able to download from Armaholic please!



Tags: Ambient,   Lightning,   Lightweight,   Zeus