Jump to content
Sign in to follow this  
K6

TURNING THE DEFAULT CITY LAMP OFF

Recommended Posts

Does someone know how I can a turn off a streetlamp in a city. No addon streetlamp!

Thanks

K6

Share this post


Link to post
Share on other sites

Very possible. You can even add lightswitches to every single lamp, if you want to.

Create a trigger, condition TRUE, activation:

nearestObject [this, "StreetLamp"] switchLight "OFF"

There ya go! You don't even need a radius to be set for the trigger.

Keep in mind that O:FP's handling of streetlights is VERY slow. It might take a few seconds for the thing to actually appear to be off, but this DOES work.

To make a lightswitch feature, I did this:

Place a flag or other static object inside the light (using an invisible game logic unit will only work in single player), give it a name, and put this in the init field:

this addAction ["Turn streetlight on/off","lightswitch.sqs"]

Then, make a script called "lightswitch.sqs" with the following code:

***

_lightname = _this select 0

? lightIsOn nearestObject [_lightname, "StreetLamp"] == "OFF" : goto "setOn"

? lightIsOn nearestObject [_lightname, "StreetLamp"] == "AUTO" : goto "setOff"

#setOff

nearestObject [this, "StreetLamp"] switchLight "OFF"

exit

#setOn

nearestObject [_lightname, "StreetLamp"] switchLight "AUTO"

exit

***

NOTE: "AUTO" is used, because "ON" doesn't show the light during daytime anyways, and "AUTO" is the default value. You can change it if you want to, with no ill effects, AFAIK.

Have fun!

- PlaneShifter -

Share this post


Link to post
Share on other sites

Thanks dude, great answer...more the I expected. Will try this out.

Thanks again

Share this post


Link to post
Share on other sites

I did it exactly as you said. Not the switch part! It wrote "invalid number in expression"

confused.gif

Share this post


Link to post
Share on other sites

Can someone warchover the first light off sentence its not working.

Thanks

Share this post


Link to post
Share on other sites

Try naming the trigger and replacing "this" with the trigger name. Might be referencing the trigger list or something, I dunno. Also, make sure your quotes and brackets are all in the right places. I'll try this myself and see if I get the same problem.

- PlaneShifter -

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  

×