BIS fnc switchLamp: Difference between revisions

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


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 1.64


| arma3 |= Game name
|eff= local


|1.00|= Game version
|gr1= Object Manipulation
____________________________________________________________________________________________


| <pre>/*
|descr= Switch streetlamp on/off.
Author: Karel Moricky


Description:
|s1= [object, state] call [[BIS_fnc_switchLamp]]
Switch streetlamp on/off


Parameter(s):
|r1= [[Nothing]]
0: OBJECT
1: BOOL - true to turn the light on


Returns:
|p1= object: [[Object]] - street Lamp
NOTHING
*/


|p2= state: [[Boolean]] - true to turn lamp on, false to turn it off


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|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>


| <!-- [] call [[BIS_fnc_switchLamp]]; --> |= Syntax
|x2= <sqf>
|p1= |= Parameter 1
// simulates a damaged street light
 
aLamp spawn {
| |= Return value
params [
____________________________________________________________________________________________
["_lamp", objNull, [objNull]]
 
];
|x1= <code></code> |=
while { player distance _lamp < 200 } do
____________________________________________________________________________________________
{
 
[_lamp, selectRandom [true, false]] call BIS_fnc_switchLamp;
| |= See also
sleep 0.1 + random 0.5;
};
};
</sqf>


|seealso= [[switchLight]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Objects|{{uc:switchLamp}}]]
[[Category:Functions|{{uc:switchLamp}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:switchLamp}}]]

Latest revision as of 15: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