# sm.effect.playHostedEffect

Plays an effect. It will fetch position, velocity and orientation data from the host interactable.

**Kind:** Function

**Environments:** Game

## Game

### Overload 1

``` { .lua .api-signature }
sm.effect.playHostedEffect(
    name,
    interactable,
    boneName?,
    parameters?,
    axis?,
    startTime?,
    offsetPosition?,
    offsetRotation?,
    scale?
)
```

[Open the full Game reference](../Game-Script-Environment/Static-Functions/sm.effect.md#playhostedeffect-string-interactable-string-optional-table-optional-integer-optional-number-optional-vec3-optional-quat-optional-vec3-optional)

**Availability:** Client only

> **Note:**
> If you start a looping effect using this function you will not be able to stop it.<br>Please use [createEffect](../Game-Script-Environment/Static-Functions/sm.effect.md#createeffect) for looping effects

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `name` | string | The effect name. |
| `interactable` | [Interactable](../Game-Script-Environment/Userdata/Interactable.md) | The interactable the effect is attached to. |
| `boneName` *(optional)* | string | The bone name. (Optional) |
| `parameters` *(optional)* | table | The table containing the parameters for the effect. (Optional) |
| `axis` *(optional)* | integer | The axis of which the effect will ignore the hosts rotation around. (Defaults to [sm.effect.axis.none](../Game-Script-Environment/Static-Functions/sm.effect.md#axis)) (Optional) |
| `startTime` *(optional)* | number | The initial time progression of the effect. Can be used to fast forward some effect parts. Can be used to delay effect part activation if negative. |
| `offsetPosition` *(optional)* | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The host object relative offset position. (Defaults to sm.vec3.zero()) |
| `offsetRotation` *(optional)* | [Quat](../Game-Script-Environment/Userdata/Quat.md) | The host object relative offset rotation. (Defaults to sm.quat.identity()) |
| `scale` *(optional)* | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The scale, only applied to renderables. (Defaults to sm.vec3.one()) |

### Overload 2

``` { .lua .api-signature }
sm.effect.playHostedEffect(
    name,
    shape,
    boneName?,
    parameters?,
    axis?,
    startTime?,
    offsetPosition?,
    offsetRotation?,
    scale?
)
```

[Open the full Game reference](../Game-Script-Environment/Static-Functions/sm.effect.md#playhostedeffect-string-shape-string-optional-table-optional-integer-optional-number-optional-vec3-optional-quat-optional-vec3-optional)

**Availability:** Client only

Plays an effect. It will fetch position, velocity and orientation data from the host shape.

> **Note:**
> If you start a looping effect using this function you will not be able to stop it.<br>Please use [createEffect](../Game-Script-Environment/Static-Functions/sm.effect.md#createeffect) for looping effects

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `name` | string | The effect name. |
| `shape` | [Shape](../Game-Script-Environment/Userdata/Shape.md) | The shape the effect is attached to. |
| `boneName` *(optional)* | string | The bone name. (Optional) |
| `parameters` *(optional)* | table | The table containing the parameters for the effect. (Optional) |
| `axis` *(optional)* | integer | The axis of which the effect will ignore the hosts rotation around. (Defaults to [sm.effect.axis.none](../Game-Script-Environment/Static-Functions/sm.effect.md#axis)) (Optional) |
| `startTime` *(optional)* | number | The initial time progression of the effect. Can be used to fast forward some effect parts. Can be used to delay effect part activation if negative. |
| `offsetPosition` *(optional)* | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The host object relative offset position. (Defaults to sm.vec3.zero()) |
| `offsetRotation` *(optional)* | [Quat](../Game-Script-Environment/Userdata/Quat.md) | The host object relative offset rotation. (Defaults to sm.quat.identity()) |
| `scale` *(optional)* | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The scale, only applied to renderables. (Defaults to sm.vec3.one()) |

### Overload 3

``` { .lua .api-signature }
sm.effect.playHostedEffect(
    name,
    harvestable,
    boneName?,
    parameters?,
    axis?,
    startTime?,
    offsetPosition?,
    offsetRotation?,
    scale?
)
```

[Open the full Game reference](../Game-Script-Environment/Static-Functions/sm.effect.md#playhostedeffect-string-harvestable-string-optional-table-optional-integer-optional-number-optional-vec3-optional-quat-optional-vec3-optional)

**Availability:** 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.<br>Please use [createEffect](../Game-Script-Environment/Static-Functions/sm.effect.md#createeffect) for looping effects

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `name` | string | The effect name. |
| `harvestable` | [Harvestable](../Game-Script-Environment/Userdata/Harvestable.md) | The harvestable the effect is attached to. |
| `boneName` *(optional)* | string | The bone name. (Optional) |
| `parameters` *(optional)* | table | The table containing the parameters for the effect. (Optional) |
| `axis` *(optional)* | integer | The axis of which the effect will ignore the hosts rotation around. (Defaults to [sm.effect.axis.none](../Game-Script-Environment/Static-Functions/sm.effect.md#axis)) (Optional) |
| `startTime` *(optional)* | number | The initial time progression of the effect. Can be used to fast forward some effect parts. Can be used to delay effect part activation if negative. |
| `offsetPosition` *(optional)* | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The host object relative offset position. (Defaults to sm.vec3.zero()) |
| `offsetRotation` *(optional)* | [Quat](../Game-Script-Environment/Userdata/Quat.md) | The host object relative offset rotation. (Defaults to sm.quat.identity()) |
| `scale` *(optional)* | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The scale, only applied to renderables. (Defaults to sm.vec3.one()) |

### Overload 4

``` { .lua .api-signature }
sm.effect.playHostedEffect(
    name,
    character,
    boneName?,
    parameters?,
    axis?,
    startTime?,
    offsetPosition?,
    offsetRotation?,
    scale?
)
```

[Open the full Game reference](../Game-Script-Environment/Static-Functions/sm.effect.md#playhostedeffect-string-character-string-optional-table-optional-integer-optional-number-optional-vec3-optional-quat-optional-vec3-optional)

**Availability:** 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.<br>Please use [createEffect](../Game-Script-Environment/Static-Functions/sm.effect.md#createeffect) for looping effects

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `name` | string | The effect name. |
| `character` | [Character](../Game-Script-Environment/Userdata/Character.md) | The character the effect is attached to. |
| `boneName` *(optional)* | string | The bone name. (Optional) |
| `parameters` *(optional)* | table | The table containing the parameters for the effect. (Optional) |
| `axis` *(optional)* | integer | The axis of which the effect will ignore the hosts rotation around. (Defaults to [sm.effect.axis.none](../Game-Script-Environment/Static-Functions/sm.effect.md#axis)) (Optional) |
| `startTime` *(optional)* | number | The initial time progression of the effect. Can be used to fast forward some effect parts. Can be used to delay effect part activation if negative. |
| `offsetPosition` *(optional)* | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The host object relative offset position. (Defaults to sm.vec3.zero()) |
| `offsetRotation` *(optional)* | [Quat](../Game-Script-Environment/Userdata/Quat.md) | The host object relative offset rotation. (Defaults to sm.quat.identity()) |
| `scale` *(optional)* | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The scale, only applied to renderables. (Defaults to sm.vec3.one()) |
