Vfx

Particle effects from the game's catalogue. A spawned effect stays for everyone in view until removed. A burst plays once for nearby players and is not kept. Names have the form Library.group.name; Vfx.list gives the 583 effects in the game's particle libraries, on both sides. In client scripts, spawn, burst and burstFrom play only in that player's game, with the same names and options, and a client's placed effect has id and destroy(), ending when its resource stops.

vfx.spawn()

Vfx.spawn(effect, position, options, dimension)

Places an effect that stays until destroyed. Throws a TypeError for a name not in the form Library.group.name, and a RangeError for an effect the game's libraries do not have.

vfx.burst()

Vfx.burst(effect, position, options, dimension)

Plays an effect once for players within 250 m and returns how many saw it. Nothing is kept. An unknown effect throws, as for spawn.

vfx.burstFrom()

Vfx.burstFrom(effect, entity, options)

Plays an effect once on an entity, following it. On the server, it returns how many players were told. On a client, it plays in this game only and returns true. An unknown effect throws, as for spawn.

vfx.all()

Vfx.all(dimension)

All placed effects, or those in one dimension.

vfx.getById()

Vfx.getById(id)

The effect with this network id, or null.

vfx.destroyAll()

Vfx.destroyAll(dimension)

Removes all placed effects, or those in one dimension, and returns how many.

vfx.list()

Vfx.list(prefix)

All effect names in the game's particle libraries, on both sides, optionally those starting with a prefix. Throws a TypeError for a prefix that is not a string.

vfx.library

library

The first part of the name.

vfx.group

group

The middle part of the name.

vfx.position

position

Its location.

vfx.rotation

rotation

Its rotation.

vfx.destroy()

destroy()

Removes the effect, firing vfxDestroy.

vfx.scale

scale

Size, 0.01 to 32. Assigning resizes the running effect in all games without restarting it, so a fire can grow step by step. Other assignments restart the effect.

vfx.countScale

countScale

Particle count multiplier, 0.01 to 16. You can assign to it.

vfx.speedScale

speedScale

Particle speed multiplier, 0 to 16. You can assign to it.

vfx.timeScale

timeScale

Playback speed, 0.01 to 16. You can assign to it.

vfx.strength

strength

The effect's strength, -1 to 1. You can assign to it.

vfx.pulsePeriod

pulsePeriod

Seconds between pulses, 0 to 600, where 0 plays continuously. You can assign to it.

vfx.attach()

Vfx.attach(effect, entity, options)

Client only. Attaches an effect to a player or NPC in this game only, following them until stopped, `durationMs` passes, or the resource stops. A body not yet in this game gets it on arrival. Returns an object with destroy(), as spawn does. Throws a TypeError for an unusable entity, and a RangeError for an offset over 8 m or a bad durationMs.

vfx.stop()

Vfx.stop(effect)

Client only. Stops an effect this resource placed. Returns false if it is not playing.

vfx.stopAll()

Vfx.stopAll()

Client only. Stops all effects this resource placed and returns how many.

vfx.isPlaying()

Vfx.isPlaying(effect)

Client only. Whether an effect this resource placed still plays. Only a stop or the resource ending ends one.

vfx.has()

Vfx.has(effect)

Client only. Whether the game has an effect with this name.

vfx.count()

Vfx.count()

Client only. How many effects this resource has placed and not stopped.

vfx.id

id: number

The network id.

vfx.effect

effect: string

The effect's full name.

vfx.dimension

dimension: number

Its dimension.