Skip to content
ASArcaneMP Scripting APIScripting reference
Data shapeServer APIGenerated

EventMap

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

Native events dispatched through Events.on. Each property is the exact callback argument tuple for that event.

readonly arenaCompleted: [string, Player[]]

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

The last wave was cleared. players stood in the arena at that moment; the game’s own reward for it is the arena’s reward item, which this does not grant.


readonly arenaEnded: [string, "stopped" | "completed" | "abandoned" | "disabled"]

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

A running arena ended and despawned its enemies: completed (a few seconds after arenaCompleted), abandoned (nobody in it for 20 s), stopped, or disabled.


readonly arenaStarted: [string]

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

An arena started; its first wave follows once nearby clients have loaded it.


readonly arenaWaveCleared: [string, number]

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

Every enemy of a wave, reinforcements included, has died.


readonly arenaWaveStarted: [string, number]

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

A wave was announced; its enemies spawn a moment later. wave counts from 1.


readonly beastBorn: [Beast, Beast]

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

A vivarium mother’s young was born (or hatched) next to her pen. It joins her room’s roster.


readonly beastBreedRequest: [Player, Beast, Beast]

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

A room’s editor bred a pair at a breeding pen in the game: a female and a male of one species, in the pen’s vivarium, the pen free and the vivarium with room for the young. Synchronous: a handler returning false refuses it. Allowed, the mother carries the young (beast.pregnancy), an egg-layer then sits on the egg, and the young is born next to the pen.


readonly beastByproductCollected: [Beast, Player, string, number]

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

A harvest went through: count of item went into the player’s inventory.


readonly beastByproductRequest: [Beast, Player]

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

A player harvests a vivarium beast’s byproduct in the game, both its needs met and the byproduct full, standing beside it in its room. Synchronous: a handler returning false refuses it and nothing changes. Allowed, the player’s inventory gets the species’ byproduct and the cycle starts again.


readonly beastCaptured: [Player, CapturedBeast]

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

A catch went through: the beast left every player’s world and is in the catcher’s bag. The bag belongs to the connection, so save it from here.


readonly beastCaptureRequest: [Beast, Player]

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

A catch finished in the catcher’s game, which holds it until the server answers. A handler that returns false synchronously refuses it, and the beast stays.


readonly beastCaptureStart: [Beast, Player]

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

A player’s Nab-Sack started drawing a beast in. A handler that returns false synchronously cancels the catch, and the Nab-Sack lets the beast go.


readonly beastCared: [Beast, Player, "pet" | "feed"]

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

A player petted or fed a beast. A handler that returns false synchronously refuses it.


readonly beastDismounted: [Beast, Player, "rider" | "passenger", "script" | "left" | "died" | "dismounted" | "gone" | "riderLeft"]

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

A player is off a beast: dismounted (the rider’s own dismount), script (beast.dismount, or setPassenger(null)), died (the player or the beast), left (they disconnected or changed world), gone (the beast was destroyed), or riderLeft (a passenger whose rider got off). A passenger goes before their rider.


readonly beastLifeChanged: [Beast, BeastLife, BeastLife]

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

A beast was killed, wounded or revived (beast.kill, beast.revive).


readonly beastMounted: [Beast, Player, "rider" | "passenger"]

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

A player is on a beast: the rider once their game has seated them (beast.mount), or the passenger put behind them (beast.setPassenger).


readonly beastMountFailed: [Beast, Player, string]

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

A beast.mount that started never seated its rider: their game refused it, their copy of the beast never appeared (“timed out”), or beast.dismount withdrew it (“cancelled”). The beast is free again.


readonly beastMoveEnded: [Beast, "arrived" | "stopped" | "replaced" | "targetGone" | "unreachable"]

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

A beast’s moveAlong path or follow ended: arrived (a “once” path’s last waypoint, after its wait), stopped (stop() or a position set), replaced (a new command), unreachable (the game could not reach a waypoint), or targetGone (the followed entity left).


readonly beastReleased: [Player, CapturedBeast, object]

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

