Effect

Associated namespace: sm.effect

A userdata object representing an effect.

Values:

Functions:

Operations:

OperationDescription
Effect == EffectChecks if two instances of Effect refer to the same Effect.

id integer

Get:

Returns the id of an effect.


bindEventCallback(effect, methodName, params=nil, reference=nil)

Client only

Bind an lua callback to be triggerd by the effect.

Parameters:

TypeNameDescription
EffecteffectThe effect.
stringmethodNameThe name of the callback method being bound. Example: MyClass.methodName( self, event, params )
anyparams=nilParameter object passed to the callback. (Optional)
tablereference=nilTable to recieve the callback. (Optional)

clearEventCallbacks(effect)

Client only

Clear all lua effect callbacks.

Parameters:

TypeNameDescription
EffecteffectThe effect.

destroy(effect)

Stops and destroys the effect.

Parameters:

TypeNameDescription
EffecteffectThe effect.

getCameraFov(effect)

Client only

Get the desired camera FOV.

Will return nil if the effect is not playing.

Parameters:

TypeNameDescription
EffecteffectThe effect.

Returns:

TypeDescription
numberThe FOV.

getCameraPosition(effect)

Client only

Get the desired camera position.

Will return nil if the effect is not playing.

Parameters:

TypeNameDescription
EffecteffectThe effect.

Returns:

TypeDescription
Vec3The position vector.

getCameraRotation(effect)

Client only

Get the desired camera rotation.

Will return nil if the effect is not playing.

Parameters:

TypeNameDescription
EffecteffectThe effect.

Returns:

TypeDescription
QuatThe rotation.

getId(effect)

Returns the id of an effect.

Parameters:

TypeNameDescription
EffecteffectThe effect.

Returns:

TypeDescription
integerThe effect's id.

hasActiveCamera(effect)

Client only

Check if the effect has an active camera effect.

Parameters:

TypeNameDescription
EffecteffectThe effect.

Returns:

TypeDescription
booleanIs active.

isDone(effect)

Client only

Returns whether the effect is done, meaning that all effect instances have finished.

Parameters:

TypeNameDescription
EffecteffectThe effect.

Returns:

TypeDescription
booleanWhether effect is done.

isPlaying(effect)

Client only

Returns whether the effect is currently playing.

Parameters:

TypeNameDescription
EffecteffectThe effect.

Returns:

TypeDescription
booleanWhether effect is playing.

setAutoPlay(effect, autoplay)

Client only

Sets an effect to start playing and repeating automatically.

Parameters:

TypeNameDescription
EffecteffectThe effect.
booleanautoplayAutoplay enabled.

setOffsetPosition(effect, offsetPosition)

Client only

Offsets the position of the effect relatively to the host interactable.

Note:

Does not work if the effect was created without a host interactable.

Parameters:

TypeNameDescription
EffecteffectThe effect.
Vec3offsetPositionThe relative offset position.

setOffsetRotation(effect, offsetRotation)

Client only

Offsets the orientation of the effect relatively to the host interactable.

Note:

Does not work if the effect was created without a host interactable.

Parameters:

TypeNameDescription
EffecteffectThe effect.
QuatoffsetRotationThe relative offset rotation.

setParameter(effect, name, value)

Client only

Sets a named parameter value on the effect.

Parameters:

TypeNameDescription
EffecteffectThe effect.
stringnameThe name.
anyvalueThe effect parameter value.

setPosition(effect, position)

Client only

Sets the position of an effect.

Note:

Does not work if the effect was created with a host interactable.

Parameters:

TypeNameDescription
EffecteffectThe effect.
Vec3positionThe position.

setRotation(effect, rotation)

Client only

Sets the orientation of an effect using a quaternion.

Note:

Does not work if the effect was created with a host interactable.

Parameters:

TypeNameDescription
EffecteffectThe effect.
QuatrotationThe rotation.

setScale(effect, scale)

Client only

Sets the scale of an effect.

Note:

Only applies to effect renderables.

Parameters:

TypeNameDescription
EffecteffectThe effect.
Vec3scaleThe scale.

setStartStopDistance(effect, startDistance, stopDistance)

Client only

Sets an effect to stop and restart depending on distance to the player.

Parameters:

TypeNameDescription
EffecteffectThe effect.
numberstartDistanceThe distance when effect will start
numberstopDistanceThe distance when effect will stop

setTimeOfDay(effect, enabled, start, end, inversed)

Client only

Sets an effect to be active during specific period of the day / night cycle.

Parameters:

TypeNameDescription
EffecteffectThe effect.
booleanenabledTime of day enabled.
numberstartStart normalized time of day.
numberendEnd normalized time of day.
booleaninversedIf true, period between start-end becomes inactive time.

setVelocity(effect, velocity)

Client only

Sets the velocity of an effect. The effect will move along at the set velocity until it receives a new position.

Note:

Does not work if the effect was created with a host interactable.

Parameters:

TypeNameDescription
EffecteffectThe effect.
Vec3velocityThe velocity.

setWorld(effect, world)

Client only

Sets the world for an effect.

Parameters:

TypeNameDescription
EffecteffectThe effect.
WorldworldThe world. Defaults to world from script constext. (optional)

start(effect)

Client only

Starts playing an effect.

Parameters:

TypeNameDescription
EffecteffectThe effect.

stop(effect)

Client only

Stops playing an effect

Parameters:

TypeNameDescription
EffecteffectThe effect.

stopBreakSustain(effect)

Client only

Stops playing an effect, letting sound finish before destroying the effect.

Parameters:

TypeNameDescription
EffecteffectThe effect.

stopImmediate(effect)

Client only

Immediately stop playing an effect, sound effects ended immediately.

Parameters:

TypeNameDescription
EffecteffectThe effect.