BIS fnc switchLamp: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\{\{ *codecomment *\| *\/\/ *([^ ]+) *\}\} " to "{{cc|$1}}")
m (Undo revision 224513 by Lou Montana (talk) revert+format)
Tag: Undo
Line 1: Line 1:
{{RV|type=function
{{RV|type=function


|Arma3|1.64
|game1= arma3
 
|version1= 1.64


|arg= global |MParg= Multiplayer Arguments
|arg= global |MParg= Multiplayer Arguments
Line 9: Line 11:
|gr1= Object Manipulation
|gr1= Object Manipulation


| Switch streetlamp on/off
|descr= Switch streetlamp on/off.


| [object, state] call [[BIS_fnc_switchLamp]]
|s1= [object, state] call [[BIS_fnc_switchLamp]]


| [[Nothing]]
|r1= [[Nothing]]


|p1= object: [[Object]] - Street Lamp
|p1= object: [[Object]] - Street Lamp
Line 19: Line 21:
|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>{{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];
|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];
{ [_x, [[false]]] [[call]] [[BIS_fnc_switchLamp]]; } forEach _lampsIn200m;</code>
{ [_x, [[false]]] [[call]] [[BIS_fnc_switchLamp]]; } forEach _lampsIn200m;</code>


|x2= <code>{{cc| Simulates a damaged street light}}aLamp [[spawn]] {
|x2= <code>{{cc|simulates a damaged street light}}
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]]
Line 31: Line 35:
};</code>
};</code>


| [[switchLight]]
|seealso= [[switchLight]]
}}
}}
<dl class="command_description">
<!-- BEGIN Note Section -->
<!-- END Note Section -->
</dl>
{{GameCategory|arma3|Functions}}
[[Category:Functions|{{uc:switchLamp}}]]

Revision as of 16:48, 29 January 2021

Hover & click on the images for description

Description

Description:
Switch streetlamp on/off.
Execution:
call
Groups:
Object Manipulation

Syntax

Syntax:
[object, state] call BIS_fnc_switchLamp
Parameters:
object: Object - Street Lamp
state: Boolean - true to turn lamp on, false to turn it off
Return Value:
Nothing

Examples

Example 1:
// 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;
Example 2:
// simulates a damaged street light aLamp 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:
switchLight

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