{"name":"setLightAttenuation","operator":null,"title":"setLightAttenuation","type":"command","url":"https://community.bistudio.com/wiki/setLightAttenuation","revid":369342,"updated":"2024-09-03T18:43:02Z","groups":["Lights"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma3","name":"Arma 3","version":"0.50"},"arma3_since":"0.50","branch":null,"locality":{"argument":"local","effect":"local","server_exec":false},"exec":null,"description":"Sets attenuation of light. Standard method of attenuation (1 / (constant + linear*dist + quadratic*dist*dist)).\n*start* param represents distance where the attenuation starts to take effects (dist = distance - start).","syntaxes":[{"syntax":"light setLightAttenuation [start, constant, linear, quadratic, hardlimitstart, hardlimitend]","since":null,"effect":null,"exec":null,"params":[{"name":"light","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"light: Object"},{"name":"start","type":"Number","optional":false,"default":null,"description":"distance with 100% intensity, falloff starts here","types":["Number"],"since":null,"text":"start: Number - distance with 100% intensity, falloff starts here"},{"name":"constant","type":"Number","optional":false,"default":null,"description":"constant attenuation coef","types":["Number"],"since":null,"text":"constant: Number - constant attenuation coef"},{"name":"linear","type":"Number","optional":false,"default":null,"description":"linear attenuation coef","types":["Number"],"since":null,"text":"linear: Number - linear attenuation coef"},{"name":"quadratic","type":"Number","optional":false,"default":null,"description":"quadratic attenuation coef","types":["Number"],"since":null,"text":"quadratic: Number - quadratic attenuation coef"},{"name":"hardlimitstart","type":"Number","optional":true,"default":null,"description":"max distance hard limit start (start of fading of intensity to 0) in m","types":["Number"],"since":null,"text":"hardlimitstart: Number - (Optional) max distance hard limit start (start of fading of intensity to 0) in m"},{"name":"hardlimitend","type":"Number","optional":true,"default":null,"description":"max distance hard limit end (end of fading of intensity to 0) in m","types":["Number"],"since":null,"text":"hardlimitend: Number - (Optional) max distance hard limit end (end of fading of intensity to 0) in m"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"light","types":["Object"]},"right":{"text":"[start, constant, linear, quadratic, hardlimitstart, hardlimitend]","types":["Array"]}}],"examples":[{"text":"```sqf\nmyLight setLightAttenuation [2, 4, 4, 0, 9, 10];\n```","code":["myLight setLightAttenuation [2, 4, 4, 0, 9, 10];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["setLightAmbient","setLightColor","lightAttachObject","lightDetachObject","setLightBrightness","setLightIntensity","setLightUseFlare","setLightFlareSize","setLightFlareMaxDistance","setLightDayLight"],"notes":[{"user":"ffur2007slx2_5","date":"2014-03-25T12:31:00Z","text":"(A3 1.14) setLightAttenuation array will present fallowing visual effects:\n\n[start(SCALAR), constant(SCALAR), linear (SCALAR), quadratic(SCALAR)]\n\n**start(SCALAR)** – Number can be unlimited, this parameter determines the range that the light source takes effect. Terrain environmental color will be bathed by setLightAmbient within the range and its covered objects will reflect the color by setLightColor.\n\n**constant(SCALAR)** – Support signed number, this parameter determines the brightness proportion of the light source, higher the number is, less the brightness will be, vice versa. Any minus value passed will be treated as 0 (100% brightness). In other words, this parameter is related with setLightBrightness and setLightIntensity.\n\n**linear (SCALAR)** – Support signed number, effective range is from 0 ~ 100 (passed minus value will be treated as 0), this parameter determines the concentration of the light source, higher the number is, more will the light concentrate, vice versa. In other words, this parameter will turn the source into spotlight and sharpens its light circle border.\n\nPlease pay attention to a special value: **4.31918e-005**\n\ne.g.\n\n```sqf\n// This value will make the light source reach an ultra high effect range. Any initial param set before will be discarded and overwritten.\n_light setLightAttenuation [2, 4, 4.31918e-005, 0];\n```\n\n**quadratic(SCALAR)** – Support signed number (range unlimited, passed minus number will be treated as 0), this parameter determines the range that the light source is visible and its visual presentation looks similar to linear. 0 means the maximum visible range. In further explanation, a less bright source can’t be seen out of the range on the land but still visible on the sea, and a bright enough source won’t be effected by the passed range who is still visible out of the range.\n\nPlease pay attention to a special value: **4.31918e-005**\n\ne.g.\n\n```sqf\n// This value will make the light source reach an ultra high effect range. Any initial param set before will be discarded and overwritten.\n_light setLightAttenuation [6, 0, 0, 4.31918e-005];\n```"}],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Lights","Introduced with Arma 3 version 0.50","Scripting Commands","Scripting Commands: Local Effect"]}