Jump to content
Sign in to follow this  

Recommended Posts

Has anyone figured out how to get a house to light up at night without relying on the Ambient Civilian Module? It's a great feature and a wonderful touch - something I've been wanting since OFP - but I'd like to have missions where a certain building is always occupied, as it were, with lights in its windows and possibly chimney smoking each time the mission is played. I've ripped open ALICE (er, that sounds bad...) and kinda identified the scripts that make it all work, but there my skills and knowledge disappear - I can't figure out how to get it to work myself. :(

Anyone have any suggestions?

Cheers!

Share this post


Link to post
Share on other sites

looks like you need to call the function

scriptName "Alice\data\scripts\fnc_houseEffects.sqf";

??? call BIS_fnc_houseEffects

its looking for 3 variables i think (maybe 2).. Is ALICE_obj the module or a house ??

_mode = _this select 0;
_door = _this select 1;
_obj = _door getvariable "ALICE_obj";

not that good with sqf..

hope this helps :)

Share this post


Link to post
Share on other sites

It's actually defined as an animation of the house model - the animations are named "Lights_1" to "Lights_5".

Here's a little code I stole from BIS to turn the lights on in a specific house:

for "_i" from 1 to 5 do {

			_house animate [format ["Lights_%1",_i],1];
};

Here, _house has to be the house you want to light up. I used the following code to light up all houses within a certain radius - but be warned that this is computationally very expensive and probably not practical in a real mission:

_objHouse = nearestObjects [player, ["House"], 3000];

{
for "_i" from 1 to 5 do {

				_x animate [format ["Lights_%1",_i],1];
};
} forEach _objHouse;

Share this post


Link to post
Share on other sites

Don't use the nearestObjects command for such big searching area. Use the nearEntities command instead, because it will work much faster.

Share this post


Link to post
Share on other sites

It works! Great stuff - Chernogorsk now looks quite pretty at night :p

Cheers for the help! :)

Share this post


Link to post
Share on other sites
Don't use the nearestObjects command for such big searching area. Use the nearEntities command instead, because it will work much faster.

Out of interest, is there any difference between those two commands, apart from nearEntities supposing to be faster?

Share this post


Link to post
Share on other sites

As the original post also asked, is there a way to get the house chimneys smoking also? Is there a house object we can "animate" like the Lights?

Share this post


Link to post
Share on other sites
Out of interest, is there any difference between those two commands, apart from nearEntities supposing to be faster?

well, the big difference for me is that nearEntities returns *nothing* (empty array), regardless how i use it, while nearestObjetcs still works like a charm like it always did :o

Share this post


Link to post
Share on other sites

Does anyone know where this code goes specifcally? I would like to see these in action. Are you using a Function module? Trigger? Calling an sqf? Command in the Init?

Share this post


Link to post
Share on other sites
Does anyone know where this code goes specifcally? I would like to see these in action. Are you using a Function module? Trigger? Calling an sqf? Command in the Init?

Wold like to know the exact same thing :/ tried putin it in units init field but dident work and then I tried a trigger but no luck even did some random modules but got nothing.

So culd someone explain for a clules player where this goes?

Thanks :)

Best wishes /// 3inar

Share this post


Link to post
Share on other sites

I just put the following code into a file named "LightsOn.sqf" in my scripts folder:

_objHouse = nearestObjects [Centre, ["House"], 1500];

{
for "_i" from 1 to 5 do {

				_x animate [format ["Lights_%1",_i],1];
};
} forEach _objHouse;

I then put this into my init.sqf:

execVM "Scripts\LightsOn.sqf";

and it worked :)

Share this post


Link to post
Share on other sites

Can some1 please make a sample mission i've tryed every which way possible n it wont work for me. :confused:

Share this post


Link to post
Share on other sites

it doesnt work for me, i created a folder and put it in the main arma 2 foldier, put this in my init file in my mission

//add lights

execVM "Scripts\LightsOn.sqf";

then i created the sqf file in scripts. loaded the mission and nothing

i copy/pasted that exact code to..

