用户:满月居于夜空查看:4 回复:8 评论:4 创建时间:2021-12-09T20:52:26
// 玩家与实体进行交互时触发
npc.onInteract(async ({entity}) => {
const result = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: npc.id,
lookTarget:npc,
content: `您好,请问有什么可以帮到您的?`,
options: ['A', 'B'],
});
console.log(`选择了第 index: ${result.index} 个选项: ${result.value}`)
// 如果选了第一个选项,也就是'A'。就会执行特定事件
if (result.index === 1){
entity.position=new Box3Vector3('11','13','249')
}
});
小白一号Rua正确的应该是:
// 玩家与实体进行交互时触发
npc.onInteract(async ({entity}) => {
c喵t result = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: npc.id,
lookTarget:npc,
content: `您好,请问有什么可以帮到您的?`,
opti喵: ['A', 'B'],
});
c喵ole.log(`选择了第 index: ${result.index} 个选项: ${result.value}`)
// 如果选了第一个选项,也就是'A'。就会执行特定事件
if (result.index === 1){
entity.position = new Box3Vector3(11,13,249)
}
});点赞0
评论
ymd1010cat// 玩家与实体进行交互时触发
npc.onInteract(async ({entity}) => {
const result = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: npc.id,
lookTarget:npc,
content: `您好,请问有什么可以帮到您的?`,
options: ['A', 'B'],
});
console.log(`选择了第 index: ${result.index} 个选项: ${result.value}`)
// 如果选了第一个选项,也就是'A'。就会执行特定事件
if (result.index === 1){
entity.position.set(11,13,249)
}
});点赞0
评论