dcl-npc-toolkit 1.6.1-20251229150951.commit-1329ff8 → 1.6.1-20251229172248.commit-6697be1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -18
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -118,7 +118,28 @@ export let ILoveCats: Dialog[] = [
|
|
|
118
118
|
]
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
6. Use that dialog when the NPC gets activated
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
export let myNPC = npc.create(
|
|
125
|
+
{
|
|
126
|
+
position: Vector3.create(8, 0, 8),
|
|
127
|
+
rotation: Quaternion.Zero(),
|
|
128
|
+
scale: Vector3.create(1, 1, 1),
|
|
129
|
+
},
|
|
130
|
+
//NPC Data Object
|
|
131
|
+
{
|
|
132
|
+
type: npc.NPCType.CUSTOM,
|
|
133
|
+
model: 'models/npc.glb',
|
|
134
|
+
onActivate: () => {
|
|
135
|
+
npc.talk(myNPC, ILoveCats, 0)
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# NPC Default Behavior
|
|
122
143
|
|
|
123
144
|
NPCs at the very least must have:
|
|
124
145
|
|
|
@@ -215,29 +236,16 @@ With sdk7, there are new ways to implement similar features from sdk6, one of th
|
|
|
215
236
|
import ReactEcs, { Label, ReactEcsRenderer, UiEntity } from '@dcl/sdk/react-ecs'
|
|
216
237
|
import { NpcUtilsUi } from 'dcl-npc-toolkit'
|
|
217
238
|
|
|
218
|
-
const SceneOwnedUi = () =>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
</UiEntity>
|
|
223
|
-
)
|
|
239
|
+
const SceneOwnedUi = () => [
|
|
240
|
+
NpcUtilsUi(),
|
|
241
|
+
// other UI elements
|
|
242
|
+
]
|
|
224
243
|
|
|
225
244
|
export function setupUi() {
|
|
226
245
|
ReactEcsRenderer.setUiRenderer(SceneOwnedUi)
|
|
227
246
|
}
|
|
228
247
|
```
|
|
229
248
|
|
|
230
|
-
Note: The UI drawn by this library library requires fetching images from an external URL. For the scene to allow you to do this, you must include the `ALLOW_MEDIA_HOSTNAMES` scene permission and add `decentraland.org` to the list of allowed domains in your `scene.json` file. Learn more about [image permissions](https://docs.decentraland.org/creator/development-guide/sdk7/materials/#textures-from-an-external-url).
|
|
231
|
-
|
|
232
|
-
```json
|
|
233
|
-
"requiredPermissions": [
|
|
234
|
-
"ALLOW_MEDIA_HOSTNAMES"
|
|
235
|
-
],
|
|
236
|
-
"allowedMediaHostnames": [
|
|
237
|
-
"decentraland.org"
|
|
238
|
-
],
|
|
239
|
-
```
|
|
240
|
-
|
|
241
249
|
## NPC Additional Properties
|
|
242
250
|
|
|
243
251
|
To configure other properties of an NPC, add a fourth argument as an `NPCData` object. This object can have the following optional properties:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dcl-npc-toolkit",
|
|
3
|
-
"version": "1.6.1-
|
|
3
|
+
"version": "1.6.1-20251229172248.commit-6697be1",
|
|
4
4
|
"description": "A collection of tools for creating Non-Player-Characters (NPCs). These are capable of having conversations with the player, and play different animations.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@dcl/js-runtime": "latest"
|
|
38
38
|
},
|
|
39
|
-
"commit": "
|
|
39
|
+
"commit": "6697be1f02129f3a3fea4d1c69de550148c55ce7"
|
|
40
40
|
}
|