Jump to content
Sign in to follow this  
gruukh

Indoor lighting for night missions

Recommended Posts

This is probably a bit ambitious to ask given the game is still an alpha, but does anybody know of a way to emulate or enable interior lighting of buildings. I'd like to have a degree of realism/immersion for a night mission i am making.

Share this post


Link to post
Share on other sites

I wrote this mod a while ago for A2: http://forums.bistudio.com/showthread.php?134139-TPW-HOUSELIGHTS-automatic-house-light-addon , which adds lights into buildings around the player at night. I've been out of modding for a while, but recently tried a few of my old mods in A3 and whaddya know, this one actually works.

It does increase immersion but be aware that the interior lights have no source (lamp, candle etc).

I'll be interested to hear if it works for you.

Share this post


Link to post
Share on other sites

That sounds good mate, I'll give that one a crack and let you know how it goes.

Share this post


Link to post
Share on other sites

wait, wait , wait...

TPW, your saying that your houselights mod works in Arma 3 .. because once again like the JTD likes i was just thinking about testing that next .. i just played around with dynamic weather script and i was thinking about this one.. I cant wait to try it out now !!

Thanks TPW

Share this post


Link to post
Share on other sites

This sounds cool but.. How do I use this for arma 3.. I'm terrible at this stuff.

Share this post


Link to post
Share on other sites

tpw, I tried running the script but A3 hung when i ran it in the editor. I have the mod running via a launcher, and correctly edited/repacked the pbo so the paths to the scripts were correct (I'm using the MP version BTW, it's a COOP mission). As an FYI, to run it I placed a gamelogic and put nul=[this] execVM "tpw_houselights_1081mp\tpw_houselights.sqf" to call it. I couldn't figure out if this is the right way to call it; my Arma coding skills are strictly of the script kiddie variety...

I think I'm doing something wrong here, but I don't know what exactly. Did you get it working with the SP or MP version?

Share this post


Link to post
Share on other sites
tpw, I tried running the script but A3 hung when i ran it in the editor. I have the mod running via a launcher, and correctly edited/repacked the pbo so the paths to the scripts were correct (I'm using the MP version BTW, it's a COOP mission). As an FYI, to run it I placed a gamelogic and put nul=[this] execVM "tpw_houselights_1081mp\tpw_houselights.sqf" to call it. I couldn't figure out if this is the right way to call it; my Arma coding skills are strictly of the script kiddie variety...

I think I'm doing something wrong here, but I don't know what exactly. Did you get it working with the SP or MP version?

I've only quickly run the addon version of SP and it definitely worked in the editor. There should be no need to place nul=[this] execVM "tpw_houselights_1081mp\tpw_houselights.sqf", it just runs. Make sure to place yourarma3/userconfig/TPW_HOUSELIGHTS/TPW_HOUSELIGHTS.hpp too.

IIRC people started having troubles with the MP for some reason but I never got to the bottom of it before taking a break from Arma. I will look into it shortly. Please try SP in the mean time and at least see if you can get some lights happening.

EDIT: It just occurred to me that the MP version cannot work yet, as it replies on me setting up a list of precalculated lights. I haven't done this yet. The SP version calculates the lights on the fly and will work on any map with enterable buildings

Edited by tpw

Share this post


Link to post
Share on other sites
EDIT: It just occurred to me that the MP version cannot work yet, as it replies on me setting up a list of precalculated lights. I haven't done this yet. The SP version calculates the lights on the fly and will work on any map with enterable buildings

I thought that may be the case - I seem to recall reading MP lights were hardcoded. I'll try SP anyways, see how it goes. If you get around to doing an MP version for Stratis, let me know, would be awesome!

EDIT: Ran it with SP and get a hint saying TPW Houselights 1.08 0 Lightable houses. Not sure why it doesn't work for me, but I only make COOP missions at this stage so not too worried about it.

Edited by gruukh

Share this post


Link to post
Share on other sites
I thought that may be the case - I seem to recall reading MP lights were hardcoded. I'll try SP anyways, see how it goes. If you get around to doing an MP version for Stratis, let me know, would be awesome!

EDIT: Ran it with SP and get a hint saying TPW Houselights 1.08 0 Lightable houses. Not sure why it doesn't work for me, but I only make COOP missions at this stage so not too worried about it.

OK I just tried again with TPW Houselights 1.081 SP addon version (not the script version): https://dl.dropbox.com/u/481663/TPW_HOUSELIGHTS_1081.zip, and it absolutely does work, for both the alpha and the dev versions of A3.

See how you go with these!

Share this post


Link to post
Share on other sites

Shall do. Will do a fresh install/setup and try it.

---------- Post added at 09:27 PM ---------- Previous post was at 09:13 PM ----------

OK, saw it working now. It's an awesome addon! Am I correct in saying that adapting the MP script to Stratis would require adding an array with all of the lighting locations, as you have done for zargabad, shapur, etc?

Share this post


Link to post
Share on other sites
Shall do. Will do a fresh install/setup and try it.

---------- Post added at 09:27 PM ---------- Previous post was at 09:13 PM ----------

OK, saw it working now. It's an awesome addon! Am I correct in saying that adapting the MP script to Stratis would require adding an array with all of the lighting locations, as you have done for zargabad, shapur, etc?

Glad you finally got it happening. You are absolutely correct, I will need to make the stratis lighting array. I will first have to dust off my rusty arma scripting and mod compiling "skills" so this won't be happening tonight I'm afraid.

Share this post


Link to post
Share on other sites
Glad you finally got it happening. You are absolutely correct, I will need to make the stratis lighting array. I will first have to dust off my rusty arma scripting and mod compiling "skills" so this won't be happening tonight I'm afraid.

Yeah from looking at the arrays for A2 + OA maps, it looks laborious. Where do you find the information to populate the array - is it the ID of each building on the map?

Share this post


Link to post
Share on other sites

The released script version of TPW is missing a variable but here is the MP one that works (using it in a mission).

Save as tpw_houselights108-mp.sqf

// THIS SCRIPT WON'T RUN ON DEDICATED SERVERS
if (isDedicated) exitWith {};

