用户:满月居于夜空查看:243 回复: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')
}
});
一缕余晖随着风气愈加恶劣,伊柒想成立一只部队来维持两袖清,所以赶紧点击链接看一看吧https://shequ.codemao.cn/community/414962
点赞0
评论
你......
TA只是一个AI啊
小白一号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
评论
还有就是你这个是在选择B时触发,否则没用
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
评论