Jump to content
Sign in to follow this  
tpw

TPW HOUSELIGHTS - automatic house light addon

Recommended Posts

Wow! Thanks for taking the time to do that. Any chance of doing a video on Aliabad, which has fewer streetlights? Maybe getting up close to a few houses to show the lights actually flickering. I'd love to use the video on the 1st post if that's OK with you.

Thanks again McLupo, and I'm glad you are getting enjoyment from my work.

Hi tpw,

thanks for the update today.

I'm thrilled about this addon, because it allows me with modest means to set an atmosphere that´s absolutely unique!

Thanks a lot!

For your pleasure, if you like...

Best regards

McLupo

Share this post


Link to post
Share on other sites

Hi mate,

no problem, it´s a honor...

I hope you can use it, otherwise i will make a new one, please tell me!

All the best!

McLupo

Share this post


Link to post
Share on other sites

Vielen Dank McLupo, I've added links to your videos on the 1st post.

Hi mate,

no problem, it´s a honor...

I hope you can use it, otherwise i will make a new one, please tell me!

All the best!

McLupo

Share this post


Link to post
Share on other sites

Hey tpw,

your script is superb! keep up the good work!

i don't know much about scripting, but i have an idea how you could easily set this up for multiplayer.

it would kill the randomization-aspect, but otherwise should work fine and should not be too much work.

the basic idea is:

1. some talented scripter runs a modified script on a certain map. for example aliabad. the script has to be modified, so that it saves all the light locations in a file.

2. now, if you want a multiplayer mission on aliabad, you would take that file, put it in your mission folder an use another version of your original script to be executed in the mission, which now only reads the location file and creates the lights.

3. the location-file and the generate script are distributed like any other script at the beginning of the mission.

that should make lights perfectly multiplayer-compatible with the only downside, that the lights would always be at the same place, always have same parameters and the location-file would have to be custom-generated for every map. unfortunately i'm not skilled enough to do that, but hopefully some of you talented folks here, can make that work.

beste grüße, twistking

*edit* if you or someone else could make that work, you could ship your script with a pre-calculated light-location-file for let's say aliabad, takistan or any other popular map.

Edited by twistking

Share this post


Link to post
Share on other sites

Thanks twistking, that's a really brilliant idea.

I was thinking of synchronising the array holding house and light settings. For example, the dedicated server generates this array at mission start, and it is then sent to all clients so that they will all see the same houses and lights. The advantage of this is that the house/lights are generated dynamically according to settings, and don't need to be precalculated per map. The disadvantage is that I know nothing about synching.

Your approach is good because no synching is required. I could make the script read the worldname, and switch to the appropriate house/lights file. I'll just have to work out how to save arrays to the clipboard, and then I should be able to try implementing it.

Thanks again!

Hey tpw,

your script is superb! keep up the good work!

i don't know much about scripting, but i have an idea how you could easily set this up for multiplayer.

it would kill the randomization-aspect, but otherwise should work fine and should not be too much work.

the basic idea is:

1. some talented scripter runs a modified script on a certain map. for example aliabad. the script has to be modified, so that it saves all the light locations in a file.

2. now, if you want a multiplayer mission on aliabad, you would take that file, put it in your mission folder an use another version of your original script to be executed in the mission, which now only reads the location file and creates the lights.

3. the location-file and the generate script are distributed like any other script at the beginning of the mission.

that should make lights perfectly multiplayer-compatible with the only downside, that the lights would always be at the same place, always have same parameters and the location-file would have to be custom-generated for every map. unfortunately i'm not skilled enough to do that, but hopefully some of you talented folks here, can make that work.

beste grüße, twistking

*edit* if you or someone else could make that work, you could ship your script with a pre-calculated light-location-file for let's say aliabad, takistan or any other popular map.

Share this post


Link to post
Share on other sites

OK, thanks to twistking's excellent suggestions I've come up with a preliminary solution for MP. Obviously this will need further refinement but it seems to work so far.

There are now 2 scripts. The main script tpw_houselights108-mp.sqf actually has hard coded house and light parameters, based upon the defaults. These parameters are simply a (very large) array of arrays of position data for each house, with the lighting parameters for that house. Depending on the map, the appropriate array is processed and the final array of lightable houses generated for the script to use. Every player using this script will see the same lights at the same spot on the map. No synchronisation necessary.

I've set it up with house data from some of the most common maps with enterable buildings:

  • Aliabad
  • Clafghan
  • Fallujah
  • Fayshkhabur
  • Hazarkot
  • Lingor
  • Qom
  • Sangin
  • Shapur
  • Takistan
  • Tigeria
  • Torabora
  • Tropica
  • Zargabad

If you'd like to add maps, or change the hard coded parameters, then simply play with the light settings and run tpw_houselights-scan.sqf on the map of your choice. You can then paste the resulting array from your clipboard back into the main houselights script.

Please try these scripts out and let me know if I'm at least barking up the right tree.

Scripts: http://www.gamefront.com/files/21778770/tpw_houselights108-mp.zip

Edited by tpw

Share this post


Link to post
Share on other sites

Could the next update of the addon version have a variable in the .hpp to turn off the hint at mission init? Thanks for the continual work, tpw.

Share this post


Link to post
Share on other sites