/*
 TPW HOUSELIGHTS v 1.08
 This script causes flickering lights to automatically come on in enterable
 buildings around the player. It will work on any map with ALICE2 compatible
 enterable buildings, and will simply ignore unenterable ALICE buildings.
 Please feel free to modify and improve this script, on the proviso that you
 post your improvements for others to benefit from.

 This is the multiplayer version, with light parameters hard coded in so that 
 all players see the same lights. 

 Thanks:
 * CarlGustaffa for the azimuth code
 * Rydygier for the inspiration for the flickering code
 * RogueTrooper for the improved code for determining enterable buildings
 * Xeno for config and server help
 * Demon Cleaner and Muzzleflash for code cleanup and optimisation
 * Twistking for MP suggestions

 TPW 20120603
*/  

sleep 10; // Allow other scripts time to settle down

////////////////
// VARIABLES //
//////////////
private ["_flickerdistance","_brightdistance","_hint"];
// How close player must be to a light to see it flickering - use a lower value if flickering lights are too CPU demanding
_flickerdistance = 50;

// Houses greater than this distance will be brighter, to compensate for engine.
_brightdistance =  100;

_housedistance = _this select 0;

// Initialisation hint. 0 = no hint 
_hint = 0;

///////////////////////
// FLICKER FUNCTION //
/////////////////////
tpw_flicker = {
private ['_lt0','_br','_fv','_rng','_brmax','_brmin','_op','_inc','_br2','_fd','_ct'];
_lt0 = _this select 0; // Light source
_br = _this select 1; // Brightness
_fv = _this select 2; // Brightness variation
_fd = _this select 3; // Distance from player to flicker
_rng = _br * _fv; // Brightness range
_brmax = (_br + _rng); // Initial maximum brightness
_brmin = (_br - _rng); // Initital minimum brightness
_op = 1; // Operator, will be +/-
_inc = _rng / (random 10); // Initial brightness increment
_br2 = _br;
_ldist = (vehicle player) distance _lt0; // Initial distance from player
_ct = 0;
while {not (isNull _lt0)} do { // Only run if lightsource object exists 
_ct = _ct + 1;
if (_ldist < _fd) then { // Only flicker if close enough to player
_br2 = _br2 + (_op * _inc); // Increment/decrement brightness (depends on operator)
_lt0 setLightBrightness _br2; // Set brightness
if (_br2 > _brmax) then { // If brightness exceeds maximum, then change operator so it will decrease
  _op = -1;
  _brmax = _br + (random _rng); // New maximum
  _inc = _rng / ((random 10) + 1); // New increment
};
if (_br2 < _brmin) then { // If brightness less than minimum, then change operator so it will increase
  _op = 1;
  _brmin = _br - (random _rng); // New minimum
  _inc = _rng / ((random 10) + 1); // New increment
};
};
sleep (random 0.1); // Random time between each increment/decrement
if (_ct > 100) then {_ldist = (vehicle player) distance _lt0; _ct = 0}; // Only determine distance from player every second or 2, to save CPU
};
};

///////////////
// SUN ANGLE//
/////////////
[] spawn {
while {true} do 
{
private ["_lat","_day","_hour","_sunangle"];
_lat = -1 * getNumber(configFile >> "CfgWorlds" >> worldName >> "latitude");
_day = 360 * (dateToNumber date);
_hour = (daytime / 24) * 360;
tpw_houselights_sunangle = ((12 * cos(_day) - 78) * cos(_lat) * cos(_hour)) - (24 * sin(_lat) * cos(_day));  
sleep 60; 
};
};


///////////////////////////
// INITIALISE HOUSES    //
/////////////////////////
private ["_house","_houses","_pos","_params","_rawarray"];

//Arrays of house positions and precalculated lighting parameters
//You can add or replace data generated with tpw_houselights-scan.sqf

