Difference between revisions of "Lightpoint Tutorial"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Fix Camera remnants)
m (Fix link)
Line 98: Line 98:
 
== See also ==
 
== See also ==
  
* [[:Category:Command Group: Lights]]
+
* [[:Category:Command Group: Lights|Command Group: Lights]]
  
  

Revision as of 00:30, 20 July 2020

Basics

A lightpoint (glowing light source) is a non-physical object that shines a light. Unlike projectors or vehicle headlights, this light type cannot be directed into a beam and can only glow uniformously.

A lightpoint is local to the computer where the script has been called; one player could see a light in the dark while another would not have such light "object" created.


How to

The list of all lightpoint commands can be found in the Lights command group category.

Light commands were introduced in Armed Assault, and some were added later in Arma 3 (e.g setLightIntensity, setLightUseFlare).

Create a lightpoint

private _lightpoint = "#lightpoint" createVehicleLocal player modelToWorld [0,2,1.5];
Reminder that a lightpoint is local (and all the light commands take a local argument too), hence createVehicleLocal.

Set light colour

Colour

_lightpoint setLightColor [0.25, 1, 1];
Colour set by setLightColor also defines Flare colour.

Ambient Colour

_lightpoint setLightAmbient [1, 1, 1]; // sets the colour applied to the surroundings

Set flare

For the flare to be visible, all the following values (use flare, size, visibility) must be defined, and light colour set by setLightColor must not be [0,0,0]. Flare is not visible by day, even using setLightDayLight.
Introduced with Arma 3 version 0.500.50

Enable flare

_lightpoint setLightUseFlare true;
Introduced with Arma 3 version 0.500.50

Set flare size

_lightpoint setLightFlareSize 1; // in meter
Introduced with Arma 3 version 0.500.50

Set flare visibility

_lightpoint setLightFlareMaxDistance 100; // in meter

Set light brightness

Set brightness

_lightpoint setLightBrightness 8;
Introduced with Arma 3 version 0.500.50

Set intensity

_lightpoint setLightIntensity 3000;
Introduced with Arma 3 version 0.500.50

Set attenuation

_lightpoint setLightAttenuation [0, 2, 4, 4, 0, 9, 10]; // [start, constant, linear, quadratic, hardLimitStart, hardLimitEnd]
Formula is 1 / (constant + linear × dist + quadratic × dist × dist) - see setLightAttenuation for more information.
Introduced with Arma 3 version 0.500.50

Make light visible by day

_lightpoint setLightDayLight true; // Only for light itself, not the flare

Delete lightpoint

deleteVehicle _lightpoint; // as simple as that

Full examples

Dark Souls

skipTime -daytime;

_lightpoint = "#lightpoint" createVehicleLocal [0,0,0];
_lightpoint attachTo [player, [0, 0, 1.5]];
_lightpoint setLightColor [0,0,0];
_lightpoint setLightAmbient [1,0.8, 0.25];
_lightpoint setLightBrightness 0.15;

Contact

skipTime -daytime;

private _position = player modelToWorld [0, 20, 1.5];
private _lightpoint = "#lightpoint" createVehicleLocal _position;
_lightpoint setLightColor [0,1,1];
_lightpoint setLightAmbient [0.2,0.0,0.3];
_lightpoint setLightUseFlare true;
_lightpoint setLightFlareSize 3;
_lightpoint setLightFlareMaxDistance 3.5;
_lightpoint setLightBrightness 4;
_lightpoint setLightDayLight true;

_lightpoint spawn {
	while { sleep 0.05; player distance _this > 2 } do
	{
		_this setLightBrightness 4 max (40 / (player distance _this));
	};
	deleteVehicle _this;
};


See also