Jump to content
Sign in to follow this  
Jackael

Light sources

Recommended Posts

So far the only way I've been able to add light is with burning objects (campfire or barrel) or use the searchlight which is extremely bright. I want to add lights to an indoor building that doesn't have them. Is this possible any other way?

Okay, so I found this:

http://community.bistudio.com/wiki/lightAttachObject

Thing is, I'm looking for more of a light SOURCE than just a random light. I'm looking for something that emits light, not just light coming from nowhere.

Edited by Jackael

Share this post


Link to post
Share on other sites

There's the search light, or just make the light small enough and attach it to something and tada, light source.

What specifically are you trying to do, that would help guide us to the most appropriate solution.

Share this post


Link to post
Share on other sites

There's a construction yard/factory that I want to light up for a night time mission. It has no lightning by default. I want to light it up on the inside but since it is indoors I don't really want to use fire (I'm trying to make this realistic... I don't want my bad guys getting smoked out of their base ;P)

You can check out the spot here if you want to see it:

http://img208.imageshack.us/img208/2498/piclx.jpg

Set it to night time and see that there are no lights. My enemies will not have night vision so I want the place to be lit up enough for you to be able to see well without night vision.

Also, when you're setting objects, how do you set their XYZ coordinates? I'm not sure how to even get the specific coordinates you want.

I know theres a setpos command but I need to figure out how to get the exact location's XYZ numbers.

Share this post


Link to post
Share on other sites

Here's an example mission for you: Demo Mission

Load it up (copy the extracted FactoryNight.chernarus folder into your Mission Editor folder under My Docs), see how dark it is (March 27th, at 3:20AM) then use the action menu to turn the lights on. Walk around the factory to check the coverage.

There are two scripts in the folder, one is the lightsOn.sqf which creates the lights, moves them into place and lights them up. The second script is nightlight.sqf which only lights things up. You can use that to pre-place a light, then in it's init string put:

nul = [this] execVM "nightlight.sqf";

Here are the two scripts:

lightsOn.sqf:

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: 1ID-CPL. Venori
//////////////////////////////////////////////////////////////////

_lamp1 = createVehicle ["Misc_Wall_lamp", [1,1,1], [], 0, "NONE"];
_lamp2 = createVehicle ["Misc_Wall_lamp", [1,1,1], [], 0, "NONE"];
_lamp3 = createVehicle ["Misc_Wall_lamp", [1,1,1], [], 0, "NONE"];
_lamp4 = createVehicle ["Misc_Wall_lamp", [1,1,1], [], 0, "NONE"];

_lamp1 setDir 5;
_lamp1 setPos [11465,7487,3];
_lamp2 setDir 5;
_lamp2 setPos [11454,7478.5,3];
_lamp3 setDir 192;
_lamp3 setPos [11447.1,7486.95,3];
_lamp4 setDir 110;
_lamp4 setPos [11480.5,7465.5,3];


{
_light = "#lightpoint" createVehicle [1,1,1];
_light setLightBrightness 0.01;
_light setLightAmbient[.9, .9, .6];
_light setLightColor[.9, .9, .6];
_light lightAttachObject [_x, [0,-0.1,0]];
} forEach [_lamp1,_lamp2,_lamp3,_lamp4];

hint "Lights on!";

nightlight.sqf:

_target = _this select 0;

// Create a small local light and attach it to the object.
_light = "#lightpoint" createVehicle [0,0,0];
_light setLightBrightness 0.01;
_light setLightAmbient[.9, .9, .6];
_light setLightColor[.9, .9, .6];
_light lightAttachObject [_target, [0,-0.1,0]];

Now, to find the locations for the lights I used an addon called Editor Dude. It's mostly used for movie making, but it has a nice action menu option for "Show Position".

I just walked up to likely wall spots, wrote down the number it gave me, then kept playing around with positions till I got it into the spot and facing I wanted. Kinda sucked to be honest. :)

Share this post


Link to post
Share on other sites

Thanks tons =]

---------- Post added at 11:16 PM ---------- Previous post was at 10:18 PM ----------

Uh oh, I've ran into another problem. I tried to use the same method to add an interior light to a helicopter so you can see, however it doesn't always light up the units in the helicopter. It randomly flickers between them being lit up and them being this:

http://img249.imageshack.us/i/wtfhax.jpg/

Why is this happening?

I'm going to play around with the position of the light to see if it is just where the light is emitted from.

Share this post


Link to post
Share on other sites

Try this, it's what BIS used in the campaign for that effect:

_cabinLight = "#lightpoint" createVehicle position heloNameHere;
_cabinLight setLightBrightness 0.00275;
_cabinLight setLightAmbient[ 1.0, 0.0, 0.0];
_cabinLight setLightColor [1.0, 0.0, 0.0];
_cabinLight lightAttachObject [heloNameHere, [0, -3.25, -0.25]];

Share this post


Link to post
Share on other sites

I have another quick question. I know that the underscore makes things "local" but whenever I try to use a local variable it says "Local Variable in Global Space." How do you make it a local space?

---------- Post added at 11:44 PM ---------- Previous post was at 11:32 PM ----------

No dice Kylania.

http://img32.imageshack.us/i/wtfhaxb.jpg/

Might it be my video card? Although light in other spots works fine.

On second thought, could it be because I don't have them as local? How do I make it so they work as local?

Edited by Jackael

Share this post


Link to post
Share on other sites

In a script or something. You could put that code in the init.sqf file to run it from the start for example. If you were adding it in the helo's init field use this:

cabinLight = "#lightpoint" createVehicle position this;
cabinLight setLightBrightness 0.00275;
cabinLight setLightAmbient[ 1.0, 0.0, 0.0];
cabinLight setLightColor [1.0, 0.0, 0.0];
cabinLight lightAttachObject [this, [0, -3.25, -0.25]];

This works pretty well.

Share this post


Link to post
Share on other sites

Hmm, it may be my video card because it still doesn't work.

I'm running a 9800gt.

Suitable for ARMA? heh

Wait a sec..

this is really odd.

It works when the helicopter is landed, however it has problems when it is in mid-flight.

---------- Post added at 12:00 AM ---------- Previous post was Yesterday at 11:50 PM ----------

I think I figured out how to fix this. It seems that setting the helicopter to start as Flying under Special causes the light to trip out like that. But if I start with the helicopter landed it works fine.

Thanks for the help =]

Ah hell...

messes up when the helicopter is in flight, but not when it is landed... I don't know how to get around this.

Edited by Jackael

Share this post


Link to post
Share on other sites

Odd, yeah I had the testing with a sitting helo which must be why I didn't see the black outs you saw.

You can change the color too. In the setLightColor [1.0, 0.0, 0.0]; line the numbers are colors, [red, green, blue]. The number goes from 1.0 to 0.0.

So for Red it would be [1.0, 0, 0] for Green it would be [0, 1.0, 0] for Purple it would be [1.0, 0, 1.0].

For the factory example I wanted a "dirty yellow" color. So I popped open Photoshop and found a color that was 250, 250, 178. So changing that to a 1 - 0 scale, I set it as [0.9, 0.9, 0.6]

(255 - 0 = 1.0 - 0.0)

Share this post


Link to post
Share on other sites

Yea I was playing with this. I found something sweet you can do.

I put the player's squad in an APC and gave it that red light, and then once they got to the "Drop off zone" (so i called it) then the light changed to green and the vehicle status unlocked.

Edited by Jackael

Share this post


Link to post
Share on other sites

Is there also a way to make the lights change each second?

I want an disco/nightclub effect ;)

Share this post


Link to post
Share on other sites

I have an example mission in Utes for you all, that dynamically adds light onto flagpoles declared in init.sqf.

Light Test (Utes)

@Disco, while loop, use a table of colours with their own seconds, and use differentials to say where the points go sorta like what I showed. I'll play around with it, but don't except UK flag colours in sequence. It's not that simple, every light source has to have its own relative position to the anchor, with its own colour, then have independent sleep state (Sleeps and waituntils in each anchor loop), and for each anchor must wait on each light source.

Edited by sparcdr

Share this post


Link to post
Share on other sites
In a script or something. You could put that code in the init.sqf file to run it from the start for example. If you were adding it in the helo's init field use this:

cabinLight = "#lightpoint" createVehicle position this;
cabinLight setLightBrightness 0.00275;
cabinLight setLightAmbient[ 1.0, 0.0, 0.0];
cabinLight setLightColor [1.0, 0.0, 0.0];
cabinLight lightAttachObject [this, [0, -3.25, -0.25]];

This works pretty well.

Hey Kylania, this works well on a UH-1Y but using it on a chinook or blackhawk doesnt work!

Any idea why? or can you help me to get it to work on other choppers please?

Thanks

Share this post


Link to post
Share on other sites
Why do lights attached to a static C130 dissapear when placed on fe 3000 mt height?

Check out this post from Demonized, I believe it answers your question. Also, read the whole thread, as Demonized posted code which may work for you.

I haven't messed around with this, but maybe attaching to the plane using modelToWorld could work...

Demonized Chinook lights

Share this post


Link to post
Share on other sites
Why do lights attached to a static C130 dissapear when placed on fe 3000 mt height?

Not 100% sure, but it may be related to lack of floating point accuracy with how the lighting engine works, as we tend to put in very tiny values in the light datas. I've seen the same thing happen to non static C130 where attachto works properly, and to other "off earth" locations trying to illuminate other kinds of "base equipment" (simulating tunnels - light failure). I've also seen this apparent behavior for particles - they simply stop working above certain altitudes.

Again, not sure, but the reasoning seems valid, as I've had my issues with single precision floats in the past :p

Share this post


Link to post
Share on other sites
Is there also a way to make the lights change each second?

I want an disco/nightclub effect ;)

I have an example mission in Utes for you all, that dynamically adds light onto flagpoles declared in init.sqf.

Light Test (Utes)

@Disco, while loop, use a table of colours with their own seconds, and use differentials to say where the points go sorta like what I showed. I'll play around with it, but don't except UK flag colours in sequence. It's not that simple, every light source has to have its own relative position to the anchor, with its own colour, then have independent sleep state (Sleeps and waituntils in each anchor loop), and for each anchor must wait on each light source.

Speaking of disco, I wonder if anyone know how to mess with particle lights? Anyone know if it is possible at all to focus those particles orbs like at light point or any useful tips with them at all. Thanks.

Share this post


Link to post
Share on other sites
Guest

The lights are not strobing. What happens is that it's position is not updated every frame, so the heli more forward and the light stay behind it until the next position update.

 

This update position lag is something forced by the engine, and will happens always i believe. I'm looking in a way to fix that... i'm attaching lights to bullets.

Share this post


Link to post
Share on other sites

Question:

1. Want those lights to be seen in MP or...

2. are they only for a single-player mission?

 

My Answer for yours:

 

Attaching #lightpoints to bullets on a MP mission can be the worst idea to improve the lag. They need to become global to let other clients see them, so you need to use MP Framework or an AddPublicEventHandler + PublicVariable for each light. That could be disastrous. A PublicVariable Spam in a server could give you a large bunch of desyncs.

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  

×