_Stratis_array = [[[1910.21,5713.01,0.00357676],[[1,0.784314,0.392157],0.0241939,0.05]],[[1924.22,5737.5,0.00246572],[[1,0.498039,0.0941176],0.0185451,0.1]],[[1957.83,5704.6,0.00731421],[[1,0.498039,0.0941176],0.0219447,0.1]],[[2060.23,5503.81,0.00332975],[[1,0.784314,0.392157],0.0263404,0]],[[1993.41,5324.27,-2.16516],[[1,0.498039,0.0941176],0.0165755,0.1]],[[2080.44,5522.36,0.128621],[[1,0.498039,0.0941176],0.0168645,0]],[[2084.66,5541.19,0.128039],[[0.392157,0.784314,1],0.0148168,0.3]],[[2052.4,5704.96,-0.00413704],[[1,0.498039,0.0941176],0.0170159,0]],[[2028.04,5339.88,-0.373367],[[1,0.784314,0.392157],0.0202533,0]],[[2055.05,5715.52,0.0147452],[[1,0.498039,0.0941176],0.0144333,0.1]],[[2000.84,5291.02,-1.85543],[[1,0.498039,0.0941176],0.02313,0.1]],[[1952.04,5856.69,0.000226498],[[1,0.498039,0.0941176],0.0182275,0.1]],[[1991.04,5250.5,-1.74065],[[0.392157,0.784314,1],0.0130192,0.3]],[[2127.89,5585.6,0.0162649],[[1,0.498039,0.0941176],0.0231187,0.1]],[[2129.78,5595.13,8.39233e-005],[[1,0.498039,0.0941176],0.0230918,0.1]],[[2132.2,5576.36,0.00306177],[[0.392157,0.784314,1],0.0147303,0.3]],[[2132,5629.43,0.0221262],[[1,0.498039,0.0941176],0.0214837,0.1]],[[2145.53,5531.46,-0.00874996],[[1,0.498039,0.0941176],0.017543,0.1]],[[2141.1,5615.91,6.77109e-005],[[1,0.498039,0.0941176],0.0190521,0.1]],[[2145.51,5577.61,0.0125713],[[1,0.784314,0.392157],0.0263411,0]],[[1981.13,5210.01,-1.62483],[[1,0.784314,0.392157],0.0217495,0]],[[2151.91,5593.34,0.000247478],[[1,0.498039,0.0941176],0.0135029,0.1]],[[2154.26,5570,0.00715637],[[1,0.498039,0.0941176],0.0181689,0.1]],[[2143.58,5648.77,0.159845],[[1,0.498039,0.0941176],0.0194984,0.1]],[[2144.09,5667.69,0.000878334],[[1,0.498039,0.0941176],0.0159982,0]],[[2161.04,5611.14,-0.000351429],[[1,0.498039,0.0941176],0.0184714,0.1]],[[2047.24,5852,-0.0832357],[[1,0.784314,0.392157],0.0300618,0]],[[2156.88,5656.85,0.000393867],[[1,0.498039,0.0941176],0.0211032,0.1]],[[1755.07,5102.38,0.12882],[[1,0.784314,0.392157],0.0190728,0]],[[2149.58,5684.9,0.000124454],[[1,0.498039,0.0941176],0.0133027,0.1]],[[1971.44,5169.75,-1.1805],[[1,0.498039,0.0941176],0.0164139,0]],[[2150.41,5396.9,0.00277901],[[1,0.498039,0.0941176],0.0130825,0.1]],[[2152.2,5697.8,0.000668526],[[1,0.498039,0.0941176],0.0200044,0.1]],[[2160.26,5672.26,0.000601768],[[1,0.498039,0.0941176],0.0146133,0.1]],[[2072.73,5845.81,-0.158573],[[1,0.498039,0.0941176],0.0144048,0.1]],[[2161.4,5682.35,0.000577927],[[1,0.498039,0.0941176],0.0198262,0]],[[2169.16,5656.34,-0.000276566],[[1,0.784314,0.392157],0.0291679,0]],[[2181.52,5513.95,0.000536919],[[1,0.498039,0.0941176],0.0196764,0]],[[2183.75,5582.31,0.00230503],[[1,0.498039,0.0941176],0.0213,0.1]],[[2053.1,5874.79,-0.0584216],[[1,0.498039,0.0941176],0.0138107,0.1]],[[2171.65,5669.12,0.000722408],[[0.392157,0.784314,1],0.0204941,0.3]],[[2164.07,5696.85,0.00065279],[[1,0.498039,0.0941176],0.0180219,0]],[[2186.54,5594.75,-0.00685787],[[1,0.784314,0.392157],0.024416,0]],[[1996.67,5169.47,-0.168254],[[0.392157,0.784314,1],0.0196957,0.3]],[[2173.68,5679.79,-9.53674e-005],[[1,0.784314,0.392157],0.0205622,0.05]],[[2188.96,5607.1,-0.00374746],[[1,0.784314,0.392157],0.0170062,0.05]],[[1980.34,5156.15,-2.22425],[[1,0.784314,0.392157],0.0193471,0]],[[2148.32,5344.68,0.00117397],[[1,0.498039,0.0941176],0.0209723,0.1]],[[2194.86,5569.62,0.0143456],[[1,0.498039,0.0941176],0.018756,0.1]],[[2196.94,5579.03,0.00386858],[[0.392157,0.784314,1],0.0122563,0.3]],[[2176.43,5693.29,0.000612736],[[1,0.498039,0.0941176],0.019641,0]],[[2077.66,5869.29,-0.135517],[[1,0.498039,0.0941176],0.0151174,0.1]],[[2201.34,5595.4,0.0208888],[[1,0.498039,0.0941176],0.0189291,0]],[[2201.35,5604.91,-0.0228443],[[1,0.498039,0.0941176],0.0176342,0.1]],[[2139.09,5795.2,-0.00495577],[[1,0.784314,0.392157],0.0163114,0]],[[2197.91,5658.45,0.000582695],[[1,0.784314,0.392157],0.0215344,0]],[[2107.71,5852.86,-0.189972],[[1,0.498039,0.0941176],0.0127743,0.1]],[[2201.5,5671.16,0.000396729],[[1,0.498039,0.0941176],0.0136409,0]],[[2203.61,5683.4,0.000936508],[[1,0.498039,0.0941176],0.0180731,0.1]],[[2211.01,5661.41,0.000131607],[[1,0.498039,0.0941176],0.0211414,0.1]],[[2212.64,5670,5.24521e-006],[[1,0.784314,0.392157],0.0239914,0.05]],[[2143.31,5849.84,-2.15236],[[1,0.784314,0.392157],0.0159477,0]],[[2134.49,5883.43,-2.07421],[[0.392157,0.784314,1],0.0199895,0.3]],[[2225.5,5721.37,-0.499993],[[0.392157,0.784314,1],0.0219093,0.3]],[[2183.82,5840.09,-2.1095],[[1,0.498039,0.0941176],0.0193332,0.1]],[[2238.31,5759.13,-0.0111847],[[1,0.784314,0.392157],0.0178754,0]],[[2144.19,5923.93,-2.19077],[[1,0.498039,0.0941176],0.0140405,0.1]],[[2224.28,5830.34,-1.79982],[[0.392157,0.784314,1],0.0196476,0.3]],[[2276.76,5774.2,0.00402308],[[1,0.498039,0.0941176],0.0151076,0.1]],[[2282.5,5761.34,-0.0228877],[[1,0.498039,0.0941176],0.0153033,0.1]],[[2443.25,5694.54,-0.0335312],[[1,0.498039,0.0941176],0.0126566,0.1]],[[2462.3,5688.83,0.00961304],[[1,0.498039,0.0941176],0.0158895,0.1]],[[2495.83,5708.71,-0.0802994],[[1,0.498039,0.0941176],0.0156098,0.1]],[[2557.17,5508.92,0.0150833],[[0.392157,0.784314,1],0.0125792,0.3]],[[2571.43,5488.41,-0.736595],[[0.392157,0.784314,1],0.0188602,0.3]],[[2711.29,5793.75,-0.000499487],[[1,0.498039,0.0941176],0.0225212,0.1]],[[2745.58,5733.31,0.0678892],[[0.392157,0.784314,1],0.0160129,0.3]],[[2732.88,5799.09,0.0562296],[[1,0.784314,0.392157],0.0225472,0]],[[2764.9,5749.43,0.0998237],[[1,0.498039,0.0941176],0.0203633,0.1]],[[2772.59,5731.97,0.067955],[[1,0.498039,0.0941176],0.0204804,0.1]],[[2756.81,5840.8,-0.131434],[[1,0.498039,0.0941176],0.0208958,0]],[[2589.3,4893.93,0.41555],[[1,0.784314,0.392157],0.025339,0.05]],[[2706.52,6051.8,1.55377],[[1,0.498039,0.0941176],0.0174099,0]],[[2710.38,6059.06,-0.103183],[[0.392157,0.784314,1],0.014419,0.3]],[[2715.42,6054.49,-0.654269],[[1,0.784314,0.392157],0.0189973,0.05]],[[2733.53,6073.64,-0.138891],[[1,0.498039,0.0941176],0.0208456,0.1]],[[2751.78,6093.14,-0.833737],[[1,0.498039,0.0941176],0.0222005,0.1]],[[2849.96,5887.8,0.0856276],[[0.392157,0.784314,1],0.0191986,0.3]],[[2807.09,6024.22,2.9753],[[0.392157,0.784314,1],0.0215457,0.3]],[[2769.28,6107.33,-0.376381],[[1,0.784314,0.392157],0.0306483,0]],[[2860.21,5939.27,-0.00702524],[[1,0.498039,0.0941176],0.0214166,0]],[[2871.3,5928.01,0.00201464],[[1,0.498039,0.0941176],0.016516,0.1]],[[2793.08,6119.4,-0.647403],[[1,0.498039,0.0941176],0.0161991,0.1]],[[2871.66,5953.42,-0.140089],[[0.392157,0.784314,1],0.0193471,0.3]],[[2811.29,6113.65,-1.39334],[[1,0.498039,0.0941176],0.016388,0.1]],[[2891.2,5925.65,-0.0121686],[[1,0.498039,0.0941176],0.011872,0.1]],[[2838.64,6080.07,-0.966141],[[1,0.498039,0.0941176],0.011913,0.1]],[[2893.99,5943.96,0.000748634],[[0.392157,0.784314,1],0.0190204,0.3]],[[2832.88,6097.61,-1.42115],[[1,0.784314,0.392157],0.0275747,0]],[[2844.53,6078.36,-0.210017],[[1,0.498039,0.0941176],0.020195,0.1]],[[2824.57,6127.3,-0.131157],[[1,0.498039,0.0941176],0.0178016,0]],[[2906.33,5939.29,0.104975],[[1,0.498039,0.0941176],0.0145554,0]],[[2915.06,5915.79,0.379043],[[0.392157,0.784314,1],0.0184181,0.3]],[[2887.17,6002.42,-0.222772],[[1,0.498039,0.0941176],0.0143083,0.1]],[[2838.79,6116.63,0.0605567],[[1,0.498039,0.0941176],0.021328,0.1]],[[2900.55,5984.03,-0.257972],[[1,0.498039,0.0941176],0.0220969,0.1]],[[2844.98,6112.76,-0.000215769],[[1,0.498039,0.0941176],0.0219313,0.1]],[[2851.3,6107.53,-0.0287569],[[1,0.784314,0.392157],0.0233231,0.05]],[[2912.24,5964.26,-0.197158],[[1,0.498039,0.0941176],0.0170863,0]],[[2863.61,6100.74,0.0253301],[[1,0.498039,0.0941176],0.0187427,0.1]],[[2908.01,5997.82,-0.14643],[[1,0.498039,0.0941176],0.0202924,0]],[[2937.02,5917.14,-0.918091],[[1,0.784314,0.392157],0.0285227,0.05]],[[2921.58,5972.42,-0.199087],[[1,0.498039,0.0941176],0.0229673,0.1]],[[2930.87,5952.56,-0.217356],[[1,0.498039,0.0941176],0.0201363,0.1]],[[2872.82,6101.48,-0.0190504],[[0.392157,0.784314,1],0.0161487,0.3]],[[2924.49,5988.46,6.50883e-005],[[1,0.784314,0.392157],0.0218677,0.05]],[[2942.38,5940.23,-0.0147693],[[1,0.498039,0.0941176],0.0193723,0.1]],[[2891.04,6081.74,0.80522],[[0.392157,0.784314,1],0.0177781,0.3]],[[2884.97,6096.13,-0.119161],[[0.392157,0.784314,1],0.0129942,0.3]],[[2939.32,5963.37,-0.216607],[[1,0.498039,0.0941176],0.015771,0.1]],[[2975.44,5854.29,0.128049],[[1,0.784314,0.392157],0.0157876,0]],[[2917.69,6035.4,-0.144032],[[1,0.498039,0.0941176],0.0190725,0.1]],[[2941.62,5974.09,-0.190837],[[1,0.784314,0.392157],0.0278571,0]],[[2955.06,5934.43,-0.0255966],[[1,0.498039,0.0941176],0.0194087,0.1]],[[2882.9,6129.05,-0.0617771],[[1,0.498039,0.0941176],0.0233424,0.1]],[[2928.51,6032.78,-0.158352],[[1,0.498039,0.0941176],0.0154752,0.1]],[[2914.3,6069.47,0.0943685],[[1,0.784314,0.392157],0.0178305,0]],[[2970.69,5918.41,-0.000462532],[[1,0.498039,0.0941176],0.0221294,0]],[[2908.3,6107.66,-0.0793433],[[0.392157,0.784314,1],0.0166021,0.3]],[[2929.83,6061.42,-0.19041],[[0.392157,0.784314,1],0.0158766,0.3]],[[2951.23,6017.74,-0.142504],[[0.392157,0.784314,1],0.0211561,0.3]],[[2895.93,6147.17,-0.879253],[[1,0.498039,0.0941176],0.0123325,0.1]],[[2975.65,5956.96,0.00123692],[[0.392157,0.784314,1],0.0232948,0.3]],[[2924.64,6089.58,0.611936],[[1,0.784314,0.392157],0.0235267,0.05]],[[2934.68,6072.25,-0.257392],[[1,0.498039,0.0941176],0.0130868,0.1]],[[2943.61,6053.14,-0.00137877],[[1,0.498039,0.0941176],0.018815,0.1]],[[2986.04,5951.96,-0.288474],[[1,0.784314,0.392157],0.0288724,0]],[[2971.03,6006.62,-0.00388193],[[1,0.784314,0.392157],0.0228922,0]],[[2965.03,6028.19,-0.0717831],[[1,0.498039,0.0941176],0.0205131,0]],[[2954.85,6063.52,-0.107338],[[1,0.498039,0.0941176],0.022267,0]],[[2975.9,6016.8,-0.0017488],[[1,0.784314,0.392157],0.0210759,0]],[[3018.4,5907.37,-0.0759816],[[1,0.498039,0.0941176],0.0146791,0]],[[2940.3,6120.31,0.948738],[[0.392157,0.784314,1],0.0143109,0.3]],[[3014,5953.64,-0.0721233],[[1,0.784314,0.392157],0.0169352,0]],[[2993.6,6014,0.0152388],[[1,0.784314,0.392157],0.0307693,0]],[[2940.98,6147.01,-0.08848],[[1,0.498039,0.0941176],0.021067,0.1]],[[3027.07,5931.71,-0.0234327],[[1,0.498039,0.0941176],0.0143282,0.1]],[[2984.07,6057.81,0.787474],[[1,0.498039,0.0941176],0.0211241,0.1]],[[3039.21,5894.36,-0.950711],[[1,0.498039,0.0941176],0.0225754,0.1]],[[3002.76,6013.23,-0.0339105],[[1,0.498039,0.0941176],0.021485,0.1]],[[2987.64,6065.96,0.648252],[[1,0.784314,0.392157],0.0303968,0.05]],[[2975.43,6095.27,-0.901814],[[1,0.784314,0.392157],0.0246155,0]],[[2965.57,6123.98,0.0208912],[[1,0.784314,0.392157],0.0245051,0]],[[3011.91,6015.21,-0.000139475],[[1,0.498039,0.0941176],0.0210904,0.1]],[[3004.93,6083.6,0.920055],[[1,0.784314,0.392157],0.0192447,0]],[[3001.1,6092.91,0.209581],[[1,0.498039,0.0941176],0.0159358,0]],[[3040.72,5991.46,-0.0430517],[[0.392157,0.784314,1],0.0117855,0.3]],[[3022.38,6043,-0.116776],[[1,0.498039,0.0941176],0.0218337,0.1]],[[3041.74,6000.63,-0.0901427],[[1,0.498039,0.0941176],0.0218199,0.1]],[[3039.69,6016.51,-0.00163221],[[1,0.784314,0.392157],0.0171229,0]],[[3077.51,5921.39,0.107523],[[1,0.498039,0.0941176],0.012426,0.1]],[[3042.43,6048.49,0.0622711],[[1,0.498039,0.0941176],0.0203628,0.1]],[[3059.64,6022.41,-0.0044713],[[1,0.498039,0.0941176],0.0193959,0.1]],[[3112.02,5861.42,-1.00002],[[1,0.498039,0.0941176],0.0200405,0.1]],[[3045.97,6090.69,-0.000940323],[[1,0.498039,0.0941176],0.0121277,0.1]],[[3070.39,6050.04,0.0625429],[[1,0.498039,0.0941176],0.0171187,0.1]],[[3055.74,6090.74,0.000267982],[[1,0.498039,0.0941176],0.0211139,0]],[[3082.92,6018.83,-0.00135612],[[1,0.784314,0.392157],0.0225043,0]],[[3126.29,5866.93,0.463709],[[1,0.784314,0.392157],0.0213559,0]],[[3109.55,5958.11,0.00574756],[[1,0.498039,0.0941176],0.0208112,0.1]],[[3101.79,5984.45,0.0997503],[[1,0.784314,0.392157],0.0169659,0.05]],[[3065.52,6090.73,-0.0758266],[[1,0.784314,0.392157],0.0303964,0]],[[3047.78,6137.65,-0.0973377],[[0.392157,0.784314,1],0.0194615,0.3]],[[3115.15,5962.9,1.19209e-006],[[1,0.498039,0.0941176],0.0148214,0.1]],[[3056.31,6127.4,0.395985],[[1,0.498039,0.0941176],0.0161164,0.1]],[[3140.46,5873.71,0.00794554],[[1,0.498039,0.0941176],0.011932,0.1]],[[3088.95,6051.06,-0.00153208],[[1,0.784314,0.392157],0.0181013,0]],[[3100.8,6019.89,-0.00311041],[[1,0.784314,0.392157],0.0302148,0.05]],[[3123.67,5969.85,0.0108206],[[1,0.498039,0.0941176],0.0125487,0]],[[3042.56,6182.18,-0.191381],[[1,0.498039,0.0941176],0.0166548,0.1]],[[3146.75,5914.06,-0.114973],[[1,0.498039,0.0941176],0.0137727,0]],[[3118.66,6025.49,0.182423],[[1,0.784314,0.392157],0.0206739,0]],[[3115.2,6048.29,0.156334],[[1,0.498039,0.0941176],0.0222018,0.1]],[[3206.65,5832.47,-0.00509453],[[1,0.498039,0.0941176],0.0189668,0.1]],[[3217.32,5807.05,0.00474596],[[1,0.498039,0.0941176],0.0176106,0.1]],[[3153.15,6060.72,0.193203],[[1,0.498039,0.0941176],0.0224598,0.1]],[[3219.65,5837.2,0.0173521],[[1,0.784314,0.392157],0.0264356,0]],[[3253.8,5836.59,-0.0477638],[[0.392157,0.784314,1],0.0227477,0.3]],[[3271.41,5823.69,0.03475],[[1,0.498039,0.0941176],0.0158373,0]],[[3277.65,5832.98,-0.0618069],[[1,0.498039,0.0941176],0.0218697,0.1]],[[3377.88,6068.76,-0.81464],[[1,0.498039,0.0941176],0.0192135,0.1]],[[3408.78,6043.02,0.0180397],[[0.392157,0.784314,1],0.023409,0.3]],[[3415.16,6061.5,0.0303078],[[1,0.498039,0.0941176],0.021699,0.1]],[[1911.6,3575.73,-0.00178719],[[1,0.498039,0.0941176],0.0213949,0.1]],[[1909.87,3551.38,-1.51401],[[0.392157,0.784314,1],0.0180229,0.3]],[[1888.43,3543.41,-2.54771],[[1,0.784314,0.392157],0.0278756,0]],[[1869.41,3538.35,0.346721],[[1,0.498039,0.0941176],0.0188852,0.1]],[[1985.5,3541.27,-0.016974],[[1,0.784314,0.392157],0.030403,0]],[[1994.65,3537.11,-0.0449982],[[1,0.498039,0.0941176],0.0180539,0.1]],[[1992.49,3517.53,-0.0404725],[[1,0.498039,0.0941176],0.0161869,0.1]],[[2001.18,3518.38,-0.027261],[[1,0.498039,0.0941176],0.016712,0.1]],[[1971.92,3507.48,-0.0200353],[[1,0.498039,0.0941176],0.0203767,0.1]],[[2047.43,3438.67,0.186403],[[1,0.498039,0.0941176],0.0124927,0]],[[2097.07,3421.24,0.00765228],[[1,0.784314,0.392157],0.025831,0.05]],[[2853.42,3694.18,0.0863152],[[1,0.498039,0.0941176],0.018793,0]],[[3613.16,6771.29,0.0201149],[[1,0.498039,0.0941176],0.0230212,0.1]],[[1924.29,2986.35,0.0706847],[[1,0.498039,0.0941176],0.014039,0]],[[2055.15,2790.68,0.0921149],[[1,0.498039,0.0941176],0.0215339,0.1]],[[1887.01,2767.33,0.0392723],[[1,0.784314,0.392157],0.0309501,0]],[[1998.05,2767.01,0.0111389],[[1,0.784314,0.392157],0.0182008,0]],[[1877.71,2755.92,0.0908527],[[0.392157,0.784314,1],0.0154546,0.3]],[[2035.63,2768.05,-0.524241],[[1,0.498039,0.0941176],0.0171616,0]],[[1876.81,2745.33,0.5741],[[1,0.498039,0.0941176],0.0133946,0]],[[1962.04,2747.26,0.8543],[[1,0.498039,0.0941176],0.0124226,0.1]],[[1969.8,2739.61,0.101201],[[1,0.498039,0.0941176],0.0152537,0.1]],[[2077.36,2747.5,0.748177],[[1,0.498039,0.0941176],0.0174387,0]],[[2044.14,2738.07,0.228559],[[1,0.784314,0.392157],0.0298447,0]],[[2025.89,2732.37,0.0142086],[[1,0.498039,0.0941176],0.0162326,0.1]],[[2011.61,2728.25,0.0157468],[[1,0.498039,0.0941176],0.0118453,0.1]],[[2084.66,2731.07,0.390984],[[1,0.784314,0.392157],0.0160125,0]],[[4241.29,4234.18,0.11792],[[1,0.498039,0.0941176],0.0179686,0.1]],[[2002.96,2718.57,0.0166464],[[1,0.498039,0.0941176],0.0163101,0.1]],[[2043.3,2722.7,-0.779949],[[1,0.498039,0.0941176],0.0164941,0.1]],[[2067.56,2724.67,0.19197],[[1,0.784314,0.392157],0.025775,0]],[[1946.24,2710.66,0.732364],[[1,0.498039,0.0941176],0.0207797,0]],[[2089.71,2721.73,-0.00395393],[[1,0.498039,0.0941176],0.0192859,0]],[[2036.69,2713.74,0.000685453],[[0.392157,0.784314,1],0.0119387,0.3]],[[4314.88,4355.63,-0.0223999],[[0.392157,0.784314,1],0.018622,0.3]],[[4310.92,4346.83,0.000701904],[[1,0.498039,0.0941176],0.0145489,0]],[[2040.02,2704.55,1.03095],[[1,0.498039,0.0941176],0.0147423,0]],[[2069.71,2705.47,0.282563],[[1,0.498039,0.0941176],0.0129169,0.1]],[[2044.62,2688.28,0.519398],[[1,0.498039,0.0941176],0.0211212,0.1]],[[4347.24,4357.2,-0.353622],[[1,0.498039,0.0941176],0.0136092,0.1]],[[2051.98,2681.51,0.123417],[[1,0.784314,0.392157],0.0194882,0.05]],[[2056.32,2677.61,0.0653095],[[1,0.498039,0.0941176],0.01426,0]],[[2015.92,2664.97,0.112841],[[1,0.498039,0.0941176],0.0148583,0.1]],[[2028.25,2664.34,0.0834622],[[0.392157,0.784314,1],0.0232939,0.3]],[[1978.86,2657.67,0.776226],[[1,0.498039,0.0941176],0.0133508,0.1]],[[2004.42,2659.06,-0.0445662],[[1,0.498039,0.0941176],0.0181001,0.1]],[[3284.7,2970.92,-0.222733],[[1,0.498039,0.0941176],0.0171189,0.1]],[[3272.65,2949.95,0.0059967],[[1,0.784314,0.392157],0.0306861,0]],[[4484.76,6803.15,-0.300667],[[1,0.498039,0.0941176],0.0176943,0.1]],[[3310.15,2950.71,-0.000152588],[[1,0.498039,0.0941176],0.0199697,0.1]],[[4492.68,6815.14,-0.985992],[[1,0.784314,0.392157],0.0211432,0]],[[3389.14,2987.81,0.0709686],[[1,0.784314,0.392157],0.0220245,0]],[[3318.26,2940.43,0.0584106],[[1,0.498039,0.0941176],0.0198404,0.1]],[[4512.92,6801.74,1.0145],[[1,0.498039,0.0941176],0.0194206,0.1]],[[4512.8,6814.82,-0.199707],[[1,0.498039,0.0941176],0.0132666,0.1]],[[3312.73,2922.09,-0.137177],[[1,0.784314,0.392157],0.0195412,0]],[[3291.5,2909.05,0.00691223],[[1,0.784314,0.392157],0.0158772,0.05]],[[4119.08,7472.64,-0.012866],[[1,0.784314,0.392157],0.0260382,0.05]],[[4321.78,3906.71,-0.235611],[[0.392157,0.784314,1],0.0189004,0.3]],[[4327.42,3872.11,-0.0422516],[[0.392157,0.784314,1],0.0221436,0.3]],[[4358.7,3893.71,0.000244141],[[1,0.498039,0.0941176],0.0207168,0.1]],[[4341.89,3817.53,-0.115402],[[1,0.784314,0.392157],0.0195288,0]],[[4426.45,3935.52,-0.0270844],[[1,0.498039,0.0941176],0.0207154,0]],[[4337.46,3774.26,-0.202255],[[1,0.784314,0.392157],0.029619,0.05]],[[4346.2,3759.61,-0.00445557],[[1,0.498039,0.0941176],0.0141302,0]],[[4879.42,5901.36,-0.0434265],[[1,0.498039,0.0941176],0.0213531,0.1]],[[4390.22,3798.32,-0.21965],[[1,0.498039,0.0941176],0.0119482,0.1]],[[4380.37,3782.88,-0.0302277],[[1,0.498039,0.0941176],0.0161312,0.1]],[[4381.53,3776.45,-0.194687],[[1,0.498039,0.0941176],0.0144821,0.1]],[[4388.07,3770.59,-0.0840759],[[1,0.498039,0.0941176],0.0213717,0.1]],[[4954.66,5409.71,-0.0292206],[[1,0.498039,0.0941176],0.0231072,0]],[[4364.95,3678.53,-0.055542],[[1,0.498039,0.0941176],0.0213863,0]],[[4963.77,5425.87,-0.884689],[[1,0.498039,0.0941176],0.0179428,0.1]],[[4845.99,6551.8,0.00600433],[[1,0.784314,0.392157],0.0244063,0]],[[4797.79,4389.48,0.0182648],[[1,0.498039,0.0941176],0.0128815,0.1]],[[4989.07,5921.34,-0.00502014],[[1,0.498039,0.0941176],0.0127974,0.1]],[[4994.55,5871.83,-0.0665283],[[0.392157,0.784314,1],0.0140464,0.3]],[[4994.32,5890.84,-0.010376],[[1,0.498039,0.0941176],0.0234805,0.1]],[[4811.38,4410.02,-0.130463],[[1,0.498039,0.0941176],0.022628,0.1]],[[5005.33,5871.89,-0.0296478],[[0.392157,0.784314,1],0.0186378,0.3]],[[5002.14,5933.93,-0.0316925],[[0.392157,0.784314,1],0.0189812,0.3]],[[5007.03,5890.55,-0.0254669],[[1,0.498039,0.0941176],0.0153985,0.1]],[[4144.83,3304.16,-0.165024],[[1,0.784314,0.392157],0.030331,0]],[[3674.6,2873.8,0.0224457],[[1,0.784314,0.392157],0.01779,0]],[[3683.92,2878.98,0.327957],[[1,0.784314,0.392157],0.0248002,0.05]],[[5019.22,5945.33,-0.157486],[[1,0.784314,0.392157],0.0230115,0]],[[3700.83,2875.51,0.0315399],[[1,0.498039,0.0941176],0.0145573,0.1]],[[5037.38,5876.8,-0.0488586],[[0.392157,0.784314,1],0.0189225,0.3]],[[5210.55,4995.42,-0.00686646],[[1,0.784314,0.392157],0.0228096,0]],[[5076.39,4320.62,-0.0280151],[[1,0.784314,0.392157],0.0258822,0]],[[3080.68,2170.99,-0.0162201],[[1,0.498039,0.0941176],0.015952,0.1]],[[3054.94,2156.54,-1.06409],[[1,0.498039,0.0941176],0.0213379,0.1]],[[3092.76,2130.6,0.247742],[[1,0.498039,0.0941176],0.0167858,0.1]],[[3069.69,2120.5,0.113403],[[1,0.498039,0.0941176],0.0206295,0.1]],[[2166.68,1886.59,0.276541],[[1,0.498039,0.0941176],0.0121309,0.1]],[[4264,2696.91,0.339013],[[1,0.498039,0.0941176],0.0198451,0.1]],[[4263.09,2684.93,0.232688],[[1,0.498039,0.0941176],0.0188451,0.1]],[[5309.26,4194.86,0.236099],[[1,0.784314,0.392157],0.027886,0]],[[4287.9,2695.6,-0.844428],[[1,0.498039,0.0941176],0.0173199,0.1]],[[4266.2,2668.36,0.231149],[[0.392157,0.784314,1],0.015566,0.3]],[[5318.97,4189.49,-0.00266266],[[1,0.498039,0.0941176],0.0119269,0.1]],[[4295.28,2672.23,0.347955],[[1,0.784314,0.392157],0.0216207,0]],[[4282.82,2644.81,0.148194],[[1,0.784314,0.392157],0.0304968,0]],[[5524.81,4699.33,0.334915],[[1,0.498039,0.0941176],0.0220022,0.1]],[[2778.5,1761.72,0.0962219],[[1,0.784314,0.392157],0.0197558,0]],[[2767.58,1758.47,0.293442],[[1,0.784314,0.392157],0.0213441,0.05]],[[2758.99,1752.24,0.0845947],[[1,0.498039,0.0941176],0.0129942,0.1]],[[2765.87,1737.61,-1.00552],[[0.392157,0.784314,1],0.0213898,0.3]],[[2794.93,1743.34,0.117828],[[1,0.784314,0.392157],0.0296781,0]],[[2769.41,1696.94,-0.0410614],[[1,0.498039,0.0941176],0.0164571,0.1]],[[5386.38,3784.94,0.0494661],[[0.392157,0.784314,1],0.0234573,0.3]],[[2234.74,1344.3,0.269091],[[1,0.498039,0.0941176],0.0202039,0.1]],[[2677.61,1275.35,0.0167789],[[1,0.784314,0.392157],0.0193746,0]],[[2653.93,1267.45,0.00253487],[[1,0.784314,0.392157],0.0276108,0]],[[2406.56,1172.69,0.39693],[[1,0.498039,0.0941176],0.0127948,0.1]],[[2414.39,1173.56,0.0931351],[[1,0.498039,0.0941176],0.0218282,0.1]],[[2428.04,1169.13,0.0183809],[[1,0.498039,0.0941176],0.0208628,0.1]],[[2381.95,1110.33,0.281267],[[0.392157,0.784314,1],0.015497,0.3]],[[2434.36,1111.6,0.113868],[[1,0.784314,0.392157],0.0206065,0]],[[2423.09,1091.32,-0.062885],[[1,0.498039,0.0941176],0.0226381,0.1]],[[6391.18,5425.06,-0.275427],[[1,0.498039,0.0941176],0.0208767,0.1]],[[6419.59,5379.82,0.000747681],[[1,0.784314,0.392157],0.0255367,0]],[[6427.33,5388.79,0.00104094],[[1,0.498039,0.0941176],0.0169925,0.1]],[[6441.23,5402.97,0.00312901],[[1,0.498039,0.0941176],0.01422,0.1]],[[6453.93,5377.47,0.000910759],[[0.392157,0.784314,1],0.01531,0.3]],[[2438.37,820.053,0.0650835],[[0.392157,0.784314,1],0.0160646,0.3]],[[6523.54,4918.35,-0.750355],[[1,0.498039,0.0941176],0.0207808,0.1]],[[6543.32,5044.89,0.199413],[[1,0.498039,0.0941176],0.0156218,0]],[[6533.35,4936.19,0.0456123],[[1,0.498039,0.0941176],0.0149129,0.1]],[[6569.61,5329.18,-0.0305176],[[1,0.784314,0.392157],0.0294718,0]],[[6565.85,5047.68,-0.259632],[[0.392157,0.784314,1],0.0169069,0.3]],[[6593.17,5343.08,0.00149345],[[1,0.784314,0.392157],0.0166332,0.05]],[[6589.37,5197.03,-0.0467377],[[1,0.784314,0.392157],0.0265965,0.05]],[[6581.62,5094.84,-0.163605],[[1,0.498039,0.0941176],0.0137131,0.1]],[[6598.29,5319.39,0.521713],[[1,0.498039,0.0941176],0.0168522,0.1]],[[6589.6,5100.15,0.00957108],[[1,0.498039,0.0941176],0.0151178,0.1]],[[6599.59,5192.14,-0.0233459],[[1,0.498039,0.0941176],0.0215389,0]]];
_raw_array = [];