any sudgestions?

Share this post


Link to post
Share on other sites

the script goes to your mission's folder in "Documents/ArmA2/missions".

It's pretty good when you're using it at the start of the mission. I've put "[] execVM lightup.sqf" in the init.sqs file (I've called the script "lightup.sqf"). I did it this way, beacause I'm having trouble when I try tu run it using execVM in the init field of a unit - returns me a strange error, don't know why though.

Share this post


Link to post
Share on other sites

ok i still does nothing. it appears to detect the sqf file in the missions folder but when i preview a mission it does nothing, tell me step by step.

i did as u said. i copyed his code onto notepad named lightup.sqf (is the code suppose to have that huge weird spacing like that?, if not how do i fix?) then i put []execVM "lightup.sqf" in my missions init.sqf

do i put the lightup into a folder called scripts and place it into documents/arma2/missions (or do i have to place it in my actual mission im making folder)

totaly lost lol on why it not work, maybes that huge spaceing<<?

Share this post


Link to post
Share on other sites
_objHouse = nearestObjects [Centre, ["House"], 1500];

{

for "_i" from 1 to 5 do {

_x animate [format ["Lights_%1",_i],1];

};

} forEach _objHouse;

i think you need to add an object called Centre in the editor if you are using the above script. 1500 is the radius in the script above

Share this post


Link to post
Share on other sites

oooooo ok thanx will try it again lol

new->

woot it worked thanx you guys. apparently all i had to do is name my unit Centre xD as jelliz said. thanx again!

Edited by lostninja
^.^ is happy..got it work just wanted to say thnx in same post lol

Share this post


Link to post
Share on other sites

dont name your player centre, give that name to a gamelogic or an invisible helipad. ^^

Share this post


Link to post
Share on other sites

Question about houses/buildings that can not be entered. I thought I read somewhere around here a long time ago that houses/buildings like this can be "animated" to have an interior.

Is this true? If so, can any one help me with how to do this. I would like to use a building in a compound on the map but it's not one with an interior!

I searched all over but all I can find is about making these buildings have lights, etc. but I thought I saw something about spawning an interior. Maybe I'm delusional though. ;)

Share this post


Link to post
Share on other sites

Has anyone got this to work on Arrowhead? I've either got the script wrong (entirely possible) or this is doesn't work in Arrowhead.

Share this post


Link to post
Share on other sites

I don't think it works in Arrowhead, or at least not with the new house models which have interiors instead of fake windows with a light texture. That's logic speaking, not experience or tested or anything. Might work with Arma2 houses in Chernarus though, don't know.

Share this post


Link to post
Share on other sites

I tried it on Takistan and Zargabad, doesn't seem to do anything. It works great on Utes. They probably don't have proper lighting in Takistan ;)

---------- Post added at 11:07 PM ---------- Previous post was at 10:49 PM ----------

Oh and I didn't see your reply when I posted Carl. I think that makes perfect sense.

Share this post


Link to post
Share on other sites

Guys, I'm really new at editing and scripting isn't my forte yet. Still, I wanted to make a night mission and wanted to have some custom placed houses to have their lights on.

I have quite a few ACE add on that let me place some houses and objects in the map. In this particular case, I placed a street lamp post entitled "L lampa_ind_zebr" which is located in the following editing field: units/empty/map: EU-signs.

Unfortunately, I don't know which ACE addon incorporated the object. Can anyone give me a hint as to how I'm supposed to turn on this light?

thanks in advance

Share this post


Link to post
Share on other sites
Question about houses/buildings that can not be entered. I thought I read somewhere around here a long time ago that houses/buildings like this can be "animated" to have an interior.

Is this true? If so, can any one help me with how to do this. I would like to use a building in a compound on the map but it's not one with an interior!

I searched all over but all I can find is about making these buildings have lights, etc. but I thought I saw something about spawning an interior. Maybe I'm delusional though. ;)

im interested in this as well, i remember from a mission in the red harvest campaign of a building that had an interior and all, but when looking at it in the editor, it was just fake windows and no way in??

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  

×