Skip to content
ASArcaneMP Scripting APIScripting reference
Global objectServer APIGenerated

World

const World: object

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

Server-authoritative world state: the global state bag, the clock, the calendar, the season, the weather, holiday decor, the Headmaster’s office, the Great Hall’s meals and banners, the Defence Against the Dark Arts dueling table, and the Hogwarts Express.

readonly commonRoomEntrances: object

Each house’s common-room entrance as setCommonRoomEntrance holds it on every client: “open”, “closed”, or “game” (the default: the entrance opens for its own house).

Gryffindor: "game" | "open" | "closed"

Hufflepuff: "game" | "open" | "closed"

Ravenclaw: "game" | "open" | "closed"

Slytherin: "game" | "open" | "closed"

readonly day: number

Day of the month.

readonly decor: "game" | "none" | "halloween" | "christmas"

Holiday decor pinned on every client: “halloween”, “christmas”, “none”, or “game” (the default: left to story missions).

readonly duelingTable: "game" | "long" | "short"

The dueling table raised in the Defence Against the Dark Arts classroom on every client: “long”, “short”, or “game” (the default: the classroom’s desks, left to the story).

readonly encounterPolicy: "suppressed" | "server"

Who spawns the Overland’s enemy camps: “suppressed” (nobody; the default) or “server” (replicated NPCs).

readonly greatHallBanners: "Gryffindor" | "Hufflepuff" | "Ravenclaw" | "Slytherin" | "none" | "game"

The house whose banners hang at the head of the Great Hall on every client, “none”, or “game” (the default: left to the story, which never hangs one).

readonly headmasterOffice: "game" | "open" | "closed"

The Headmaster’s office staircase pinned on every client: “open”, “closed”, or “game” (the default: left to the story quest).

readonly hogwartsExpress: HogwartsExpress

The Hogwarts Express. The game’s own timetable is off on every client, so it runs only when a script moves it; see HogwartsExpress.

readonly hour: number

Hour of day (0-23).

readonly lootPolicy: object

Who spawns the Overland’s moonstone deposits and foragables (see setLootPolicy). “native” (each client’s own; the default), “suppressed” (nobody) or “server” (LootSpots).

foragables: "native" | "suppressed" | "server"

moonstones: "native" | "suppressed" | "server"

readonly meal: "game" | "none" | "prep" | "breakfast" | "lunch" | "dinner" | "dessert"

The meal laid on the Great Hall’s and the Kitchens’ tables on every client, or “game” (the default: the game clock’s schedule).

readonly minute: number

Minute of the hour (0-59).

readonly month: number

Month of the year (1-12).

readonly playerCollision: boolean

Whether players block each other’s movement on every client (see setPlayerCollision).

readonly revision: number

Monotonic server revision advanced whenever authoritative world state changes.

readonly season: 0 | 1 | 2 | 3

0 spring, 1 summer, 2 autumn, 3 winter.

readonly second: number

Second of the minute (0-59).

readonly spawn: { position: { x: number; y: number; z: number; }; yaw: number; } | null

Where a connecting player’s world load stands them when no player.setSpawn applies, and where a respawn with no position lands. Null (the default) leaves it to the game’s own start, the house dormitory.

readonly state: StateBag | null

Global replicated key/value state, shared by every resource and visible to every client. The server writes it; clients read it. Null before networking is up. See StateBag.

readonly stateId: number

Network id of the entity carrying World.state, for filtering the global entityStateChange bus. 0 before it exists.

readonly timeScale: number

In-game minutes advanced per real second.

readonly weather: string

Replicated weather template name.

readonly year: number

Calendar year, or 0 when the game keeps its native year.

getPlayerCount(): number

Returns the number of connected players (cheaper than PlayerManager.getAll().length).

number

The connected player count.

setCommonRoomEntrance(house, state): boolean

Holds a house’s common-room entrance open or closed on every client, with its own animation, sound and collision: the Gryffindor portrait, the Hufflepuff barrel, the Ravenclaw eagle door or the Slytherin wall. A loaded entrance follows at once, wherever the players are, and one that streams in later comes in that way. While it is held, player.commonRooms does not open it. Back on “game”, it opens for whoever its trigger admits, a player already standing in it included, and otherwise closes.

"Gryffindor" | "Hufflepuff" | "Ravenclaw" | "Slytherin"

The house whose entrance to hold, in any case.

"game" | "open" | "closed"

“open” opens the entrance and holds it open; “closed” closes it and keeps it shut, the house’s own members and professors included; “game” hands it back to its own trigger.

boolean

False for an unknown house or state, or an unavailable server.

setDate(day, month, year?): boolean

Sets the replicated calendar date.

number

Valid day for the selected month (February allows 29).

number

Month of year.

number

Calendar year. Omit (or 0) to keep the game’s own, ~1891.

boolean

False for an invalid range or unavailable server.

setDecor(decor): boolean

Sets the holiday decor every client shows, re-applied whenever a client’s world loads or a mission changes it. Releasing to “game” leaves the decor as it was until a mission changes it. The winter season’s own garlands are not holiday decor and follow World.setSeason.

"none" | "game" | "halloween" | "christmas"

“halloween” or “christmas” shows that holiday’s castle and Hogsmeade decorations; “none” keeps both off; “game” stops pinning and leaves them to story missions.

boolean

False for any other value or an unavailable server.

setDuelingTable(table): boolean

