Jump to content
Sign in to follow this  
tracy_t

How to turn all lights off on an island

Recommended Posts

Hi all,

For a given island (Skye in my case) I would like to turn off all the lights (houses & streetlamps in particular) to simulate a "power-cut" effect.

I tried:

_x = 100

#offloop

? _x < 9000: Object _x SwitchLight "OFF"

? _x==9000: goto "finished"

_x = _x+1

~.5

goto "offloop"

#finished

exit

But this code actually causes the operation flashpoint process to terminate!!!!

I realise my code may be referencing a non-existent object, but how the hell else can you do it?

Cheers

Tracy

Share this post


Link to post
Share on other sites

Common problem.

You have to switch off every light one by one, that means collect all IDs refering to StreetLamps and create a script that switches of every lamp..

Next time you should use the search function, i'm sure you would have find a thread or two with this problem already discussed.

Share this post


Link to post
Share on other sites

Your problem is the object command which causes a CTD on non exisiting object. There is no way around it, you must manually collect the object ID's of the lamps. Else you have to do map wide scans with nearestObject, and I'm not even sure that would pick up all lamps. (not that it's easier than manually gettting lamp ID's)

Share this post


Link to post
Share on other sites
Guest

Yes, but once you have all the ID no.s, there are some very cool things you can do with them wink_o.gifsmile_o.gif

Share this post


Link to post
Share on other sites

Bit poor that.

Can't get SwitchLight to work on houses, so turning the lamps off is pointless anyway. BIS, please fix this ASAP!!! lol

Share this post


Link to post
Share on other sites

Just in case if u don't know how to turn a light of:

object 173876 switchlight "on"

object-id or off

wink_o.gif

Share this post


Link to post
Share on other sites
Guest

Like I said....manual ID numbers is actually much better. Even if SwitchLight worked, it would create more lag....and you don't have as much control. I've seen a very nice script made for BAS' Tonal island which has the lights turning on randomly over a 40 second period, with some of them flickering a little....looks exactly like a city lighting up at night. There's no easy way to do that with SwitchLight even if it did work in the way you want to. smile_o.gif

Share this post


Link to post
Share on other sites

Hmm,

First:

Thanks for the lesson in object syntax freddern.

Second:

Already searched mission editing for switchlight function and got zilch.

Third: thanks to all that replied. Tried Object <lamp id> switchlight "OFF" on Skye island and nothing happened. So I guess the lights are either hard-wired to stay on sad_o.gif

Share this post


Link to post
Share on other sites
I've seen a very nice script made for BAS' Tonal island which has the lights turning on randomly over a 40 second period, with some of them flickering a little....looks exactly like a city lighting up at night. There's no easy way to do that with SwitchLight even if it did work in the way you want to.  smile_o.gif

I would guess they have made it with a scrípt.

example:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_n=random(15)

_i=0

~random(10)

#loop

~random(50)/100

_i=_i+1

object XXXXX switchlight "on"

~random(50)/100

object XXXXX switchlight "off"

? _i==_n : exit

goto "loop"

The problem with switchlight is that if you switch them off, you need to switch them back on. Otherwise when you do not do this, you will have the lights switched off when you try the mission next time or even when you run another mission on the same island. Does anyone know if this feature has been removed?

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  

×