SetEffectDensity: Difference between revisions
Jump to navigation
Jump to search
(create page) |
m (Added warning about variable upper limit.) |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
{{New | {{New feature/item|3.0140|1.4|6208| | ||
This function sets the density | This function sets the density of a specified [[effect]]. | ||
}} | }} | ||
{{Warning|Upper density limit of this function depends on client FX Quality setting. | |||
The limit is 1 for Low, 1.5 for Medium, and 2 for High/Very high.|true}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setEffectDensity ( effect theEffect, float density ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[effect]]:setDensity|density|getEffectDensity}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''theEffect:''' The [[effect]] to change the speed of. | ||
*'''density:''' The level of density. | *'''density:''' The level of density (from 0 to 2). | ||
===Returns=== | |||
Returns ''true'' if the density was succesfully changed, ''false'' otherwise. | |||
===Example=== | ===Example=== | ||
This example adds command ''sed'' that creates spray effect at the player's position and sets its density to 2. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addCommandHandler("sed", | addCommandHandler("sed", | ||
function (cmd) | function (cmd) | ||
local x, y, z = getElementPosition (localPlayer) | local x, y, z = getElementPosition(localPlayer) | ||
local effect = createEffect (" | local effect = createEffect("spraycan", x, y, z) | ||
setEffectDensity(effect, 2) | setEffectDensity(effect, 2) | ||
end) | end) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See also== | ==See also== | ||
{{Client_Effects_functions}} | {{Client_Effects_functions}} | ||
[[ru: | [[ru:setEffectDensity]] |
Latest revision as of 20:43, 22 August 2017
This function sets the density of a specified effect.
Syntax
bool setEffectDensity ( effect theEffect, float density )
OOP Syntax Help! I don't understand this!
- Method: effect:setDensity(...)
- Variable: .density
- Counterpart: getEffectDensity
Required Arguments
- theEffect: The effect to change the speed of.
- density: The level of density (from 0 to 2).
Returns
Returns true if the density was succesfully changed, false otherwise.
Example
This example adds command sed that creates spray effect at the player's position and sets its density to 2.
addCommandHandler("sed", function (cmd) local x, y, z = getElementPosition(localPlayer) local effect = createEffect("spraycan", x, y, z) setEffectDensity(effect, 2) end)