This is used to play effects in VCI.
For the details of how to use the component, refer to Effekseer (for VCI).
For the latest list of the methods, refer to “types.lua” file in “EmbeddedScriptWorkspace” folder.
Function | Description |
---|---|
EffectName | Acquire the effect name as a string. |
Play() | Loop play the effect until it is stopped. |
PlayOneShot() | Play the effect once. |
Stop() | Stop the effect. It disappears gradually. |
StopImmediate() | Stop the effect. The effect disappears instantaneously. |
StopRoot() | |
SetAllColor(color: Color) | Change the color of the effect. |
SetTargetLocation(targetLocation: Vector3) | Specify the target location of the effect. |
SetPause (paused: bool) | Pause the effect at the specified timing. |
SetShow (shown: bool) | Switch between show/hide of the effect. |
SetSpeed (speed: number) | Change the speed of the effect. The base speed is 1 and the speed can be specified with its multiple. |
SetLoop (isLoop: bool) | The effect will loop when set to true. The default is the value set in Effekseer Emitter. |
The methods with _ALL_
are synchronized and run on other clients as well.
If you want the result to be the same in all clients, use methods with _ALL_
prefix.
Method | Description |
---|---|
_ALL_Play () | Loop play the effect until it is stopped. |
_ALL_PlayOneShot () | Play the effect once. |
_ALL_Stop () | Stop the effect. It disappears gradually. |
_ALL_StopImmediate () | Stop the effect. The effect disappears instantaneously. |
_ALL_StopRoot () | |
_ALL_SetAllColor (color: Color) | Change the color of the effect. |
_ALL_SetTargetLocation (targetLocation: Vector3) | Specify the target location of the effect. |
_ALL_SetPause (paused: bool) | Pause the effect at the specified timing. |
_ALL_SetShow (shown: bool) | Switch between show/hide of the effect. |
_ALL_SetSpeed (speed: number) | Change the speed of the effect. The base speed is 1 and the speed can be specified with its multiple. |
_ALL_SetLoop (isLoop: bool) | The effect will loop when set to true. The default is the value set in Effekseer Emitter. |
vci.assets.GetEffekseerEmitter(“SubItem”)
orvci.assets.GetEffekseerEmitters(“SubItem”)
to store the effect from SubItem into a variable. For the argument, specify the name of the target gemeobject with string.*For the details on the component and how to set it up, refer to Effekseer (for VCI).
Example
-- Specify the name of the GameObject with the effect attached to store the effect. -- Store the effect attached to the GameObject named "Effect" in a variable "effect" local effect = vci.assets.GetEffekseerEmitter("Effect") -- Print the effect name print(effect.EffectName) function onUse() -- Play the stored effect once effect.PlayOneShot() end
The result
(The effect is played once when the subitem is used)
Return value: string
-- Store the effect attached to the GameObject local _Effect = vci.assets.GetEffekseerEmitter("EffectItem") -- Print the name of the effect to play print("Play the effect: ".._Effect.EffectName) -- Start playing the effect _Effect._ALL_Play()
The result
Play the effect: Effect (The effect stored in _Effect starts to play)
Argument: none
-- Store the effect attached to the GameObject local _Effect = vci.assets.GetEffekseerEmitter("EffectItem") function onUse() -- Start playing the effect when used _Effect._ALL_Play() print("Start playing the effect: ".._Effect.EffectName) end function onUnuse() -- Stop playing the effect when unused _Effect._ALL_Stop() print("Stop playing the effect: ".._Effect.EffectName) end
The result
(The effect starts to play when used) (The effect stops playing when unused)
Argument: none
-- Store the effect attached to the GameObject local _Effect = vci.assets.GetEffekseerEmitter("EffectItemLoop") function onUse() -- Play the effect once _Effect._ALL_PlayOneShot() end
The result
(The effect is played once)
Argument: none
-- Store the effect attached to the GameObject local _Effect = vci.assets.GetEffekseerEmitter("EffectItem") function onUse() -- Start playing the effect when used _Effect._ALL_Play() print("Start playing the effect: ".._Effect.EffectName) end function onUnuse() -- Stop playing the effect when unused _Effect._ALL_Stop() print("Stop playing the effect: ".._Effect.EffectName) end
The result
(The effect starts to play when used) (The effect stops playing when unused)
1st argument: color (color)
-- Store the effect attached to the GameObject local _Effect = vci.assets.GetEffekseerEmitter("EffectItem") -- Start playing the effect _Effect._ALL_Play() function onUse() -- Create a random color local color = Color.__new(math.random(0,100) * 0.01, math.random(0,100) * 0.01, math.random(0,100) * 0.01, 1) _Effect.SetAllColor(color) end
The result
(The color of the effect changes randomly when used)
-- Store the effect attached to the GameObject local _Effect = vci.assets.GetEffekseerEmitter("EffectItem") -- Start playing the effect _Effect._ALL_Play() function onUse() -- Change the color of the effect to blue _Effect.SetAllColor(Color.blue) end function onUnuse() -- Change the color of the effect to red _Effect.SetAllColor(Color.red) end
The result
(The color of the effect changes to blue when used) (The color of the effect changes to red when unused)
1st argument: paused (bool)
-- Store the effect attached to the GameObject local _Effect = vci.assets.GetEffekseerEmitter("EffectItemLoop") -- Start playing the effect _Effect._ALL_Play() function onUse() -- Pause the effect _Effect._ALL_SetPause(true) end function onUnuse() -- Resume the effect _Effect._ALL_SetPause(false) end
The result
(Spawn the item to play the effect) (The effect pauses when used) (The effect resumes when unused)
1st argument: shown (bool)
-- Store the effect attached to the GameObject local _Effect = vci.assets.GetEffekseerEmitter("EffectItemLoop") -- Start playing the effect _Effect._ALL_Play() function onUse() -- Hide the effect _Effect._ALL_SetShow(false) end function onUnuse() -- Show the effect _Effect._ALL_SetShow(true) end
The result
(Spawn the item to play the effect) (When used, the effect will be hidden) (When unused, the effect will be shown)
1st argument: Speed(number)
-- Store the effect attached to the GameObject local _Effect = vci.assets.GetEffekseerEmitter("EffectItem") function onUse() -- Assign a random value between 1.0 and 3.0 into the speed local speed = 0.1 * math.random(10, 30) -- Change the play speed of the effect _Effect._ALL_SetSpeed(speed) -- Play the effect only once _Effect.PlayOneShot() end
The result
(When used, play the effect once with a random speed between 1x and 3x)
1st argument: isLoop (bool)
-- Store the effect attached to the GameObject local _Effect = vci.assets.GetEffekseerEmitter("EffectItem") function onGrab() -- Set the effect to play in loop _Effect._ALL_SetLoop(true) -- Start playing the effect _Effect._ALL_Play() end function onUse() -- Disable the loop play of the effect _Effect._ALL_SetLoop(false) -- Start playing the effect _Effect._ALL_Play() end
The result
(Grab will start the loop play of the effect) (Use will play the effect only one and ends)