From cba86320327a9890badd91d1fc58a25548728ac4 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Sun, 8 Sep 2013 00:48:09 +0100 Subject: [PATCH] Update local_lights_off.sqf --- SQF/dayz_code/compile/local_lights_off.sqf | 73 +++++++++++++++++----- 1 file changed, 58 insertions(+), 15 deletions(-) diff --git a/SQF/dayz_code/compile/local_lights_off.sqf b/SQF/dayz_code/compile/local_lights_off.sqf index fb49a4609..0fffd7cb8 100644 --- a/SQF/dayz_code/compile/local_lights_off.sqf +++ b/SQF/dayz_code/compile/local_lights_off.sqf @@ -1,20 +1,63 @@ /* - DayZ Epoch Lighting System + DayZ Epoch Lighting System - Fail / Switch Off Lights Made for DayZ Epoch please ask permission to use/edit/distrubute email axeman@thefreezer.co.uk. */ -private ["_objLightPoint","_rng","_nrstGen","_objHouse"]; +private ["_rng","_nrstTrig","_objHouses","_objHouse","_nrLights","_nrTowers","_doRand","_rnd","_animlightpoint","_sleeptime","_brightness"]; _rng = _this select 0; -_rng=_rng+5; -_nrstGen = _this select 1; -_objLightPoint = nearestObject [_nrstGen, "#lightpoint"]; - -while {_nrstGen distance _objLightPoint < _rng} do { -_objLightPoint = nearestObject [_nrstGen, "#lightpoint"]; -deleteVehicle _objLightPoint; +_rng = _rng + 20; +_nrstTrig = _this select 1; +_doRand = _this select 2; +_nrLights = position _nrstTrig nearObjects ["#lightpoint",_rng]; +_objHouses = nearestObjects [_nrstTrig, ["House"], _rng]; +_nrTowers = nearestObjects [_nrstTrig, ["Land_Ind_IlluminantTower"], _rng]; +if(_doRand)then{//Randomly fail a nearby house + if(count _objHouses >0)then{ + _rnd = random count _objHouses; + _objHouse = _objHouses select _rnd; + _animlightpoint = nearestObject [_objHouse, "#lightpoint"]; + for "_s" from 1 to 5 do { + if(_s%2==0)then + { + _brightness=0; + for "_l" from 1 to 2 do { + _objHouse animate [format ["Lights_%1",_l],0]; + }; + } + else + { + _brightness=0.01; + for "_l" from 1 to 2 do { + _objHouse animate [format ["Lights_%1",_l],1]; + }; + }; + _animlightpoint setLightBrightness _brightness; + _sleeptime=(random 100)/1200; + sleep _sleeptime; + }; + _animlightpoint setLightBrightness 0; + _objHouse animate ["Lights_1",0]; + _objHouse animate ["Lights_2",0]; + _objHouse setVariable ["axeHLight", 0, false]; + }; +} +else{ + if(count _nrLights >0)then{ + { + deleteVehicle _x; + }forEach _nrLights; + }; + + if(count _objHouses >0)then{ + { + _x animate ["Lights_1",0]; + _x animate ["Lights_2",0]; + _x setVariable ["axeHLight", 0, false]; + }forEach _objHouses; + }; + + if(count _nrTowers >0)then{ + { + _x setVariable ["axeTLight", 0, false]; + }forEach _nrTowers; + }; }; - -_objHouse = nearestObjects [_nrstGen, ["House"], _rng]; -{ -_x animate ["Lights_1",0]; -_x animate ["Lights_2",0]; -}forEach _objHouse;