creating light sources with script

Posted By: gfxExp

creating light sources with script - 11/02/09 09:29

Hi,

Just like ent_create, how would I go about creating lights? When I had used WED before (can't use it now though) I could easily add lights.

Lite-C Workshop so far doesn't explain much about creating lights. I'm at workshop 19 (Physic Workshop).

Any suggestions?
Posted By: delinkx

Re: creating light sources with script - 11/02/09 09:35

wat kind of lights do u wanna create ?
Posted By: Razoron

Re: creating light sources with script - 11/02/09 09:35

Code:
function light_place(x,y,z,r,g,b,range)
{ 
  ENTITY* light = ent_create(NULL,vector(x,y,z),NULL);
  light.red = r;
  light.green = g;
  light.blue = b;
  light.lightrange = range;
}


function main()
{
  ...
  level_load(...);
  light_place(100,100,100,0,0,255,1000);
  ...
}


Posted By: gfxExp

Re: creating light sources with script - 11/02/09 10:14

Ah, so have to use null entity to create lights. Thanks!

EDIT
----

level entities are not casting any shadows. Any suggestions?
Posted By: delinkx

Re: creating light sources with script - 11/02/09 10:32

cause the light is alwys attached to an entity. if u wanna use spot light, u have to do same. but for environment light, its on the map.
Posted By: gfxExp

Re: creating light sources with script - 11/02/09 12:40

Point taken. Light are attached to entity. so how can I go about making the model entities cast shadows? I tried setting CAST flag to the light entity, did not work. I also tried setting model entities CAST flag as well. Still no luck.
Posted By: Liamissimo

Re: creating light sources with script - 11/02/09 17:39

Set the flag shadow, in Sed with

entity.flags |= (SHADOW);
© 2024 lite-C Forums