BIS fnc switchLamp: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{Function " to "{{RV|type=function ")
m (Text replacement - "\{\{ *codecomment *\| *\/\/ *([^ ]+) *\}\} " to "{{cc|$1}}")
Line 19: Line 19:
|p2= state: [[Boolean]] - true to turn lamp on, false to turn it off
|p2= state: [[Boolean]] - true to turn lamp on, false to turn it off


|x1= <code>{{codecomment|// Switches all lamps off in a radius of 200m}}
|x1= <code>{{cc| Switches all lamps off in a radius of 200m}}[[private]] _lampsIn200m = [[nearestObjects]] [<nowiki/>[[player]], ["Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F"], 200];
[[private]] _lampsIn200m = [[nearestObjects]] [<nowiki/>[[player]], ["Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F"], 200];
{ [_x, [[false]]] [[call]] [[BIS_fnc_switchLamp]]; } forEach _lampsIn200m;</code>
{ [_x, [[false]]] [[call]] [[BIS_fnc_switchLamp]]; } forEach _lampsIn200m;</code>


|x2= <code>{{codecomment|// Simulates a damaged street light}}
|x2= <code>{{cc| Simulates a damaged street light}}aLamp [[spawn]] {
aLamp [[spawn]] {
[[private]] _lamp = [[param]] [0, [[objNull]], [<nowiki/>[[objNull]]]];
[[private]] _lamp = [[param]] [0, [[objNull]], [<nowiki/>[[objNull]]]];
[[while]] { [[player]] [[distance]] _lamp < 200; } [[do]]
[[while]] { [[player]] [[distance]] _lamp < 200; } [[do]]

Revision as of 17:32, 29 January 2021

Hover & click on the images for description

Description

Description:
Description needed
Execution:
call
Groups:
Object Manipulation

Syntax

Syntax:
Syntax needed
Parameters:
object: Object - Street Lamp
state: Boolean - true to turn lamp on, false to turn it off
Return Value:
Return value needed

Examples

Example 1:
// Switches all lamps off in a radius of 200mprivate _lampsIn200m = nearestObjects [player, ["Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F"], 200]; { [_x, false] call BIS_fnc_switchLamp; } forEach _lampsIn200m;
Example 2:
// Simulates a damaged street lightaLamp spawn { private _lamp = param [0, objNull, [objNull]]; while { player distance _lamp < 200; } do { [_lamp, selectRandom [true, false ]] call BIS_fnc_switchLamp; sleep 0.1 + random 0.5; }; };

Additional Information

See also:
See also needed

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note