Skip to content

Commit ce383a5

Browse files
committed
State of commit 90f8ede
1 parent 9c15d64 commit ce383a5

22 files changed

Lines changed: 772 additions & 0 deletions

‎docs/api.json‎

Lines changed: 406 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: 'NPC'
3+
---
4+
# `constants` NPC <font size="4">(server-side)</font>
5+
6+
| Name | Description |
7+
| :----------: | :----------------------------------- |
8+
| `ACTION_PLAY_ANI` | Represents action play ani type. |
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: 'onNpcActionFinished'
3+
---
4+
# `event` onNpcActionFinished <font size="4">(server-side)</font>
5+
!!! info "Available since version: 0.3.0"
6+
7+
Triggered when an action leaves the queue through completion, failure, cancellation or timeout.
8+
9+
## Parameters
10+
```c++
11+
void onNpcActionFinished(number npc_id, number action_type, number action_id, boolean result)
12+
```
13+
14+
* `number` **npc_id**: NPC id.
15+
* `number` **action_type**: ACTION_PLAY_ANI.
16+
* `number` **action_id**: Finished action id.
17+
* `boolean` **result**: True only for successful completion reported by the current host.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: 'onNpcActionSent'
3+
---
4+
# `event` onNpcActionSent <font size="4">(server-side)</font>
5+
!!! info "Available since version: 0.3.0"
6+
7+
Triggered when the current action is dispatched to its host. A replay after host migration may emit it again.
8+
9+
## Parameters
10+
```c++
11+
void onNpcActionSent(number npc_id, number action_type, number action_id)
12+
```
13+
14+
* `number` **npc_id**: NPC id.
15+
* `number` **action_type**: ACTION_PLAY_ANI.
16+
* `number` **action_id**: Dispatched action id.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: 'onNpcChangeHostPlayer'
3+
---
4+
# `event` onNpcChangeHostPlayer <font size="4">(server-side)</font>
5+
!!! info "Available since version: 0.3.0"
6+
7+
Triggered when the player responsible for executing an NPC's actions changes.
8+
9+
## Parameters
10+
```c++
11+
void onNpcChangeHostPlayer(number npc_id, number current_id, number previous_id)
12+
```
13+
14+
* `number` **npc_id**: NPC id.
15+
* `number` **current_id**: New host id, or -1 for no host.
16+
* `number` **previous_id**: Previous host id, or -1 for no host.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: 'onNpcCreated'
3+
---
4+
# `event` onNpcCreated <font size="4">(server-side)</font>
5+
!!! info "Available since version: 0.3.0"
6+
7+
Reports NPC creation at the end of the server tick. The NPC may already be spawned or destroyed.
8+
9+
## Parameters
10+
```c++
11+
void onNpcCreated(number npc_id)
12+
```
13+
14+
* `number` **npc_id**: Created NPC id.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: 'onNpcDestroyed'
3+
---
4+
# `event` onNpcDestroyed <font size="4">(server-side)</font>
5+
!!! info "Available since version: 0.3.0"
6+
7+
Triggered after a server-owned NPC is destroyed. The id is no longer valid.
8+
9+
## Parameters
10+
```c++
11+
void onNpcDestroyed(number npc_id)
12+
```
13+
14+
* `number` **npc_id**: Destroyed NPC id.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: 'clearNpcActions'
3+
---
4+
# `function` clearNpcActions <font size="4">(server-side)</font>
5+
!!! info "Available since version: 0.3.0"
6+
7+
Cancels the current action and all pending actions.
8+
9+
## Declaration
10+
```cpp
11+
boolean clearNpcActions(number npc_id)
12+
```
13+
14+
## Parameters
15+
* `number` **npc_id**: Server NPC id.
16+
17+
## Returns `boolean`
18+
True if cleared, including an empty queue; false for an invalid NPC or failed operation.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: 'createNpc'
3+
---
4+
# `function` createNpc <font size="4">(server-side)</font>
5+
!!! info "Available since version: 0.3.0"
6+
7+
Creates an unspawned, server-owned NPC. Use spawnPlayer to stream it to clients.
8+
9+
## Declaration
10+
```cpp
11+
number createNpc(string name, string|nil instance)
12+
```
13+
14+
## Parameters
15+
* `string` **name**: Character name.
16+
* `string|nil` **instance**: Gothic NPC instance; defaults to PC_HERO.
17+
18+
## Returns `number`
19+
NPC id, or -1 on failure.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: 'destroyNpc'
3+
---
4+
# `function` destroyNpc <font size="4">(server-side)</font>
5+
!!! info "Available since version: 0.3.0"
6+
7+
Destroys an NPC and cancels its queued actions.
8+
9+
## Declaration
10+
```cpp
11+
boolean destroyNpc(number npc_id)
12+
```
13+
14+
## Parameters
15+
* `number` **npc_id**: Server NPC id.
16+
17+
## Returns `boolean`
18+
True if the NPC was destroyed.

0 commit comments

Comments
 (0)