light on or off

Posted By: DAVIDMORETON

light on or off - 07/02/15 11:24

Yet another problem !!
I have a lamp over a desk (lamp composed of shade (mdl), flare bit map and the actual ‘light’, which I want to turn on or off as needed.
As a light does not have a 'behaviour' I can't give it an 'action'.
I can find no data in the manual or the forum to do this.
Anyone got any ideas please?
Kind regards, David
Posted By: Anonymous

Re: light on or off - 07/02/15 19:38

Create a second mdl"cube" in the script with ent_creat()
set it's flags to invisible, set it's flag to LIGHT,
set it's lightrange to say 100;
in the ent_create - assign it a action
in the action you turn the light on and off by setting reseting the LIGHT flag or settting lightrange to 0 or >0
Posted By: MasterQ32

Re: light on or off - 07/04/15 07:20

hey, don't create a CUBE, just create an empty model via script:
Code:
ENTITY *light = ent_create(NULL, position, action);
light->lightrange = 100; // Or similar

// Switch on/off
if(toggle) {
 light->lightrange = 100 - 100 * (light->lightrange > 0);
}

Posted By: DAVIDMORETON

Re: light on or off - 07/05/15 10:23

Thanks Guys,
Where would the unskilled be without help from people like you? Thanks again, David
© 2024 lite-C Forums