No worries, I'm on it! New version in the next 24 hours. I hope you can live with the hint until then :)

Share this post


Link to post
Share on other sites

Hello mate,

another vid for your "Showcase"...:cool:

It shows how it works at the Takistan - Map, the scanning procedure, the flickering nearby and at the distance.

Recorded in the dusk, at night and at the dawn.

Also the different lights are shown; the warm amber- and the cool blue light.

Hope you can use it?!

A personal gift for such a nice interview.

Cheers

McLupo

Share this post


Link to post
Share on other sites

Thanks McL, I've updated the 1st post. And thanks for the interview, although i'm struggling to come to terms with the fame and fortune...

Share this post


Link to post
Share on other sites

SP and MP compatible addon versions of v1.08 have been released, as per the 1st post.

Share this post


Link to post
Share on other sites

Hello,

thanks for the Info.

The ArmA2Base download section will be updated with the v1.08!

Thanks!

Cheers

McL :)

Share this post


Link to post
Share on other sites
Here's the easiest way I can think of. Save the script below as flicker.sqf, into your mission directory. In the editor, place a game logic near the building you want lit and in its init put 0 = [this] execvm "flicker.sqf";

This should cause the building nearest the logic to light up and start flickering. I'm not in front of my Arma computer so can't verify that it works.

//Variables
_house = nearestBuilding (_this select 0); // house nearest the logic
_housepos = getpos _house; // position of the house
_flickerdistance = 50; // If you move further than this, the light won't flicker

//Flicker
tpw_flicker = { 
private ['_lt0','_br','_fv','_rng','_brmax','_brmin','_op','_inc','_br2','_fd','_ct']; 
_lt0 = _this select 0; 
_br = _this select 1; 
_fv = _this select 2; 
_fd = _this select 3; 
_rng = _br * _fv; 
_brmax = (_br + _rng); 
_brmin = (_br - _rng); 
_op = 1; 
_inc = _rng / (random 10); 
_br2 = _br; 
_ldist = player distance _lt0; 
_ct = 0; 
while {not (isNull _lt0)} do { 
_ct = _ct + 1; 
if (_ldist < _fd) then { 
_br2 = _br2 + (_op * _inc); 
_lt0 setLightBrightness _br2; 
if (_br2 > _brmax) then { 
  _op = -1; 
  _brmax = _br + (random _rng); 
  _inc = _rng / ((random 10) + 1); 
   }; 
if (_br2 < _brmin) then { 
  _op = 1; 
  _brmin = _br - (random _rng); 
  _inc = _rng / ((random 10) + 1); 
   }; 
}; 
sleep (random 0.2); 
if (_ct > 100) then {_ldist = player distance _lt0; _ct = 0}; 
}; 
}; 

//Light
_lp = "#lightpoint" createVehicleLocal _housepos; 
_lp setLightColor [1,0.5,0.1]; // Set its colour 
_lp setLightBrightness 0.03; // Set its brightness 
_lp lightAttachObject [_house, [1,1,1]]; // Position it within house 
[_lp,0.03,0.1,_flickerdistance] spawn tpw_flicker;

It works perfectly, thanks a lot !

Share this post


Link to post
Share on other sites

Good script idea, verry nice looking on night !

Share this post


Link to post
Share on other sites
Guest

Thanks Foxhound, greatly appreciate the support!

Share this post


Link to post
Share on other sites

Sorry all, I realised that there was a config error in the 1.08 SP addon version which mixed up a few variables. I've upgraded it to v1.081. All other versions are OK. That's what you get for finalising and uploading addons late Sunday night!

Share this post


Link to post
Share on other sites

Just curious if there will be a variant with the possibility to switch on/off those lights for example via action menu? Or something that "destroys" the light source through explosion/building damage/bullethit?

Share this post


Link to post
Share on other sites
Just curious if there will be a variant with the possibility to switch on/off those lights for example via action menu? Or something that "destroys" the light source through explosion/building damage/bullethit?

Good idea NoRailGunner, I never thought of that one. I'm sure it's doable, leave it with me!

Share this post


Link to post
Share on other sites

Hehe and I got another idea (maybe feature/option): if there is a battle/firefight in certain (close) range lights could be switched off aka human/dynamic reaction from landlords and tenants ;)

Share this post


Link to post
Share on other sites

@NoRailgunner: Great ideas! It would be seem very real. :rolleyes:

@tpw: Thanks for the configfix, added as news to the community.

Cheers

McL

Share this post


Link to post
Share on other sites

I think it would be fantastic link to this fantastic mod with "AEG (ArmA Electrical Grids)"

http://www.armaholic.com/page.php?id=15178

I think it would be incredible to control the electrical system for convenience by accessing "AEG" and turning ON / OFF on the lights of the houses of "HOUSELIGHTS TPW MOD"

Congratulations on the mod! I think this effect in ArmA III would be great.

Share this post


Link to post
Share on other sites

interesting to see how this develops, keep up the great work !

when testing this, mp version is only for dedi servers not self hosted games right?

Share this post


Link to post
Share on other sites
interesting to see how this develops, keep up the great work !

when testing this, mp version is only for dedi servers not self hosted games right?

Sorry mate, it's the other way round. Neither the SP or MP version will run on a dedi server. For MP, the system must run for each client.

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  

×