Skip to content
ASArcaneMP Scripting APIScripting reference
Global objectServer APIGenerated

WorldEvents

const WorldEvents: object

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

The Overland’s roaming enemy encounters under World.setEncounterPolicy(“server”), run once on the server so every player meets the same one. A spot rolls when a player comes within 100 m: each of its kinds has a 60% chance (at most 3 of a kind up at once), then a size and a roster. Everyone leaving its stream-out radius despawns it and starts its cooldown; a failed roll waits for everyone to leave. Events: worldEventStarted(spotId, kind), worldEventCleared(spotId), worldEventEnded(spotId).

readonly cooldownHours: number

In-game hours on the server clock before a spot that ran an event rolls again. Default 24, the game’s own.

readonly enabled: boolean

Whether world events run under the “server” policy. Default true.

get(id): { activeFrom: number; activeTo: number; cleared: boolean; cooldownSeconds: number; id: string; kind: string | null; kinds: string[]; npcs: NPC[]; state: "waiting" | "failed" | "active" | "cooldown"; streamOutRadius: number; x: number; y: number; z: number; } | null

One spot, or null for an unknown id.

string

A spot id from getAll.

{ activeFrom: number; activeTo: number; cleared: boolean; cooldownSeconds: number; id: string; kind: string | null; kinds: string[]; npcs: NPC[]; state: "waiting" | "failed" | "active" | "cooldown"; streamOutRadius: number; x: number; y: number; z: number; } | null

getAll(): object[]

Every spot. kinds are the encounters it can run (WE_ENEMY_ENCOUNTER_[_EVE]); kind is the running or last one. activeFrom..activeTo are the server-clock hours it may start in (0..24 all day). cooldownSeconds is the in-game time left before a cooling spot rolls again, and npcs its live NPCs.

object[]

getRewardPolicy(): object

What world-event enemies pay, with the server default and built-in values filled in.

object

experience: number

gameReward: boolean

loot: object[] | null

lootDelivery: "drop" | "inventory"

lootMode: "each" | "shared"

radius: number

recipients: "killer" | "damagers" | "nearby"

reset(id): boolean

Despawns a spot’s event and clears its cooldown; it rolls again for the next player to come near.

string

boolean

False for an unknown id.

setCooldownHours(hours): boolean

Sets the cooldown for events that end from now on.

number

0 to 720; 0 rolls again on the next approach.

boolean

False for a value out of range.

setEnabled(enabled): void

Turns world events on or off. Off despawns every running event, clears cooldowns and rolls nothing; camps are unaffected.

boolean

void

setRewardPolicy(policy): void

Sets what world-event enemies pay when they die (see NPC.setRewardPolicy), on their live NPCs and on every one spawned after. Throws a TypeError or RangeError for a malformed policy.

{ experience?: number; gameReward?: boolean; loot?: object[] | null; lootDelivery?: "drop" | "inventory"; lootMode?: "each" | "shared"; radius?: number; recipients?: "killer" | "damagers" | "nearby"; } | null

Fields left out come from NPC.setDefaultRewardPolicy; null clears it.

void

start(id, kind?): boolean

Starts an event at a spot now, whatever its roll, cooldown, hours or the active cap. It ends like any other, once everyone has left.

string

string

One of the spot’s kinds; a uniform pick among them when left out.

boolean

False for an unknown spot or kind, a spot already running one, or outside the “server” policy.