Forum Jump :

Author Message

Posts: 3

Level: Member

Country: ua
Location: Kirovohrad Oblast
Occupation: Student
Age: 21
In-game name: AwesomeDima

#1 Posted at 2014-10-12 08:14        
Can anyone tell me how to create a static light at a certain location? For example it's very dark at night in the city of Черногорск/ Chernogorsk. And I want to set lights around the city using game logic. Excuse my English *SCRATCH*

Author Message


Posts: 56

Level: Member

Country: 00
Location: Planet LV-426
Occupation: Sargeant
In-game name: ||SGT|| Spunkmeyer \\/\//

#2 Posted at 2014-10-12 09:44        
Place more streetlamps around the city you want more intensity.We only need the streetlamp class name.

They will turn on when night comes.

I found something interesting:
You can use this in a radio trigger:

arrlights = position player nearObjects ["streetlamp",20];
obj = arrlights select 0;
class = typeOf obj;
player sidechat format ["%1",class];
copyToClipboard (str (class));

you can then Alt-Tab and paste the class name into a text editor - it just gave me "LAND_LAMP_SMALL_EP1" for a lamppost. 

It gave me "LAND_LAMPA_IND_EP1" in Takistan.

Added 1 hour 14 minutes later:


I use this script, just create more markers, and place them in the editor, then add more NL's to the script and run it
// null=[]execVM "NightLighting.sqf"

	_NL1 = markerpos "NL1";

NL1 = createVehicle ["suitcase", _NL1, [], 0, "NONE"];
NL1 setpos [getpos NL1 select 0, getpos NL1 select 1, -2];
light = "#lightpoint" createVehicleLocal position NL1; light setLightBrightness 0.05; light setLightAmbient[0.0, 0.0, 0.0]; light setLightColor[

But this method is only for making ambient light, not for Lamp posts with light.
If you want to make a lamp post with light on while night is:
Make an small object like a "laptop" or "baseball" called :"object1" and a trigger on editor with these lines on its ON ACT:

bld="land_powlines_conc2l_ep1" createvehiclelocal (getposasl object1); bld setdir (getdir this); bld setpos (object1 modelToWorld [0,0,11]);  bld setVectorUp [0,0,1]; light1="#lightpoint" createVehicle [0,0,-5]; light1 setLightBrightness 0.02; light1 setLightAmbient [1,1,0.5]; light1 setLightColor [1,0,0]; light1 lightAttachObject [bld,[0,0,0]];

Maybe you need to change "land_powlines_conc2l_ep1" (Takistan version) for "land_powlines_concl" Chernarus Version.

The bad thing is when you shoot the lamppost... if you destroy it light will still be present.

I got some possible Streetlamps working on the editor:

Added 41 minutes later:

Good news. It 's done!
This is an example for a spawned Streetlamp with no light when it's broken and a "personal" light for a soldier.

    * Open the editor,choose a place to edit and place the time at 00:00 for night.
    1 soldier as player
    1 item "baseball" from objects (small) called "object1"
    1 trigger with Empty INIT, and ON ACT:
    bld1="land_powlines_conc2l_ep1" createvehicle (getpos object1); bld1 setdir (getdir object1); bld1 setpos (object1 modelToWorld [0,0,11]);
    1 trigger with Empty INIT, and ON ACT:
    light2="#lightpoint" createVehicle [0,0,-5]; light2 setLightBrightness 0.002; light2 setLightAmbient [3,1,1]; light2 setLightColor [25,0,0]; light2 lightAttachObject [player,[0,0,0]];

You'll can make more streetlamps where you need only making a new trigger each object made and changing "bld" and "object1" names in these new triggers.
Changing number "11" will change the height of the lamppost relative to the ground:
bld1 setpos (object1 modelToWorld [0,0,11]);

Sample mission:

Making Streetlamps in OA and Personal Light for soldier:

This post was edited by SPK (2014-10-13 10:41, ago)

\\//\\// Corp. ||U.S.C.M|| Division.


Author Message

Posts: 67

Level: Member

Country: nl
Location: The Netherlands
Occupation: Joint Tast Force 141
Age: 19
In-game name: 2LT D.Reynaert

#3 Posted at 2014-10-13 17:34        
light = "#lightpoint" createVehicle position this;
light setLightBrightness 0.00275;
light setLightAmbient[ 1.0, 0.0, 0.0];
light setLightColor [1.0, 0.0, 0.0];
light lightAttachObject [this, [0,0,0]];

Place that in a gamelogic's init.

Brightness is a bit of a weird one, changing value slightly changes the light a bit too much so try to tweak it a bit.

Author Message

Posts: 3

Level: Member

Country: ua
Location: Kirovohrad Oblast
Occupation: Student
Age: 21
In-game name: AwesomeDima

#4 Posted at 2014-10-14 09:00        
thanks for the replies guys, wilco and trying it out now