//Use appropriate array depending on map
//You can add your own mapname here

switch worldname do 
{ 	case "Stratis": {_rawarray = _Stratis_array};
};

_houses = [];
{
_pos = _x select 0;
_params = _x select 1;
_house = nearestobject [_pos,"House"];
_house setvariable ["light_parameters",_params]; 
_house setvariable ["lit",0]; 
_houses set [count _houses,_house]
} foreach _rawarray;
tpw_housecount = count _houses; //public variable for debugging

////////////////
// START HINT//
//////////////
if (_hint > 0) then {
[] spawn {
hintsilent format ["TPW Houselights 1.08 MP\n%1 Lightable Houses",tpw_housecount];
sleep 5;
hintsilent "";
};
};

///////////////
// MAIN LOOP//
/////////////
tpw_lithouses = 0; // public variable for debugging
while {true} do 
{
// IF IT'S DARK
if (tpw_houselights_sunangle < 0) then 
{
 {
private ["_lit","_light","_params","_dist"];
//Lighting variables associated with each house
_lit = _x getvariable "lit"; 
_light = _x getvariable "light_source"; 
_params = _x getvariable "light_parameters";
_dist = (vehicle player) distance _x;

if (_lit == 0) then 
{ 
//UNLIT HOUSES
//Light house if close enough to player
if (_dist < _housedistance) then 
    { 
_col = _params select 0; // Colour
_br = _params select 1; // Brightness
_flvar = _params select 2; // Flickering amount	
_lp =  createVehicle ["#lightpoint", (getposatl _x),[],0,""] ; // Create light
_lp setLightColor _col; // Set its colour
_lp setLightBrightness _br; // Set its brightness
_lp lightAttachObject [_x, [1,1,1]]; // Position it within house
if (_flvar > 0) then {[_lp,_br,_flvar,_flickerdistance] spawn tpw_flicker}; // Flicker if flickering value greater than 0
_x setvariable ["light_source",_lp]; // Assign this lightsource to this house
_x setvariable ["lit",1]; // Mark house as lit
tpw_lithouses= tpw_lithouses + 1; // Increment lit house counter
 };
} else 
   {
//LIT HOUSES	
//Remove lights from houses greater than specified distance		
if  (_dist > _housedistance) then 
 {
deletevehicle _light; // Remove light source
_x setvariable ["lit",0]; // Mark house as unlit
tpw_lithouses= tpw_lithouses - 1; // Decrement lit house counter
 };

//Increase the brightness of distant house lights		
if (_dist > _brightdistance) then 
 {
_br = (_params select 1) * 1.5; // Increase brightness
_light setlightbrightness _br;
 };	

//Normal brightness of close house lights		
if (_dist < _brightdistance) then 
 {
_br = _params select 1; // Normal brightness
_light setlightbrightness _br;
 };			
   } 
  } foreach _houses;
} else
{
// IF IT'S LIGHT THEN DELETE ALL HOUSE LIGHTS
if (tpw_lithouses > 0) then 
 {
  {
_lit = _x getvariable "lit"; 
if (_lit == 1) then 
{
_light = _x getvariable "light_source"; 
deletevehicle _light; // Remove light source
_x setvariable ["lit",0]; // Mark house as unlit
tpw_lithouses = tpw_lithouses - 1; // Decrement lit house counter
   };
  } foreach _houses;
 };
};
sleep 15;
};

And put this in your init.sqf

[200] execVM "tpw_houselights108-mp.sqf";

And everything should work fine after 10 seconds. Note this is the MP version, not the SP.

Share this post


Link to post
Share on other sites

LOL, I posted a thread where i took your(TPWs) mod version apart for use as a script .. posted a seprate thread labeled TPW house lights..... and the MP version works perfectly .....

Edited by Lordprimate

Share this post


Link to post
Share on other sites

The proper SP and MP version, compatible with A2 and A3, and runnable as addon or script is now available here: http://forums.bistudio.com/showthread.php?151320-tpw_houselights-automatic-house-lighting-for-Arma2-and-Arma3

I'd appreciate it if any posts detailing further deconstruction and tinkering of my work be placed in that thread. Thanks!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×