You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Hooks for events created as plain objects, as shown in the create-event guide."
4
+
---
5
+
6
+
# Event hooks
7
+
8
+
These are the hooks for events created as plain objects, as shown in [Create an event](/guide/create-event).
9
+
10
+
## Members
11
+
12
+
-[onAction](#onaction)
13
+
-[onChanges](#onchanges)
14
+
-[onDetectInShape](#ondetectinshape)
15
+
-[onDetectOutShape](#ondetectoutshape)
16
+
-[onInit](#oninit)
17
+
-[onInShape](#oninshape)
18
+
-[onOutShape](#onoutshape)
19
+
-[onPlayerTouch](#onplayertouch)
20
+
21
+
## onAction
22
+
23
+
Called when a player performs an action on this event.
24
+
25
+
- Source: `packages/server/src/rooms/map.ts`
26
+
- Kind: `property`
27
+
- Defined in: `EventHooks`
28
+
29
+
### Signature
30
+
31
+
```ts
32
+
onAction: (player:RpgPlayer) =>void
33
+
```
34
+
35
+
## onChanges
36
+
37
+
Called during the change-detection cycle for the current player.
38
+
39
+
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.
40
+
41
+
- Source: `packages/server/src/rooms/map.ts`
42
+
- Kind: `property`
43
+
- Defined in: `EventHooks`
44
+
45
+
### Signature
46
+
47
+
```ts
48
+
onChanges: (player:RpgPlayer) =>void
49
+
```
50
+
51
+
## onDetectInShape
52
+
53
+
Called when a player is detected entering a detection shape attached to the event.
0 commit comments