A player released a beast from their bag through the Field Guide; at is where they stood.


readonly beastWaypoint: [Beast, number, number]

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

A beast on a moveAlong path reached a waypoint (index into the caller’s array), before its wait. lap counts completed laps of a “loop” or “pingpong” path.


readonly campActivated: [string]

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

A camp’s roster spawned because a player came near.


readonly campCleared: [string]

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

Every enemy of an active camp has died.


readonly characterMoveEnded: [Character, MoveEndReason | "targetGone"]

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

A character’s path or follow ended: “arrived” after the last point’s wait of a once path, “stopped” on stop() or a position assignment, “replaced” by a new moveAlong, moveTo or follow, “targetGone” when a followed entity left.


readonly characterWaypoint: [Character, number, number]

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

A character’s path reached waypoints[index], before its wait. lap counts the laps a loop or pingpong has completed.


readonly chatCommand: [Player, string, string, string[]]

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

A player sent a slash command: message is the whole line with its /, command the word after it and args the words after that.


readonly chatMessage: [Player, string]

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

A player sent a chat line that is not a command. While any resource listens for it the server stops relaying chat itself, so a listener sends the line on.


readonly colliderSpellHit: [Collider, Player, ColliderSpellHit]

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

A player’s bolt met a collider that stops it. Reported by the caster’s client and rate-limited, so treat it like any client-sourced signal. Bolts of players it lets through, spells that fire no bolt, NPC casts, and thrown objects (Oppugno) ending on a collider that does not deflect raise nothing.


consoleCommand: [string, string[]]

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

Dispatched for a line typed into the server console that no built-in command (help, ensure, refresh, …) claimed. args is the rest of the line, split on whitespace. The console is the operator’s, so this is the place for commands no player may run.


readonly doorUnlocked: [Player, DoorUnlock]

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

A player opened a lock by key or Alohomora and it is now fully unlocked in their game. When door.shared is true the server already holds it unlocked for everyone; Doors.clear or Doors.set takes that back.


readonly doorUnlockRequest: [Player, DoorUnlockRequest]

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

A player tried to open a lock the server holds shut, by key or Alohomora. Their game has already refused it; a script decides whether to release it, at once with Doors.set or through their own cast and lockpicking with Doors.allowUnlock. Alohomora only gets this far for a player whose Alohomora reaches the door’s lock level, which Doors.set can hold.


entityStateChange: [ServerEntity, string, any, any]

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

Dispatched when one key of an entity’s state changes: on the server when a script writes it, on a client when the write arrives. value is undefined when the key was removed and previous is undefined when it held nothing before, so a stored null stays distinguishable from an absent key. The entity is whatever the game’s WrapScriptEntity answers, and the base Entity handle by default.


readonly housePointsChange: ["Gryffindor" | "Hufflepuff" | "Ravenclaw" | "Slytherin", number, number]

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

Raised alongside housePointsChanged with the same arguments; listen to that instead.


readonly housePointsChanged: ["Gryffindor" | "Hufflepuff" | "Ravenclaw" | "Slytherin", number, number]

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

A house’s points changed.


readonly housePointsRequest: [Player, HousePointsRequest]

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

A player’s game asked to award or deduct house points. A handler that returns false synchronously refuses the request.


readonly loadingFinished: [Player]

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

A player’s load screen was dismissed, after worldReady.


readonly lootableTaken: [Player, number, LootItem[]]

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

A player took a lootable; items is what it gave them.


readonly lootSpotTaken: [Player, string, LootItem[]]

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

A player took from a loot spot; items is what it gave them.


readonly npcDamaged: [number, number | null, number, number | null]

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

A server-spawned NPC took damage from a player or from another NPC (sourceNpcId). attackerId is the player credited: the reporter for its own hit, a led NPC’s leader for its hit, null for a wild NPC’s. amount is clamped and rate-capped. Client-reported: validate before rewarding it.


readonly npcDied: [number, string, number | null, number[]]

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

