Jump to content
anfo

BIS_fnc_switchLamp

Recommended Posts

Hi

Plucked and am using example code straight out of the wiki:

// Switches all lamps off in a radius of 200m
private _lampsIn200m = nearestObjects [player, ["Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F"], 200];
{ [_x, false] call BIS_fnc_switchLamp; } forEach _lampsIn200m;

Can somebody please help me verify a couple of things?

Noticed nearestObjects only seem to be valid for a player or object, but not a marker. Can it be a marker?

Either way, I'd like to illuminate (true from initially false) multiple independent zones across a map, instead of just one. Can anybody please show how to introduce an array into the code?

Share this post


Link to post
Share on other sites

@anfo,

Try like this,

private _lampsIn1000m = nearestObjects [(getMarkerPos "marker_name"), ["Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F"], 1000];

Have fun!

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

A marker is not an object, it's a marker. But it has a position you can use in any command waiting for a position. The 1st parameter of nearestObjects can be an object or a position, so, no problem with something like getMarkerPos "yourMarkerName" .

 

Note: The bis_fnc_switchLamp is using the switchlight command itself which is drastically improved since 1.92.

It's OK for street lamps but not enough for runway lights for example.

Using the nearestObjects [player, ["Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F"], 2000]; (no matter the radius here), as in example 1,

will switch off "all" street lights. If you want to switch off the runway lights as well, you need to enlarge the nearestObjects search:

something like:  nearestObjects [player, [], 2000]; But it's very demanding on resource (for a wide area like an airport).

 

I spent sometimes on classes for lamps, lights, on multiple maps (CUP ones), for SP & MP... and I created my own module for that.

 

Remaining challenge (on BI side): the vanilla fuel station ("Land_fs_roof_F") will never switch off, whatever the method. The model is poorly implemented.

  • Like 1

Share this post


Link to post
Share on other sites
14 minutes ago, wogz187 said:

 


private _lampsIn1000m = nearestObjects [(getMarkerPos "marker_name"), ["Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F"], 1000];

 

 

If I wanted to add multiple markers, would it be something along the lines of?

[(getMarkerPos ["marker_name1", "marker_name2"]),

 

Share this post


Link to post
Share on other sites
7 minutes ago, pierremgi said:

I spent sometimes on classes for lamps, lights, on multiple maps (CUP ones)... and I created my own module for that.

 

I forgot I downloaded your modules, will load them up and have another look!

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

×