Forum Jump :

Author Message

Nightrain  

I blow you away


Posts: 960
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 26
In-game name:

 
#1 Posted at 2009-12-04 22:14        
     
Hey all,

I am making a mission where you have to blow up the powerplant by Elektrozavodsk.
When this happens, the ambient building/house lights in the city (and a few other places) are scripted to go off.
Here is the script, it works fine:

lightoff.sqf

_objHouse = nearestObjects [player, ["House"], 10000];
{
	for "_i" from 1 to 5 do {
					
					_x animate [format ["Lights_%1",_i],0];
	};
} forEach _objHouse;

I don't want to have to go Rambo style and shoot all the streetlamps out. So, I would like to now if there is a way to also make the street lights on the roads turn off.


Thanks for answers,
Nightrain

Armstrong-"Hey Carillo, do you see that?"
Carillo-"See what?"
Armstrong-"Something's burning over there, see the smoke?"
Carillo-"That's not smoke it's dust!"
Armstrong-"Dust? i don't get it."

Author Message

Dead3yez  

I am evil


Posts: 3113
Rank:


Level: Member

Country: en
Location: North Yorkshire
Occupation: dead3yez
Age: 28
In-game name: dead3yez

 
#2 Posted at 2009-12-05 03:19        
     
http://community.bistudio.com/wiki/switchLight

Try that.

This post was edited by Foxhound (2009-12-07 09:31, ago)


Advertisement


Author Message

Nightrain  

I blow you away


Posts: 960
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 26
In-game name:

 
#3 Posted at 2009-12-05 14:09        
     
Dead3yez : http://community.bistudio.com/wiki/switchLight

Try that.

Thanks again Dead3yez.

@coldwarzones: I told you that the script works fine, I got it from the BI forums. Again, I have no idea why you are talking about spawning stuff.



[edit]
While the command works, there are to many streetlights to use a single command for (already 30 and thats only 1/6 of city).

Is there any way someone could write and post a script that shuts the streetlights off? There are too many to use a single command for.


Nightrain

This post was edited by Foxhound (2009-12-07 09:31, ago)

Armstrong-"Hey Carillo, do you see that?"
Carillo-"See what?"
Armstrong-"Something's burning over there, see the smoke?"
Carillo-"That's not smoke it's dust!"
Armstrong-"Dust? i don't get it."

Author Message

Dead3yez  

I am evil


Posts: 3113
Rank:


Level: Member

Country: en
Location: North Yorkshire
Occupation: dead3yez
Age: 28
In-game name: dead3yez

 
#4 Posted at 2009-12-05 18:03        
     
I am not familiar with .sqf but why not use it in the same script as the one above?

So like one of these:
_strlight = nearestObjects [player, ["Streetlamp"], 10000];
{switchLight "OFF"} forEach _strlight;

or

nearestObjects [player, ["Streetlamp"], 10000] switchlight "OFF";


Author Message

Nightrain  

I blow you away


Posts: 960
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 26
In-game name:

 
#5 Posted at 2009-12-18 21:03        
     
Tried that and it didn't work.

I found this from Arma:
// lightsoff.sqf
_pos    = _this select 0;
_range = _this select 1;

// Add more types if needed
_types = ["Land_lampa_vysoka", "Land_lampa_ind", "Land_lampa_ind_b", "Land_lampa_sidl", "Land_lampa_ind_zebr"];
for [{_i=0},{_i < (count _types)},{_i=_i+1}] do
{
  _lamps = _pos nearObjects [_types select _i, _range];
  Sleep 1;
  {_x switchLight "OFF"} forEach _lamps;
};

I don't see why it would not work, but the problem is I can't find the classnames for the streetlamps in ArmA 2.


Anyone know them, I looked in the Biki and in the class library.

Armstrong-"Hey Carillo, do you see that?"
Carillo-"See what?"
Armstrong-"Something's burning over there, see the smoke?"
Carillo-"That's not smoke it's dust!"
Armstrong-"Dust? i don't get it."

Author Message


Posts: 1513
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#6 Posted at 2009-12-18 23:15        
     
I do it much the same way http://www.sendspace.com/file/ehe8vd there is some ambient light added but you can remove this easily.


Author Message

Nightrain  

I blow you away


Posts: 960
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 26
In-game name:

 
#7 Posted at 2009-12-18 23:31        
     
F2kSel : I do it much the same way http://www.sendspace.com/file/ehe8vd there is some ambient light added but you can remove this easily.

Thanks, I have trouble writing scripts so this is really helpful.

I will try it and get back.

Armstrong-"Hey Carillo, do you see that?"
Carillo-"See what?"
Armstrong-"Something's burning over there, see the smoke?"
Carillo-"That's not smoke it's dust!"
Armstrong-"Dust? i don't get it."

Author Message

Nightrain  

I blow you away


Posts: 960
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 26
In-game name:

 
#8 Posted at 2009-12-19 14:25        
     
I found this thread on BI forums.

This is now the process and command I use that works perfectly to turn off the streetlights.

1. Place a Game Logic (object) and name it:
lsw

2. In a trigger (activated however you want) put this
{_x switchLight "OFF"} forEach ((getPos lsw) nearObjects ["StreetLamp",2000]);

3. The Game Logic is the center of the blackout and the number is the radius.

4. They can be turned back on by simply changing "OFF" to "ON" or with "AUTO" back to default

Armstrong-"Hey Carillo, do you see that?"
Carillo-"See what?"
Armstrong-"Something's burning over there, see the smoke?"
Carillo-"That's not smoke it's dust!"
Armstrong-"Dust? i don't get it."