BIS fnc switchLamp: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|eff= global |=" to "|eff= global |MPeff=")
m (Text replacement - "(\|[pr][0-9]+ *= *[^-\r\n]+) *- *S([a-z])" to "$1 - s$2")
 
(20 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Function|=
{{RV|type=function
____________________________________________________________________________________________


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


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


|arg= global |= Multiplayer Arguments
|gr1= Object Manipulation


|eff= global |MPeff= Multiplayer Effects
|descr= Switch streetlamp on/off.
____________________________________________________________________________________________


| Switch streetlamp on/off |DESCRIPTION=
|s1= [object, state] call [[BIS_fnc_switchLamp]]
____________________________________________________________________________________________


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


| [[Nothing]] |RETURNVALUE=
|p1= object: [[Object]] - street Lamp


|p1= object: [[Object]] - Street Lamp |PARAMETER1=
|p2= state: [[Boolean]] - true to turn lamp on, false to turn it off


|p2= state: [[Bool]] - true to turn lamp on, false to turn it off |PARAMETER2=
|x1= <sqf>
// 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;
</sqf>


____________________________________________________________________________________________
|x2= <sqf>
 
// simulates a damaged street light
|x1= <code>{{codecomment|// Switches all lamps off in a radius of 200m}}
aLamp spawn {
[[private]] _lampsIn200m = [[nearestObjects]] <nowiki>[</nowiki>[[player]], ["Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F"], 200];
params [
{ [_x, [[false]]] [[call]] [[BIS_fnc_switchLamp]]; } forEach _lampsIn200m;</code> |EXAMPLE1=
["_lamp", objNull, [objNull]]
 
];
|x2= <code>{{codecomment|// Simulates a damaged street light}}
while { player distance _lamp < 200 } do
aLamp [[spawn]] {
[[private]] _lamp = [[param]] [0, [[objNull]], <nowiki>[</nowiki>[[objNull]]]];
[[while]] { [[player]] [[distance]] _lamp < 200; } [[do]]
{
{
[_lamp, [[selectRandom]] [ [[true]], [[false]] ]] [[call]] [[BIS_fnc_switchLamp]];
[_lamp, selectRandom [true, false]] call BIS_fnc_switchLamp;
[[sleep]] 0.1 + [[random]] 0.5;
sleep 0.1 + random 0.5;
};
};
};</code> |EXAMPLE2=
};
____________________________________________________________________________________________
</sqf>


| [[switchLight]] |SEEALSO=
|seealso= [[switchLight]]
}}
}}
<dl class="command_description">
<!-- BEGIN Note Section -->
<!-- END Note Section -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Arma 3: Functions|{{uc:switchLamp}}]]

Latest revision as of 14:44, 8 November 2023

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 { params [ ["_lamp", 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