[SOLVED]Setting light as dynamic?

Posted By: wrekWIRED

[SOLVED]Setting light as dynamic? - 05/13/12 18:12

I like to make a candle with flame to light a certain part of my level and it should be able to cast shadows when the light hits an object. When using set(my, LIGHT) on the flame entitie how do i make it dynamic just like how i set light properties on WED?
Posted By: PadMalcom

Re: Setting light as dynamic? - 05/13/12 18:16

Set its lightrange to a value > 0.
Posted By: wrekWIRED

Re: Setting light as dynamic? - 05/14/12 03:56

Ow. So it's set to dynamic when lightrange is > 0. That's strange. I alredy set the light range using thses. But doesn't cast any shadows unlike the light i set using WED.
Code:
my.lightrange = 150 + random(20);


Posted By: Espér

Re: Setting light as dynamic? - 05/14/12 06:35

activate the CAST flag on the light, and the SHADOW flag on all objects that should have shadows
Posted By: wrekWIRED

Re: Setting light as dynamic? - 05/14/12 09:43

Negative. I tried setting SHADOW and CAST flags but still no shadow is cast.

Here are the screenshots taken in two lights i use. One uses light set by WED and other one is set using lightrange.

this one i set lightrange to 200 to an invisible object above the candle.



this one i set using WED. Light is same sa the flare above the candle on the fist screenshot and flags set is dynamic and lightrange of 150.


i set the following variable on main fuction to set the shadow.

Code:
shadow_offset = 5;
shadow_range = 15;
shadow_threshold = 60;
shadow_stencil = 2;
mat_shadow.alpha = 90;



Is there something wrong with the way i set the light on the candle? Or is there a better way to add light using lite-C and set it's property just like in WED?

I see that the light created by WED is quite different from setting it to a entity.
Posted By: Aku_Aku

Re: Setting light as dynamic? - 05/14/12 13:30

I can see a shadow on second picture. It belongs to the white box.
An advise, try to increase the value of the lightrange, perhaps first time to 600.
Posted By: wrekWIRED

Re: Setting light as dynamic? - 05/14/12 14:52

did that already but still the same result. Not to mention it also lits the other room where it it should not brcause of the wall. I was thinking of controlling the light i add using WED if it's posible.
Posted By: MasterQ32

Re: Setting light as dynamic? - 05/14/12 14:58

is the lightbox a model or a block?
if it's a block, dynamic light won't throw a shadow
Posted By: wrekWIRED

Re: Setting light as dynamic? - 05/14/12 15:43

its a model. I add the model on top of the candle where the flame is and set it's light property.

I use the following codes.
Code:
function candleflame()
{
	set(my, PASSABLE);
	set(my, INVISIBLE); //set model to invisible
	set(my, LIGHT);
	vec_set(my.blue,vector(255,255,255)); //set light to white
	my.lightrange = 200;

}

//attached to the candle action
ent_create ("nothing.mdl", vector(my.x,my.y,my.z+17), candleflame);



Just not sure why it does that.
Posted By: GameScore

Re: Setting light as dynamic? - 05/14/12 15:44

try something like this

Code:
action DynLight()
{
	set(my,INVISIBLE);
	set(my,PASSABLE);
	
	my.red = 255;
	my.green = 255;
	my.blue = 255;
	my.lightrange = 1000;
	set(my,CAST); 
	my.emask &= ~DYNAMIC;

}


Posted By: wrekWIRED

Re: Setting light as dynamic? - 05/14/12 15:51

there is no light emited when my.emask &= ~DYNAMIC; is added. Is it possible to control the light that i add using WED?
Posted By: wrekWIRED

Re: Setting light as dynamic? - 05/15/12 10:34

Got it. I spent the whole day trying to figure out what the problem is so i created a new test level to test the light and i foundout that shadow_threshold that was keeping the shadows from being cast. Thanks for the help guys.

By the way. Is it posible for the blocks to cast shadows to like so that it light don't penetrate to the oderside of the room?
© 2024 lite-C Forums