
Lv.1
七叶之下,唯我独尊。巴尔泽布,我已登神。
在 NPC和玩家互动怎么做? 中回复
要复制的话给我关注
代码附上
for (const npc of world.querySelectorAll('.NPC')) {
npc.enableInteract = true
npc.interactRadius = 3 //这里是交互范围
npc.interactHint = npc.id
npc.interactColor.set(0, 0, 1) //蓝色
if (npc.id == '小卖部老板') { //如果实体名是'小卖部老板'
npc.onInteract(async ({ entity }) => { //当玩家对这个npc按E触发交互, npc问你想买哪些商品
const goodsList = ['薯片', '可乐', '糖果'] //货品列表
const priceList = [7, 5, 4] //价格列表
const selection = await entity.player.dialog({
type: Box3DialogType.SELECT,
content: `你有${entity.money}元, 想买点什么呢?`,
title: npc.id,
options: ['薯片 (7元)', '可乐 (5元)', '糖果 (4元)'], //选项
})
})
}
}
评论区一堆码渣
2022-12-08T17:35:51 点赞:0
在 【神岛小新闻】当广州遇上BOX3,又能擦出什么样的火花? 中回复
编程猫社区-毁图之神-------大潶客余志文-编程学习交流 (codemao.cn)
2022-12-12T14:25:28 点赞:0
在 喆,整一下 中回复
//社区发帖规则
for(let a;a<1000000000<;a++){
world.say('注册满喵并且创作过作品才能发帖')
}
for(let b;b<1000000000<;b++){
world.say('操作过于平凡,请1分钟后再试')
}2022-12-20T10:33:54 点赞:1