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

Quest

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

Replicated journal quest handle.

new Quest(id): Quest

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

Creates a script wrapper for an existing quest with this ID; use Quest.give() to write one.

number

Network entity identifier.

Quest

Entity.constructor

objectives(): object[]

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

Reads the quest’s objectives back.

object[]

One entry per objective, in journal order. position is present only on an objective that has one.


remove(): void

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

Takes this quest out of every journal it was written into.

void


setObjective(index, objective, announce?): void

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

Rewrites one line of the quest in place.

number

Which objective to rewrite, counting from zero. An index past the end is ignored.

string | { optional?: boolean; position?: Vector3; progress?: "done" | "failed" | "active"; text: string; }

The line, as text or as an object carrying its state.

boolean

Whether to raise the quest-updated toast; defaults to true.

void


setObjectives(objectives, announce?): void

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

Replaces the quest’s objective list.

(string | { optional?: boolean; position?: Vector3; progress?: "done" | "failed" | "active"; text: string; })[]

The whole list, at most eight entries; anything past that is dropped.

boolean

Whether to raise the quest-updated toast; defaults to true.

void


setProgress(progress, announce?): void

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

Moves the quest on. There is no way back to unstarted: a quest nobody should see any more is removed.

"done" | "failed" | "active"

Where the quest now stands.

boolean

Whether to raise the game’s quest-updated toast; defaults to true. Pass false for a correction the player should not be told about.

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

Formats this quest handle for logging and debugging.

string

The quest ID, its key, its state and how many objectives it carries.

Entity.toString


track(player?): number

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

Makes the game follow this quest, exactly as the journal’s track button does: it is listed in the HUD tracker, and every active objective that has a position is drawn as the game’s own quest marker on the map and the compass. It is an instruction, not a lock – the player can untrack it from the journal – and the outcome arrives as questTrackingChanged like any other change. A quest given a moment ago can be tracked at once; the client waits for it to arrive.

number

Network id of the player who should follow the quest. Omitted, everyone who has the quest follows it: its one owner, or every player in its world.

number

How many clients were told. Zero when the player does not have this quest.


untrack(player?): number

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

Makes the game stop following this quest, which takes its markers off the map and the compass. The outcome arrives as questTrackingChanged.

number

Network id of the player who should stop following the quest. Omitted, everyone who has the quest stops.

number

How many clients were told.


static all(virtualWorld?): Quest[]

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

Lists every replicated quest the server currently has.

number

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

Quest[]

One handle per live quest, in no particular order.


static find(key, virtualWorld?, player?): Quest | null

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

Looks a quest up by its key.

string

The key the quest was given under.

number

Optional virtual world to search; omitted searches every one of them.

number

Network id of the player whose copy to find. Keys are unique per recipient, so this is how one player’s errand is told from another’s.

Quest | null

The quest’s handle, or null when no live quest has that key.


static getById(id): Quest | null

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

Looks a replicated quest up by its network entity ID.

number

Network entity identifier.

Quest | null

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


static give(key, title, options?, virtualWorld?): Quest

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

Writes a quest into the game’s own journal. It is a replicated entity, so a player who joins late, reloads or walks away still finds it in their log – which is what a quest needs and what a one-shot notification cannot do. What the player sees is the game’s quest UI: its journal row, its diary page, its objective tracker and its quest-updated toast, all reading a quest node the client builds with the game’s own constructor.

string

What the quest is filed under: up to 64 letters, digits, underscores or dashes, unique within its virtual world.

string

The line the journal row shows.

description is the diary page, type the journal section, objectives the lines under it – each with an optional world position the game marks on the map and compass while the quest is followed – player the network id of the one player it belongs to, announce whether to raise the toast, and track whether its recipients start following it.

boolean

string

(string | { optional?: boolean; position?: Vector3; progress?: "done" | "failed" | "active"; text: string; })[]

number

boolean

"main" | "side" | "activity" | "event" | "micro" | "racing"

number

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

Quest

The newly written quest handle.


static removeAll(virtualWorld?): number

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

Takes quests out of every journal they were written into.

number

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

number

How many quests were removed.

description: string

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

The body of the journal’s diary page for this quest. Assignment is silent.


readonly id: number

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

Immutable network entity identifier.

Entity.id


readonly key: string

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

The key the quest is filed under, and the name the game knows the quest node by. Read-only: it is the quest’s identity.


readonly objectiveCount: number

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

How many objectives the quest carries, up to eight.


readonly player: number

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

Network id of the one player this quest was written for, or 0 when it went to everyone in the world. Read-only: who a quest belongs to is decided when it is given.


position: Vector3

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

Authoritative world-space position; assignment forces replicated state.

Entity.position


progress: string

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

active, done or failed. Assignment announces the change; setProgress can do it quietly.


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


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


title: string

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

The line the journal row and the quest toast show. Assignment is silent; it does not raise a toast.


readonly type: string

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

Which section of the journal the quest files under. Read-only: it is decided when the quest is given.


readonly virtualWorld: number

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

Current virtual-world identifier.

Entity.virtualWorld