Light Source Tutorial: Difference between revisions
Lou Montana (talk | contribs) m (Text replacement - "\{\{ArgTitle *\| *([^\|]+) *\| *([1-6]) *\|" to "{{ArgTitle|$2|$1|") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 25: | Line 25: | ||
== How | == How To == | ||
The list of all lightpoint commands can be found in the [[:Category:Command Group: Lights|Lights command group]] category. | The list of all lightpoint commands can be found in the [[:Category:Command Group: Lights|Lights command group]] category. | ||
=== Create a | === Create a Lightpoint === | ||
<sqf>private _lightpoint = "#lightpoint" createVehicleLocal player modelToWorld [0, 2, 1.5];</sqf> | |||
{{Feature | Informative | A lightpoint is '''local''' (and all the lightpoint commands take a local argument too), hence [[createVehicleLocal]] usage.}} | {{Feature | Informative | A lightpoint is '''local''' (and all the lightpoint commands take a local argument too), hence [[createVehicleLocal]] usage.}} | ||
=== Set | === Set Light Colour === | ||
==== Colour ==== | ==== Colour ==== | ||
<sqf>_lightpoint setLightColor [0.25, 1, 1]; // also defines Flare colour</sqf> | |||
==== Ambient Colour ==== | ==== Ambient Colour ==== | ||
<sqf>_lightpoint setLightAmbient [1, 1, 1]; // sets the colour applied to the surroundings</sqf> | |||
=== Set | === Set Flare === | ||
{{Feature | Informative | For the flare to be visible, all the following values (use flare, size, visibility) must be defined and light colour [[#Colour_2|set by]] [[setLightColor]] must not be [0,0,0].}} | {{Feature | Informative | For the flare to be visible, all the following values (use flare, size, visibility) must be defined and light colour [[#Colour_2|set by]] [[setLightColor]] must not be [0,0,0].}} | ||
{{ArgTitle|4|Enable | {{ArgTitle|4|Enable Flare|{{GVI|arma3|0.50}}}} | ||
<sqf>_lightpoint setLightUseFlare true;</sqf> | |||
{{ArgTitle|4|Set | {{ArgTitle|4|Set Flare Size|{{GVI|arma3|0.50}}}} | ||
<sqf>_lightpoint setLightFlareSize 1; // in meter</sqf> | |||
{{ArgTitle|4|Set | {{ArgTitle|4|Set Flare Visibility|{{GVI|arma3|0.50}}}} | ||
<sqf>_lightpoint setLightFlareMaxDistance 100; // in meter</sqf> | |||
=== Set | === Set Light Brightness === | ||
==== Set | ==== Set Brightness ==== | ||
<sqf>_lightpoint setLightBrightness 8;</sqf> | |||
{{ArgTitle|4|Set intensity|{{GVI|arma3|0.50}}}} | {{ArgTitle|4|Set intensity|{{GVI|arma3|0.50}}}} | ||
<sqf>_lightpoint setLightIntensity 3000;</sqf> | |||
{{ArgTitle|4|Set attenuation|{{GVI|arma3|0.50}}}} | {{ArgTitle|4|Set attenuation|{{GVI|arma3|0.50}}}} | ||
<sqf>_lightpoint setLightAttenuation [0, 2, 4, 4, 0, 9, 10]; // [start, constant, linear, quadratic, hardLimitStart, hardLimitEnd]</sqf> | |||
{{Feature | Informative | Formula is {{ic|1 / (constant + linear × dist + quadratic × dist × dist)}} - see [[setLightAttenuation]] for more information.}} | {{Feature | Informative | Formula is {{ic|1 / (constant + linear × dist + quadratic × dist × dist)}} - see [[setLightAttenuation]] for more information.}} | ||
{{ArgTitle|3|Make light visible by day|{{GVI|arma3|0.50}}}} | {{ArgTitle|3|Make light visible by day|{{GVI|arma3|0.50}}}} | ||
<sqf>_lightpoint setLightDayLight true; // only for the light itself, not the flare</sqf> | |||
=== Delete | === Delete Lightpoint === | ||
<sqf>deleteVehicle _lightpoint; // as simple as that</sqf> | |||
== | |||
== Examples == | |||
=== Dark Souls === | === Dark Souls === | ||
<sqf> | |||
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; | |||
</sqf> | |||
=== Contact === | === Contact === | ||
<sqf> | |||
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; | |||
}; | |||
</sqf> | |||
== See | == See Also == | ||
* [[:Category:Command Group: Lights|Command Group: Lights]] | * [[:Category:Command Group: Lights|Command Group: Lights]] |
Revision as of 17:13, 16 June 2022
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. The glowing does not cast shadows (only the sun or the moon can) and can go through walls.
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.
Colour
Colour set via setLightColor determines the lens flare effect colour, as well as light's first colour.
Ambient
Colour set via setLightAmbient determines the outer colour shone by the lightpoint.
Flare
The flare is the "colour point" centre that emits light. It can be visible or invisible (set by setLightUseFlare).
How To
The list of all lightpoint commands can be found in the Lights command group category.
Create a Lightpoint
Set Light Colour
Colour
Ambient Colour
Set Flare
Enable Flare
Set Flare Size
Set Flare Visibility
Set Light Brightness
Set Brightness
Set intensity
Set attenuation
Make light visible by day
Delete Lightpoint
Examples
Dark Souls
Contact