SetEffectSpeed: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
{{New items| | {{New items|3.014|1.4 r6208| | ||
This function sets the speed | This function sets the speed of a specified [[effect]]. | ||
}} | }} | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setEffectSpeed ( effect theEffect, float speed ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[effect]]:setSpeed|speed|getEffectSpeed}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''theEffect:''' The [[effect]] to change the speed of. | ||
*'''speed:''' The speed. | *'''speed:''' The speed to set. | ||
===Returns=== | |||
Returns ''true'' if the effect speed was succesfuly changed, ''false'' otherwise. | |||
===Example=== | ===Example=== | ||
This example adds command ''ses'' that creates effect of a smoke at player's position and sets its speed to 5. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addCommandHandler("ses", | addCommandHandler("ses", | ||
function (cmd) | function (cmd) | ||
local x, y, z = getElementPosition (localPlayer) | local x, y, z = getElementPosition(localPlayer) | ||
local effect = createEffect ("smoke30lit", x, y, z) | local effect = createEffect("smoke30lit", x, y, z) | ||
setEffectSpeed (effect, 5) | setEffectSpeed(effect, 5) | ||
end) | end) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See also== | ==See also== | ||
{{Client_Effects_functions}} | {{Client_Effects_functions}} | ||
[[ru:setEffectSpeed]] |
Latest revision as of 13:55, 7 May 2017
This function sets the speed of a specified effect.
Syntax
bool setEffectSpeed ( effect theEffect, float speed )
OOP Syntax Help! I don't understand this!
- Method: effect:setSpeed(...)
- Variable: .speed
- Counterpart: getEffectSpeed
Required Arguments
- theEffect: The effect to change the speed of.
- speed: The speed to set.
Returns
Returns true if the effect speed was succesfuly changed, false otherwise.
Example
This example adds command ses that creates effect of a smoke at player's position and sets its speed to 5.
addCommandHandler("ses", function (cmd) local x, y, z = getElementPosition(localPlayer) local effect = createEffect("smoke30lit", x, y, z) setEffectSpeed(effect, 5) end)