Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Runtime classServer APIGenerated

Vfx

Defined in: server/api.d.ts:3942

Replicated particle effect handle.

new Vfx(id): Vfx

Defined in: server/api.d.ts:3947

Creates a script wrapper for an existing effect with this ID; use Vfx.spawn() to place one.

number

Network entity identifier.

Vfx

Entity.constructor

destroy(): void

Defined in: server/api.d.ts:4003

Stops this effect on every client that can see it, after emitting vfxDestroy.

void


setVirtualWorld(world): void

Defined in: server/api.d.ts:8797

Moves this entity into another virtual world.

number

Virtual-world identifier used to partition replication and visibility.

void

Entity.setVirtualWorld


setVisibleTo(player): void

Defined in: server/api.d.ts:8803

Restricts replication of this entity to one owning connection while preserving normal range and visibility checks.

Entity | null

Player-owned entity whose connection should exclusively receive this entity, or null to clear the restriction.

void

Entity.setVisibleTo


toString(): string

Defined in: server/api.d.ts:3998

Formats this effect handle for logging and debugging.

string

The effect ID, its name and its scale.

Entity.toString


static all(virtualWorld?): Vfx[]

Defined in: server/api.d.ts:4039

Lists every replicated effect the server currently has.

number

Optional virtual world to list; omitted lists every one of them.

Vfx[]

One handle per live effect, in no particular order.


static burst(effect, position, options?, virtualWorld?): number

Defined in: server/api.d.ts:4023

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.

string

Effect to play, spelled as the game’s particle libraries spell it.

Vector3

Where it happens, in world-space metres.

As spawn, and here durationMs does apply: how long each client keeps the emitter, two seconds by default and a minute at most.

number

number

boolean

number

Vector3 | Quaternion

number

number

number

number

number

Optional virtual world; omitted uses the global one.

number

How many clients were told.


static burstOn(effect, entity, options?): number

Defined in: server/api.d.ts:4032

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.

string

Effect to play, spelled as the game’s particle libraries spell it.

number | Entity

What to hang it on: any replicated handle – a Player, Prop, Horse or Dog – or a bare network entity ID.

As burst, plus offset: where the emitter sits in the entity’s own space, in metres, up to 8 m from its origin.

number

number

Vector3

boolean

number

Vector3 | Quaternion

number

number

number

number

number

How many clients were told.


static destroyAll(virtualWorld?): number

Defined in: server/api.d.ts:4053

Stops replicated effects, emitting vfxDestroy for each one.

number

Optional virtual world to clear; omitted clears every one of them.

number

How many effects were stopped.


static getById(id): Vfx | null

Defined in: server/api.d.ts:4046

Looks a replicated effect up by its network entity ID.

number

Network entity identifier.

Vfx | null

The effect’s handle, or null when no live effect has that ID.


static list(prefix?): string[]

Defined in: server/api.d.ts:4060

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.

string

Keep only the names starting with this, e.g. WH_Particels.fires or collisions.combat.

string[]

The matching names.


static spawn(effect, position?, options?, virtualWorld?): Vfx

Defined in: server/api.d.ts:4013

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.

string

Effect to place, spelled as the game’s particle libraries spell it – WH_Particels.fires.campfire_a. Vfx.list() is the whole vocabulary.

Vector3 | Partial<Vector3>

Optional world-space position; omitted components default to zero.

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.

number

number

boolean

number

Vector3 | Quaternion

number

number

number

number

number

Optional virtual world the effect belongs to; omitted puts it in the global one.

Vfx

The newly placed effect handle.

countScale: number

Defined in: server/api.d.ts:3972

Multiplies how many particles are emitted, from 0.01 to 16. Assignment restarts the effect.


readonly effect: string

Defined in: server/api.d.ts:3952

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.


readonly group: string

Defined in: server/api.d.ts:3962

Authored bucket inside that library, e.g. fires.


readonly id: number

Defined in: server/api.d.ts:8765

Immutable network entity identifier.

Entity.id


readonly library: string

Defined in: server/api.d.ts:3957

Particle library the effect came out of, e.g. WH_Particels, which is the part of the name before the first dot.


position: Vector3

Defined in: server/api.d.ts:8775

Authoritative world-space position; assignment forces replicated state.

Entity.position


pulsePeriod: number

Defined in: server/api.d.ts:3992

Seconds between restarts of the whole emitter, from 0 to 600; 0 never restarts it. Assignment restarts the effect.


rotation: Vector3 | Quaternion

Defined in: server/api.d.ts:8780

Authoritative rotation; reads return a quaternion and assignments accept a quaternion or Euler angles in degrees.

Entity.rotation


scale: number

Defined in: server/api.d.ts:3967

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: number

Defined in: server/api.d.ts:3977

Multiplies emission speed, from 0 to 16. Assignment restarts the effect.


readonly state: StateBag

Defined in: server/api.d.ts:8785

Arbitrary key/value state carried by this entity. The server writes it and every client that can see the entity receives it; see StateBag.

Entity.state


strength: number

Defined in: server/api.d.ts:3987

Feeds the effect’s own strength curves, from -1 to 1; -1 leaves them where the effect authored them. Assignment restarts the effect.


timeScale: number

Defined in: server/api.d.ts:3982

Multiplies how fast the emitter’s own time runs, from 0.01 to 16. Assignment restarts the effect.


readonly virtualWorld: number

Defined in: server/api.d.ts:8770

Current virtual-world identifier.

Entity.virtualWorld