playerConnect(player: Player)- Dispatched once a connecting player's entity exists. It has no position yet; wait for `playerReady` to place them.
playerReady(player: Player)- Dispatched once the player's world is synced and they stand in it: the moment to spawn, dress and equip them. Their inventory record follows shortly after, with their first report.
playerDisconnect(player: Player)- Dispatched while a player is leaving, before their entity is destroyed, so the handle still reads. Anything keyed on the player is cleaned up here.
playerDeath(player: Player, killer: Player | null)- Dispatched once when a player dies. `killer` is the last player who hit them, or null. Nothing brings them back on its own: call `player.respawn`.
playerShoot(player: Player)- Dispatched when a player fires, before the shot is shown to the players around them.
playerProjectile(player: Player, projectile: number, npc: Npc | null)- Dispatched when a player's game launches a projectile: a missile, a grenade in flight, a flame, or one an NPC it simulates launched (`npc`). `projectile` is the BGSProjectile form ID. Return `false` to refuse: nobody else sees it. It still flies on the shooter's own screen.
playerSpaceChange(player: Player, space: PlayerSpace, previous: PlayerSpace | null)- Dispatched when a player's game reports them in another worldspace or interior: through a door, a fast travel or `teleport`. `previous` is null for the first space they report after joining.
playerAppearanceChange(player: Player)- Dispatched when a player's game reports a new look after the one they joined with: the look editor closed, or `setLook`, `randomizeLook` or `setAppearance` changed it. `getAppearance` reads it.
playerHit(attacker: Player, victim: Player, damage: number, kind: "direct" | "blast" | "hazard")- Dispatched when a player's game lands a hit on another player, before the victim takes it. Return `false` to drop the hit. `damage` is the attacker's game's own. `kind` is a shot or a blow, an explosion's blast, or a hazard the attacker left (a radiation or gas cloud), which casts its spell and carries no damage figure.
playerReload(player: Player, event: string)- Dispatched when a player starts a reload, before it is shown to the players around them. `event` is the animation event their game played.
playerExplosion(player: Player, position: Vector3, explosion: number, npc: number | null)- Dispatched when a player's game sets off an explosion: a grenade, a mine, a missile, an explosive round, or one an NPC it simulates set off (`npc`, its network ID). `explosion` is the BGSExplosion form ID. Return `false` to refuse it: nobody else sees it and its blast lands on no one.
playerPowerArmor(player: Player, entered: boolean)- Dispatched once when a player gets into a power armor frame (`entered`) and once when they get out, however it happened.
playerPowerArmorBattery(player: Player, charge: number, previous: number)- Dispatched when the charge of the fusion core in a player's power armor changes, in whole units: their game drains it (a jump, among others), a new core is loaded, or `setPowerArmorBattery` set it. Not on getting in.
playerFusionCore(player: Player, kind: "consumed" | "inserted" | "ejected", core: number | null, condition: number)- Dispatched when a player's game takes a fusion core into their power armor or launches it out. `consumed`: the suit's core ran out and their game loaded the next one they carry. `inserted`: a core went into the empty suit as it reached them. `ejected`: they launched the core out of the suit (Nuclear Physicist), `core` null. `condition` is the core's charge in percent. Return `false` to refuse a core taken in: it goes back to their inventory, the suit keeps the charge it had and takes no other core until `setPowerArmorBattery` gives it a charge or they get out. A launch cannot be refused.
playerChat(player: Player, text: string)- Dispatched for a chat line, before anyone sees it. Return `false` to swallow it.
playerCommand(player: Player, command: string, args: string[])- Dispatched for a `/command arg...` line; `command` has no slash.
worldHourChange(hour: number)- Dispatched when the running clock reaches a new whole hour, 0 to 23. `World.setHour` does not raise it.
doorChange(player: Player, ref: number, open: boolean)- Dispatched when a player opens or closes a door. Return `false` to refuse: their door swings back.
lockChange(player: Player, ref: number, locked: boolean)- Dispatched when a player picks, unlocks or locks a lock. Return `false` to refuse: their lock goes back.
containerOpen(player: Player, ref: number)- Dispatched when a player opens a container nobody else holds. Return `false` to keep it shut.
containerClose(player: Player, ref: number)- Dispatched when the player holding a container closes its menu; anyone may open it again.
containerChange(player: Player, ref: number, items: InventoryItem[])- Dispatched when a player's game reports what a container holds now, after they put something in or took something out. To refuse a transfer, refuse the player's `inventoryChange`, which reverts the container with it.
itemDrop(player: Player, item: Item)- Dispatched when a player drops an item. Return `false` to refuse: the item leaves the world and goes back into their inventory.
itemPickUp(player: Player, item: Item | null, ref: number | null)- Dispatched when a player picks up a loose item, before they get it: a dropped or spawned `item`, or a placed reference by its form ID as `ref`. Return `false` to refuse; the item stays where it is.
inventoryChange(player: Player, changes: InventoryDelta[])- Dispatched when a player's game reports a change the server would accept: looting, buying, crafting, using an item. Return `false` to refuse it: the server keeps its record and sends it back to their game, and any container involved keeps what it held. Changes a script made itself do not raise it.
playerCharacterLoad(player: Player)- Dispatched once a player's character is established, shortly after they join: adopted from their game. Restore a kept character here with `setCharacter`. Character methods work from here.
playerXpGain(player: Player, amount: number)- Dispatched when the player's game awards XP: a kill, a quest, a lock, a terminal, a workshop build. `amount` is the game's, Intelligence included. Return `false` to refuse it: their game takes it back.
playerLevelChange(player: Player, level: number, previous: number)- Dispatched when the character's level moves, by XP or by a script.
playerPerkRequest(player: Player, perk: number, kind: "buy" | "grant" | "remove")- Dispatched when the player's game changes a perk rank: bought on the perk chart (after the server checked points, level, the rank below and SPECIAL), given by something in the game such as a magazine, or taken away. Return `false` to refuse it: their game undoes it.
playerPerkChange(player: Player, perk: number, added: boolean)- Dispatched when a perk rank was added to or taken from the character, by their game or by a script.
playerValueRequest(player: Player, value: string, previous: number, base: number)- Dispatched when the player's game moves a SPECIAL base: the SPECIAL menu, a bobblehead, a book. `value` is its editor ID. Return `false` to refuse it: their game puts it back.
playerValueChange(player: Player, value: string, base: number, previous: number)- Dispatched when an actor value base on the character's record moved, by their game or by a script.
mineLaid(mine: Mine)- Dispatched once a player's mine settles and is armed. Return `false` to refuse: it leaves the world unexploded.
mineTrigger(mine: Mine, player: Player)- Dispatched when a player walks onto another player's mine, before it goes off. Return `false` to keep it armed; the player's game asks again every half second while they stand on it.
mineRemove(mine: Mine)- Dispatched when a mine goes, whatever took it: its blast, a disarm, its owner leaving or a script. The handle still reads.
npcHit(attacker: Player, npc: Npc, damage: number, kind: "direct" | "blast")- Dispatched when a player's game lands a hit on an NPC, before the NPC takes it. Return `false` to drop the hit. `damage` is the attacker's game's own; `kind` is a shot or a blow, or an explosion's blast.
npcAttack(npc: Npc, victim: Player, damage: number, kind: "direct" | "blast")- Dispatched when an NPC lands a hit on a player, before the victim takes it. Return `false` to drop the hit. `damage` is the game's own, from the client that runs the NPC.
npcDeath(npc: Npc, killer: Player | null)- Dispatched once when an NPC dies. `killer` is the last player who hit it, or null. It comes back on its own a while later; `npcRespawn` follows.
npcRespawn(npc: Npc)- Dispatched when an NPC is back at its placement, whole: on its own after its death, or from `respawn`.
npcSimulatorChange(npc: Npc, simulator: Player | null)- Dispatched when another player's game takes over running an NPC, or when nobody near does any more (`simulator` null) and the server walks it.
npcLeaderChange(npc: Npc, leader: Player | null)- Dispatched when an NPC becomes a player's companion (`setLeader`), or follows nobody any more (`leader` null): let go, or its leader left.
workshopBuild(player: Player, form: number, workbench: number, position: Vector3, angle: Vector3)- Dispatched when a player builds an object in a settlement, before anyone else sees it. Return `false` to refuse: their game takes it back out. The recipe's components are theirs to have spent; the server cannot refund them.
workshopMove(player: Player, item: WorkshopItem, position: Vector3, angle: Vector3)- Dispatched when a player moves a built object, before anyone else sees it. Return `false` to refuse: the object is put back where it was for everyone, as a new `WorkshopItem`, and the old handle reads nothing.
workshopScrap(player: Player, item: WorkshopItem)- Dispatched when a player scraps or stores a built object, before it goes for everyone. Return `false` to refuse: the object is put back for everyone, as a new `WorkshopItem`, and the old handle reads nothing. The player keeps what their game gave them for it.
resourceStart(resourceName: string)- Dispatched after a resource entry point has run and immediately before the resource becomes running.
resourceStop(resourceName: string)- Dispatched while a resource is stopping, before its stop callback, timers, exports and event handlers are cleaned up.
entityStateChange(entity: Entity, key: string, value: any, previous: any)- 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.
consoleCommand(command: string, args: string[])- 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.
playerConnecting(connection: PendingConnection)- 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.