Skip to main content

Event hooks

Hooks for events created as plain objects, as shown in the create-event guide.

Members

onAction

Called when a player performs an action on this event
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onAction: (this: RpgEvent, player: RpgPlayer) => void

onChanges

Called during the change-detection cycle for the current player. Use this hook to recompute the event state from player data, especially player variables. This is useful for reactive visuals such as an opened chest, a hidden door, or a conditional NPC graphic.
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onChanges: (this: RpgEvent, player: RpgPlayer) => void

onDetectInShape

Called when a player is detected entering a detection shape attached to the event
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onDetectInShape: (this: RpgEvent, player: RpgPlayer, shape: RpgShape) => void

onDetectOutShape

Called when a player is detected exiting a detection shape attached to the event
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onDetectOutShape: (this: RpgEvent, player: RpgPlayer, shape: RpgShape) => void

onInit

Called when the event is first initialized. Use this hook for default setup that does not depend on a player interaction, such as setting the initial graphic, speed, or movement route.
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onInit: (this: RpgEvent) => void

onInShape

Called when a player enters a shape attached to the event
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onInShape: (this: RpgEvent, zone: RpgShape, player: RpgPlayer) => void

onOutShape

Called when a player exits a shape attached to the event
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onOutShape: (this: RpgEvent, zone: RpgShape, player: RpgPlayer) => void

onPlayerTouch

Called when a player touches this event
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onPlayerTouch: (this: RpgEvent, player: RpgPlayer) => void