Skip to content

$vfx

Visual effects.

17 natives. Read-only natives only look things up; the rest change something. Parameter types use the language's names (Types).

create_attribute_list

$vfx.create_attribute_list(vfx: Reference, initial_attributes: Reference) -> list

Create attribute list with initial attributes for vfx.drawcall_attributes()

ParameterTypeMeaning
vfxReferenceThe effect to create attribute list for
initial_attributesReferenceThe initial attributes.

Returns list: The list that contains initial attributes

create_curve_attribute

$vfx.create_curve_attribute(num_points: int, order: int, t_scale: var, interpolation: float, allow_interpolation_loop: bool) -> Reference

Create a curve to pass as an attribute to an effect.

ParameterTypeMeaning
num_pointsintThe number of control points in the curve.
orderintThe number of dimensions the curve has. Valid range is 1-4.
t_scalevarControls the scale of the x axis. Default of 0 means the curve goes from 0-1. Greater than 0 means the points are evenly distributed between 0 and t_scale. Less than 0 means each control point will define it's own x value. A vec2 means the x axis is evenly distributed between t_scale.x and t_scale.y.
interpolationfloatControls how the curve interpolates between points. Unspecified or less than 0 means use the effect setting, 0 is linear, other values greater than 0 scale the length of the tangents for cubic hermite spline interpolation (1.0 is Catmull-Rom).
allow_interpolation_loopboolControls if the curve should calculate tangents smoothly through the first and last points when they are equal.

Returns Reference: The curve attribute

disable

$vfx.disable(disable: bool)

This will disable drawing any vfx - must be called every draw to remain disabled.

ParameterTypeMeaning
disableboolTrue if we should stop drawing vfx.

drawcall

$vfx.drawcall(vfx: Reference, state_number: int, loop: bool, transform: Component, priority: float, fill_limited: bool, camera_mask: int, attributes: list, attributes_counter: int, scene: Component)

Declare an effect emitter and play it.

ParameterTypeMeaning
vfxReferenceThe effect to spawn.
state_numberintParticle effect will emit new particles when state_number is greater than 0, and restart when state_number is greater than max state_number encountered previously
loopboolWhether the effect should be looped.
transformComponentReference a transform component that positions the effect.
priorityfloatRelative priority of the effect.
fill_limitedboolIf true, the effect is generally GPU fill rate limited. Only a small number of such effects are allowed active at once.
camera_maskintWhich (split-screen) cameras should draw this emitter.
attributeslistList of attribute values to set.
attributes_counterintA counter that should be updated whenever the attributes are changed to mark them as dirty.
sceneComponentThe scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

effect_collider

$vfx.effect_collider(position: vec3, rotation: vec4, size: vec3, collider_type: int, mesh: Reference, priority: float, scene: Component)

Declare an effect collider to interact with effects - where type is passed in

ParameterTypeMeaning
positionvec3The current position of the collider.
rotationvec4The current rotation of the collider.
sizevec3The current size of the collider.
collider_typeintType of collider (quad, box etc)
meshReferenceThe mesh data if the type is of type mesh
priorityfloatPriority of collider
sceneComponentThe scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

effect_collider_box

$vfx.effect_collider_box(position: vec3, rotation: vec4, size: vec3, priority: float, scene: Component)

Declare a box effect collider to interact with effects

ParameterTypeMeaning
positionvec3The current position of the collider.
rotationvec4The current rotation of the collider.
sizevec3The current size of the collider.
priorityfloatPriority of collider
sceneComponentThe scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

effect_collider_capsule

$vfx.effect_collider_capsule(position: vec3, rotation: vec4, size: vec3, priority: float, scene: Component)

Declare a capsule effect collider to interact with effects

ParameterTypeMeaning
positionvec3The current position of the collider.
rotationvec4The current rotation of the collider.
sizevec3The current size of the collider.
priorityfloatPriority of collider
sceneComponentThe scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

effect_collider_convex_mesh

$vfx.effect_collider_convex_mesh(position: vec3, rotation: vec4, size: vec3, mesh: Reference, priority: float, scene: Component)

Declare a convex mesh effect collider to interact with effects

ParameterTypeMeaning
positionvec3The current position of the collider.
rotationvec4The current rotation of the collider.
sizevec3The current size of the collider.
meshReferenceThe mesh data of the collider
priorityfloatPriority of collider
sceneComponentThe scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

effect_collider_plane

$vfx.effect_collider_plane(position: vec3, rotation: vec4, priority: float, scene: Component)

Declare a static plane effect collider to interact with effects

ParameterTypeMeaning
positionvec3The current position of the collider.
rotationvec4The current rotation of the collider.
priorityfloatPriority of collider
sceneComponentThe scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

effect_collider_sphere

$vfx.effect_collider_sphere(position: vec3, rotation: vec4, size: vec3, priority: float, scene: Component)

Declare a sphere effect collider to interact with effects

ParameterTypeMeaning
positionvec3The current position of the collider.
rotationvec4The current rotation of the collider.
sizevec3The current size of the collider.
priorityfloatPriority of collider
sceneComponentThe scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

get_attribute_index

$vfx.get_attribute_index(vfx: Reference, attribute_name: string) -> int

Get the index of an attribute. Returns -1 if none found.

ParameterTypeMeaning
vfxReferenceThe effect reference
attribute_namestringThe name of the attribute.

Returns int: Index of the attribute. -1 if not found.

get_duration

$vfx.get_duration(vfx: Reference) -> float

Get the emit duration of an effect, or -1.0 if the effect is infinite (ie the effect emits forever).

ParameterTypeMeaning
vfxReferenceThe effect to get duration from.

Returns float: Duration of the effect, or -1.0 if the effect is infinite.

get_effect_to_spawn

$vfx.get_effect_to_spawn(vfx: Reference) -> Reference

Gets the appropriate effect to spawn.

ParameterTypeMeaning
vfxReferenceThe effect to spawn.

Returns Reference: Effect ref to use.

get_max_fade_duration

$vfx.get_max_fade_duration(vfx: Reference) -> float

Get an upper-bound on the time it takes for an effect to finish after it stops emitting.

ParameterTypeMeaning
vfxReferenceThe effect to get duration from.

Returns float: Fade duration of the effect.

hard_kill

$vfx.hard_kill(vfx: Reference)

Hard kill an effect and all particles that have been emitted.

ParameterTypeMeaning
vfxReferenceThe effect to hard kill.

set_curve_attribute_point

$vfx.set_curve_attribute_point(curve: Reference, index: int, t: float, value: var, x: float, y: float, z: float, w: float)

Sets a point inside a curve attribute using the vector in value or x, y, z and w.

ParameterTypeMeaning
curveReferenceThe curve to modify.
indexintThe index of the point to set.
tfloatThe t value for this point, only required and used when the curve was created with t_scale less that 0.
valuevarVector representing the value for the point. Should be at least the same size as the curve's order, if it's bigger the extra values are ignored. For order 4 curves, a vec3 can be used here with w set to the last value.
xfloatx component
yfloaty component
zfloatz component
wfloatw component

spawn_effect

$vfx.spawn_effect(effect: Reference, parent: Entity, name: string, loop: bool) -> Component

Spawn a local entity with an effect component

ParameterTypeMeaning
effectReferenceThe effect to play on the new effect component.
parentEntityOptional entity used as reference for placing spawned entities
namestringOptional spawn name. If specified, allows the engine to make certain network optimizations. Must be unique.
loopboolWhether the effect should be looped.

Returns Component: A handle to the new effect component.