Jump to content
Sign in to follow this  
anfo

Floodlight Off > On by trigger

Recommended Posts

Hello

 

Say I place a floodlight down, when the environment is night it automatically starts turned on. However does anybody know of a script or command that when a trigger is fired, said floodlight goes from Off (start status) to On? A bit like a motion detector?

 

Cheers, Anfo

Share this post


Link to post
Share on other sites

I'm not getting any actual light from the "Floodlight" tool.  The Lamp (Halogen) [on] (classname Land_LampHalogen_F) however does work.  Toggle Vertical Mode (') to get it down in the ground so it's not so tall.

 

In it's init put:

{this setHit [_x, 0.97]} forEach ["light_1_hitpoint", "light_2_hitpoint", "light_3_hitpoint", "light_4_hitpoint"];

Then put a trigger where you want the detection range, ANYBODY PRESENT.

 

onAct:

{nameOfLamp setHit [_x, 0]} forEach ["light_1_hitpoint", "light_2_hitpoint", "light_3_hitpoint", "light_4_hitpoint"];

onDeact:

{nameOfLamp setHit [_x, 0.97]} forEach ["light_1_hitpoint", "light_2_hitpoint", "light_3_hitpoint", "light_4_hitpoint"];

Share this post


Link to post
Share on other sites

The floodlight doesn't turn on.
But you could attach a portable light to the floodlight when the trigger is activated.
But you would need to cover up the rest of the portable light with maybe like a camera looking system.
But the code to attach a portable light to a flood light is:

portablelight attachTo [floodlight,[0,0,0]];

that would be in the onAct field in a trigger.
the [0,0,0] is the X,Y,Z coords.
To make it look right I would fiddle around with it abit.
Sorry thats the best there is I think. Correct me if I'm wrong.

Share this post


Link to post
Share on other sites

 

I'm not getting any actual light from the "Floodlight" tool.  

 

 

 

The floodlight doesn't turn on.

 

Sorry guys, you're right. It has to be the "on' variety of floodlight to be automatically on at night. Thanks for the contributions, I'll give them both a shot.

Share this post


Link to post
Share on other sites

Sorry guys, you're right. It has to be the "on' variety of floodlight to be automatically on at night. Thanks for the contributions, I'll give them both a shot.

 

Only saw one object named "Floodlight" under Things -> Tools.  Everything else was under Lamps and had off and on versions.

Share this post


Link to post
Share on other sites

I have always used the setDamage command for this situation using the ON variant of a lamp.

if (condition)then{
myFloodLight setDamage 098;
}else{
myFloodLight setDamage 0;
};

For Trigger.

 

In the Lights init (named myFloodLight for example)

myFloodLight setDamage 0.998;

OnAct

myFloodLight setDamage 0;

OnDeact

myFloodLight setDamage 0.998;

Setting the damage to 1 makes the light collapse and disappear.

 

( First post guys be gentle )

  • Like 1

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  

×