A server-spawned NPC died. killerId is its killer’s network id, or null when none is known, and damagerIds lists every player that damaged it.


readonly npcMoveEnded: [NPC, "arrived" | "stopped" | "replaced" | "targetGone" | "unreachable"]

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

An NPC’s path or follow ended: “arrived” after the last point’s wait of a once path, “stopped” on stop() or its death, “replaced” by a new moveAlong, moveTo or follow, “unreachable” when the game found no way to a point, “targetGone” when the entity it followed left.


readonly npcWaypoint: [NPC, number, number]

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

An NPC on a moveAlong path reached waypoints[index], before its wait. lap counts the laps a loop or pingpong has completed.


readonly playerAnimalAttack: [Player, number, string, AnimalAttackPhase]

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

An attack from player.playAnimalAttack moved on. The player’s client reports started, hit (its strike window opened), released (its projectile would have left the body) and ended as its own copy of the body plays it, failed when that copy could not play it, and interrupted when that copy went away mid-attack. The server reports interrupted for a new attack, stopAnimalAttack, a new form, death, a disconnect, or an owner that never reported the end. Each phase is raised once per id, and nothing follows ended, interrupted or failed.


readonly playerAppearanceChanged: [Player, LookJson | null, number]

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

The server accepted and sanitized a new appearance for a player; revision increases per connection. look is null only if it could not be serialized.


readonly playerConnect: [Player]

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

Raised alongside playerConnected with the same arguments; listen to that instead.


readonly playerConnected: [Player]

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

A player connected. It is not raised again for players already online when a resource starts.


playerConnecting: [PendingConnection]

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

Dispatched when a player asks to join, before the connection exists: they hold no player slot, are not counted as online, and are sent nothing – no resource list, no download, no body. The request waits until every handler has returned and every Promise a handler returned has settled, then it is let in if a player slot is free (otherwise it is refused as full). connection.reject() turns it away instead, and so does a handler that throws or rejects, or handlers that have not settled within the server’s admission timeout (30 seconds by default, restarted by every connection.update()). With no handler at all, every request is let in at once.


readonly playerDied: [Player]

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

A player’s game reported entering the dead state. Client-reported: validate before acting on it.


readonly playerDisconnect: [Player]

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

Raised alongside playerDisconnected with the same arguments; listen to that instead.


readonly playerDisconnected: [Player]

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

A player is leaving; their handle and inventory still resolve inside the handler. A dropped connection raises nothing else, so clean up anything keyed on the player here.


readonly playerDowned: [Player]

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

A player’s game reported the near-death kneeling state. Client-reported.


readonly playerDownedEnd: [Player]

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

Raised alongside playerDownedEnded with the same arguments; listen to that instead.


readonly playerDownedEnded: [Player]

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

A player recovered from the downed state or respawned. Client-reported.


readonly playerFastTravelComplete: [Player, number, number]

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

Raised alongside playerFastTravelCompleted with the same arguments; listen to that instead.


readonly playerFastTravelCompleted: [Player, number, number]

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

A player.fastTravel request finished. status: 0 success, 1 superseded, 2 unavailable, 3 declined, 4 timed out.


readonly playerFastTravelRequest: [Player, PlayerFastTravelRequest]

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

A player picked a fast-travel destination on their map, and their game holds the travel until the server answers. A handler that returns false synchronously refuses it, and the player stays on the map. Not raised while player.setFastTravelEnabled(false) holds, nor for player.fastTravel.


readonly playerFastTravelUnlocked: [Player, PlayerFastTravelUnlock]

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

A Floo flame lit on a player’s map by their own game, as finding it does. Not raised for player.setFastTravelUnlocked, nor for the flames already lit when their world loads. Client-reported: save from here, but validate before rewarding it.


readonly playerGearChanged: [Player]

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

A player’s gear changed.


readonly playerHoldEnded: [Player, string, "released" | "disconnect" | "expired" | "anchorLost"]

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

A server-owned hold on a player ended. owner is the name it was added under.


