sm.effect
Associated object type: Effect
The effect api handles the creation and playing of audio and visual effects.
Effects can consist of multiple components each being of separate types and with unique offsets, rotations and delays.
For more information on how to setup effects please take a look in the Effects/Database/EffectSets folder in the game data.
Functions:
sm.effect.createEffect(name)
Client only
Creates an effect.
Parameters:
Type | Name | Description |
---|---|---|
string | name | The name. |
Returns:
Type | Description |
---|---|
Effect | The created effect. |
sm.effect.createEffect(name, interactable, name=nil)
Client only
Creates an effect.
If you provide a host interactable to the effect then it will fetch position, velocity and orientation data from the interactable instead of relying on this information being fed to it.
This results in far more accurate positioning of effects that are supposed to stay attached to an object.
Parameters:
Type | Name | Description |
---|---|---|
string | name | The name. |
Interactable | interactable | The interactable the effect is attached to. |
string | name=nil | The bone name. (Defaults to not attached to a bone) (Optional) |
Returns:
Type | Description |
---|---|
Effect | The created effect. |
sm.effect.createEffect(name, harvestable)
Client only
Creates an effect.
If you provide a host harvestable to the effect then it will fetch position, velocity and orientation data from the harvestable instead of relying on this information being fed to it.
This results in far more accurate positioning of effects that are supposed to stay attached to an object.
Parameters:
Type | Name | Description |
---|---|---|
string | name | The name. |
Harvestable | harvestable | The harvestable the effect is attached to. |
Returns:
Type | Description |
---|---|
Effect | The created effect. |
sm.effect.createEffect(name, character, name=nil)
Client only
Creates an effect.
If you provide a host character to the effect then it will fetch position, velocity and orientation data from the character instead of relying on this information being fed to it.
This results in far more accurate positioning of effects that are supposed to stay attached to an object.
Parameters:
Type | Name | Description |
---|---|---|
string | name | The name. |
Character | character | The character the effect is attached to. |
string | name=nil | The bone name. (Defaults to not attached to a bone) (Optional) |
Returns:
Type | Description |
---|---|
Effect | The created effect. |
sm.effect.createEffect2D(name)
Client only
Creates an 2d effect.
Parameters:
Type | Name | Description |
---|---|---|
string | name | The name of the effect. |
Returns:
Type | Description |
---|---|
Effect | The created effect. |
sm.effect.estimateSize(name, parameters)
Client only
Estimates the radius of influence for an effect and instance parameters
Parameters:
Type | Name | Description |
---|---|---|
string | name | The name of the effect. |
table | parameters | Table of params |
Returns:
Type | Description |
---|---|
number | The Range |
sm.effect.playEffect(name, position, velocity=nil, rotation=nil, scale=nil, parameters=nil)
Plays an effect. If this function is called on the server it will play the effect on all clients.
Note:
If you start a looping effect using this function you will not be able to stop it.
Please use createEffect for looping effects.
Parameters:
Type | Name | Description |
---|---|---|
string | name | The name. |
Vec3 | position | The position. |
Vec3 | velocity=nil | The velocity. (Defaults to no velocity) |
Quat | rotation=nil | The rotation. (Defaults to no rotation) |
Vec3 | scale=nil | The scale. (Defaults to no scale, only applied to renderables) |
table | parameters=nil | The table containing the parameters for the effect. |
sm.effect.playHostedEffect(name, interactable, boneName=nil, parameters=nil)
Client only
Plays an effect. It will fetch position, velocity and orientation data from the host interactable.
Note:
If you start a looping effect using this function you will not be able to stop it.
Please use createEffect for looping effects
Parameters:
Type | Name | Description |
---|---|---|
string | name | The effect name. |
Interactable | interactable | The interactable the effect is attached to. |
string | boneName=nil | The bone name. (Optional) |
table | parameters=nil | The table containing the parameters for the effect. (Optional) |
sm.effect.playHostedEffect(name, harvestable, parameters=nil)
Client only
Plays an effect. It will fetch position, velocity and orientation data from the host harvestable.
Note:
If you start a looping effect using this function you will not be able to stop it.
Please use createEffect for looping effects
Parameters:
Type | Name | Description |
---|---|---|
string | name | The effect name. |
Harvestable | harvestable | The harvestable the effect is attached to. |
table | parameters=nil | The table containing the parameters for the effect. (Optional) |
sm.effect.playHostedEffect(name, character, boneName=nil, parameters=nil)
Client only
Plays an effect. It will fetch position, velocity and orientation data from the host character.
Note:
If you start a looping effect using this function you will not be able to stop it.
Please use createEffect for looping effects
Parameters:
Type | Name | Description |
---|---|---|
string | name | The effect name. |
Character | character | The charcater the effect is attached to. |
string | boneName=nil | The bone name. (Optional) |
table | parameters=nil | The table containing the parameters for the effect. (Optional) |