Lights – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[Image:" to "[[File:")
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{wip}}
{{TOC|side}}
<br>
{{Wiki|stub}}
= Vehicle Lights =
= Vehicle Lights =
== Overview ==
== Overview ==
=== Headlights ===
=== Headlights ===
[[Image:head_lights.jpg|right|thumb|Qilin with headlights on]] If a vehicle has headlights, they are usually available for the driver of the vehicle and if the driver is a human player, the headlights could be operated via keyboard binding (normally <tt>L</tt>) or scroll action menu. If the driver is AI, it will operate the headlights depending on some preset condition. For example it will turn the lights at night and turn them off in the day time. The exact time when AI may decide to use the lights can be obtained via the following formula (⚠ current formula but [[Talk:Arma_3_Lights#Previous_lights_on_randomization_formula | could change]]):
[[File:head_lights.jpg|right|thumb|Qilin with headlights on]] If a vehicle has headlights, they are usually available for the driver of the vehicle and if the driver is a human player, the headlights could be operated via keyboard binding (normally {{hl|L}}) or scroll action menu. If the driver is AI, it will operate the headlights depending on some preset condition. For example it will turn the lights at night and turn them off in the day time. The exact time when AI may decide to use the lights can be obtained via the following formula (⚠ current formula but [[Talk:Arma_3_Lights#Previous_lights_on_randomization_formula | could change]]):
[[private]] _isTimeForLightsOn = [0,0,0] [[getEnvSoundController]] "night" > 0.7;
<sqf>private _isTimeForLightsOn = [0,0,0] getEnvSoundController "night" > 0.7;</sqf>


From scripts the headlights could be operated via either the script command [[setPilotLight]] or the [[action]]s <tt>"LightOn"</tt> and <tt>"LightOff"</tt>. To check if headlights are on or off use [[isLightOn]] command. If a human player is the driver/pilot, the commands will work unconditionally. However if AI is driving or piloting, then it might resist lights status change.
From scripts the headlights could be operated via either the script command [[setPilotLight]] or the [[action]]s {{hl|"LightOn"}} and {{hl|"LightOff"}}. To check if headlights are on or off use [[isLightOn]] command.  
 
If a human player is the driver/pilot, the commands will work unconditionally. However if AI is driving or piloting, then it might resist lights status change. Whether or not AI will attempt to operate the headlights depends on the time of the day and AI's [[lifeState]] or [[behaviour]] mode. An unconscious/incapacitated AI and AI in the {{hl|STEALTH}}, {{hl|COMBAT}} or {{hl|AWARE}} modes will not operate the headlights and hence won't resist the changes.
==== Overriding ====
==== Overriding ====
Since Arma 3 v1.92 it is possible to override AI ability of operating vehicle headlights by using new "LIGHTS" directive with [[disableAI]]/[[enableAI]] commands.
Since {{arma3}} v1.92 it is possible to override AI ability of operating vehicle headlights by using new {{hl|"LIGHTS"}} directive with [[disableAI]]/[[enableAI]] commands.
_vehicle [[disableAI]] "LIGHTS"; {{codecomment | // override AI}}
<sqf>
_vehicle [[setPilotLight]] [[false]]; {{codecomment | // force switch headlights off}}
_vehicle disableAI "LIGHTS"; // override AI
_vehicle setCollisionLight false; // force switch collision lights off
</sqf>
 
==== Config Related ====
==== Config Related ====
It is possible to set initial state of the headlights in a vehicle config, so that when vehicle is spawned it has headlights either on or off.
It is possible to set initial state of the headlights in a vehicle config, so that when vehicle is spawned it has headlights either on or off.
<syntaxhighlight lang=cpp>
<syntaxhighlight lang="cpp">
class CfgVehicles
class CfgVehicles
{
{
...
// ...
class MyVehicle
class MyVehicle
{
{
...
// ...
pilotLight = true; // true - spawn with headlights on, false - spawn with headlights off. Default: false;  
pilotLight = true; // true - spawn with headlights on, false - spawn with headlights off. Default: false;
...
// ...
};
};
...
// ...
};
};
</syntaxhighlight>
</syntaxhighlight>


=== Collision Lights ===
=== Collision Lights ===
[[Image:collision_lights.jpg|right|thumb|Collision lights on the Speedboat]] Normally used in air and naval vehicles.
 
[[File:collision_lights.jpg|right|thumb|Collision lights on the Speedboat]] Normally used in air and naval vehicles.
 
==== Overriding ====
==== Overriding ====
Since {{arma3}} v1.92 it is possible to override AI ability of operating vehicle collision lights by using new {{hl|"LIGHTS"}} directive with [[disableAI]]/[[enableAI]] commands.
<sqf>
_vehicle disableAI "LIGHTS"; // override AI
_vehicle setCollisionLight false; // force switch collision lights off
</sqf>
==== Config Related ====
==== Config Related ====
It is possible to set initial state of the collision lights in a vehicle config, so that when vehicle is spawned it has collision lights either on or off.
It is possible to set initial state of the collision lights in a vehicle config, so that when vehicle is spawned it has collision lights either on or off.
<syntaxhighlight lang=cpp>
<syntaxhighlight lang="cpp">
class CfgVehicles
class CfgVehicles
{
{
...
// ...
class MyVehicle
class MyVehicle
{
{
...
// ...
collisionLight = true; // true - spawn with collision lights on, false - spawn with collision lights off. Default: false;  
collisionLight = true; // true - spawn with collision lights on, false - spawn with collision lights off. Default: false;
...
// ...
};
};
...
// ...
};
};
</syntaxhighlight>
</syntaxhighlight>


=== Search Light ===
=== Search Light ===
[[Image:search_light.jpg|right|thumb|WY-55 Hellcat with the search light activated]] At the moment, the WY-55 Hellcat helicopter is the only vehicle in vanilla Arma 3 game that has the search light implemented on the observer turret. This light could only be operated manually either by human player via the scroll action menu or via scripted [[action]]s <tt>"SearchLightOn"</tt> and <tt>"SearchLightOff"</tt>, in which case it could also be switched on/off with AI on the observer turret. There is currently no way of telling if the search light is on or off via script.
 
_heli [[turretUnit]] [0] [[action]] ["SearchLightOn", _heli];
[[File:search_light.jpg|right|thumb|WY-55 Hellcat with the search light activated]] At the moment, the WY-55 Hellcat helicopter is the only vehicle in vanilla Arma 3 game that has the search light implemented on the observer turret. This light could only be operated manually either by human player via the scroll action menu or via scripted [[action]]s {{hl|"SearchLightOn"}} and {{hl|"SearchLightOff"}}, in which case it could also be switched on/off with AI on the observer turret. To get the status of the search light use [[isLightOn]] command with turret path.
_heli [[turretUnit]] [0] [[action]] ["SearchLightOff", _heli];
<sqf>
_heli turretUnit [0] action ["SearchLightOn", _heli];
_heli turretUnit [0] action ["SearchLightOff", _heli];
</sqf>
The turret could be rotated and the search light elevated. To get the orientation of the search light beam:
The turret could be rotated and the search light elevated. To get the orientation of the search light beam:
[[private]] _searchLightRotation = [[deg]] (_heli [[animationSourcePhase]] "obsTurret");
<sqf>
[[private]] _searchLightElevation = [[deg]] (_heli [[animationSourcePhase]] "obsGun");
private _searchLightRotation = deg (_heli animationSourcePhase "obsTurret");
private _searchLightElevation = deg (_heli animationSourcePhase "obsGun");
</sqf>
The search light is model's VolumeLight proxy that is revealed or hidden by the engine, following user action.
The search light is model's VolumeLight proxy that is revealed or hidden by the engine, following user action.


Line 62: Line 80:
Some weapons in Arma 3 allow attachments in form of flashlight or IR laser. Both could be used by human players and AI units.  
Some weapons in Arma 3 allow attachments in form of flashlight or IR laser. Both could be used by human players and AI units.  
=== Flashlight ===
=== Flashlight ===
[[Image:flash_light.jpg|right|thumb|A FIA soldier with the gun flashlight]] When equipped, the flashlight could normally be operated by pressing <tt>L</tt> if the player is human or via <tt>"GunLightOn"</tt> and <tt>"GunLightOff"</tt> [[action]]s. The status of the flashlight could be checked with [[isFlashlightOn]] command. Flashlights might need to be explicitly enabled for a group before they could be used.  
[[File:flash_light.jpg|right|thumb|A FIA soldier with the gun flashlight]] When equipped, the flashlight could normally be operated by pressing {{hl|L}} if the player is human or via {{hl|"GunLightOn"}} and {{hl|"GunLightOff"}} [[action]]s. The status of the flashlight could be checked with [[isFlashlightOn]] command. Flashlights might need to be explicitly enabled for a group before they could be used.  
==== Enabling/Disabling ====
==== Enabling/Disabling ====
Flashlights could only be enabled or disabled for a group. The [[enableGunLights]] command can have 3 options: <tt>"ForceOn"</tt>, <tt>"ForceOff"</tt> and <tt>"Auto"</tt>. Passing <tt>"Auto"</tt> will let AI automatically switch flashlight on and off depending on combat mode. If force enabled, the individual unit flashlight state could be controlled with <tt>"GunLightOn"</tt> and <tt>"GunLightOff"</tt> [[action]]s:
Flashlights could only be enabled or disabled for a group. The [[enableGunLights]] command can have 3 options: {{hl|"ForceOn"}}, {{hl|"ForceOff"}} and {{hl|"Auto"}}. Passing {{hl|"Auto"}} will let AI automatically switch flashlight on and off depending on combat mode. If force enabled, the individual unit flashlight state could be controlled with {{hl|"GunLightOn"}} and {{hl|"GunLightOff"}} [[action]]s:
_unit [[enableGunLights]] "ForceOn"; {{codecomment |// enables flashlight for the _units's group}}
<sqf>
_unit [[action]] ["GunLightOff", _unit]; {{codecomment |// switches flashlight off for the _unit only}}
_unit enableGunLights "ForceOn"; // enables flashlight for the _units's group
_unit action ["GunLightOff", _unit]; // switches flashlight off for the _unit only
</sqf>
Enabling and disabling works only for AI units, human player can always operate flashlight regardless of the mode.
Enabling and disabling works only for AI units, human player can always operate flashlight regardless of the mode.


=== IR Laser ===
=== IR Laser ===
==== Enabling/Disabling ====
==== Enabling/Disabling ====


== Examples ==
== Examples ==
= Street Lights =
= Street Lights =
[[Image:street_light.jpg|right|thumb|A street light on Malden]]
 
[[File:street_light.jpg|right|thumb|A street light on Malden]]
 


= Particle Light Sources =
= Particle Light Sources =
== See Also ==
* [[Arma 3: CfgLights]]
* [[Light Source Tutorial]]
{{GameCategory|arma3|Editing}}

Latest revision as of 23:10, 20 November 2023

Vehicle Lights

Overview

Headlights

Qilin with headlights on

If a vehicle has headlights, they are usually available for the driver of the vehicle and if the driver is a human player, the headlights could be operated via keyboard binding (normally L) or scroll action menu. If the driver is AI, it will operate the headlights depending on some preset condition. For example it will turn the lights at night and turn them off in the day time. The exact time when AI may decide to use the lights can be obtained via the following formula (⚠ current formula but could change):

private _isTimeForLightsOn = [0,0,0] getEnvSoundController "night" > 0.7;

From scripts the headlights could be operated via either the script command setPilotLight or the actions "LightOn" and "LightOff". To check if headlights are on or off use isLightOn command.

If a human player is the driver/pilot, the commands will work unconditionally. However if AI is driving or piloting, then it might resist lights status change. Whether or not AI will attempt to operate the headlights depends on the time of the day and AI's lifeState or behaviour mode. An unconscious/incapacitated AI and AI in the STEALTH, COMBAT or AWARE modes will not operate the headlights and hence won't resist the changes.

Overriding

Since Arma 3 v1.92 it is possible to override AI ability of operating vehicle headlights by using new "LIGHTS" directive with disableAI/enableAI commands.

_vehicle disableAI "LIGHTS"; // override AI _vehicle setCollisionLight false; // force switch collision lights off

Config Related

It is possible to set initial state of the headlights in a vehicle config, so that when vehicle is spawned it has headlights either on or off.

class CfgVehicles
{
	// ...
	class MyVehicle
	{
		// ...
		pilotLight = true; // true - spawn with headlights on, false - spawn with headlights off. Default: false;
		// ...
	};
	// ...
};

Collision Lights

Collision lights on the Speedboat

Normally used in air and naval vehicles.

Overriding

Since Arma 3 v1.92 it is possible to override AI ability of operating vehicle collision lights by using new "LIGHTS" directive with disableAI/enableAI commands.

_vehicle disableAI "LIGHTS"; // override AI _vehicle setCollisionLight false; // force switch collision lights off

Config Related

It is possible to set initial state of the collision lights in a vehicle config, so that when vehicle is spawned it has collision lights either on or off.

class CfgVehicles
{
	// ...
	class MyVehicle
	{
		// ...
		collisionLight = true; // true - spawn with collision lights on, false - spawn with collision lights off. Default: false;
		// ...
	};
	// ...
};

Search Light

WY-55 Hellcat with the search light activated

At the moment, the WY-55 Hellcat helicopter is the only vehicle in vanilla Arma 3 game that has the search light implemented on the observer turret. This light could only be operated manually either by human player via the scroll action menu or via scripted actions "SearchLightOn" and "SearchLightOff", in which case it could also be switched on/off with AI on the observer turret. To get the status of the search light use isLightOn command with turret path.

_heli turretUnit [0] action ["SearchLightOn", _heli]; _heli turretUnit [0] action ["SearchLightOff", _heli];

The turret could be rotated and the search light elevated. To get the orientation of the search light beam:

private _searchLightRotation = deg (_heli animationSourcePhase "obsTurret"); private _searchLightElevation = deg (_heli animationSourcePhase "obsGun");

The search light is model's VolumeLight proxy that is revealed or hidden by the engine, following user action.

Other Light Sources

Examples

Unit Lights

Overview

Some weapons in Arma 3 allow attachments in form of flashlight or IR laser. Both could be used by human players and AI units.

Flashlight

A FIA soldier with the gun flashlight

When equipped, the flashlight could normally be operated by pressing L if the player is human or via "GunLightOn" and "GunLightOff" actions. The status of the flashlight could be checked with isFlashlightOn command. Flashlights might need to be explicitly enabled for a group before they could be used.

Enabling/Disabling

Flashlights could only be enabled or disabled for a group. The enableGunLights command can have 3 options: "ForceOn", "ForceOff" and "Auto". Passing "Auto" will let AI automatically switch flashlight on and off depending on combat mode. If force enabled, the individual unit flashlight state could be controlled with "GunLightOn" and "GunLightOff" actions:

_unit enableGunLights "ForceOn"; // enables flashlight for the _units's group _unit action ["GunLightOff", _unit]; // switches flashlight off for the _unit only

Enabling and disabling works only for AI units, human player can always operate flashlight regardless of the mode.

IR Laser

Enabling/Disabling

Examples

Street Lights

A street light on Malden


Particle Light Sources

See Also