readonly playerHoldStrained: [Player, string, number]

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

A held player keeps reporting positions beyond the hold’s boundary, distanceCm past it.


readonly playerInventoryChanged: [Player, InventoryItem[]]

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

A player’s game reported its native inventory, whole. Client-reported, and it does not change the authoritative inventory.


readonly playerInventoryConsumed: [Player, InventoryItem | null, number]

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

An accepted native use of a consumable updated the authoritative inventory; remaining is how many are left.


readonly playerInventoryNativeDelta: [Player, NativeInventoryDelta]

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

A player’s game reported a native acquisition the authoritative inventory does not hold yet. The first report after connecting sets a baseline and raises nothing. Adopt it with player.inventory.adoptNative() only under an allowlist.


readonly playerInventoryUpdated: [Player, InventoryItem[], number]

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

A player’s authoritative inventory changed, by a script or by gear and mounts the player changed in game; items is all of it at revision. Save from here.


readonly playerLocationChanged: [Player, PlayerLocation | null, PlayerLocation | null]

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

A player’s coordinate-space context became available, became unavailable during world travel, or changed area, region or confirmed destination. player.location() inside the handler equals current.


readonly playerMapDiscoveryChange: [Player]

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

Raised alongside playerMapDiscoveryChanged with the same arguments; listen to that instead.


readonly playerMapDiscoveryChanged: [Player]

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

A player uncovered more of their world map in their own game, as exploring does; read it with player.getMapDiscovery(). At most every few seconds while they explore. Not raised for player.setMapDiscovery, nor for the map their world loads with. Client-reported.


readonly playerMapTravelComplete: [Player, number, number, MapTravelCompletion]

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

Raised alongside playerMapTravelCompleted with the same arguments; listen to that instead.


readonly playerMapTravelCompleted: [Player, number, number, MapTravelCompletion]

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

A player.travelToMap or travelToPlace request finished, once the player is playable in the new map. status: 0 arrived, 1 superseded, 2 unavailable, 3 declined (the map or a level is not installed on this client), 4 timed out, 5 failed (the load settled in another map, completion.areaId), 6 level failed (arrived without one of the extra levels).


readonly playerMoveEnded: [Player, string, "released" | "interrupted" | "arrived" | "replaced" | "disconnect" | "expired" | "blocked" | "targetLost" | "travel" | "died"]

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

A drive from player.moveTo or player.follow ended. The player’s client reports arrived (checked against the server’s copy of their position), blocked (no headway for 5 s), targetLost, interrupted (mounted, swimming, knocked down or taken by a scene for 3 s), travel and died; the server reports the rest. A follow never arrives.


readonly playerSanctuaryEnter: [Player, string]

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

Raised alongside playerSanctuaryEntered with the same arguments; listen to that instead.


readonly playerSanctuaryEntered: [Player, string]

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

A player entered a Room of Requirement. On a swap between rooms it follows playerSanctuaryExited.


readonly playerSanctuaryExited: [Player, string]

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

A player left a Room of Requirement, including by disconnecting.


readonly playerSanctuaryLeave: [Player, string]

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

Raised alongside playerSanctuaryExited with the same arguments; listen to that instead.


readonly playerSpellCast: [Player, string, SpellCastInfo]

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

A player cast a server-defined spell; spell is its id and cast where it was aimed. Reported by the caster’s client and rate-limited, so treat it like any client-sourced signal.


readonly playerTeleportComplete: [Player, number, number, TeleportCompletion]

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

Raised alongside playerTeleportCompleted with the same arguments; listen to that instead.


readonly playerTeleportCompleted: [Player, number, number, TeleportCompletion]

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

A player.teleport request finished. status: 0 success, 1 superseded, 2 unavailable, 3 world changed, 4 teleport failed, 5 timed out.


playerVoiceStart: [Player]

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

Dispatched when a player starts speaking, as isPlayerTalking turns true.


playerVoiceStop: [Player]

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

Dispatched shortly after a player’s last voice frame, as isPlayerTalking turns false. A player who disconnects while talking gets no stop, so clear them on disconnect too.


