{"name":"BIS_fnc_switchLamp","operator":null,"title":"BIS fnc switchLamp","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_switchLamp","revid":348593,"updated":"2023-11-08T13:44:37Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.64"}],"since":{"game":"arma3","name":"Arma 3","version":"1.64"},"arma3_since":"1.64","branch":null,"locality":{"argument":null,"effect":"local","server_exec":false},"exec":null,"description":"Switch streetlamp on/off.","syntaxes":[{"syntax":"[object, state] call BIS_fnc_switchLamp","since":null,"effect":null,"exec":null,"params":[{"name":"object","type":"Object","optional":false,"default":null,"description":"street Lamp","types":["Object"],"since":null,"text":"object: Object - street Lamp"},{"name":"state","type":"Boolean","optional":false,"default":null,"description":"true to turn lamp on, false to turn it off","types":["Boolean"],"since":null,"text":"state: Boolean - true to turn lamp on, false to turn it off"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"```sqf\n// switches all lamps off in a radius of 200m\nprivate _lampsIn200m = nearestObjects [player, [\"Lamps_base_F\", \"PowerLines_base_F\", \"PowerLines_Small_base_F\"], 200];\n{ [_x, false] call BIS_fnc_switchLamp; } forEach _lampsIn200m;\n```","code":["// switches all lamps off in a radius of 200m\nprivate _lampsIn200m = nearestObjects [player, [\"Lamps_base_F\", \"PowerLines_base_F\", \"PowerLines_Small_base_F\"], 200];\n{ [_x, false] call BIS_fnc_switchLamp; } forEach _lampsIn200m;"]},{"text":"```sqf\n// simulates a damaged street light\naLamp spawn {\n    params [\n        [\"_lamp\", objNull, [objNull]]\n    ];\n    while { player distance _lamp < 200 } do\n    {\n        [_lamp, selectRandom [true, false]] call BIS_fnc_switchLamp;\n        sleep 0.1 + random 0.5;\n    };\n};\n```","code":["// simulates a damaged street light\naLamp spawn {\n\tparams [\n\t\t[\"_lamp\", objNull, [objNull]]\n\t];\n\twhile { player distance _lamp < 200 } do\n\t{\n\t\t[_lamp, selectRandom [true, false]] call BIS_fnc_switchLamp;\n\t\tsleep 0.1 + random 0.5;\n\t};\n};"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["switchLight"],"notes":[],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Object Manipulation","Functions","Functions: Local Effect","Introduced with Arma 3 version 1.64"],"docblock":null,"filled_from_docblock":[]}