Effect
A userdata object representing an effect.
Values:
Operations:
| Operation | Returns | Description |
|---|---|---|
Effect == Effect |
boolean | Checks if two instances of Effect refer to the same Effect. |
Server + Client
destroy
effect:destroy( )
Stops and destroys the effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
getId
effect:getId( )
Returns the id of an effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
Returns:
| Type | Description |
|---|---|
| integer | The effect's id. |
Client-only
bindEventCallback
effect:bindEventCallback( methodName, params, reference )
Deprecated: use Effect.bindEventClientCallback instead.
Bind a lua callback to be triggered by the effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
methodName |
string | The name of the callback method being bound. Example: MyClass.methodName( self, event, params ) |
params (optional) |
any | Parameter object passed to the callback. (Optional) |
reference (optional) |
table | Table to receive the callback. (Optional) |
bindEventClientCallback
effect:bindEventClientCallback( params, reference )
Bind a lua client callback script reference to be used by the effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
params (optional) |
any | Parameter object passed to the callback. (Optional) |
reference (optional) |
table | Table to receive the callback. (Optional) |
bindEventServerCallback
effect:bindEventServerCallback( params, reference )
Bind a lua server callback script reference to be used by the effect. Host only.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
params (optional) |
any | Parameter object passed to the callback. (Optional) |
reference (optional) |
table | Table to receive the callback. (Optional) |
clearClientEventCallback
effect:clearClientEventCallback( )
Clear the effect lua client callback script reference.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
clearEventCallbacks
effect:clearEventCallbacks( )
Deprecated: use Effect.clearClientEventCallback together with Effect.bindEventClientCallback instead.
Clear all lua effect callbacks.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
clearServerEventCallback
effect:clearServerEventCallback( )
Clear the effect lua server callback script reference.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
detach
effect:detach( )
Detaches the effect from its host object.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
getCameraData
effect:getCameraData( )
Get a table of camera effect data.
Returns nil if the effect is not a camera effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
Returns:
| Type | Description |
|---|---|
| table | The settings. { hasBlendIn = boolean, hasBlendOut = boolean, active = boolean, cameraPosition = Vec3, cameraRotation = Quat, cameraFov = number } |
getWorldPosition
effect:getWorldPosition( )
Gets the current world position
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
Returns:
| Type | Description |
|---|---|
| Vec3 | The world position. |
hasActiveCamera
effect:hasActiveCamera( )
Check if the effect has an active camera effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
Returns:
| Type | Description |
|---|---|
| boolean | Is active. |
hasHost
effect:hasHost( )
Returns whether the effect has a host.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
Returns:
| Type | Description |
|---|---|
| boolean | Whether the effect is hosted. |
isBreakSustaining
effect:isBreakSustaining( )
Returns whether the effect is break sustained.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
Returns:
| Type | Description |
|---|---|
| boolean | Whether effect is break sustained. |
isDone
effect:isDone( )
Returns whether the effect is done, meaning that all effect instances have finished.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
Returns:
| Type | Description |
|---|---|
| boolean | Whether effect is done. |
isPlaying
effect:isPlaying( )
Returns whether the effect is currently playing.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
Returns:
| Type | Description |
|---|---|
| boolean | Whether effect is playing. |
setAutoPlay
effect:setAutoPlay( autoplay, autoPlayOnce, resetPlayOnce )
Sets an effect to start playing and repeating automatically.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
autoplay |
boolean | Autoplay enabled. |
autoPlayOnce (optional) |
boolean | If set the effect will not loop when autoplaying. (Defaults to false) (Optional) |
resetPlayOnce (optional) |
boolean | Will reset the autoPlayOnce condition, allowing the effect to play again if it already has since earlier. (Defaults to false) (Optional) |
setDetachOnHostDestroy
effect:setDetachOnHostDestroy( detach )
Detaches the effect from its host object when the host disappears.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
detach |
boolean | If the effect should automatically detach from the host or not. |
setHost - Interactable
effect:setHost( Interactable, boneName )
Sets a Interactable as host for an effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
Interactable |
Interactable | The Interactable the effect is attached to. |
boneName (optional) |
string | The bone name to attach effect to. (Defaults to not attached to a bone) (Optional) |
setHost - Shape
effect:setHost( shape, boneName )
Sets a Shape as host for an effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
shape |
Shape | The shape the effect is attached to. |
boneName (optional) |
string | The bone name to attach effect to. (Defaults to not attached to a bone) (Optional) |
setHost - Character
effect:setHost( Character, boneName )
Sets a Character as host for an effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
Character |
Character | The Character the effect is attached to. |
boneName (optional) |
string | The bone name to attach effect to. (Defaults to not attached to a bone) (Optional) |
setHost - Harvestable
effect:setHost( pHarvestable, boneName )
Sets a Harvestable as host for an effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
pHarvestable |
Harvestable | The pHarvestable the effect is attached to. |
boneName (optional) |
string | The bone name to attach effect to. (Defaults to not attached to a bone) (Optional) |
setHostAxisIgnore
effect:setHostAxisIgnore( axis )
Sets a rotation axis which hosted effects will ignore.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
axis |
integer | The rotation axis. |
setOffsetPosition
effect:setOffsetPosition( offsetPosition )
Offsets the position of the effect relatively to the host.
Note: Does not work if the effect was created without a host.
Parameters:
setOffsetRotation
effect:setOffsetRotation( offsetRotation )
Offsets the orientation of the effect relatively to the host.
Note: Does not work if the effect was created without a host.
Parameters:
setParameter
effect:setParameter( name, value )
Sets a named parameter value on the effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
name |
string | The name. |
value |
any | The effect parameter value. |
setPosition
effect:setPosition( position )
Sets the position of an effect.
Note: Does not work if the effect has a host.
Parameters:
setRotation
effect:setRotation( rotation )
Sets the orientation of an effect using a quaternion.
Note: Does not work if the effect has a host.
Parameters:
setScale
effect:setScale( scale )
Sets the scale of an effect.
Note: Only applies to effect renderables.
Parameters:
setStartStopDistance
effect:setStartStopDistance( startDistance, stopDistance )
Sets an effect to stop and restart depending on distance to the player.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
startDistance |
number | The distance when effect will start |
stopDistance |
number | The distance when effect will stop |
setTimeOfDay
effect:setTimeOfDay( enabled, start, end, inversed )
Sets an effect to be active during specific period of the day / night cycle.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
enabled |
boolean | Time of day enabled. |
start |
number | Start normalized time of day. |
end |
number | End normalized time of day. |
inversed |
boolean | If true, period between start-end becomes inactive time. |
setVelocity
effect:setVelocity( velocity )
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 has a host.
Parameters:
setWorld
effect:setWorld( world )
Sets the world for an effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
world |
World | The world. Defaults to world from script context. (optional) |
setWorldAny
effect:setWorldAny( )
Sets the effect's world to UWorldId_Any, used to play global sounds through the dialog manager.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
start
effect:start( startTime )
Starts playing an effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
startTime (optional) |
number | The start time of the effect. Only applies to audio and cinematic effects. (Defaults to 0) |
stop
effect:stop( )
Stops playing an effect
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
stopBreakSustain
effect:stopBreakSustain( )
Stops playing an effect, letting sound finish before destroying the effect.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |
stopImmediate
effect:stopImmediate( )
Immediately stop playing an effect, sound effects ended immediately.
Parameters:
| Name | Type | Description |
|---|---|---|
effect |
Effect | The effect. |