Vfx
Defined in: server/api.d.ts:4280
Replicated particle effect handle.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Vfx(
id):Vfx
Defined in: server/api.d.ts:4285
Creates a script wrapper for an existing effect with this ID; use Vfx.spawn() to place one.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”Vfx
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy():
void
Defined in: server/api.d.ts:4341
Stops this effect on every client that can see it, after emitting vfxDestroy.
Returns
Section titled “Returns”void
setVirtualWorld()
Section titled “setVirtualWorld()”setVirtualWorld(
world):void
Defined in: server/api.d.ts:9890
Moves this entity into another virtual world.
Parameters
Section titled “Parameters”number
Virtual-world identifier used to partition replication and visibility.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”setVisibleTo()
Section titled “setVisibleTo()”setVisibleTo(
player):void
Defined in: server/api.d.ts:9896
Restricts replication of this entity to one owning connection while preserving normal range and visibility checks.
Parameters
Section titled “Parameters”player
Section titled “player”Entity | null
Player-owned entity whose connection should exclusively receive this entity, or null to clear the restriction.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”toString()
Section titled “toString()”toString():
string
Defined in: server/api.d.ts:4336
Formats this effect handle for logging and debugging.
Returns
Section titled “Returns”string
The effect ID, its name and its scale.
Inherited from
Section titled “Inherited from”
staticall(virtualWorld?):Vfx[]
Defined in: server/api.d.ts:4377
Lists every replicated effect the server currently has.
Parameters
Section titled “Parameters”virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to list; omitted lists every one of them.
Returns
Section titled “Returns”Vfx[]
One handle per live effect, in no particular order.
burst()
Section titled “burst()”
staticburst(effect,position,options?,virtualWorld?):number
Defined in: server/api.d.ts:4361
Plays an effect once for the players who can see the point it happens at, and keeps nothing. Recipients are chosen by the effect’s own draw distance – there is no point telling a client about something its engine would not draw – so a blood spray reaches the people standing there and nobody else. A player who arrives afterwards sees nothing, which is the right answer for a spark and the wrong one for a campfire; use spawn for those.
Parameters
Section titled “Parameters”effect
Section titled “effect”string
Effect to play, spelled as the game’s particle libraries spell it.
position
Section titled “position”Where it happens, in world-space metres.
options?
Section titled “options?”As spawn, and here durationMs does apply: how long each client keeps the emitter, two seconds by default and a minute at most.
countScale?
Section titled “countScale?”number
durationMs?
Section titled “durationMs?”number
prime?
Section titled “prime?”boolean
pulsePeriod?
Section titled “pulsePeriod?”number
rotation?
Section titled “rotation?”scale?
Section titled “scale?”number
speedScale?
Section titled “speedScale?”number
strength?
Section titled “strength?”number
timeScale?
Section titled “timeScale?”number
virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world; omitted uses the global one.
Returns
Section titled “Returns”number
How many clients were told.
burstOn()
Section titled “burstOn()”
staticburstOn(effect,entity,options?):number
Defined in: server/api.d.ts:4370
Plays an effect once on a replicated entity, where it follows that entity: blood on the body that was hit, sparks on the weapon that struck. A client that has not streamed the entity in drops it rather than playing it somewhere else.
Parameters
Section titled “Parameters”effect
Section titled “effect”string
Effect to play, spelled as the game’s particle libraries spell it.
entity
Section titled “entity”number | Entity
What to hang it on: any replicated handle – a Player, Prop, Horse or Dog – or a bare network entity ID.
options?
Section titled “options?”As burst, plus offset: where the emitter sits in the entity’s own space, in metres, up to 8 m from its origin.
countScale?
Section titled “countScale?”number
durationMs?
Section titled “durationMs?”number
offset?
Section titled “offset?”prime?
Section titled “prime?”boolean
pulsePeriod?
Section titled “pulsePeriod?”number
rotation?
Section titled “rotation?”scale?
Section titled “scale?”number
speedScale?
Section titled “speedScale?”number
strength?
Section titled “strength?”number
timeScale?
Section titled “timeScale?”number
Returns
Section titled “Returns”number
How many clients were told.
destroyAll()
Section titled “destroyAll()”
staticdestroyAll(virtualWorld?):number
Defined in: server/api.d.ts:4391
Stops replicated effects, emitting vfxDestroy for each one.
Parameters
Section titled “Parameters”virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to clear; omitted clears every one of them.
Returns
Section titled “Returns”number
How many effects were stopped.
getById()
Section titled “getById()”
staticgetById(id):Vfx|null
Defined in: server/api.d.ts:4384
Looks a replicated effect up by its network entity ID.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”Vfx | null
The effect’s handle, or null when no live effect has that ID.
list()
Section titled “list()”
staticlist(prefix?):string[]
Defined in: server/api.d.ts:4398
Every effect name the shipped game declares, in order. Mined from the game’s particle libraries at build time, so it is the same list the client has.
Parameters
Section titled “Parameters”prefix?
Section titled “prefix?”string
Keep only the names starting with this, e.g. WH_Particels.fires or collisions.combat.
Returns
Section titled “Returns”string[]
The matching names.
spawn()
Section titled “spawn()”
staticspawn(effect,position?,options?,virtualWorld?):Vfx
Defined in: server/api.d.ts:4351
Places a particle effect in the world and leaves it running. It is a replicated entity, so the interest grid streams it to whoever comes near and takes it away again when they leave – which is what a campfire, a torch or a plume of smoke needs and what burst cannot do. How far it streams is taken from the effect’s own draw distance, between 25 and 250 metres.
Parameters
Section titled “Parameters”effect
Section titled “effect”string
Effect to place, spelled as the game’s particle libraries spell it – WH_Particels.fires.campfire_a. Vfx.list() is the whole vocabulary.
position?
Section titled “position?”Optional world-space position; omitted components default to zero.
options?
Section titled “options?”rotation aims the emitter; scale, countScale, speedScale and timeScale multiply what the effect authored; strength feeds its strength curves; pulsePeriod restarts it on that many seconds; prime starts it already running, which is what a fire wants. durationMs is ignored here – a placed effect lasts until it is destroyed.
countScale?
Section titled “countScale?”number
durationMs?
Section titled “durationMs?”number
prime?
Section titled “prime?”boolean
pulsePeriod?
Section titled “pulsePeriod?”number
rotation?
Section titled “rotation?”scale?
Section titled “scale?”number
speedScale?
Section titled “speedScale?”number
strength?
Section titled “strength?”number
timeScale?
Section titled “timeScale?”number
virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world the effect belongs to; omitted puts it in the global one.
Returns
Section titled “Returns”Vfx
The newly placed effect handle.
Properties
Section titled “Properties”countScale
Section titled “countScale”countScale:
number
Defined in: server/api.d.ts:4310
Multiplies how many particles are emitted, from 0.01 to 16. Assignment restarts the effect.
effect
Section titled “effect”
readonlyeffect:string
Defined in: server/api.d.ts:4290
Name of the particle effect this is playing, e.g. WH_Particels.fires.campfire_a. Read-only: every spawn parameter is read once when the emitter is created, so an effect is the one it was placed as.
readonlygroup:string
Defined in: server/api.d.ts:4300
Authored bucket inside that library, e.g. fires.
readonlyid:number
Defined in: server/api.d.ts:9858
Immutable network entity identifier.
Inherited from
Section titled “Inherited from”library
Section titled “library”
readonlylibrary:string
Defined in: server/api.d.ts:4295
Particle library the effect came out of, e.g. WH_Particels, which is the part of the name before the first dot.
position
Section titled “position”position:
Vector3
Defined in: server/api.d.ts:9868
Authoritative world-space position; assignment forces replicated state.
Inherited from
Section titled “Inherited from”pulsePeriod
Section titled “pulsePeriod”pulsePeriod:
number
Defined in: server/api.d.ts:4330
Seconds between restarts of the whole emitter, from 0 to 600; 0 never restarts it. Assignment restarts the effect.
rotation
Section titled “rotation”rotation:
Vector3|Quaternion
Defined in: server/api.d.ts:9873
Authoritative rotation; reads return a quaternion and assignments accept a quaternion or Euler angles in degrees.
Inherited from
Section titled “Inherited from”scale:
number
Defined in: server/api.d.ts:4305
Multiplies every size the effect authored, from 0.01 to 32; a value outside that is clamped into it. Assignment rebuilds the emitter on every client that can see it, so the effect restarts.
speedScale
Section titled “speedScale”speedScale:
number
Defined in: server/api.d.ts:4315
Multiplies emission speed, from 0 to 16. Assignment restarts the effect.
readonlystate:StateBag
Defined in: server/api.d.ts:9878
Arbitrary key/value state carried by this entity. The server writes it and every client that can see the entity receives it; see StateBag.
Inherited from
Section titled “Inherited from”strength
Section titled “strength”strength:
number
Defined in: server/api.d.ts:4325
Feeds the effect’s own strength curves, from -1 to 1; -1 leaves them where the effect authored them. Assignment restarts the effect.
timeScale
Section titled “timeScale”timeScale:
number
Defined in: server/api.d.ts:4320
Multiplies how fast the emitter’s own time runs, from 0.01 to 16. Assignment restarts the effect.
virtualWorld
Section titled “virtualWorld”
readonlyvirtualWorld:number
Defined in: server/api.d.ts:9863
Current virtual-world identifier.