Sets the Defence Against the Dark Arts classroom’s dueling table on every client, re-applied whenever a client’s world loads or the classroom streams in. A client with the classroom loaded plays the change, as the class’s cutscene does: the desks slide aside to the walls and the table rises out of the floor, in about 4 s, and “game” plays it backwards. A client whose classroom loads later finds it in place.

"long" | "short" | "game"

“long” raises the full dueling table of the first Defence Against the Dark Arts class and pushes the desks aside; “short” raises its short table the same way; “game” puts the table away and the desks back.

boolean

False for any other value or an unavailable server.

setEncounterPolicy(policy): boolean

Sets who spawns the Overland’s enemy camps, for every client. No client spawns an enemy of its own under either policy: the game’s quest fights, dungeon waves and other world events are off. Under “server” a camp spawns when a player comes within its native trigger radius, despawns once nobody is near, and its dead return after Camps.respawnSeconds; world events roll as players approach their spots (WorldEvents). Leaving “server” removes every camp and world-event NPC.

"suppressed" | "server"

“suppressed” keeps the game’s enemy spawners off on every client; “server” keeps them off and spawns the camps and roaming world events as replicated NPCs.

boolean

False for any other value or an unavailable server.

setGreatHallBanners(banners): boolean

Sets the one-house banners at the head of the Great Hall on every client. A change unfurls the new house’s banners in place with the game’s own reveal, and is re-applied whenever a client’s world loads or a mission changes it. Releasing to “game” leaves the banners as they were until a mission changes them. The game removes the banners for good once a save has completed the story mission FGB_01.

"none" | "Gryffindor" | "Hufflepuff" | "Ravenclaw" | "Slytherin" | "game"

A house name, in any case, hangs that house’s banners; “none” takes them down; “game” stops pinning and leaves them to the story.

boolean

False for any other value or an unavailable server.

setHeadmasterOffice(office): boolean

Sets the Headmaster’s office staircase on every client, re-applied whenever a client’s world loads or a quest changes it. A staircase that is already loaded follows at once: “open” raises it, “closed” plays the raise backwards, folding the stairs away before the gargoyle sinks, and closes the stairwell off again. Releasing to “game” leaves it as it was until the quest changes it.

"game" | "open" | "closed"

“open” raises the gargoyle staircase to the Headmaster’s office; “closed” keeps it down; “game” stops pinning and leaves it to the story quest.

boolean

False for any other value or an unavailable server.

setLootPolicy(policy): boolean

Sets who spawns the Overland’s moonstone deposits and foragables, for every client. Under “server” the game’s own spots (LootSpots) are shared lootables: a take empties a spot until its kind’s respawn time has passed, and it is adopted into the taker’s inventory as Lootables are. Native spawns are removed from areas that load after the change, so set it at startup. Leaving “server” removes every spot.

“native” leaves the family to each client’s game, where every player has their own copy of each spawn; “suppressed” removes it; “server” removes it and spawns the game’s own spots as server lootables. Families left out keep their setting.

"native" | "suppressed" | "server"

"native" | "suppressed" | "server"

boolean

False for a non-object, any other value or an unavailable server; nothing changes then.

setMeal(meal): boolean

Sets the meal laid on the Great Hall’s and the Kitchens’ tables on every client. It holds through the schedule’s mealtimes and is re-applied whenever either room streams in or a story conversation lays its own lunch. Releasing to “game” lays the schedule’s meal for the current time at once.

"none" | "game" | "prep" | "breakfast" | "lunch" | "dinner" | "dessert"

A meal lays that meal’s food; “prep” lays plates and goblets with no food; “none” clears the tables; “game” stops pinning and leaves them to the game clock’s schedule.

boolean

False for any other value or an unavailable server.

setPlayerCollision(on): boolean

Switches player-to-player collision for every client. Only a player’s own movement is blocked: NPCs, spells and the world are unaffected, and nobody can push anyone. Two players who end up inside each other (a teleport, a shared spawn) pass through until they separate. Hidden, mounted, dead, disillusioned and animal-form players never block, and player.setCollidable(false) takes one player out of it.

boolean

true makes players block each other; false (the default) lets them walk through each other.

boolean

False for a non-boolean or an unavailable server.

setSeason(season): boolean

Sets the replicated season.

number

0 = spring, 1 = summer, 2 = autumn, 3 = winter.

boolean

False for a non-integer, invalid range, or unavailable server.

setSpawn(spawn): boolean

Sets the server-wide spawn point: where a player’s client loads into the world when they connect, so they never pass through the dormitory first, and where a respawn without a position stands them. player.setSpawn overrides it per player. A change applies from the next connect or respawn; players already in the world stay where they are.

{ position: { x: number; y: number; z: number; }; yaw?: number; } | null

An Overland position and a heading in degrees (default 0); null returns players to the game’s own start, the house dormitory.

boolean

False for a malformed spawn or an unavailable server.

setTime(hour, minute, second?): boolean

Sets the replicated time of day. The clock keeps running from there at the current time scale.

number

Hour of day (0-23).

number

Minute of the hour (0-59).

number

Second of the minute (0-59). Defaults to 0.

boolean

False for an invalid range or unavailable server.

setTimeScale(minutesPerSecond): boolean

Sets the rate of the server-authoritative clock.

number

In-game minutes advanced per real second (0-600). 1 = a 24-minute in-game day; 0 freezes the clock.

boolean

False for an invalid range or unavailable server.

setWeather(name): boolean

Sets the active replicated weather template. Template membership is not validated.

string

Non-empty weather template name to replicate to clients.

boolean

False for an empty/oversized name or unavailable server.