playerVoiceTierChange: [Player, number]

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

Dispatched when a player switches voice tier themselves: 0 whisper, 1 normal, 2 shout. setPlayerTier does not raise it.


readonly playerWandChanged: [Player]

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

A player’s wand changed.


readonly pvpDefeat: [Player, Player, "death" | "kneel"]

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

A PvP hit defeated a player, by death or by kneeling as the rules decide.


readonly pvpFlagChanged: [Player, boolean]

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

A player’s PvP flag turned on or off.


readonly pvpHit: [number, number, string, number, BodyPart | null]

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

A PvP hit passed arbitration and policy and was relayed to its victim. The ids are network ids, spell is the spell record path (a mod’s own for a modded spell), and damage is the final amount. bodyPart is where it struck, as the policy saw it. Informational: use Pvp.setPolicy to veto or reprice hits.


readonly pvpRulesChanged: [PvpRules]

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

The PvP rules changed; rules is the new set.


resourceStart: [string]

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

Dispatched after a resource entry point has run and immediately before the resource becomes running.


resourceStop: [string]

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

Dispatched while a resource is stopping, before its stop callback, timers, exports and event handlers are cleaned up.


readonly sanctuaryChanged: [string, number, Player | null]

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

A Room of Requirement’s layout changed, including a vivarium beast’s needs met by care or its byproduct harvested (the revision moves only for edits). editor is the player who changed it, or null when no player did.


readonly trainEnded: ["end" | "despawned"]

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

The train is gone: “end” when a departure left the track, “despawned” on despawn() or a spawn() that replaced it.


readonly trainSpawned: [number]

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

World.hogwartsExpress.spawn stood the train at t.


readonly trainStopped: [number]

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

The train braked to a stop at t, at the end of a moveTo or a halt.


readonly vivariumMove: [Player, VivariumMove]

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

Raised alongside vivariumMoveRequest with the same arguments; listen to that instead.


readonly vivariumMoveRequest: [Player, VivariumMove]

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

A room’s editor moved a beast on the game’s beast screens: released one from their bag into the vivarium they stand in, took one into their bag, returned one to the wild, or summoned one to them. Synchronous: a handler returning false refuses it, and the beast stays where it was.


readonly wandLinkEnded: [WandLink, Player | null, "ended" | "cancelled" | "playerLeft" | "playerDied"]

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

A wand link ended. winner is the player a script ended it in favour of, and null for every other reason.


readonly worldEventCleared: [string]

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

Every enemy of a running world event has died.


readonly worldEventEnded: [string]

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

A world event despawned because every player left, and its spot started cooling down.


readonly worldEventStarted: [string, string]

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

A world event spawned at a spot; kind is its encounter, such as WE_ENEMY_ENCOUNTER_WOLF.


readonly worldReady: [Player]

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

A player’s world, pawn and replication are ready.


readonly zoneEnter: [Zone, Player | Character | Beast | NPC | WorldObject | null]

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

Raised alongside zoneEntered with the same arguments; listen to that instead.


readonly zoneEntered: [Zone, Player | Character | Beast | NPC | WorldObject | null]

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

An entity entered a zone. entity is null only if it was destroyed before the handler ran.


readonly zoneExit: [Zone, Player | Character | Beast | NPC | WorldObject | null, "left" | "gone", number]

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

Raised alongside zoneExited with the same arguments; listen to that instead.


readonly zoneExited: [Zone, Player | Character | Beast | NPC | WorldObject | null, "left" | "gone", number]

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

An entity left a zone, or was destroyed inside it: then reason is “gone” and entity is null. entityId is its network id either way.


readonly zoneHazard: [Zone, Player | null, boolean, number]

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

A player’s exposure to a zone’s hazard changed: true once they are inside and unprotected, false when they leave, become protected or the hazard is taken off. Destroying the zone sends none, as it sends no zoneExited. player is null only for one who disconnected inside; playerId is their network id either way.