BIS fnc switchLamp: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[[Cc]ategory:[ _]?Arma[ _]3:[ _]([^|]*)[ _]?\|.*\]\]" to "{{GameCategory|arma3|$1}}")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("server" o...)
Line 1: Line 1:
{{Function|Comments=
{{Function


|Arma3|Game=
|Arma3|Game=


|1.64|Game Version (number surrounded by NO SPACES)=
|1.64


|arg= global |MParg= Multiplayer Arguments
|arg= global |MParg= Multiplayer Arguments
Line 9: Line 9:
|eff= global |MPeff= Multiplayer Effects
|eff= global |MPeff= Multiplayer Effects


|gr1= Object Manipulation|GROUP1=
|gr1= Object Manipulation


| Switch streetlamp on/off |DESCRIPTION=
| Switch streetlamp on/off


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


| [[Nothing]] |RETURNVALUE=
| [[Nothing]]


|p1= object: [[Object]] - Street Lamp |PARAMETER1=
|p1= object: [[Object]] - Street Lamp


|p2= state: [[Boolean]] - true to turn lamp on, false to turn it off |PARAMETER2=
|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>{{codecomment|// 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> |EXAMPLE1=
{ [_x, [[false]]] [[call]] [[BIS_fnc_switchLamp]]; } forEach _lampsIn200m;</code>


|x2= <code>{{codecomment|// Simulates a damaged street light}}
|x2= <code>{{codecomment|// Simulates a damaged street light}}
Line 33: Line 33:
[[sleep]] 0.1 + [[random]] 0.5;
[[sleep]] 0.1 + [[random]] 0.5;
};
};
};</code> |EXAMPLE2=
};</code>


| [[switchLight]] |SEEALSO=
| [[switchLight]]
}}
}}



Revision as of 00:48, 18 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

Bottom Section