Jump to content
Sign in to follow this  
egwal

Switching streetlights on and off?

Recommended Posts

So Im making this mp mission where a Russian naval squad defends a bridge on the East Border-map(FDFMOD). There are two streetlights near the bridge. One in each end.

And now i want to be able to switch them on and off when a player gets near(addaction?). But the problem is that i havent placed them in the editor, they came with them map, so I guess I gotta fool around with the IDs.

Thanks in advance.

Share this post


Link to post
Share on other sites

Some lampost type objects respond to

object <id of object> SwitchLight "OFF"

And others respond to

object <id of object> inflame false

Share this post


Link to post
Share on other sites
Some lampost type objects respond to

object <id of object> SwitchLight "OFF"

And others respond to

object <id of object> inflame false

Thanks tracy, it worked fine, but its not finished yet.

I want to have it so that when someone gets near the streetlight in mp, a new action appers in action menu, eg. "switch the northern light off". How do I do this?

Share this post


Link to post
Share on other sites

Well, you could use

object <id of lampost> addaction ["Switch Lightpost off", "switchlightoff.sqs"]

If that doesn't work, then you're gonna have to use a trigger, or use:

? Player distance NearestObject [Player, "streetlamp"] < 5: addaction etc etc.

Share this post


Link to post
Share on other sites

I would recommend against switching streetlights off. When you switch them off, they will remain off, even in the next mission you play. So one way to go around this to damage the lammpost.

object <id of object> setdammage 0.5

That will damage the lamp and "switch" it off.

Downside of this method is that there will be a delay when the lights are switched off...

Share this post


Link to post
Share on other sites

Hmm, tried that with Skye map McDeth, and it didn't work.

SwitchLight did though ;)

Share this post


Link to post
Share on other sites
Hmm, tried that with Skye map McDeth, and it didn't work.

SwitchLight did though ;)

Well tried it yesterday with FDF East Border Island and it worked fine. It does have an annoying delay though...

Share this post


Link to post
Share on other sites
Hmm, tried that with Skye map McDeth, and it didn't work.

SwitchLight did though ;)

Well tried it yesterday with FDF East Border Island and it worked fine. It does have an annoying delay though...

Somebody has all streetlamp object ID of FDF East Border Island? biggrin_o.gif

Share this post


Link to post
Share on other sites

the mapfact barracks addon has a power station unit, and you can use it to turn street lights on and off based on the fact that the street light either has a name or an object id. the instructions are in the mapfact barracks zip file. Please read it, its very easy to understand, and can even apply to other things if you wish.

Share this post


Link to post
Share on other sites
the mapfact barracks addon has a power station unit, and you can use it to turn street lights on and off based on the fact that the street light either has a name or an object id. the instructions are in the mapfact barracks zip file. Please read it, its very easy to understand, and can even apply to other things if you wish.

Thanks I know that, my intention to use it to cut power off. But determine all object id of streetlamp is very dull and long work.

sad_o.gif That is why I hope somebody already done this before. smile_o.gif

Share this post


Link to post
Share on other sites

Then by all means use me as your inspiration, motivation, whatever.  You can not only cut power off, but using your knowledge of id's you can have destroyed buildings set off objectives if you research hard enough into it. That is exactly what i need to figure out, and once done write up a tutorial for it into ofpec.

Share this post


Link to post
Share on other sites

Thanks! I start working on it.

I rewrote script found in MAPFACT baracken addon.

[nameofcurrenthouse,arrayofIDs] exec "script.sqs"

like

[this,[221126,221133]] exec "powercut.sqs"

------------------------------------------

_Currenthouse = _this select 0

_IDs = _this select 1

#Cycle

@(_Currenthouse animationPhase "Component02" >= 0.5 or not alive _Currenthouse)

"object _x switchlight ""off""" foreach _IDs

?(not alive _Currenthouse):exit

@(_Currenthouse animationPhase "Component02" < 0.5 or not alive _Currenthouse)

?(not alive _Currenthouse):exit

"object _x switchlight ""on""" foreach _IDs

Goto "Cycle"

------------------------------------------

Share this post


Link to post
Share on other sites

this is the script

this addaction ["Power Off", "lightsout.sqs"]

Quote[/b] ]; *****************************************************

; ** Operation Flashpoint Script File

; *****************************************************

;"lightsout.sqs"

_flicks=random(10)+10

_flick=0

#loop

_flick=_flick+1

(object 5436) switchlight "off"

(object 5802) switchlight "off"

(object 6540) switchlight "off"

(object 6062) switchlight "off"

~random(40)/100

(object 5436) switchlight "on"

(object 5802) switchlight "on"

(object 6540) switchlight "on"

(object 6062) switchlight "on"

~random(70)/100

?_flick<_flicks: goto "loop"

(object 5436) switchlight "off"

(object 5802) switchlight "off"

(object 6540) switchlight "off"

(object 6062) switchlight "off"

exit

this makes the lights flicker in the town before going off..

then to get them back on at the end because they will stay off for each mission.

this addaction ["Power On", "lightsout2.sqs"]

Quote[/b] ]; *****************************************************

; ** Operation Flashpoint Script File

; *****************************************************

;"lightsout2.sqs"

_flicks=random(10)+10

_flick=0

#loop

_flick=_flick+1

(object 5436) switchlight "off"

(object 5802) switchlight "off"

(object 6540) switchlight "off"

(object 6062) switchlight "off"

~random(40)/100

(object 5436) switchlight "on"

(object 5802) switchlight "on"

(object 6540) switchlight "on"

(object 6062) switchlight "on"

~random(70)/100

?_flick<_flicks: goto "loop"

(object 5436) switchlight "on"

(object 6062) switchlight "on"

exit

note i have made it so only a few lights come back on in the town making it look like some of them blew fuses..   biggrin_o.gif

PM me if you want an example mission

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  

×