2 registered members (AndrewAMD, VoroneTZ),
1,258
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Dynamic Light
#285989
08/22/09 03:46
08/22/09 03:46
|
Joined: Mar 2009
Posts: 207
Erick_Castro
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 207
|
I created an action that make a dynamic light to be on and off in a room.
action luz_random { my.lightred = 250; my.lightgreen = 250; my.lightblue = 170; while(1) { my.lightrange=200; sleep(1.5); my.lightrange=0; sleep(1.5); } }
it works good. But i see that my gun entity defined in layer 1 is afected for the dynamic light when it is turned ON even when i am in other rooms of my world and separated from walls.
entity gun0 { type = <el_revolver.mdl>; ambient = 0; pan=90; x= 5; scale_x=2; scale_y=2; scale_z=2; layer=1; y= 3; z= 0; ammo=0; numbergun=1; recargar=1; }
I dont want that happens , but i dont know why it happens.
Thank you for your help, friends
Last edited by Erick_Castro; 08/22/09 03:48.
|
|
|
Re: Dynamic Light
[Re: Claus_N]
#286077
08/22/09 22:03
08/22/09 22:03
|
Joined: Mar 2009
Posts: 207
Erick_Castro
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 207
|
Claus_N Thanyou for your help. The entity, or view entity, of my gun i defined the next way:
entity gun0 { type = <el_revolver.mdl>; ambient = 0; pan=90; x= 5; scale_x=2; scale_y=2; scale_z=2; layer=1; y= 3; z= 0; ammo=0; numbergun=1; recargar=1; }
How can i define it like a real entity in the world space? o how can i turn off the lights of the view entity?
thank you friend.
Last edited by Erick_Castro; 08/22/09 22:04.
|
|
|
Re: Dynamic Light
[Re: Erick_Castro]
#286123
08/23/09 09:21
08/23/09 09:21
|
Joined: May 2004
Posts: 1,510 Denmark
Claus_N
Serious User
|
Serious User
Joined: May 2004
Posts: 1,510
Denmark
|
You can do it like this:
entity* theGun;
function gun_function()
{
my.passable = on;
my.ambient = 0;
vec_scale(my.scale_x,2);
while(my)
{
vec_set(my.pan,camera.pan); // Same angle as camera
vec_set(my.x,camera.x); // Same position as camera
// play around with these values
my.x += 5;
my.y += 0;
my.z += 0;
wait(1);
}
}
function createGun()
{
if(theGun != null) {ent_remove(theGun);}
theGun = ent_create("el_revolver.mdl",camera.x,gun_function);
}
Edit: If you want multiple guns, I suppose it's better to use ent_morph to change the gun model, instead of creating multiple gun entities and switching which one is visible
Last edited by Claus_N; 08/23/09 09:23.
|
|
|
|