Skip to content
ASArcaneMP Scripting APIScripting reference
Runtime classServer APIGenerated

HogwartsExpress

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

The Hogwarts Express, reached as World.hogwartsExpress. The server runs it and every client draws it at the same spot; the game’s own timetable is off, so it runs only when a script moves it. Positions are t along its one track, from 0 (the whole train just on the track, south of Hogsmeade) to 1 (the far end), or the id of a stop. It runs forward only. Events: trainSpawned(t), trainStopped(t), trainEnded(reason).

new HogwartsExpress(): HogwartsExpress

HogwartsExpress

depart(options?): boolean

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

Runs the train off the far end of the track at its cruise speed. It despawns there (trainEnded “end”).

As for moveTo; decel only slows it to a lower cruise speed.

number

number

number

boolean

False with no train, one already leaving the track, or bad options.


despawn(): boolean

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

Removes the train at once (trainEnded “despawned”).

boolean

False with no train.


get(): object

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

Where the train is now. t and speed (m/s) are meaningful while spawned; target is the t a moveTo or halt brakes onto; seconds is the time until it stops, or until a departure leaves the track.

object

departing: boolean

moving: boolean

seconds: number | null

spawned: boolean

speed: number

t: number

target: number | null


halt(options?): boolean

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

Brakes a moving train to a stop wherever that lands, never past the spot a moveTo was heading for (trainStopped).

Braking in m/s² (default 0.7, up to 10); Infinity stops it dead.

number

boolean

False when it is not moving, is already leaving the track, or for a bad decel.


moveTo(at, options?): boolean

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

Runs the train from wherever it is, standing or moving, and brakes it to a stop on the spot (trainStopped). A spot too close to brake for at decel brakes harder. Replaces a running move or departure.

string | number

t (0..1) or a stop id, at or ahead of the engine.

speed: cruise in m/s (default 20, the game’s own; up to 60). accel: m/s² pulling away (default 0.5). decel: m/s² braking (default 0.7). accel and decel up to 10.

number

number

number

boolean

False with no train, a spot behind the engine, a departure already leaving the track, or bad options.


spawn(at?): boolean

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

Stands the train at a spot, replacing one already out (trainEnded “despawned” for it), and fires trainSpawned.

string | number

t (0..1) or a stop id. Defaults to 0.

boolean

False for a t out of range or an unknown stop.

readonly length: number

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

Metres of track from t = 0 to t = 1.


readonly stops: object[]

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

Named spots along the track. hogsmeade stops the train along the station’s platform.

id: string

t: number